fmincon using only gradient vector, without scalar function

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

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
Walter Roberson 2020년 9월 27일

0 개 추천

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

The functions with that gradient are
100*X^4 + X^2 - 2*X + 100*Y^2 - 200*X^2*Y + c
for all finite constants c.
The value of c will not change the location of the minima, so you might as well use 0.
Thanks. But my plan was to get the solution without the objective function (only using the gradient vector). For instance, if the gradient vector is lager in size, converting into the original function may be challenging (it may take more computational time).
fmincon does not support that. As far as I recall, none of the Mathworks minimizers support that.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

태그

질문:

HAT
2020년 9월 27일

댓글:

2020년 10월 1일

Community Treasure Hunt

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

Start Hunting!

Translated by