linear objective, non-linear constraint
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... https://github.com/scipy/scipy/blob/a9fb36bc44bad4bbd2c1a41cb43c6f10925b38ae...
Are S, and C the only unknowns? Can you give your other constraints? Benjamin On 18.11.2015 15:24, Gustavo Goretkin 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... https://github.com/scipy/scipy/blob/a9fb36bc44bad4bbd2c1a41cb43c6f10925b38ae...
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-user
-- Benjamin Trendelkamp-Schroer Fritschestrasse 24 10585 Berlin
On Wednesday, November 18, 2015, Gustavo Goretkin < gustavo.goretkin@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... https://github.com/scipy/scipy/blob/a9fb36bc44bad4bbd2c1a41cb43c6f10925b38ae...
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
Wed, 18 Nov 2015 09:24:21 -0500, Gustavo Goretkin kirjoitti:
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'
One thing potentially worth trying is to give upper and lower bounds for all of the variables. The SLSQP solver as it currently is simulates unconstrained variables by using some large numeric values for the upper/lower bounds --- these might cause numerical problems for the constraints.
Sorry for not including the whole problem originally. I was hoping someone could tell me what a singular matrix C means in terms of the optimization problem. In any case, here is the setup of the optimization problem that is giving me trouble: https://gist.github.com/goretkin/e54819eb0b3831d09daa I tried adding tight-ish bounds as suggested (+/- 100 on each decision variable), but that didn't help Here is a simplified version, which does work. It's a linear program. https://gist.github.com/goretkin/acc92375430bbe374b0c For what is worth, here is my attempt at modeling the same problem in Julia's JuMP: https://gist.github.com/goretkin/facccca9d99b6f55c175. Using IPOPT, the solver converges to what I expect. On Thu, Nov 19, 2015 at 7:35 AM, Pauli Virtanen <pav@iki.fi> wrote:
Wed, 18 Nov 2015 09:24:21 -0500, Gustavo Goretkin kirjoitti:
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'
One thing potentially worth trying is to give upper and lower bounds for all of the variables.
The SLSQP solver as it currently is simulates unconstrained variables by using some large numeric values for the upper/lower bounds --- these might cause numerical problems for the constraints.
_______________________________________________ SciPy-User mailing list SciPy-User@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-user
participants (4)
-
Benjamin Trendelkamp-Schroer -
Eric Moore -
Gustavo Goretkin -
Pauli Virtanen