Why does my optimization solver return a solution that violates constraints when it ends prematurely?

I am using an optimization solver with the active set algorithm and in most cases I see it correctly return a vector subject to all constaints, as it should. 
However, I see several cases where one of the coefficients disobeys one or more constaints.
This is surprising as I believe the solver should guarantee that all constraints are met when it finds a solution. 
Can you please help me understand the conditions when a solver would return one or more coefficients that disobey my constaints? Possibly due to the iteration count being exceeded or the solver exiting prematurely? 

 采纳的回答

It is possible that if an optimization solver ends prematurely while using the active-set algorithm the solution may not obey all constraints.  
While the end result of the algorithm should meet all constraints placed on the optimization problem, active-set starts out with a subset of inequality constraints that need to be satisfied and adds inequality constraints if the algorithm can find a descent direction in the feasible region.  If the solver were to exceed the max iterations or exit prematurely for some other reason, the coefficients returned may not be guaranteed to meet all constraints put on the problem (in this case they may be negative).  However, MATLAB should warn you that the solver has ended prematurely.
One example of this happening is 'lsqnonneg' returning a solution with negative values if it exceedsd the maximum number of iterations.
 

更多回答(0 个)

类别

产品

版本

R2016a

Community Treasure Hunt

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

Start Hunting!

Translated by