why do we need the analytic gradient in fmincon?

조회 수: 2 (최근 30일)
Chantrea Lean
Chantrea Lean 2015년 5월 8일
댓글: Chantrea Lean 2015년 5월 8일
Dear sir,
I wondered that using command "fmincon" in matlab without analytic gradient and with analytic gradient we got the same result,so why do we need to use fmincon with analytic gradient ? I think it's very complex in case that we have multi-variables for the input.I noted that number of iteration for fmincon with analytic gradient is less than fmincon without gradient,but for the computation time it's not very different.Some problem I noted that sometime using fmincon without analytic gradient is faster than fmincon with analytic gradient, so why ?
thank you very much
Chantrea

채택된 답변

Michael Haderlein
Michael Haderlein 2015년 5월 8일
The algorithm applied (by default interior-point-algorithm, find details here. This algorithm needs the Jacobian, so either you have an analytic solution or the Jacobian will be approximated by finite differences (I guess).
Now, the number of iterations usually is lower if the analytical Jacobian is available, but to what extend strongly depends on the function itself. If the function evaluation is fast, the number of iterations doesn't matter too much. However, there are cases when each function evaluation takes a long time, say, minutes. You'll agree that fast convergence and low number of evaluations will be a huge benefit then.
If you only have to do it a few times only and you get convergence anyway, I wouldn't spent too much time in deriving the Jacobian by hand. If you have to repeat it very often, if the function has trouble to converge, or if computational time is really high, I would try to find an analytical solution. But that's just my personal experience, there might as well be other opinions.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Solver Outputs and Iterative Display에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by