diff --git a/README.md b/README.md index 3d3cdc6..222fa6b 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ It currently supports the following optimizers: - [HiGHS](https://github.com/ERGO-Code/HiGHS) ( Open source ) - [Mosek](https://www.mosek.com/) ( Commercial ) - [Ipopt](https://github.com/coin-or/Ipopt) ( Open source ) +- [KNITRO](https://www.artelys.com/solvers/knitro/) ( Commercial ) ## Short Example ```python @@ -113,7 +114,7 @@ It uses [nanobind](https://github.com/wjakob/nanobind), [fmtlib](https://github. The design of PyOptInterface is inspired by [JuMP.jl](https://jump.dev). -Some solver-related code in `src` folder is adapted from the corresponding solver interface package in `JuMP.jl` +Some solver-related code in `src` folder is adapted from the corresponding solver interface package in `JuMP.jl` ecosystem, which is licensed under MIT License. The header files in `thirdparty/solvers` directory are from the corresponding distribution of optimizers and are licensed under their own licenses. diff --git a/docs/source/index.md b/docs/source/index.md index 40fb7a1..fd334bb 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -28,6 +28,7 @@ copt.md mosek.md highs.md ipopt.md +knitro.md changelog.md ``` diff --git a/docs/source/nonlinear.md b/docs/source/nonlinear.md index 7564a7e..a986c6c 100644 --- a/docs/source/nonlinear.md +++ b/docs/source/nonlinear.md @@ -11,7 +11,7 @@ Compared with the linear and quadratic expressions and objectives we have discus :::{note} -Before trying out the code snippets, please ensure that you have completed the installation of PyOptInterface with correct dependencies via `pip install pyoptinterface[nlp]` and solvers that support nonlinear programming (IPOPT, COPT, Xpress, Gurobi) as described in the [Getting Started](getting_started.md) section. +Before trying out the code snippets, please ensure that you have completed the installation of PyOptInterface with correct dependencies via `pip install pyoptinterface[nlp]` and solvers that support nonlinear programming (IPOPT, COPT, Xpress, Gurobi, KNITRO) as described in the [Getting Started](getting_started.md) section. ::: ## Construct nonlinear expressions diff --git a/src/pyoptinterface/_src/knitro.py b/src/pyoptinterface/_src/knitro.py index 459ed9a..11d1794 100644 --- a/src/pyoptinterface/_src/knitro.py +++ b/src/pyoptinterface/_src/knitro.py @@ -217,7 +217,7 @@ def _result_status_knitro(model: "Model"): return ResultStatusCode.INFEASIBLE_POINT return ResultStatusCode.NO_SOLUTION - +# Model Attribute model_attribute_get_func_map = { ModelAttribute.ObjectiveValue: lambda model: model.get_obj_value(), ModelAttribute.ObjectiveSense: lambda model: model.get_obj_sense(), @@ -232,7 +232,6 @@ def _result_status_knitro(model: "Model"): ModelAttribute.TimeLimitSec: lambda model: model.get_raw_parameter( KN.PARAM_TIME_LIMIT ), - # TODO: Bind this in C++ ModelAttribute.BarrierIterations: lambda model: model.get_number_iterations(), ModelAttribute.NodeCount: lambda model: model.get_mip_node_count(), ModelAttribute.ObjectiveBound: lambda model: model.get_obj_bound(),