Skip to content

Multi-Objective Particle Swarm Optimization (MOPSO)

Particle swarm optimization for problems with several objectives.

MOPSO

MOPSO(*, w=0.7, c1=1.0, c2=1.0, repository_size=100, divisions=30, mutation_decay=0.5, max_archive=None, **kwargs)

Multi-Objective Particle Swarm Optimization (MOPSO) of Coello Coello, Pulido and Lechuga (2004).

The swarm keeps a repository of the non-dominated positions found, at most repository_size of them, located in an adaptive grid of hypercubes in objective space. Each iteration:

  1. Each particle takes a leader from the repository: a hypercube is chosen by roulette, with fitness 10 divided by the number of members in it (so sparse regions are preferred), and then a member of that hypercube at random.
  2. v = w v + c1 r1 (pbest - x) + c2 r2 (leader - x) and x = x + v, with r1 and r2 uniform in [0, 1] for each component. A component that leaves [0, 1] is set to the bound and its velocity is reversed.
  3. Mutation: with probability p = (1 - t) ** (5 / mutation_decay), where t is the share of the run used, one random component of a particle is redrawn uniformly within p of its value (clipped to [0, 1]). So every particle mutates over the full range at the start, and mutation fades out over the run.
  4. The particles are evaluated and the repository is updated: the non-dominated positions of the repository and the swarm are kept. When there are more than repository_size, a random member of the most crowded hypercube is removed, and the grid is computed again, until they fit.
  5. A particle's best position is replaced when the new position dominates it, kept when it dominates the new one, and otherwise replaced with probability 1/2.

Parameters

  • pop_size: number of particles (default 100)
  • w: inertia weight (default 0.7, chosen on benchmark tests). The paper uses 0.4.
  • c1, c2: acceleration toward the particle's best position and toward its leader (default 1 and 1, which gives the paper's update)
  • repository_size: the largest size of the leader repository (default 100)
  • divisions: number of grid divisions per objective (default 30)
  • mutation_decay: sets how fast mutation fades, through the exponent 5 / mutation_decay (default 0.5). 0 turns mutation off.
  • max_archive: largest size of Result.front. None (default) keeps every non-dominated solution.

The repository guides the swarm only. The front of the run (Result.front) is the exact archive of every non-dominated solution found, kept apart from it.

Constraints use the problem's rule, constrained domination by default (the paper's rule).

Reference: C. A. Coello Coello, G. T. Pulido and M. S. Lechuga (2004), Handling multiple objectives with particle swarm optimization, IEEE Transactions on Evolutionary Computation 8(3), 256 to 279.

Example

import ypea
from ypea.benchmarks import pareto_front, zdt1
from ypea.indicators import igd

problem = ypea.Problem(
    ypea.Real("x", shape=30, lb=0, ub=1),
    lambda sol: zdt1(sol.x),
    vectorized=True,
    n_obj=2,
    name="zdt1",
)

alg = ypea.MOPSO(max_nfe=10_000)
result = alg.solve(problem, seed=1)

true_front = pareto_front("zdt1", 500)
score = igd(result.front.obj_values, true_front)
print(len(result.front), score)
64 0.19732802865684645

Differs from Python: MATLAB draws its own random numbers, so the front size and IGD differ from Python's.

problem = ypea.Problem( ...
    vars=ypea.Real("x", shape=30, lb=0, ub=1), ...
    objective=@(sol) ypea.benchmarks.zdt1(sol.x), ...
    vectorized=true, ...
    n_obj=2, ...
    name="zdt1");

alg = ypea.MOPSO(max_nfe=10000);
result = alg.solve(problem, seed=1);

true_front = ypea.benchmarks.pareto_front("zdt1", 500);
score = ypea.indicators.igd(result.front.obj_values, true_front);
fprintf("%d %.17g\n", length(result.front), score)
53 0.19124637192662125

Front on ZDT1

Front found by MOPSO on ZDT1
MOPSO with default settings on ZDT1 with 10 variables, 10 000 evaluations (seed 1), a separate run from the example above. Each dot is one solution of result.front, and the dashed line is the true front.