Find constrained minima of a real multi-objective function.


x = moga(@func,x0)

x = moga(@func,x0,A,b)

x = moga(@func,x0,A,b,Aeq,beq)

x = moga(@func,x0,A,b,Aeq,beq,lb,ub)

x = moga(@func,x0,A,b,Aeq,beq,lb,ub,nonlcon)

x = moga(@func,x0,A,b,Aeq,beq,lb,ub,nonlcon,options)

[x,fval,info,output] = moga(...)


The function to minimize.
An estimate of the location of a minimum.
A matrix used to compute A*x for inequality contraints.
Use [ ] if unneeded.
The upper bound of the inequality constraints A*x<=b.
Use [ ] if unneeded.
A matrix used to compute Aeq*x for equality contraints.
Use [ ] if unneeded.
The upper bound of the equality constraints Aeq*x=beq.
Use [ ] if unneeded.
The design variable lower bounds.
Use [ ] if unbounded. Support for this option is limited. See comments.
The design variable upper bounds.
Use [ ] if unbounded. Support for this option is limited. See comments.
The non-linear constraints function.
The function signature is as follows:
function [c, ceq] = ConFunc(x)
where c and ceq contain inequality and equality contraints, respectively. The inequality constraints are assumed to have upper bounds of 0.
The function can return 1 or 2 outputs.
A struct containing options settings.
See mogaoptimset for details.


The locations of the multi-objective minima.
The multi-objective function minima.
The convergence status flag.
  • info = 0: reached maximum number of iterations.
  • info = 1: the function converged.
  • info = 3: a constraint violation within TolCon occurred.
A struct containing iteration details. The members are as follows.
  • Pareto: a logical matrix indicating which samples belong to the Pareto Front. Each column contains the front information for an iteration.
  • nfev: the number of function evaluations.
  • xiter: the candidate solution at each iteration.
  • fvaliter: the objective function values at each iteration.
  • coniter: the constraint values at each iteration. The columns will contain the constraint function values in the following order: linear inequality contraints, linear equality constraints, nonlinear inequality contraints, nonlinear equality constraints.


Plot the iterations and Pareto Front for the function ObjFunc.
function obj = ObjFunc(x)
    obj = zeros(2,1);
    obj(1) = 2*(x(1)-3)^2 + 4*(x(2)-2)^2 + 6;
    obj(2) = 2*(x(1)-3)^2 + 4*(x(2)+2)^2 + 6;

init = [2; 0];
lowerBound = [1, -5];
upperBound = [5, 5];

options = mogaoptimset('MaxIter', 40, 'Seed', 2017);
[x,fval,info,output] = moga(@ObjFunc,init,[],[],[],[],lowerBound,upperBound,[],options);

obj1 = output.fvaliter(:,1);
obj2 = output.fvaliter(:,2);
scatter(obj1, obj2);
hold on;

obj1P = fval(:,1);
obj2P = fval(:,2);
scatter(obj1P, obj2P);
legend('Iteration History','Pareto Front');

Figure 1. moga figure 1
Modify the previous example to pass extra parameters to the function using a function handle.
function obj = ObjFunc(x,p1,p2)
    obj = zeros(2,1);
    obj(1) = 2*(x(1)-3)^2 + 4*(x(2)-2)^2 + p1;
    obj(2) = 2*(x(1)-3)^2 + 4*(x(2)+2)^2 + p2;

handle = @(x) ObjFunc(x,7,8);
[x,fval] = moga(handle,init,[],[],[],[],lowerBound,upperBound,[],options);


moga uses a Multi-Objective Genetic Algorithm.

See the fmincon optimization tutorial for an example with nonlinear constraints.

Options are specified with mogaoptimset. The defaults are as follows.
  • MaxIter: 50
  • MaxFail: 20000
  • PopulationSize: 0 (the algorithm chooses)
  • TolCon: 0.5 (%)
  • CrowdDist: 0
  • Seed: 0
  • Display: 'off'

Unbounded limits design variable limits are not fully supported and are set to -1000 and 1000. Use of large limits is discouraged due to the size of the search area.

To pass additional parameters to a function argument, use an anonymous function.