Skip to content

Commit dc704f5

Browse files
committed
code: add knitro to pyproject.toml
1 parent b2e4bfe commit dc704f5

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

linopy/solvers.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
"mosek",
4949
"copt",
5050
"mindopt",
51+
"knitro"
5152
]
5253

5354
# Solvers that don't need a solution file when keep_files=False
@@ -145,6 +146,9 @@ class xpress_Namespaces: # type: ignore[no-redef]
145146
except coptpy.CoptError:
146147
pass
147148

149+
with contextlib.suppress(ModuleNotFoundError, ImportError):
150+
import knitro
151+
148152
quadratic_solvers = [s for s in QUADRATIC_SOLVERS if s in available_solvers]
149153
logger = logging.getLogger(__name__)
150154

@@ -176,6 +180,7 @@ class SolverName(enum.Enum):
176180
COPT = "copt"
177181
MindOpt = "mindopt"
178182
PIPS = "pips"
183+
Knitro = "knitro"
179184

180185

181186
def path_to_string(path: Path) -> str:

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ docs = [
5858
"gurobipy==11.0.2",
5959
"ipykernel==6.29.5",
6060
"matplotlib==3.9.1",
61+
"knitro>=15.0.1",
6162
]
6263
dev = [
6364
"pytest",
@@ -70,6 +71,7 @@ dev = [
7071
"types-requests",
7172
"gurobipy",
7273
"highspy",
74+
"knitro",
7375
]
7476
solvers = [
7577
"gurobipy",
@@ -81,6 +83,7 @@ solvers = [
8183
"coptpy!=7.2.1",
8284
"xpress; platform_system != 'Darwin' and python_version < '3.11'",
8385
"pyscipopt; platform_system != 'Darwin'",
86+
"knitro>=15.0.1",
8487
]
8588

8689
[tool.setuptools.packages.find]

0 commit comments

Comments
 (0)