www.gusucode.com > globaloptim 案例源码程序 matlab代码 > globaloptim/MultiobjectiveOptimizationWithBoundConstraintsExample.m

    %% Multiobjective Optimization with Bound Constraints
% Find the Pareto front for the two fitness functions |sin(x)| and |cos(x)|
% on the interval $0\le x\le 2\pi$.
fitnessfcn = @(x)[sin(x),cos(x)];
nvars = 1;
lb = 0;
ub = 2*pi;
rng default % for reproducibility
x = gamultiobj(fitnessfcn,nvars,[],[],[],[],lb,ub)
%%
% Plot the solution.
plot(sin(x),cos(x),'r*')
xlabel('sin(x)')
ylabel('cos(x)')
title('Pareto Front')
legend('Pareto front')
%%
% |gamultiobj| did a good job of finding evenly-spaced points along the
% entire Pareto front.