We want to minimize a simple fitness function of two variables x1 and x2
min f(x) = 100 * (x1^2 – x2) ^2 + (1 – x1)^2;
x
such that the following two nonlinear constraints and bounds are satisfied
x1*x2 + x1 – x2 + 1.5 <=0, (nonlinear constraint)
10 – x1*x2 <=0, (nonlinear constraint)
0 <= x1 <= 1, and (bound)
0 <= x2 <= 13 (bound)
it can be solved by
ObjectiveFunction = @simple_fitness;
nvars = 2; % Number of variables
LB = [0 0]; % Lower bound
UB = [1 13]; % Upper bound
ConstraintFunction = @simple_constraint;
[x,fval] = ga(ObjectiveFunction,nvars,[],[],[],[],LB,UB, …
ConstraintFunction)
how to plot the objective function with both variables simultaniously with marking the optimim values?
Best Answer