Fmincon with different objective function in line search

Hello everyone,
I'm using fmincon to optimize a nonlinear and nonconvex optimization problem. I have an Objective function to minimize in general, but in my line search, i would like to add an extra term in the objective function. I don't know whether it's possible to define different objective function during line search.

Réponses (2)

Arnav Mendiratta
Arnav Mendiratta le 17 Nov 2016
Modifié(e) : Arnav Mendiratta le 17 Nov 2016
It is possible to pass extra parameters to the objective function and nonlinear constraint functions. Refer to this documentation link for details.
However, I cannot think of any way to use a different objective function for just line search other than running two separate instances of "fmincon", looking through their iterations, and repeating the process with an updated problem/start point.
I am not sure why you would want to do this for a specific objective function. Can you share some more information about the motivation for following this workflow?

4 commentaires

The objective function does not know whether it is being called in the context of a "line search" or not.
I am not even sure that fmincon does line searches in any of the 5 algorithms. There was a time when fmincon allowed levenberg-marquardt which perhaps could be said to do line-searches, but when that was in effect everything was line searches if any of it was.
Farzad Fakhraeiroudsari
Farzad Fakhraeiroudsari le 18 Nov 2016
Modifié(e) : Farzad Fakhraeiroudsari le 18 Nov 2016
Thanks for the your response.
I’m doing a research over origin destination calibration using optimization tools in matlab. In my research, I use bi-level optimization in which in the upper level origin destination matrices are optimized then they are used in the lower level as input for traffic simulator. The output of simulator is then is compared in upper level with filed measurements.
Since the objective function is highly non-convex, I use sensitivity of OD pairs in the parts that I have measurements. That is, with changing cell by cell in the OD matrices, I have the gradient information which says which OD has a direct relationship with which detector in my network. To find a local minimum of a function using gradient descent, steps are taken to the negative of the gradient (a sensitivity matrix) of the function at the current point. Then a line search method is used to find the optimal step. Although in line search step, I need to make sure that I’m not taking a large step size which disturbs my congestion pattern. Therefore a penalty term is used in line search objective function to make sure the step keep the correct congestion pattern. Why I don’t want to have this penalty term in gradient approximation? Because I want to give full possibility to optimization while calculating the descent direction.
Therefore I need to have two objective functions (one with extra penalty term). Yesterday I was checking the performance of fmincon and I found something which was new for me. As I mentioned, first sensitivity matrix using finite difference is calculated (changing cell by cell and check the objective function). I put a check and it seems when all OD cells are checked, fmincon take extra function evaluations while all OD matrices are changed. I though this might be the moment that line search is performed. Therefore I put a criteria to use extra term in objective function at this moment. Although I might be totally off. I hope my explanation was clear and appreciate any feedback or suggestion
fmincon does not use gradient descent, and I am not convinced it ever does line search. It sounds as if you have your own optimization routines outside of fmincon.
We need to see your optimization invocation.
I do observe that if you request the sqp-legacy algorithm for fmincon then it invokes sqpLineSearch which is a mex file . The documentation for sqp-legacy says that the algorithm is nearly the same as for the sqp algorithm. https://en.wikipedia.org/wiki/Sequential_quadratic_programming
So, potentially sqp or sqp-legacy invoke something that could be called "line search". However, the implementing code is not available, so we cannot see whether there is any way for an objective function to determine whether it is being invoked in a line-search phase.

Connectez-vous pour commenter.

John D'Errico
John D'Errico le 17 Nov 2016
No. You cannot change the objective function while in a line search.
Fmincon does not tell you if it is in a specific part of the algorithm. But worse, if you change the objective function on the fly, you have now created a non-differentiable, or worse, discontinuous function. Fmincon cannot deal with that.
I have no idea why you would want to do what you want to do, but it is a bad idea in general, even if you could do it.

1 commentaire

Dear John,
thanks for your respond. since your question was in line with previous respond, i would appreciate if you can check my reply in previous answer. thanks for your comment and feedback in-advance.
Farzad

Connectez-vous pour commenter.

Catégories

Community Treasure Hunt

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

Start Hunting!

Translated by