fmincon using only gradient vector, without scalar function
3 ビュー (過去 30 日間)
古いコメントを表示
I would like to use MATLAB function fmincon using the gradient vector alone (without scalar function f). But I have trouble with it. For instance, I have tried the following, but it doesn't work. Any help please? Thanks in advance!
x0 = [-1,2];
A = [];
b = [];
Aeq = [];
beq = [];
lb = [-2,-2];
ub = [2,2];
x = fmincon(@myfun,x0,A,b,Aeq,beq,lb,ub)
function [grad] = myfun(x)
grad = [-400*(x(2)-x(1)^2)*x(1)-2*(1-x(1));
200*(x(2)-x(1)^2)];
end
1 件のコメント
Ameer Hamza
2020 年 9 月 27 日
The concept of optimization problem does not make sense without an objective function. What does the gradient even mean in that case? Can you tell me what you are trying to do here?
採用された回答
Walter Roberson
2020 年 9 月 27 日
That is not supported by fmincon. You must return a scalar value as the first output.
If you have set the appropriate option in the option structure, you can also return the gradient as the second output.
3 件のコメント
Walter Roberson
2020 年 10 月 1 日
fmincon does not support that. As far as I recall, none of the Mathworks minimizers support that.
その他の回答 (0 件)
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!