# Multi-Guide Set-Based Particle Swarm Optimization for Multi-Objective Portfolio Optimization
## 3 Optimization Algorithms for Portfolio Optimization
### Set-Based Particle Swarm Optimization  
PSO was designed to solve continuous-valued optimization problems. However, there are many real-world optimization problems that do not have continuous-valued decision variables, e.g., feature selection problems, assignment problems, and scheduling problems. The set-based PSO (SBPSO) algorithm combines PSO to find solutions to combinatorial optimization problems where solutions can be represented as sets [25]. SBPSO uses sets to represent particle positions, which allows for positions (i.e., solutions) of varying sizes. SBPSO was proposed, and later improved, for portfolio optimization [26]. SBPSO for portfolio optimization is a two-part search process, where (1) subsets of assets are selected and (2) the weights of these assets are optimized. The asset weights are optimized using PSO according to Equation (3). The PSO used for weight optimization runs until it converges, i.e., when there is no change in the objective function value over three iterations. The result of this weight optimization stage (summarized in Algorithm 2) is the best solution found by the PSO. The objective function value of the best solution is assigned to the corresponding set-particle. In addition, if there are any zero-weighted assets in the best solution, the corresponding assets in the set-particle are removed. There is a special case where a set-particle contains only one asset. In such a case, the objective function is immediately calculated, since the asset can only ever have a weight of 1.0 given Equation (6). ```
Let \(t\) represent the current iteration;  Let \(f\) be the objective function;  Let \(X_{i}\) represent set-particle \(i\);  Minimize \(f\) using Algorithm 1 for \(t_{w}\) iterations with assets in \(X_{i}\); \(t=t+t_{w}\);  Return the best objective function value and corresponding weights found by Algorithm 1;
```  
**Algorithm 2**Weight Optimization for Set-Based Portfolio Optimization  
Like PSO, SBPSO also has position and velocity updates. However, these are redefined for sets. A set-particle's position, \(X_{i}\), is \(X_{i}\leftarrow\mathcal{P}(U)\), where \(\mathcal{P}\) is the power set of \(U\), and \(U\) is the universe of all elements in regard to a specific problem domain. For portfolio optimization, \(U\) is the set of all assets. The velocity of a set-particle is a set of operations to add or remove elements to or from a set-particle's position. These operations are denoted as \((+,e)\) if an operation is to add an element to the position or \((-,e)\) to remove an element from the position, where \(e\in U\). Formally, the velocity update is  
\[ \begin{split} V_{i}(t+1)&=\lambda_{c}(t)r_{1}\otimes( Y_{i}(t)\ominus X_{i}(t))\\ &\oplus\lambda_{c}(t)r_{2}\otimes(\hat{Y}_{i}(t)\ominus X_{i}(t)) \\ &\oplus(1-\lambda_{c}(t))r_{3}\otimes A_{i}(t)\end{split}  \tag{10}\]  
where \(V_{i}\) is the velocity of set-particle \(i\); \(\lambda_{c}(t)\) is an exploration balance coefficient equal to \(\frac{t}{n_{t}}\), where \(n_{t}\) is the maximum number of iterations; \(r_{1}\), \(r_{2}\), and \(r_{3}\) are random values, each sampled from a standard uniform distribution in the range \([0,2]\); \(X(t)\) is the position of set-particle \(i\); \(Y_{i}(t)\) is the cognitive guide of set-particle \(i\); \(\hat{Y}(t)\) is the social guide of set-particle \(i\); \(A_{i}(t)\) is shorthand for \(U\backslash(X_{i}(t)\cup Y_{i}(t)\cup\hat{Y}_{i}(t))\). The positions of set-particles are updated by using  
\[X_{i}(t+1)=X_{i}(t)\boxplus V_{i}(t+1). \tag{11}\]  
The operators \(\otimes\), \(\ominus\), \(\oplus\), and \(\boxplus\) are defined in Appendix A, and the pseudo-code for SBPSO is given in Algorithm 3. To better understand SBPSO for portfolio optimization, consider the following example. There are 50 assets in the universe. Initially, a set-particle randomly selects a subset of assets, say \(\{5,12,23,26,31\}\), from the universe. These assets are then used to create a continuous search space for the inner PSO.