# Stock Portfolio Management in the Presence of Downtends Using Computational Intelligence
## 4 Methods and Materials
### Optimizing Stock Portfolios  
The final activity to perform stock investments consists of determining how the resources should be allocated. A given distribution of resources among the selected stocks is known as the stock portfolio. Defining the most convenient distribution of resources is known as portfolio optimization. In this final activity, the decision alternatives are no longer individual stocks but complete portfolios. Thus, it is necessary to determine multiple criteria to comprehensively assess portfolios.  
Formally, a stock portfolio is a vector \(x=[x_{1},x_{2},\ldots,x_{m}]^{\top}\) such that \(x_{i}\) is the proportion of the total investment that is allocated to the \(i\)th stock. Let \(r_{i}\) be the return of the \(i\)th stock calculated according to Equation (1); the return of a given portfolio \(x\) is defined as follows:  
\[R(x)=\sum_{i=1}^{m}x_{i}r_{i} \tag{4}\]  
Of course, if we knew the \(t+1\) return of the stocks, we could allocate resources that maximize \(R(x)\) without uncertainty; however, since this is impossible, the multiple criteria used to assess portfolios are estimations of \(R(x)\). These estimations usually come from probability theory.  
According to ([12]), the most convenient portfolio \(x\) can be determined by optimizing a set of confidence intervals that describe the probabilistic distribution of the portfolio's return:  
\[\underset{x\in\Omega}{\text{Maximize}}\{\theta(x)=(\theta_{\beta_{1}}(x), \theta_{\beta_{2}}(x),\ldots,\theta_{\beta_{k}}(x))\} \tag{5}\]  
where \(\theta_{\beta_{i}}(x)=\{[c_{i},d_{i}]:P(c_{i}\leq E(R(x))\leq d_{i})=\beta_{i}\}\), \(E(R(x))\) is the expected return of portfolio \(x\), \(P(\omega)\) is the probability that event \(\omega\) occurs and \(\Omega\) is the set of feasible portfolios.  
Maximizing confidence intervals as conducted in Equation (5) does not mean increasing the wideness of the intervals; rather, it refers to the intuition that rightmost returns in the probability distribution are desired. We use the so-called interval theory ([68]) to measure the possibility that a confidence interval is greater than another one. In interval theory, an interval number allows one to encompass the uncertainty involved in the definition of a quantity.  
Since we are trying to find the best portfolios in terms of confidence intervals around their expected return, intervals further to the right are better (rather than comparing intervals in terms of their width). Therefore, the comparison method used must provide this feature. There are several works in the literature describing methods that possess this property (e.g., [81; 82]); however, the method proposed in [83] is the most broadly mentioned in the literature [84].  
The authors of [83] presented a possibility function to define the order between two interval numbers that has been increasingly used in the literature (e.g., [12; 85; 86; 87]). Let \(I=[i^{-},i^{+}]\) and \(J=[j^{-},j^{+}]\) be two interval numbers, and the possibility function presented in [83] is defined as follows:  
\[possibility(I\geq J):=\left\{\begin{array}{rl}1,&\text{if}\ \ p(I,J)>1\\ 0,&\text{if}\ \ p(I,J)<0\\ p(I,J),&\text{otherwise}\end{array}\right.\]  
where \(p(I,J)=\frac{i^{+}-j^{-}}{(i^{+}-i^{-})+(j^{-}-j^{-})}\).  
Moreover, if \(i=i^{+}=j^{-}\) and \(j=j^{+}=j^{-}\), then  
\[possibility(I\geq J):=\left\{\begin{array}{rl}1,&\text{if}\ \ i\geq j\\ 0,&\text{otherwise}\end{array}\right.\]  
Since Problem (5) can potentially have many objectives defined as interval numbers as well as multiple constraints, we use MOEA/D (see Section 2.4), as advised by ([12]). In ([12]), MOEA/D was adapted to deal with these types of objectives; the adaptation has been proven to provide good results in contexts related to stock investments. For reasons of space in this paper, the reader is referred to ([12]) for specific details about this improvement to MOEA/D.