Multiple objective functions with fgoalattain

조회 수: 8 (최근 30일)
Jimmy Zhan
Jimmy Zhan 2020년 8월 5일
답변: Divya Gaddipati 2020년 8월 12일
I have multiple objective functions F1(x), F2(x), F3(x), ... Fn(x) that I would like to use fgoalattain to optimize simultaneously.
I have tried putting the objective functions in a cell array function handle:
fun = cellstr(string);
fun = cellfun(@str2func, fun, 'UniformOutput', false);
'string' is a cell array of strings which corresponds to function names (m files).
Each objective function has an associated goal and weight, such that length(fun) == length(goal) == length(weight)
Then I tried to call fgoalattain:
[x,fval] = fgoalattain(@(x)fun(x,par1, par2, par3, par4),x0,goal,weight)
However I get the following error:
Index in position 1 is invalid. Array indices must be positive integers or logical values.
Would anyone be able to help me with this optimization problem?
Thanks

답변 (1개)

Divya Gaddipati
Divya Gaddipati 2020년 8월 12일
The input to fgoalattain should be a single function handle. You can define all your objective functions in an array as follows
fun = @(x)[F1(x); F2(x);.. FN(x)];
For more information, refer to the examples in the following link

카테고리

Help CenterFile Exchange에서 Surrogate Optimization에 대해 자세히 알아보기

제품


릴리스

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by