フィルターのクリア

Multi objective optimization of a 2D function.

5 ビュー (過去 30 日間)
Ba Ba Black Sheep!
Ba Ba Black Sheep! 2017 年 1 月 9 日
編集済み: Ba Ba Black Sheep! 2017 年 1 月 9 日
I need to optimize the following function,
.
I have written the following program. But, I couldn't figure out how to get the program working with two parameters.
main.m
fitness = @simpleMultiObjective;
nvar = 2;
[x, fval] = gamultiobj(fitness, nvar);
simpleMultiObjective.m
function z = simpleMultiObjective(x, y)
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
This program is generating the following error,
>> main
Error using simpleMultiObjective (line 2)
Not enough input arguments.
Error in createAnonymousFcn>@(x)fcn(x,FcnArgs{:}) (line 11)
fcn_handle = @(x) fcn(x,FcnArgs{:});
Error in gamultiobjMakeState (line 27)
Score = FitnessFcn(state.Population(1,:));
Error in gamultiobjsolve (line 8)
state = gamultiobjMakeState(GenomeLength,FitnessFcn,ConstrFcn,output.problemtype,options);
Error in gamultiobj (line 261)
[x,fval,exitFlag,output,population,scores] = gamultiobjsolve(FitnessFcn,nvars, ...
Error in main (line 4)
[x, fval] = gamultiobj(fitness, nvar);
Caused by:
Failure in initial user-supplied fitness function evaluation. GAMULTIOBJ cannot continue.
>>

採用された回答

Walter Roberson
Walter Roberson 2017 年 1 月 9 日
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

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeGet Started with Optimization Toolbox についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by