Optimization is generating error plotting pareto front
8 ビュー (過去 30 日間)
古いコメントを表示
Ba Ba Black Sheep!
2017 年 1 月 10 日
コメント済み: Walter Roberson
2017 年 1 月 10 日
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;
0 件のコメント
採用された回答
Walter Roberson
2017 年 1 月 10 日
Change
[x, fval] = gamultiobj(fitness, nvar);
to
[xy, fval] = gamultiobj(fitness, nvar);
x = xy(1); y = xy(2);
2 件のコメント
Walter Roberson
2017 年 1 月 10 日
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.
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Genetic Algorithm についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!