Give gradient to fmincon

조회 수: 5 (최근 30일)
Marc Laub
Marc Laub 2022년 10월 11일
댓글: Matt J 2022년 10월 12일
Hey,
so I am using fmincn to solve a problem. Im somehow not to satisfioed with the results because the solver seems to bug itsself into the lower boundary limit and ste sthe solution for 1 of the 3 parameters to zero therefore. Lokking at the gradient output it seems like there is a potential to optimize, because the gradient for 2 of the variables is like 10^-2, but for the one peramater where the solution is on the boundary, the gradient is like 10^4.
So I know that there is the possibility to set DerivativeCheck on and to give it a user suplied gradient. But I can only activate SpecifyObjectiveGradient to on or off. I am not sure wethere the user suplied gradient should represent a treshold that the output gradient should satisfy or if its an analytical gradient funtion that is required. Unfortunately I can not provide an analytical solution because the function is just to complex, filling multiple pages..
So is there another possibility to stop fmincon from bugging one of the parameters into the boundary since fmincon clearly knows that the gradient at the solution point is pretty bad?
Best regards
  댓글 수: 6
Torsten
Torsten 2022년 10월 11일
And what about the value of the objective ? Which one is "better" - yours or the one from the commercial software ?
But in any case: You should check whether the problem formulations in the two softwares are identical.
Marc Laub
Marc Laub 2022년 10월 11일
Since its a blackbox I cant check it, I can just build the same function to the best of my knowledge...but their seem to be some little deviatons.
Comparing the value of the object by putting their solution into my function, the value optianed from theit solution is worse, but the value they show in their software difers and is slightly better than my solution.
But in any case, theit solution with the non 0 solution is nice when you interpret it physically, since the 0 would represent a "pure" substance without any pollution, but a little pollution seems more realistic thermodynamically...
But I guess since the formulations seems to differ, I wont gte their result, even though I like it more for the named reasons

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

채택된 답변

Matt J
Matt J 2022년 10월 11일
편집: Matt J 2022년 10월 11일
If the problem is constrained, the gradient in a local extremum usually is not 0.
In fact, if the gradient is non-negative on the lower boundary, it is a very strong sign that a valid local minimum has been found. If you think this is a sub-optimal local minimum, you should try other initial guesses x0.
If the function is too complex to know if it is even differentiable, you may even want to try a non-derivative-based solver like ga, if you have the Global Optimization Toolbox, or fminsearch if you have a small number (<6) of unknnown parameters.
  댓글 수: 2
Marc Laub
Marc Laub 2022년 10월 12일
Somehow ga, always violates my constrains... its A=[0,1,1], b=1; but x(2)+x(3) in the solution are always larger 1
Matt J
Matt J 2022년 10월 12일
its A=[0,1,1], b=1; but x(2)+x(3) in the solution are always larger 1
That in itself doesn't imply a violation. It depends on the ConstraintTolerance parameters that you've set.
You also need to check exitflags. Possibly, ga could not find a feasible solution because there is none.

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Function Creation에 대해 자세히 알아보기

제품


릴리스

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by