-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
ECOS does not seem to handle infinite values in inequality bounds, which happen for instance when disabling an inequality while working on a problem (e.g. in box inequalities lb <= x <= ub). Right now the solver fails at first iteration if we put an infinite float (numpy.inf) in the inequality vector.
Reproduction steps
Here is an example:
import numpy as np
import scipy.sparse as spa
import ecos
c = np.array([0.0, 0.0, 1.0])
G = spa.csc_matrix(
np.array(
[
[-1.0, 0.0, 0.0],
[0.0, -1.0, 0.0],
[1.0, 0.0, 0.0],
[0.0, 1.0, 0.0],
[0.0, 0.0, -0.70710678],
[-1.0, 0.0, 0.0],
[0.0, -1.0, 0.0],
[0.0, 0.0, 0.70710678],
]
)
)
h = np.array([1.0, np.inf, np.inf, 1.0, 0.70710678, 0.0, 0.0, 0.70710678])
dims = {"q": [4], "l": 4}
ecos.solve(c, G, h, dims)It produces the following output:
ECOS 2.0.10 - (C) embotech GmbH, Zurich Switzerland, 2012-15. Web: www.embotech.com/ECOS
It pcost dcost gap pres dres k/t mu step sigma IR | BT
0 -nan -inf +nan 0e+00 7e-02 1e+00 nan --- --- 0 1 - | - -
Reached NAN dead end, recovering best iterate (368424832) and stopping.
Close to OPTIMAL (within feastol=6.9e-310, reltol=6.9e-310, abstol=6.9e-310).
Runtime: 0.000546 seconds.
See also
This example was produced from a small 2D quadratic program with box inequalities qpsolvers/qpsolvers#160:
import numpy as np
from qpsolvers import solve_qp
# minimize 1/2 x^T P x + q^T x
P = np.eye(2)
q = np.zeros(2)
# subject to lb <= x <= ub
lb = np.array([-1.0, -np.inf])
ub = np.array([np.inf, 1.0])
solve_qp(P, q, lb=lb, ub=ub, solver="ecos")Metadata
Metadata
Assignees
Labels
No labels