SchafferMO2

Problem definition

Objective function
f = @(x) [-x.*(x<=1) + (x-2).*(x>1 & x<=3) + (4-x).*(x>3 & x<=4) + (x-4).*(x>4), ...
       (x-5).^2]
Optimization settings
o = struct	

% initializing struct

o.d = 1

% dimension of decision variable

o.lb = -5

% lower bounds

o.ub = 10

% upper bounds

Problem properties

dimension objectives smoothness
1 2 -

Optimization example with nsga2

Algorithm options
o.maxit = 40	

% number of iterations

o.pop = 40

% number of population

Optimization
rng(0)	

% for tractability

[popPos,popFront,popCost,popInfo,traceIt] = nsga2(f,o)

% running minimization

Animation
rng(0)
[~,~,~,~,~,info] = nsga2(f,o)
info.plot = 'pareto'
info.animate = true	

% plot animation

info.animfreq = 2

% frame frequency

optimview('nsga2',info)

Related functions

nsga2 | plot | scatter