# 2-Phase NSGA II: An Optimized Reward and Risk Measurements Algorithm in Portfolio Optimization
## 4 Methodologies
### The Proposed 2-Phase NSGA II Algorithm  
This algorithm has been proposed for two reasons. First, it avoids the gaps in the Pareto-optimal front and second, it helps the improvement of Pareto-optimal solutions. The former makes a better diversification and discovers a well-distributed set of non-dominated solutions along with Pareto-optimal front. The latter lets us to investigate if it is feasible to improve the Pareto-optimal solutions; thereby, the final solutions could be approximated to optimal front.  
This algorithm has been divided into two phases. In the first phase, the groundwork is like the procedure of NSGA II. The Pareto-optimal solution derived from NSGA II is the input to the second phase.  
In the new phase and with integrating all the obtained solutions from the first phase in a global archive and with using elitism strategy, we improve the quality of initial Pareto solutions that elicit from the first phase. Also, with running the second phase, it is expected not only solutions diversification is preserved but also the quality of them is improved. After deriving all Pareto solutions from the previous phase, we have to do two runs for finishing the algorithm. In the first run, we sort the solutions in a descending order. Then, the following model is followed for each consecutive solution in objective functions space:  
**Pr1**:  
\[\begin{split}\min\;F_{1}\\ st:F_{1}&\leq f_{1}^{1}\\ F_{2}&\leq f_{2}^{2}\\ F_{2}&\geq f_{2}^{1}\end{split} \tag{6}\]where, \(f_{1}^{1}\) and \(f_{1}^{2}\) denote first objective function values for solutions 1 and 2, respectively and \(f_{2}^{1}\) and \(f_{2}^{2}\) determine second objective function values for the solutions 1 and 2, respectively. Each solution that is applicable to problem **Pr1** could be placed in box \(S_{1}\) or \(S_{2}\). If it is placed in box \(S_{1}\), node \(k\) locates on optimal front too; otherwise, there is a new solution improving last position and optimal front layer (Figure 1). This procedure is continued till all peer nodes are examined. It needs to be noted that we may not find a practical solution for pair nodes in stopping condition. In this situation, the algorithm is kept fixed for the first solution of pair nodes and is switched to the node which is next to pair. Finally, Pareto-optimal front is updated and the out coming real Pareto optimal set is archived.  
In the second run as a supplementary step, after testing all nodes in the first run, \(F_{2}\) and \(F_{1}\) are placed in both objective and constraints and the procedure of improving and covering solutions in problem **Pr1** is so that the improvement is possible in direction of first objective function. All above procedure for problem **Pr1** is repeated for this model. Thus, problem **Pr2** can be written as follows:  
\[\begin{split}\min\ F_{2}\\ st:F_{2}&\geq f_{2}^{1}\\ F_{1}&\leq f_{1}^{1}\\ F_{1}&\geq f_{1}^{2}\end{split} \tag{7}\]  
The possibility of improving and covering in direction of second objective function (Return) is possible by running this part. Figure 2 shows the improvement of Pareto-front by these two runs.  
This method is very interesting since the gaps between the incoherent pieces of Pareto-front are filled by Pareto-optimal solutions.