[SciPy-User] linear objective, non-linear constraint

Eric Moore ewm at redtetrahedron.org
Thu Nov 19 07:25:35 EST 2015


On Wednesday, November 18, 2015, Gustavo Goretkin <
gustavo.goretkin at gmail.com> wrote:

> I have what is a linear program, except for a non-linear constraint of the
> form
> S^2 + C^2 = 1. The other constraints are linear, as is the objective.
>
> I'm trying to use optimize.minimize interface and the SLSQP solver (which
> I believe is the only solver that supports non-linear and equality
> constraints), but I get
>
>   status: 6
>  success: False
>     njev: 1
>     nfev: 1
>      fun: -0.0
>        x: array([ 5.,  5.,  1.,  0.,  0.,  6.,  6.,  4.,  4.,  6.,  4.,  4.,  6.])
>  message: 'Singular matrix C in LSQ subproblem'
>      jac: array([-0., -0., -0., -0., -1., -0., -0., -0., -0., -0., -0., -0., -0.,  0.])
>      nit: 1
>
> Is this because the objective is not positive definite? Or is there another reason?
>
> I've looked below, but I don't see where in the fortan code that the mode gets set to 6
> https://github.com/scipy/scipy/blob/v0.16.1/scipy/optimize/slsqp/slsqp_optmz.f
> https://github.com/scipy/scipy/blob/a9fb36bc44bad4bbd2c1a41cb43c6f10925b38ae/scipy/optimize/slsqp.py#L405
>
>
Generally speaking, people are more easily able to help you if you post the
code that fails, reduced as much as possible to isolate the problem. It is
hard to say what you should change from what you have given us.

If that is your only difficult constraint, you could always replace the C
and S by a new variable t, each use of C by cos(t) and S by sin(t). This
new variable could be then be unconstrained. This doesn't solve your
current issue though it may make setting up the problem a little easier.

Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.scipy.org/pipermail/scipy-user/attachments/20151119/2a8ed562/attachment.html>


More information about the SciPy-User mailing list