Effacer les filtres
Effacer les filtres

Optimization is generating error plotting pareto front

2 vues (au cours des 30 derniers jours)
Ba Ba Black Sheep!
Ba Ba Black Sheep! le 10 Jan 2017
Commenté : Walter Roberson le 10 Jan 2017
The following code is generating the following error,
>> main
Optimization terminated: average change in the spread of Pareto
solutions less than options.TolFun.
Undefined function or variable 'y'.
Error in main (line 9)
f1 = x.^4 + y.^4 - x.^2 * y.^2 + x * y - 10 * x.^2;
simpleMultiObjective.m
function z = simpleMultiObjective(xy)
x = xy(1); y = xy(2);
z(1) = x.^4 + y.^4 - x.^2 * y.^2 + x * y - 10 * x.^2;
z(2) = x.^4 + y.^4 - x.^2 * y.^2 + x * y;
end
main.m
fitness = @simpleMultiObjective;
nvar = 2;
[x, fval] = gamultiobj(fitness, nvar);
x0 = -5:0.5:5;
f1 = x.^4 + y.^4 - x.^2 * y.^2 + x * y - 10 * x.^2;
f2 = x.^4 + y.^4 - x.^2 * y.^2 + x * y;
figure; hold on
plot(x0, f1);
plot(x0, f2);
grid;
xlabel('x');
ylabel('f');
plot(x, fval(:, 1), 'x');
plot(x, fval(:, 2), 'o');
figure;
plot(fval(:, 1), fval(:,2), 'o');
xlabel('f1');
ylabel('f2');
grid;

Réponse acceptée

Walter Roberson
Walter Roberson le 10 Jan 2017
Change
[x, fval] = gamultiobj(fitness, nvar);
to
[xy, fval] = gamultiobj(fitness, nvar);
x = xy(1); y = xy(2);
  2 commentaires
Ba Ba Black Sheep!
Ba Ba Black Sheep! le 10 Jan 2017
How can I generate the table for data values for the Pareto front?
Walter Roberson
Walter Roberson le 10 Jan 2017
What table? The answer to what you calculated is a particular pair of values that is the pareto optimum. There is no "table" associated with a pair of values.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Multiobjective Optimization dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by