フィルターのクリア

Finding Pareto Front of Shaffer's 2nd function.

3 ビュー (過去 30 日間)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 1 月 8 日
回答済み: brikh lamine 2017 年 10 月 12 日
I couldn't understand what was wrong with the following code of mine,
main.m
x = -5:0.1:5;
y = schaffer2(x);
plot(x,y(:,1),'.r');
hold on
plot(x,y(:,2),'.b');
lb = -5;
ub = 5;
fminuncOptions = optimoptions(@fminunc, ...
'Display','iter', ...
'Algorithm','quasi-newton');
options = optimoptions('HybridFcn',{@fminunc, fminuncOptions});
options = optimoptions(options, 'gamultiobj', ...
'PopulationSize',60, ...
'PlotFcns',@gaplotpareto);
[x,f,exitflag] = gamultiobj(@schaffer2,1,[],[],[],[],lb,ub,options);
This code is generating the following error,
>> main
Error using optimoptions (line 114)
Invalid solver specified. Provide a solver name or handle (such as 'fmincon' or @fminunc).
Type DOC OPTIMOPTIONS for a list of solvers.
Error in main (line 15)
options = optimoptions('HybridFcn',{@fminunc, fminuncOptions});
>>
Can somebody explain why is this code generating error?
_____
schaffer2.m
function y = schaffer2(x) % y has two columns
% Initialize y for two objectives and for all x
y = zeros(length(x),2); % ready for vectorization
% Evaluate first objective.
% This objective is piecewise continuous.
for i = 1:length(x)
if x(i) <= 1
y(i,1) = -x(i);
elseif x(i) <=3
y(i,1) = x(i) -2;
elseif x(i) <=4
y(i,1) = 4 - x(i);
else
y(i,1) = x(i) - 4;
end
end
% Evaluate second objective
y(:,2) = (x -5).^2;

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 9 日
options = optimoptions(@gamultiobj, 'HybridFcn',{@fminunc, fminuncOptions});

その他の回答 (1 件)

brikh lamine
brikh lamine 2017 年 10 月 12 日
hello, I search the vector of the front Pareto real of the function of test Schaffer 2?

カテゴリ

Help Center および File ExchangeMultiobjective Optimization についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by