Multiobjective Optimization

Multi-Objective PSO in MATLAB

Get the code
Comments

Run multi-objective PSO in MATLAB with an external repository, grid-based leader selection, mutation, and a two-objective test problem.

Illustration for Multi-Objective PSO in MATLAB
On this page

Multi-Objective Particle Swarm Optimization (MOPSO) was proposed by Coello Coello, Toscano Pulido and Salazar Lechuga in 2004 (paper (opens in a new tab)). It is a multi-objective version of PSO. It uses a Pareto envelope and a grid technique, similar to the Pareto Envelope-based Selection Algorithm, to handle multi-objective optimization problems.

As in PSO, the particles share information and move toward global best particles and their own personal (local) best memory. Unlike PSO, there is more than one criterion for defining the best particle. All non-dominated particles in the swarm are collected in a sub-swarm called the Repository, and every particle chooses its global best target from the Repository. For the personal best, MOPSO uses a domination-based probabilistic rule.

How MOPSO works

Each particle has a position xix_i, a velocity viv_i and a personal best pip_i. In each iteration, it picks a leader hh from the Repository and moves with the usual PSO rule:

vi←w vi+c1r1⊙(pi−xi)+c2r2⊙(h−xi),xi←xi+viv_i \leftarrow w\,v_i + c_1 r_1 \odot (p_i - x_i) + c_2 r_2 \odot (h - x_i), \qquad x_i \leftarrow x_i + v_i

The other steps are specific to the multi-objective case:

  • Grid. The objective space around the Repository is divided into hypercubes (cells). Each Repository member belongs to one cell.
  • Leader selection. A cell is chosen by roulette wheel selection, with a higher chance for cells that hold fewer members. A random member of that cell becomes the leader. This pulls the swarm toward less crowded parts of the front.
  • Personal best. If the new position dominates pip_i, it replaces pip_i. If pip_i dominates the new position, pip_i stays. If neither dominates the other, one of them is kept at random.
  • Repository update. New non-dominated particles join the Repository, and members that are now dominated leave it. If the Repository is too large, members are deleted from crowded cells first.
  • Mutation. A particle may be mutated, with a probability that is high at the start and falls to zero at the last iteration. This helps the swarm explore early in the run.

Implementation in MATLAB

This post shares an open-source MATLAB implementation of MOPSO. The algorithm is implemented in a structured way, so if you know MATLAB, you can easily use the code in your research projects.

To run the code, open the MOPSO folder in MATLAB and run main.m, which calls the main script mopso.m. In each iteration the program prints the number of Repository members and plots the particles and the Repository in objective space. The default problem is ZDT.m, the ZDT1 test function with two objectives. MOP2.m and MOP4.m are two more test problems. The code uses unifrnd, a function of the Statistics and Machine Learning Toolbox, so it probably needs that toolbox.

The parameters are set at the top of mopso.m:

Parameter Meaning Value
nVar Number of decision variables 5
VarMin, VarMax Lower and upper bounds of the variables 0, 1
MaxIt Maximum number of iterations 200
nPop Swarm size 200
nRep Repository size 100
w, wdamp Inertia weight and its damping rate 0.5, 0.99
c1, c2 Personal and global learning coefficients 1, 2
nGrid Number of grid cells per objective 7
alpha Inflation rate of the grid 0.1
beta Leader selection pressure 2
gamma Deletion selection pressure 2
mu Mutation rate 0.1

In the code, a cell that holds NN Repository members is chosen as the leader cell with a probability proportional to e−βNe^{-\beta N}, and as the cell to delete from with a probability proportional to eγNe^{\gamma N}. The mutation probability in iteration tt is (1−(t−1)/(MaxIt−1))1/μ(1 - (t-1)/(\text{MaxIt}-1))^{1/\mu}.

Other multi-objective algorithms on Yarpiz include NSGA-II and PESA-II, which uses a similar grid.

Check the result

Treat the repository as an approximation to the Pareto front. Recompute dominance from the returned objective values and inspect both coverage and variable bounds across repeated runs. A source review flagged that domination flags in the swarm may not be refreshed on every iteration before candidates enter the repository. Check that update path before using the implementation for comparative research. This review did not execute or change the optimizer.

Downloads

How to cite

If you use this code or tutorial in your work, articles or publications, please cite it.

Plain text
Mostapha Kalami Heris, Multi-Objective PSO in MATLAB (YPEA121), Yarpiz, 2015. https://yarpiz.com/mopso-ypea121
BibTeX
@misc{yarpiz-ypea121,
  author = {{Mostapha Kalami Heris}},
  title = {{Multi-Objective PSO in MATLAB}},
  howpublished = {Yarpiz},
  year = {2015},
  note = {Code YPEA121},
  url = {https://yarpiz.com/mopso-ypea121}
}

Comments

Sign in or create a free account to join the discussion. No password needed.