-
Hello! I try to test proxqp to solve an obvious infeasible problem. from scipy import sparse
import numpy as np
import proxsuite
print(f"{proxsuite.__version__ = }")
# (x1- 9)^2 + (x2-6)^2
# s.t.
# x1 <= 10
# x2 <= 10
# x1 >= 20
P = 2*sparse.csc_matrix([[1.0, 0.0],
[0.0, 1.0]], dtype=float)
q = np.array([-18.0,
-12.0], dtype=float)
G = sparse.csc_matrix([[1, 0], # x1 <= 10
[0, 1], # x2 <= 10
[-1, 0], # x1 >= 20
], dtype=float)
u = np.array([10,
10,
-20,
], dtype=float)
n = P.shape[0]
n_in = G.shape[0]
n_eq = 0
A = None
b = None
l = np.full(n_in, -np.inf, dtype=float)
qp = proxsuite.proxqp.sparse.QP(n, n_eq, n_in)
qp.init(P, q, A, b, G, l, u)
solver_options = {"verbose": False, "max_iter": 3000}
for key, value in solver_options.items():
setattr(qp.settings, key, value)
qp.solve()
print(f"PROXQP status: {qp.results.info.status.name}")
print(f"x: {qp.results.x}")
print(f"y: {qp.results.y}")
print(f"z: {qp.results.z}")
print(f"si: {qp.results.si}")
print(f"pri_res: {qp.results.info.pri_res}")
print(f"dua_res: {qp.results.info.dua_res}")
print(f"duality_gap: {qp.results.info.duality_gap}") Results: proxsuite.__version__ = '0.6.5'
PROXQP status: PROXQP_MAX_ITER_REACHED
x: [14.99999973 6. ]
y: []
z: [0. 0. 0.]
si: [0. 0. 0.]
pri_res: 0.0
dua_res: 0.0
duality_gap: 179.99998851439864 |
Beta Was this translation helpful? Give feedback.
Answered by
fabinsch
Jun 7, 2024
Replies: 1 comment 5 replies
-
Hi @kkzhang3, in the settings we have an option called |
Beta Was this translation helpful? Give feedback.
5 replies
Answer selected by
jcarpent
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @kkzhang3, in the settings we have an option called
check_duality_gap
, which is set toFalse
by default. If you turn it on, it should returnPROXQP_PRIMAL_INFEASIBILITY
in my opinion.