Main Content

gamultiobj

Find Pareto front of multiple fitness functions using genetic algorithm

Description

example

x= gamultiobj(fun,nvars)findsxon thePareto Frontof the objective functions defined infunnvarsis the dimension of the optimization problem (number of decision variables). The solutionxis local, which means it might not be on the global Pareto front.

Note

Passing Extra Parametersexplains how to pass extra parameters to the objective function and nonlinear constraint functions, if necessary.

example

x= gamultiobj(fun,nvars,A,b)finds a local Pareto setxsubject to the linear inequalities A x b .SeeLinear Inequality Constraintsgamultiobjsupports linear constraints only for the defaultPopulationTypeoption ('doubleVector').

x= gamultiobj(fun,nvars,A,b,Aeq,beq)finds a local Pareto setxsubject to the linear equalities A e q x = b e q and the linear inequalities A x b , seeLinear Equality Constraints.(SetA = []andb = []if no inequalities exist.)gamultiobjsupports linear constraints only for the defaultPopulationTypeoption ('doubleVector').

example

x= gamultiobj(fun,nvars,A,b,Aeq,beq,lb,ub)defines a set of lower and upper bounds on the design variablesxso that a local Pareto set is found in the rangelbxub, seeBound Constraints.Use empty matrices forAeqandbeqif no linear equality constraints exist.gamultiobjsupports bound constraints only for the defaultPopulationTypeoption ('doubleVector').

x= gamultiobj(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon)finds a Pareto set subject to the constraints defined innonlcon.这个函数nonlconacceptsxand returns vectorscandceq, representing the nonlinear inequalities and equalities respectively.gamultiobjminimizesfunsuch thatc(x)0andceq(x) = 0.(Setlb = []andub = []if no bounds exist.)gamultiobjsupports nonlinear constraints only for the defaultPopulationTypeoption ('doubleVector').

example

x= gamultiobj(fun,nvars,A,b,Aeq,beq,lb,ub,options)orx= gamultiobj(fun,nvars,A,b,Aeq,beq,lb,ub,nonlcon,options)finds a Pareto setxwith the default optimization parameters replaced by values inoptions.Createoptionsusingoptimoptions(recommended) or a structure.

x= gamultiobj(problem)finds the Pareto set forproblem, whereproblemis a structure described inproblem

[x,fval] = gamultiobj(___), for any input variables, returns a matrixfval, the value of all the fitness functions defined infunfor all the solutions inxfvalhasnfcolumns, wherenfis the number of objectives, and has the same number of rows asx

[x,fval,exitflag,output] = gamultiobj(___)returnsexitflag, an integer identifying the reason the algorithm stopped, andoutput, a structure that contains information about the optimization process.

example

[x,fval,exitflag,output,population,scores] = gamultiobj(___)returnspopulation, whose rows are the final population, andscores, the scores of the final population.

Examples

collapse all

Find the Pareto front for a simple multiobjective problem. There are two objectives and two decision variablesx

fitnessfcn = @(x)[norm(x)^2,0.5*norm(x(:)-[2;-1])^2+2];

Find the Pareto front for this objective function.

rngdefault% For reproducibilityx = gamultiobj(fitnessfcn,2);
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.

Plot the solution points.

plot(x(:,1),x(:,2),'ko') xlabel('x(1)') ylabel('x(2)') title('Pareto Points in Parameter Space')

Figure contains an axes. The axes with title Pareto Points in Parameter Space contains an object of type line.

看到the effect of a linear constraint on this problem, seeMultiobjective Problem with Linear Constraint

This example shows how to find the Pareto front for a multiobjective problem in the presence of a linear constraint.

There are two objective functions and two decision variablesx

fitnessfcn = @(x)[norm(x)^2,0.5*norm(x(:)-[2;-1])^2+2];

The linear constraint is x ( 1 ) + x ( 2 ) 1 / 2

A = [1,1]; b = 1/2;

Find the Pareto front.

rngdefault% For reproducibilityx = gamultiobj(fitnessfcn,2,A,b);
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.

Plot the constrained solution and the linear constraint.

plot(x(:,1),x(:,2),'ko') t = linspace(-1/2,2); y = 1/2 - t; holdonplot(t,y,'b--') xlabel('x(1)') ylabel('x(2)') title('Pareto Points in Parameter Space') holdoff

Figure contains an axes. The axes with title Pareto Points in Parameter Space contains 2 objects of type line.

看到the effect of removing the linear constraint from this problem, seeSimple Multiobjective Problem

Find the Pareto front for the two fitness functionssin(x)andcos(x)on the interval 0 x 2 π

fitnessfcn = @(x)[sin(x),cos(x)]; nvars = 1; lb = 0; ub = 2*pi; rngdefault% for reproducibilityx = gamultiobj(fitnessfcn,nvars,[],[],[],[],lb,ub)
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.
x =18×14.7124 4.7124 3.1415 3.6733 3.9845 3.4582 3.9098 4.4409 4.0846 3.8686 ⋮

Plot the solution.gamultiobjfinds points along the entire Pareto front.

plot(sin(x),cos(x),'r*') xlabel('sin(x)') ylabel('cos(x)') title('Pareto Front') legend('Pareto front')

Figure contains an axes. The axes with title Pareto Front contains an object of type line. This object represents Pareto front.

Find and plot the Pareto front for the two-objective Schaffer's second function. This function has a disconnected Pareto front.

Copy this code to a function file on your MATLAB® path.

函数y = schaffer2(x)% y has two columns% Initialize y for two objectives and for all xy = zeros(length(x),2);% Evaluate first objective.% This objective is piecewise continuous.fori = 1:length(x)ifx(i) <= 1 y(i,1) = -x(i);elseifx(i) <=3 y(i,1) = x(i) -2;elseifx(i) <=4 y(i,1) = 4 - x(i);elsey(i,1) = x(i) - 4;endend% Evaluate second objectivey(:,2) = (x -5).^2;

Plot the two objectives.

x = -1:0.1:8; y = schaffer2(x); plot(x,y(:,1),'r',x,y(:,2),'b'); xlabelxylabel'schaffer2(x)'legend('Objective 1','Objective 2')

The two objective functions compete forxin the ranges[1,3] and[4,5].But, the Pareto-optimal front consists of only two disconnected regions, corresponding to thexin the ranges[1,2]and[4,5].There are disconnected regions because the region[2,3]is inferior to[4,5].In that range, objective1has the same values, but objective2is smaller.

Set bounds to keep population members in the range$-5\le x\le 10$

lb = -5; ub = 10;

Set options to view the Pareto front asgamultiobjruns.

options = optimoptions('gamultiobj','PlotFcn',@gaplotpareto);

Callgamultiobj

rngdefault% For reproducibility[x,fval,exitflag,output] = gamultiobj(@schaffer2,1,[],[],[],[],lb,ub,options);
Optimization terminated: maximum number of generations exceeded.

Run a simple multiobjective problem and obtain all available outputs.

Set the random number generator for reproducibility.

rngdefault

Set the fitness functions tokur_multiobjective, a function that has three control variables and returns two fitness function values.

fitnessfcn = @kur_multiobjective; nvars = 3;

Thekur_multiobjective函数has the following code.

函数y = kur_multiobjective(x)%KUR_MULTIOBJECTIVE Objective function for a multiobjective problem.% The Pareto-optimal set for this two-objective problem is nonconvex as% well as disconnected. The function KUR_MULTIOBJECTIVE computes two% objectives and returns a vector y of size 2-by-1.%% Reference: Kalyanmoy Deb, "Multi-Objective Optimization using% Evolutionary Algorithms", John Wiley & Sons ISBN 047187339% Copyright 2007 The MathWorks, Inc.% Initialize for two objectivesy = zeros(2,1);% Compute first objectivefori = 1:2 y(1) = y(1) - 10*exp(-0.2*sqrt(x(i)^2 + x(i+1)^2));end% Compute second objectivefori = 1:3 y(2) = y(2) + abs(x(i))^0.8 + 5*sin(x(i)^3);end

Set lower and upper bounds on all variables.

ub = [5 5 5]; lb = -ub;

Find the Pareto front and all other outputs for this problem.

[x,fval,exitflag,output,population,scores] = gamultiobj(fitnessfcn,nvars,...[],[],[],[],lb,ub);
Optimization terminated: average change in the spread of Pareto solutions less than options.FunctionTolerance.

Examine the sizes of some of the returned variables.

sizex = size(x) sizepopulation = size(population) sizescores = size(scores)
sizex = 18 3 sizepopulation = 50 3 sizescores = 50 2

The returned Pareto front contains 18 points. There are 50 members of the final population. Eachpopulationrow has three dimensions, corresponding to the three decision variables. Eachscoresrow has two dimensions, corresponding to the two fitness functions.

Input Arguments

collapse all

Fitness functions to optimize, specified as a function handle or function name.

funis a function that accepts a real row vector of doublesxof lengthnvarsand returns a real vectorF(x)of objective function values. For details on writingfun, seeCompute Objective Functions

If you set theUseVectorizedoption totrue, thenfunaccepts a matrix of sizen-by-nvars, where the matrix representsnindividuals.funreturns a matrix of sizen-by-m, wheremis the number of objective functions. SeeVectorize the Fitness Function

Example:@(x)[sin(x),cos(x)]

Data Types:char|函数_handle|string

Number of variables, specified as a positive integer. The solver passes row vectors of lengthnvarstofun

Example:4

Data Types:double

Linear inequality constraints, specified as a real matrix.Ais anM-by-nvarsmatrix, whereMis the number of inequalities.

A编码Mlinear inequalities

A*x <= b,

wherexis the column vector ofnvarsvariablesx(:), andb是一个列向量Melements.

For example, give constraintsA = [1,2;3,4;5,6]andb = [10;20;30]to specify these sums:

x1+ 2x2≤ 10
3x1+ 4x2≤ 20
5x1+ 6x2≤ 30.

Example:To set the sum of the x-components to 1 or less, takeA = ones(1,N)andb = 1

Data Types:double

Linear inequality constraints, specified as a real vector.bis anM-element vector related to theAmatrix. If you passbas a row vector, solvers internally convertbto the column vectorb(:)

b编码Mlinear inequalities

A*x <= b,

wherexis the column vector ofnvarsvariablesx(:), andAis a matrix of sizeM-by-nvars

For example, give constraintsA = [1,2;3,4;5,6]andb = [10;20;30]to specify these sums:

x1+ 2x2≤ 10
3x1+ 4x2≤ 20
5x1+ 6x2≤ 30.

Example:To set the sum of the x-components to 1 or less, takeA = ones(1,N)andb = 1

Data Types:double

Linear equality constraints, specified as a real matrix.Aeqis anMe-by-nvarsmatrix, whereMeis the number of equalities.

Aeq编码Melinear equalities

Aeq*x = beq,

wherexis the column vector ofnvarsvariablesx(:), andbeq是一个列向量Meelements.

For example, give constraintsAeq = [1,2,3;2,4,1]andbeq = [10;20]to specify these sums:

x1+ 2x2+ 3x3= 10
2x1+ 4x2+x3= 20.

Example:To set the sum of the x-components to 1, takeAeq = ones(1,N)andbeq = 1

Data Types:double

Linear equality constraints, specified as a real vector.beqis anMe-element vector related to theAeqmatrix. If you passbeqas a row vector, solvers internally convertbeqto the column vector说真的(:)

beq编码Melinear equalities

Aeq*x = beq,

wherexis the column vector ofnvarsvariablesx(:), andAeqis a matrix of sizeMeq-by-N

For example, give constraintsAeq = [1,2,3;2,4,1]andbeq = [10;20]to specify these sums:

x1+ 2x2+ 3x3= 10
2x1+ 4x2+x3= 20.

Example:To set the sum of the x-components to 1, takeAeq = ones(1,N)andbeq = 1

Data Types:double

Lower bounds, specified as a real vector or real array. Ifnumel(lb) = nvars, thenlbspecifies thatx(i) >= lb(i)for alli

Ifnumel(lb) < nvars, thenlbspecifies thatx(i) >= lb(i)for1 <= i <= numel(lb)

In this case, solvers issue a warning.

Example:To specify all x-components as positive, setlb = zeros(nvars,1)

Data Types:double

Upper bounds, specified as a real vector or real array. Ifnumel(ub) = nvars, thenubspecifies thatx(i) <= ub(i)for alli

Ifnumel(ub) < nvars, thenubspecifies thatx(i) <= ub(i)for1 <= i <= numel(ub)

In this case, solvers issue a warning.

Example:To specify all x-components as less than one, setub = ones(nvars,1)

Data Types:double

Nonlinear constraints, specified as a function handle or function name.nonlconis a function that accepts a row vectorxand returns two row vectors,c(x)andceq(x)

  • c(x)is the row vector of nonlinear inequality constraints atx.Thegamultiobj函数attempts to satisfyc (x) < = 0for all entries ofc

  • ceq(x)is the row vector nonlinear equality constraints atx.Thegamultiobj函数attempts to satisfyceq(x) = 0for all entries ofceq

If you set theUseVectorizedoption totrue, thennonlconaccepts a matrix of sizen-by-nvars, where the matrix representsnindividuals.nonlconreturns a matrix of sizen-by-mcin the first argument, wheremcis the number of nonlinear inequality constraints.nonlconreturns a matrix of sizen-by-mceqin the second argument, wheremceqis the number of nonlinear equality constraints. SeeVectorize the Fitness Function

For example,x = gamultiobj(@myfun,nvars,A,b,Aeq,beq,lb,ub,@mycon), wheremyconis a MATLAB®函数such as the following:

功能测查[c] = mycon c (x) =…%计算nonlinear inequalities at x. ceq = ... % Compute nonlinear equalities at x.

For more information, seeNonlinear Constraints

Data Types:char|函数_handle|string

Optimization options, specified as the output ofoptimoptionsor a structure. See option details inGenetic Algorithm Options

optimoptionshides the options listed initalics.SeeOptions that optimoptions Hides

  • Values in{}denote the default value.

  • {}*represents the default when there are linear constraints, and forMutationFcnalso when there are bounds.

  • I*indicates thatgahandles options for integer constraints differently; this notation does not apply togamultiobj

  • NMindicates that the option does not apply togamultiobj

Options forga, Integerga, andgamultiobj

Option Description Values
ConstraintTolerance

Determines the feasibility with respect to nonlinear constraints. Also,max(sqrt(eps),ConstraintTolerance)determines feasibility with respect to linear constraints.

For an options structure, useTolCon

Positive scalar |{1e-3}

CreationFcn

I*Function that creates the initial population. Specify as a name of a built-in creation function or a function handle. SeePopulation Options

{'gacreationuniform'}|{'gacreationlinearfeasible'}*|Custom creation function

CrossoverFcn

I*Function that the algorithm uses to create crossover children. Specify as a name of a built-in crossover function or a function handle. SeeCrossover Options

{'crossoverscattered'}forga,{'crossoverintermediate'}*forgamultiobj|'crossoverheuristic'|'crossoversinglepoint'|'crossovertwopoint'|'crossoverarithmetic'|Custom crossover function

CrossoverFraction

The fraction of the population at the next generation, not including elite children, that the crossover function creates.

Positive scalar |{0.8}

Display

Level of display.

'off'|'iter'|'diagnose'|{'final'}

DistanceMeasureFcn

Function that computes distance measure of individuals. Specify as a name of a built-in distance measure function or a function handle. The value applies to decision variable or design space (genotype) or to function space (phenotype). The default'distancecrowding'is in function space (phenotype). Forgamultiobjonly. SeeMultiobjective Options

For an options structure, use a function handle, not a name.

{'distancecrowding'}means the same as{@distancecrowding,'phenotype'}|{@distancecrowding,'genotype'}|Custom distance function

EliteCount

NMPositive integer specifying how many individuals in the current generation are guaranteed to survive to the next generation. Not used ingamultiobj

Positive integer |{ceil(0.05*PopulationSize)}|{0.05*(default PopulationSize)}for mixed-integer problems

FitnessLimit

NMIf the fitness function attains the value ofFitnessLimit, the algorithm halts.

Scalar |{-Inf}

FitnessScalingFcn

Function that scales the values of the fitness function. Specify as a name of a built-in scaling function or a function handle. Option unavailable forgamultiobj

{'fitscalingrank'}|'fitscalingshiftlinear'|'fitscalingprop'|'fitscalingtop'|Custom fitness scaling function

FunctionTolerance

The algorithm stops if the average relative change in the best fitness function value overMaxStallGenerationsgenerations is less than or equal toFunctionTolerance.IfStallTestis'geometricWeighted', then the algorithm stops if theweightedaverage relative change is less than or equal toFunctionTolerance

Forgamultiobj, the algorithm stops when the geometric average of the relative change in value of the spread overoptions.MaxStallGenerationsgenerations is less thanoptions.FunctionTolerance, and the final spread is less than the mean spread over the pastoptions.MaxStallGenerationsgenerations. Seegamultiobj Algorithm

For an options structure, useTolFun

Positive scalar |{1e-6}forga,{1e-4}forgamultiobj

HybridFcn

I*Function that continues the optimization aftergaterminates. Specify as a name or a function handle.

Alternatively, a cell array specifying the hybrid function and its options. Seega Hybrid Function

Forgamultiobj, the only hybrid function is@fgoalattain.Seegamultiobj Hybrid Function

SeeWhen to Use a Hybrid Function

Function name or handle |'fminsearch' | 'patternsearch' | 'fminunc' | 'fmincon' | {[]}

or

1-by-2 cell array |{@solver, hybridoptions}, wheresolver = fminsearch,patternsearch,fminunc, orfmincon{[]}

InitialPenalty

NMI*Initial value of penalty parameter

Positive scalar |{10}

InitialPopulationMatrix

Initial population used to seed the genetic algorithm. Has up toPopulationSizerows andNcolumns, whereNis the number of variables. You can pass a partial population, meaning one with fewer thanPopulationSizerows. In that case, the genetic algorithm usesCreationFcnto generate the remaining population members. SeePopulation Options

For an options structure, useInitialPopulation

Matrix |{[]}

InitialPopulationRange

Matrix or vector specifying the range of the individuals in the initial population. Applies togacreationuniformcreation function.gashifts and scales the default initial range to match any finite bounds.

For an options structure, usePopInitRange

Matrix or vector |{[-10;10]}for unbounded components,{[-1e4+1;1e4+1]}for unbounded components of integer-constrained problems,{[lb;ub]}for bounded components, with the default range modified to match one-sided bounds.

InitialScoresMatrix

I*Initial scores used to determine fitness. Has up toPopulationSizerows and hasNfcolumns, whereNfis the number of fitness functions (1forga, greater than1forgamultiobj). You can pass a partial scores matrix, meaning one with fewer thanPopulationSizerows. In that case, the solver fills in the scores when it evaluates the fitness functions.

For an options structure, useInitialScores

Column vector for single objective | matrix for multiobjective |{[]}

MaxGenerations

Maximum number of iterations before the algorithm halts.

For an options structure, useGenerations

Positive integer |{100*numberOfVariables}forga,{200*numberOfVariables}forgamultiobj

MaxStallGenerations

The algorithm stops if the average relative change in the best fitness function value overMaxStallGenerationsgenerations is less than or equal toFunctionTolerance.IfStallTestis'geometricWeighted', then the algorithm stops if the weighted average relative change is less than or equal toFunctionTolerance

Forgamultiobj, the algorithm stops when the geometric average of the relative change in value of the spread overoptions.MaxStallGenerationsgenerations is less thanoptions.FunctionTolerance, and the final spread is less than the mean spread over the pastoptions.MaxStallGenerationsgenerations. Seegamultiobj Algorithm

For an options structure, useStallGenLimit

Positive integer |{50}forga,{100}forgamultiobj

MaxStallTime

NMThe algorithm stops if there is no improvement in the objective function forMaxStallTimeseconds, as measured byticandtoc

For an options structure, useStallTimeLimit

Positive scalar| {Inf}

MaxTime

The algorithm stops after running afterMaxTimeseconds, as measured byticandtoc.This limit is enforced after each iteration, sogacan exceed the limit when an iteration takes substantial time.

For an options structure, useTimeLimit

Positive scalar |{Inf}

MigrationDirection

Direction of migration. See迁移选项

'both'|{'forward'}

MigrationFraction

Scalar from 0 through 1 specifying the fraction of individuals in each subpopulation that migrates to a different subpopulation. See迁移选项

Scalar |{0.2}

MigrationInterval

Positive integer specifying the number of generations that take place between migrations of individuals between subpopulations. See迁移选项

Positive integer |{20}

MutationFcn

I*Function that produces mutation children. Specify as a name of a built-in mutation function or a function handle. SeeMutation Options

{'mutationgaussian'}forga,{'mutationadaptfeasible'}*forgamultiobj|'mutationuniform'|Custom mutation function

NonlinearConstraintAlgorithm

Nonlinear constraint algorithm. SeeNonlinear Constraint Solver Algorithms.Option unchangeable forgamultiobj

For an options structure, useNonlinConAlgorithm

{'auglag'}forga,{'penalty'}forgamultiobj

OutputFcn

Functions thatgacalls at each iteration. Specify as a function handle or a cell array of function handles. SeeOutput Function Options

For an options structure, useOutputFcns

Function handle or cell array of function handles |{[]}

ParetoFraction

Scalar from 0 through 1 specifying the fraction of individuals to keep on the first Pareto front while the solver selects individuals from higher fronts, forgamultiobjonly. SeeMultiobjective Options

Scalar |{0.35}

PenaltyFactor

NMI*Penalty update parameter.

Positive scalar |{100}

PlotFcn

Function that plots data computed by the algorithm. Specify as a name of a built-in plot function, a function handle, or a cell array of built-in names or function handles. SeePlot Options

For an options structure, usePlotFcns

gaorgamultiobj:{[]} | 'gaplotdistance' | 'gaplotgenealogy' | 'gaplotselection' | 'gaplotscorediversity' |'gaplotscores' | 'gaplotstopping' | 'gaplotmaxconstr' |Custom plot function

gaonly:'gaplotbestf' | 'gaplotbestindiv' | 'gaplotexpectation' | 'gaplotrange'

gamultiobjonly:'gaplotpareto' | 'gaplotparetodistance' | 'gaplotrankhist' | 'gaplotspread'

PlotInterval

Positive integer specifying the number of generations between consecutive calls to the plot functions.

Positive integer |{1}

PopulationSize

Size of the population.

Positive integer |{50}whennumberOfVariables <= 5,{200}otherwise |{min(max(10*nvars,40),100)}for mixed-integer problems

PopulationType

Data type of the population. Must be'doubleVector'for mixed integer problems.

'bitstring'|'custom'|{'doubleVector'}

gaignores all constraints whenPopulationTypeis set to'bitString'or'custom'.SeePopulation Options

SelectionFcn

I*Function that selects parents of crossover and mutation children. Specify as a name of a built-in selection function or a function handle.

gamultiobjuses only'selectiontournament'

{'selectionstochunif'}forga,{'selectiontournament'}forgamultiobj|'selectionremainder'|'selectionuniform'|'selectionroulette'|Custom selection function

StallTest

NMStopping test type.

'geometricWeighted'|{'averageChange'}

UseParallel

Compute fitness and nonlinear constraint functions in parallel. SeeVectorize and Parallel Options (User Function Evaluation)andHow to Use Parallel Processing in Global Optimization Toolbox

true|{false}

UseVectorized

Specifies whether functions are vectorized. SeeVectorize and Parallel Options (User Function Evaluation)andVectorize the Fitness Function

For an options structure, useVectorizedwith the values'on'or'off'

true|{false}

Example:optimoptions('gamultiobj','PlotFcn',@gaplotpareto)

问题描述,指定为一个结构控制aining these fields.

fitnessfcn

Fitness functions

nvars

Number of design variables

Aineq

Amatrix for linear inequality constraints

Bineq

bvector for linear inequality constraints

Aeq

Aeqmatrix for linear equality constraints

Beq

beqvector for linear equality constraints

lb

Lower bound onx

ub

Upper bound onx

nonlcon

Nonlinear constraint function

intcon Indices of integer variables
rngstate

Field to reset the state of the random number generator

solver

'gamultiobj'

options

Options created usingoptimoptionsor an options structure

You must specify the fieldsfitnessfcn,nvars, andoptions.The remainder are optional forgamultiobj

Data Types:struct

Output Arguments

collapse all

Pareto points, returned as anm-by-nvarsarray, wheremis the number of points on the Pareto front. Each row ofxrepresents one point on the Pareto front.

Function values on the Pareto front, returned as anm-by-nfarray.mis the number of points on the Pareto front, andnfis the number of fitness functions. Each row offvalrepresents the function values at one Pareto point inx

Reasongamultiobjstopped, returned as an integer.

exitflag Value Stopping Condition
1

Geometric average of the relative change in value of the spread overoptions.MaxStallGenerationsgenerations is less thanoptions.FunctionTolerance, and the final spread is less than the mean spread over the pastoptions.MaxStallGenerationsgenerations

0

Maximum number of generations exceeded

-1

Optimization terminated by an output function or plot function

-2

No feasible point found

-5

Time limit exceeded

Information about the optimization process, returned as a structure with these fields.

output Field Meaning
problemtype

Type of problem:

  • 'unconstrained'——没有约束

  • 'boundconstraints'— Only bound constraints

  • 'linearconstraints'——线性约束,with or without bound constraints

  • 'nonlinearconstr'— Nonlinear constraints, with or without other types of constraints

rngstate

State of the MATLAB random number generator, just before the algorithm started. You can use the values inrngstateto reproduce the output ofgamultiobj.SeeReproduce Results

generations Total number of generations, excludingHybridFcniterations.
funccount Total number of function evaluations.
message gamultiobjexit message.
averagedistance Average “distance,” which by default is the standard deviation of the norm of the difference between Pareto front members and their mean.
spread Combination of the “distance,” and a measure of the movement of the points on the Pareto front between the final two iterations.
maxconstraint Maximum constraint violation at the final Pareto set.

Final population, returned as ann-by-nvarsarray, wherenis the number of members of the population.

Scores of the final population, returned as ann-by-nfarray.nis the number of members of the population, andnfis the number of fitness functions.

When there are nonlinear constraints,gamultiobjsets thescoresof infeasible population members toInf

More About

collapse all

Pareto Front

APareto frontis a set of points in parameter space (the space of decision variables) that have noninferior fitness function values.

In other words, for each point on the Pareto front, you can improve one fitness function only by degrading another. For details, seeWhat Is Multiobjective Optimization?

As inLocal vs. Global Optima, it is possible for a Pareto front to be local, but not global. “Local” means that the Pareto points can be noninferior compared to nearby points, but points farther away in parameter space could have lower function values in every component.

Algorithms

gamultiobjuses a controlled, elitist genetic algorithm (a variant of NSGA-II[1]). An elitist GA always favors individuals with better fitness value (rank). A controlled elitist GA also favors individuals that can help increase the diversity of the population even if they have a lower fitness value. It is important to maintain the diversity of population for convergence to an optimal Pareto front. Diversity is maintained by controlling the elite members of the population as the algorithm progresses. Two options,ParetoFractionandDistanceMeasureFcn, control the elitism.ParetoFractionlimits the number of individuals on the Pareto front (elite members). The distance function, selected byDistanceMeasureFcn, helps to maintain diversity on a front by favoring individuals that are relatively far away on the front. The algorithm stops if thespread, a measure of the movement of the Pareto front, is small. For details, seegamultiobj Algorithm

Alternative Functionality

App

TheOptimizeLive Editor task provides a visual interface forgamultiobj

References

[1] Deb, Kalyanmoy.Multi-Objective Optimization Using Evolutionary Algorithms.Chichester, England: John Wiley & Sons, 2001.

Extended Capabilities

Introduced in R2007b