MOEA/D in MATLAB
Implement MOEA/D in MATLAB with Tchebycheff subproblems, weight-vector neighborhoods, crossover, and an archive of trade-off solutions.

On this page
Decomposition is a classic approach to multi-objective optimization. A multi-objective problem is decomposed into a family of single-objective subproblems. The decomposed objective functions can be defined in several ways, such as a weighted sum of the objectives, or the distance (norm) between the objective vector and a predefined ideal point in the objective space. However, solving each single-objective problem separately takes one full run per Pareto solution, and some of these methods, such as the weighted sum, cannot find the parts of the Pareto front that are not convex.
MOEA/D
The Multi-Objective Evolutionary Algorithm based on Decomposition (MOEA/D) is an evolutionary algorithm that decomposes a multi-objective problem into several single-objective sub-problems and solves them all together in one population. Each sub-problem keeps its own best solution found so far, which is replaced only when a new solution created in its neighborhood scores better on that sub-problem. MOEA/D was proposed by Qingfu Zhang and Hui Li in 2007 (paper (opens in a new tab)).
The problem and the Tchebycheff approach
The goal is to minimize conflicting objectives . MOEA/D creates weight vectors , one for each sub-problem. With the Tchebycheff approach, sub-problem minimizes
where is the ideal point, the best value of each objective found so far. Different weight vectors encourage different trade-offs, although the resulting coverage depends on the front and the search.
Neighborhoods
Subproblems with nearby weight vectors are grouped so that they can share candidate solutions. So each sub-problem has a neighborhood : the indices of the weight vectors closest to . In each iteration, for each sub-problem , the algorithm:
- Picks two parents at random from the current solutions of the neighbors in .
- Creates a child from them and evaluates .
- Updates the ideal point: .
- Replaces the solution of each neighbor with when is not worse than the cost of its current solution.
An external population (archive) collects the non-dominated solutions found during the run.
Implementation in MATLAB
This post shares an open-source MATLAB implementation of MOEA/D. The algorithm is implemented in a structured manner. If you know MATLAB, you should find the code easy to use in your research projects.
The MOEA-D folder holds the main script moead.m, a one line entry point main.m, and the helper functions CreateSubProblems.m (weight vectors and neighborhoods), DecomposedCost.m (the Tchebycheff cost), Crossover.m, DetermineDomination.m, Dominates.m and PlotCosts.m. The default problem is ZDT.m, the ZDT1 test function with two objectives, and MOP2.m is a second test problem.
To run the code, open the MOEA-D folder in MATLAB and run main.m. In each iteration the program prints the number of Pareto solutions in the archive and plots them. At the end it prints the minimum, maximum, range, standard deviation and mean of each objective over the archive.
A few details of this code differ from the basic description above:
- The weight vectors are random. Each one is drawn uniformly in and scaled to unit length. A commented line in
CreateSubProblems.mshows an evenly spread alternative for two objectives. - New solutions come from an arithmetic crossover of the two parents. There is no separate mutation step.
- The ideal point starts at zero and is then updated with every new solution.
- When the archive grows beyond its size limit, randomly chosen members are deleted.
The code uses unifrnd, randsample and pdist2, functions of the Statistics and Machine Learning Toolbox, so it probably needs that toolbox.
Parameters in the code
The parameters are set at the top of moead.m:
| Parameter | Meaning | Value |
|---|---|---|
nVar |
Number of decision variables | 3 |
VarMin, VarMax |
Lower and upper bounds of the variables | 0, 1 |
MaxIt |
Maximum number of iterations | 100 |
nPop |
Population size (number of sub-problems) | 50 |
nArchive |
Archive size | 50 |
T |
Number of neighbors | 15% of nPop, between 2 and 15 (8 with the defaults) |
crossover_params.gamma |
Range extension of the arithmetic crossover | 0.5 |
To solve your own problem, write a cost function that takes a column vector and returns a column vector of objective values, and set CostFunction, nVar, VarMin and VarMax in moead.m.
Check the result
Check the archive for dominance and feasibility, then inspect whether the weight vectors cover the trade-offs you need. This implementation starts its ideal-point estimate at zero. For an objective that remains strictly positive, that entry stays at zero rather than becoming the best observed value, which changes the scalarized search. Review that initialization and objective scaling before adapting the method. Random archive deletion and crossover without mutation are also implementation choices to account for in comparisons.
Related posts
NSGA-II, NSGA-III, SPEA2 and PESA-II are other multi-objective algorithms on Yarpiz, implemented in the same style.
Downloads
How to cite
If you use this code or tutorial in your work, articles or publications, please cite it.
Mostapha Kalami Heris, MOEA/D in MATLAB (YPEA124), Yarpiz, 2015. https://yarpiz.com/moead-ypea124@misc{yarpiz-ypea124,
author = {{Mostapha Kalami Heris}},
title = {{MOEA/D in MATLAB}},
howpublished = {Yarpiz},
year = {2015},
note = {Code YPEA124},
url = {https://yarpiz.com/moead-ypea124}
}Published Updated
Comments