필터 지우기
필터 지우기

Optimization is generating error plotting pareto front

조회 수: 2 (최근 30일)
Ba Ba Black Sheep!
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;

채택된 답변

Walter Roberson
Walter Roberson 2017년 1월 10일
Change
[x, fval] = gamultiobj(fitness, nvar);
to
[xy, fval] = gamultiobj(fitness, nvar);
x = xy(1); y = xy(2);
  댓글 수: 2
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017년 1월 10일
How can I generate the table for data values for the Pareto front?
Walter Roberson
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 CenterFile Exchange에서 Multiobjective Optimization에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by