Skip to content

Commit eb728ff

Browse files
authored
Uno interface (#119)
* adds first changes for interface * some more progress on uno interface * adds unopy to CI workflows * remove windows tests * remove unnecessary nlp workflow * cleanup test_nlp_solvers
1 parent 496bbf3 commit eb728ff

File tree

8 files changed

+369
-55
lines changed

8 files changed

+369
-55
lines changed

.github/workflows/test_nlp_solver.yml

Lines changed: 0 additions & 48 deletions
This file was deleted.
Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: test_nlp
1+
name: test_nlp_solvers
22

33
on:
44
pull_request:
@@ -16,7 +16,7 @@ jobs:
1616
strategy:
1717
fail-fast: false
1818
matrix:
19-
os: [ubuntu-latest, macos-latest, windows-latest]
19+
os: [ubuntu-latest, macos-latest]
2020
steps:
2121
- uses: actions/setup-python@v6
2222
with:
@@ -35,10 +35,13 @@ jobs:
3535
- name: Install cyipopt via conda
3636
run: |
3737
conda install -y -c conda-forge cyipopt
38+
- name: Install uno via pip
39+
run: |
40+
pip install unopy
3841
- name: Install test dependencies
3942
run: |
4043
pip install -e .
4144
pip install pytest hypothesis
42-
- name: Run NLP tests
45+
- name: Run nlp tests
4346
run: |
4447
pytest cvxpy/tests/nlp_tests/.

cvxpy/problems/problem.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from cvxpy.reductions.solvers.nlp_solvers.copt_nlpif import COPT as COPT_nlp
5151
from cvxpy.reductions.solvers.nlp_solvers.ipopt_nlpif import IPOPT as IPOPT_nlp
5252
from cvxpy.reductions.solvers.nlp_solvers.knitro_nlpif import KNITRO as KNITRO_nlp
53+
from cvxpy.reductions.solvers.nlp_solvers.uno_nlpif import UNO as UNO_nlp
5354
from cvxpy.reductions.solvers.qp_solvers.qp_solver import QpSolver
5455
from cvxpy.reductions.solvers.solver import Solver
5556
from cvxpy.reductions.solvers.solver_inverse_data import SolverInverseData
@@ -1228,6 +1229,15 @@ def _solve(self,
12281229
nlp_reductions = reductions + [KNITRO_nlp()]
12291230
elif solver is s.COPT:
12301231
nlp_reductions = reductions + [COPT_nlp()]
1232+
elif "uno" in solver.lower():
1233+
if solver.lower() == "uno_ipm":
1234+
# Interior-point method (requires MUMPS linear solver)
1235+
kwargs["preset"] = "ipopt"
1236+
kwargs["linear_solver"] = "MUMPS"
1237+
elif solver.lower() == "uno_sqp":
1238+
# SQP method (default)
1239+
kwargs["preset"] = "filtersqp"
1240+
nlp_reductions = reductions + [UNO_nlp()]
12311241
else:
12321242
raise error.SolverError(
12331243
"Solver %s is not supported for NLP problems." % solver

cvxpy/reductions/solvers/defines.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
from cvxpy.reductions.solvers.conic_solvers.sdpa_conif import SDPA as SDPA_con
4848
from cvxpy.reductions.solvers.conic_solvers.xpress_conif import XPRESS as XPRESS_con
4949
from cvxpy.reductions.solvers.nlp_solvers.ipopt_nlpif import IPOPT as IPOPT_nlp
50+
from cvxpy.reductions.solvers.nlp_solvers.uno_nlpif import UNO as UNO_nlp
5051

5152
# QP interfaces
5253
from cvxpy.reductions.solvers.qp_solvers.copt_qpif import COPT as COPT_qp
@@ -84,7 +85,7 @@
8485
MPAX_qp(),
8586
KNITRO_qp(),
8687
]
87-
solver_nlp_intf = [IPOPT_nlp()]
88+
solver_nlp_intf = [IPOPT_nlp(), UNO_nlp()]
8889

8990
SOLVER_MAP_CONIC = {solver.name(): solver for solver in solver_conic_intf}
9091
SOLVER_MAP_QP = {solver.name(): solver for solver in solver_qp_intf}
@@ -137,7 +138,7 @@
137138
s.MPAX,
138139
s.KNITRO,
139140
]
140-
NLP_SOLVERS = [s.IPOPT]
141+
NLP_SOLVERS = [s.IPOPT, s.UNO]
141142
DISREGARD_CLARABEL_SDP_SUPPORT_FOR_DEFAULT_RESOLUTION = True
142143
MI_SOLVERS = [
143144
s.GLPK_MI,

0 commit comments

Comments
 (0)