[SciPy-User] minimize SLSQP return code when model is infeasible

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[SciPy-User] minimize SLSQP return code when model is infeasible

Erwin Kalvelagen
Here is small model that is infeasible:
 
  min x^2 + y^2
  x+y=1
  x>=2
  x,y>=0

However when I try this with SLSQP I get a return code that seems to
indicate everything is hunky-dory:


x = [1,2]
optimize.minimize(
    lambda x: x[0]**2+x[1]**2,
    x,
    constraints = (
        {'type':'eq','fun': lambda x: x[0]+x[1]-1},
        {'type':'ineq','fun': lambda x: x[0]-2}
                  ),
    bounds = ((0,None),(0,None)),
    method='SLSQP')

    nfev: 8
     fun: 2.77777777777712
     nit: 6
     jac: array([  3.33333334e+00,   2.98023224e-08,   0.00000000e+00])
       x: array([  1.66666667e+00,   1.39888101e-14])
 success: True
 message: 'Optimization terminated successfully.'
  status: 0
    njev: 2

R has a similar interface to SLSQP, so I tried that also. We see that a
number of flags are raised.

 slsqp(c(1,2),
       function(x) {x[1]^2+x[2]^2},
       heq=function(x){x[1]+x[2]-1},
       hin=function(x){x[1]-2},
       lower=c(0,0))
$par
[1] 1.666667e+00 4.773719e-11

$value
[1] 2.777778

$iter
[1] 105

$convergence
[1] -4

$message
[1] "NLOPT_ROUNDOFF_LIMITED: Roundoff errors led to a breakdown of the
optimization algorithm. In this case, the returned minimum may still be
useful. (e.g. this error occurs in NEWUOA if one tries to achieve a
tolerance too close to machine precision.)"
 

I am not very familiar with this solver (so I may be doing something
wrong or misinterpreting something) but it looks like the scipy version
does not return a correct return code.

Thanks, Erwin

_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user
Reply | Threaded
Open this post in threaded view
|

Re: minimize SLSQP return code when model is infeasible

Erwin Kalvelagen
Added to bug tracker: https://github.com/scipy/scipy/issues/5743 


_______________________________________________
SciPy-User mailing list
[hidden email]
https://mail.scipy.org/mailman/listinfo/scipy-user