def __init__(self, expected_returns, cov_matrix, weight_bounds=(<NUM_LIT:0>, <NUM_LIT:1>)):
<EOL>self.mean = np.array(expected_returns).reshape((len(expected_returns), <NUM_LIT:1>))<EOL>if (self.mean == np.ones(self.mean.shape) * self.mean.mean()).all():<EOL><INDENT>self.mean[-<NUM_LIT:1>, <NUM_LIT:0>] += <NUM_LIT><EOL><DEDENT>self.expected_returns = self.mean.reshape((len(self.mean),))<EOL>self.cov_matrix = np.asarray(cov_matrix)<EOL>if isinstance(weight_bounds[<NUM_LIT:0>], numbers.Real):<EOL><INDENT>self.lB = np.ones(self.mean.shape) * weight_bounds[<NUM_LIT:0>]<EOL><DEDENT>else:<EOL><INDENT>self.lB = np.array(weight_bounds[<NUM_LIT:0>]).reshape(self.mean.shape)<EOL><DEDENT>if isinstance(weight_bounds[<NUM_LIT:0>], numbers.Real):<EOL><INDENT>self.uB = np.ones(self.mean.shape) * weight_bounds[<NUM_LIT:1>]<EOL><DEDENT>else:<EOL><INDENT>self.uB = np.array(weight_bounds[<NUM_LIT:1>]).reshape(self.mean.shape)<EOL><DEDENT>self.w = []  <EOL>self.l = []  <EOL>self.g = []  <EOL>self.f = []  <EOL>if isinstance(expected_returns, pd.Series):<EOL><INDENT>tickers = list(expected_returns.index)<EOL><DEDENT>else:<EOL><INDENT>tickers = list(range(len(self.mean)))<EOL><DEDENT>super().__init__(len(tickers), tickers)<EOL>
:param expected_returns: expected returns for each asset. Set to None if
                         optimising for volatility only.
:type expected_returns: pd.Series, list, np.ndarray
:param cov_matrix: covariance of returns for each asset
:type cov_matrix: pd.DataFrame or np.array
:param weight_bounds: minimum and maximum weight of an asset, defaults to (0, 1).
                      Must be changed to (-1, 1) for portfolios with shorting.
:type weight_bounds: tuple (float, float) or (list/ndarray, list/ndarray)
:raises TypeError: if ``expected_returns`` is not a series, list or array
:raises TypeError: if ``cov_matrix`` is not a dataframe or array