ampl / mp

An open-source library for mathematical programming
https://mp.ampl.com
Other
229 stars 42 forks source link

Wrong unconstrained minimum for polynomial objective #180

Closed 4er4er4er closed 2 years ago

4er4er4er commented 2 years ago

x-gurobi does not give a correct solution for the following unconstrained polynomial minimization (from camel1.txt in the NLMODELS collection):

var x{1..2} >= -5, <= 5, := 1;

minimize Fhump:
    4*x[1]^2 - 2.1*x[1]^4 + x[1]^6/3 + x[1]*x[2] - 4*x[2]^2 + 4*x[2]^4;

The optimum given in the file (and confirmed by Lindo Global) is -1.031628453, at (0.089842,-0.712656) and (-0.089842, 0.712656). But x-gurobi gives this result:

ampl: solve;
x-Gurobi 9.5.1: Set parameter Username
qp:nonconvex=2

x-Gurobi 9.5.1: optimal solution; objective 6294.833333
2 simplex iterations
1 branching nodes

ampl: display x;
x [*] :=
1   1
2  -5
;
glebbelov commented 2 years ago

Fixed in 9d019df9.

Problem: Gurobi's pow does not accept bases with negative lower bound.

Solved by reducing pow with integer positive exp to quadratics.

Best objective -1.031628885569e+00, best bound -1.031714786227e+00, gap 0.0083%
x-Gurobi 9.5.1: optimal solution; objective -1.031628886
271 simplex iterations
121 branching nodes
ampl: display x;
x [*] :=
1   0.0901601
2  -0.7132