Skip to content

Commit c32d9e0

Browse files
authored
Add Knitro interface to CVXPY for Quadratic Problems and Conic Problems (#1)
* Add KNITRO solver to the list of available solvers * Add KNITRO QP and Conic solver interfaces * Add KNITRO citation to the citation dictionary * Add KNITRO QP and Conic solver interface implementation * Add KNITRO to doc * Add KNITRO to ci for optional solvers
1 parent e6d6029 commit c32d9e0

File tree

13 files changed

+1162
-17
lines changed

13 files changed

+1162
-17
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ jobs:
5555
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
5656
echo $MOSEK_CI_BASE64 | base64 -d > mosek.lic
5757
echo "MOSEKLM_LICENSE_FILE=$( [[ $RUNNER_OS == 'macOS' ]] && echo $(pwd)/mosek.lic || echo $(realpath mosek.lic) )" >> $GITHUB_ENV
58+
5859
- uses: conda-incubator/setup-miniconda@v3
5960
with:
6061
auto-update-conda: true

.github/workflows/test_optional_solvers.yml

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
name: test_optional_solvers
22

33
on:
4-
pull_request:
5-
push:
6-
branches:
7-
- master
8-
tags:
9-
- '*'
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
tags:
9+
- '*'
10+
1011
jobs:
1112
test_optional_solvers:
1213
runs-on: ${{ matrix.os }}
@@ -24,6 +25,8 @@ jobs:
2425
echo "PYTHON_SUBVERSION=$(echo $PYTHON_VERSION | cut -c 3-)" >> $GITHUB_ENV
2526
echo $MOSEK_CI_BASE64 | base64 -d > mosek.lic
2627
echo "MOSEKLM_LICENSE_FILE=$( [[ $RUNNER_OS == 'macOS' ]] && echo $(pwd)/mosek.lic || echo $(realpath mosek.lic) )" >> $GITHUB_ENV
28+
echo "$KNITRO_CI" > ~/artelys_lic.txt
29+
2730
- uses: actions/setup-python@v5
2831
with:
2932
python-version: 3.12
@@ -46,4 +49,5 @@ jobs:
4649
4750
env:
4851
RUNNER_OS: ${{ matrix.os }}
49-
PYTHON_VERSION: 3.12
52+
PYTHON_VERSION: 3.12
53+
KNITRO_CI: ${{ secrets.KNITRO_CI }}

continuous_integration/install_optional_solvers.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,5 +43,11 @@ fi
4343

4444
# Only install Mosek if license is available (secret is not copied to forks)
4545
if [[ -n "$MOSEK_CI_BASE64" ]]; then
46-
python -m pip install mosek
46+
python -m pip install mosek
47+
fi
48+
49+
# Only install KNITRO if license is available (secret is not copied to forks)
50+
# KNITRO on macOS is only available for arch64
51+
if [[ -n "$KNITRO_CI" ]] && ! ([[ "$RUNNER_OS" == "macOS" ]] && [[ $(uname -m) != "aarch64" ]]); then
52+
python -m pip install knitro
4753
fi

cvxpy/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@
102102
USER_LIMIT as USER_LIMIT,
103103
XPRESS as XPRESS,
104104
HIGHS as HIGHS,
105+
KNITRO as KNITRO,
105106
get_num_threads as get_num_threads,
106107
set_num_threads as set_num_threads,
107108
)

cvxpy/reductions/solvers/conic_solvers/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,4 +34,5 @@
3434
from .scs_conif import SCS
3535
from .sdpa_conif import SDPA
3636
from .xpress_conif import XPRESS
37-
from .highs_conif import HIGHS
37+
from .highs_conif import HIGHS
38+
from .knitro_conif import KNITRO

0 commit comments

Comments
 (0)