www.gusucode.com > optim 案例源码 matlab代码程序 > optim/ObtainAllOutputsFromGamultiobjExample.m

    %% Obtain All Outputs from |gamultiobj|
% Run a simple multiobjective problem and obtain all available outputs.
%%
% Set the random number generator for reproducibility.
rng default
%%
% Set the fitness functions to |kur_multiobjective|, a function that has
% three control variables and returns two fitness function values.
fitnessfcn = @kur_multiobjective;
nvars = 3;
%%
% The code for the |kur_multiobjective| function is the following.
%
% <include>kur_multiobjective.m</include>
%
% This function is also studied in the example
% <docid:globaloptim_examples.example-ex75169696>.
%%
% 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);
%%
% Examine the sizes of some of the returned variables.
sizex = size(x)
sizepopulation = size(population)
sizescores = size(scores)
%%
% There are 18 points on the returned Pareto front, and 50 members of the
% final population. Each |population| row has three dimensions,
% coresponding to the three decision variables. Each |scores| row has two
% dimensions, corresponding to the two fitness functions.