Warning of fmincon in algorithm options

Hi everyone,
These days i am using the fmincon function to get the value of four unknowns from three equations. the objective function is to minimize the square sum of the three equations. However, when I run the codes, Matlab gives me the warning in the command window as
because i don't know how to supply the gradient in the objective function,thereby, I change the algorithm to "active-set". However, matlab still gives me totally the same warning in the command window. Even other algorithms of fmincon like 'interior-point' and 'sqp' also give me the same warning! I do not know why...
Could you give me some ways to deal with that ? Thanks very much!

Réponses (2)

Matt J
Matt J le 11 Déc 2013

0 votes

the objective function is to minimize the square sum of the three equations
Sounds like you should be using FSOLVE rather than FMINCON. Are there any constraints that you haven't mentioned?
As for the warning, you probably have a bug in the code you think is selecting a different algorithm. We would need to see it, to have a better idea.

7 commentaires

Stanley Cheng
Stanley Cheng le 12 Déc 2013
i have only the upper and lower bounds for the costraints of the four variables in the physical meaning, no other constraints.
Matt J
Matt J le 12 Déc 2013
Then you should consider LSQNONLIN.
Stanley Cheng
Stanley Cheng le 12 Déc 2013
but for LSQNONLIN, the Levenberg-Marquardt algorithm does not handle bound constraints,and the trust-region-reflective algorithm requires at least as many equations as variables.
not easy way.
I think i will not take the warning in fmincon into consideration, for the error produced by the function is acceptable. the annoying thing is the codes will be executed 500 times, so a lot of warning jump out in the command window.
Matt J
Matt J le 12 Déc 2013
That's true, I didn't notice that your problem is under-determined. But since it is, I wonder how you can hope to get a meaningful solution out of it!
Stanley Cheng
Stanley Cheng le 12 Déc 2013
actually, the physical meaning of the objective function is the distance between the actual point to an ideal point. if the error is acceptable, the solution is meaningful.
Matt J
Matt J le 12 Déc 2013
But because the equations are under-determined, it probably means you have a continuum of solutions. That means the solution you get will be unstable and can vary significantly if you run the code on different machines/processors or if your input data undergoes small changes or noise corruption.
Stanley Cheng
Stanley Cheng le 12 Déc 2013
yes, the small change of the input can lead to large variations in the output. But the answers are still acceptable in the physical meaning.
i think different ideas are needed in future, e.g a more comprehensive measurement of the object is required to get a more complete data, so optimization tool in matlab is not required, just to solve the equations with the same length of the unknowns in them, i.e the equations is not under or over determined.

Connectez-vous pour commenter.

Stanley Cheng
Stanley Cheng le 12 Déc 2013

0 votes

I solved it! the option is defined but i forgot to call it !
Then opts1=optimset('MaxFunEvals',30000,'MaxIter',30000,'TolFun',1e-8,'Display','off','Algorithm','active-set');
fmincon(@incisornew,A0,[],[],[],[],lb,ub,[],opts1)
so opts1 is called in fmincon(), now no warning !
Thanks for your help!

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by