You're Invited:Meet the Socket Team at RSAC and BSidesSF 2026, March 23–26.RSVP
Socket
Book a DemoSign in
Socket

linopy

Package Overview
Dependencies
Maintainers
2
Versions
64
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

linopy - pypi Package Compare versions

Comparing version
0.6.3
to
0.6.4
+1
-1
doc/index.rst

@@ -45,3 +45,3 @@ .. linopy documentation master file, created by

- `GLPK <https://www.gnu.org/software/glpk/>`__
- `HiGHS <https://www.maths.ed.ac.uk/hall/HiGHS/>`__
- `HiGHS <https://highs.dev/>`__
- `MindOpt <https://solver.damo.alibaba.com/doc/en/html/index.html>`__

@@ -48,0 +48,0 @@ - `Gurobi <https://www.gurobi.com/>`__

@@ -38,3 +38,3 @@ Getting Started

- `GLPK <https://www.gnu.org/software/glpk/>`__ - open source, free, not very fast
- `HiGHS <https://www.maths.ed.ac.uk/hall/HiGHS/>`__ - open source, free, fast
- `HiGHS <https://highs.dev/>`__ - open source, free, fast
- `Gurobi <https://www.gurobi.com/>`__ - closed source, commercial, very fast

@@ -41,0 +41,0 @@ - `Xpress <https://www.fico.com/en/fico-xpress-trial-and-licensing-options>`__ - closed source, commercial, very fast (GPU acceleration available in v9.8+)

@@ -7,2 +7,7 @@ Release Notes

Version 0.6.4
--------------
* Add support for the `knitro` solver via the knitro python API
Version 0.6.3

@@ -682,3 +687,3 @@ --------------

* Constraints can now be build combining linear expressions with right-hand-side via a `>=`, `<=` or a `==` operator. This creates an `AnonymousConstraint` which can be passed to `Model.add_constraints`.
* Add support of the HiGHS open source solver https://www.maths.ed.ac.uk/hall/HiGHS/ (https://github.com/PyPSA/linopy/pull/8, https://github.com/PyPSA/linopy/pull/17).
* Add support of the HiGHS open source solver https://highs.dev/ (https://github.com/PyPSA/linopy/pull/8, https://github.com/PyPSA/linopy/pull/17).

@@ -685,0 +690,0 @@

Metadata-Version: 2.4
Name: linopy
Version: 0.6.3
Version: 0.6.4
Summary: Linear optimization with N-D labeled arrays in Python

@@ -72,2 +72,3 @@ Author-email: Fabian Hofmann <fabianmarikhofmann@gmail.com>

Requires-Dist: pyscipopt; platform_system != "Darwin" and extra == "solvers"
Requires-Dist: knitro>=15.1.0; extra == "solvers"
Dynamic: license-file

@@ -220,3 +221,3 @@

* [GLPK](https://www.gnu.org/software/glpk/)
* [HiGHS](https://www.maths.ed.ac.uk/hall/HiGHS/)
* [HiGHS](https://highs.dev/)
* [Gurobi](https://www.gurobi.com/)

@@ -228,2 +229,3 @@ * [Xpress](https://www.fico.com/en/products/fico-xpress-solver)

* [cuPDLPx](https://github.com/MIT-Lu-Lab/cuPDLPx)
* [Knitro](https://www.artelys.com/solvers/knitro/)

@@ -230,0 +232,0 @@ Note that these do have to be installed by the user separately.

@@ -52,2 +52,3 @@ scipy

coptpy!=7.2.1
knitro>=15.1.0

@@ -54,0 +55,0 @@ [solvers:platform_system != "Darwin"]

@@ -164,2 +164,15 @@ """

),
"knitro": SolverInfo(
name="knitro",
display_name="Artelys Knitro",
features=frozenset(
{
SolverFeature.INTEGER_VARIABLES,
SolverFeature.QUADRATIC_OBJECTIVE,
SolverFeature.LP_FILE_NAMES,
SolverFeature.READ_MODEL_FROM_FILE,
SolverFeature.SOLUTION_FILE_NOT_NEEDED,
}
),
),
"scip": SolverInfo(

@@ -166,0 +179,0 @@ name="scip",

@@ -31,5 +31,5 @@ # file generated by setuptools-scm

__version__ = version = '0.6.3'
__version_tuple__ = version_tuple = (0, 6, 3)
__version__ = version = '0.6.4'
__version_tuple__ = version_tuple = (0, 6, 4)
__commit_id__ = commit_id = 'g16d6f3264'
__commit_id__ = commit_id = 'g1b08d2bb5'
Metadata-Version: 2.4
Name: linopy
Version: 0.6.3
Version: 0.6.4
Summary: Linear optimization with N-D labeled arrays in Python

@@ -72,2 +72,3 @@ Author-email: Fabian Hofmann <fabianmarikhofmann@gmail.com>

Requires-Dist: pyscipopt; platform_system != "Darwin" and extra == "solvers"
Requires-Dist: knitro>=15.1.0; extra == "solvers"
Dynamic: license-file

@@ -220,3 +221,3 @@

* [GLPK](https://www.gnu.org/software/glpk/)
* [HiGHS](https://www.maths.ed.ac.uk/hall/HiGHS/)
* [HiGHS](https://highs.dev/)
* [Gurobi](https://www.gurobi.com/)

@@ -228,2 +229,3 @@ * [Xpress](https://www.fico.com/en/products/fico-xpress-solver)

* [cuPDLPx](https://github.com/MIT-Lu-Lab/cuPDLPx)
* [Knitro](https://www.artelys.com/solvers/knitro/)

@@ -230,0 +232,0 @@ Note that these do have to be installed by the user separately.

@@ -87,2 +87,3 @@ [build-system]

"pyscipopt; platform_system != 'Darwin'",
"knitro>=15.1.0",
# "cupdlpx>=0.1.2", pip package currently unstable

@@ -89,0 +90,0 @@ ]

@@ -146,3 +146,3 @@ # linopy: Optimization with array-like variables and constraints

* [GLPK](https://www.gnu.org/software/glpk/)
* [HiGHS](https://www.maths.ed.ac.uk/hall/HiGHS/)
* [HiGHS](https://highs.dev/)
* [Gurobi](https://www.gurobi.com/)

@@ -154,2 +154,3 @@ * [Xpress](https://www.fico.com/en/products/fico-xpress-solver)

* [cuPDLPx](https://github.com/MIT-Lu-Lab/cuPDLPx)
* [Knitro](https://www.artelys.com/solvers/knitro/)

@@ -156,0 +157,0 @@ Note that these do have to be installed by the user separately.

@@ -48,3 +48,15 @@ #!/usr/bin/env python3

free_lp_problem = """
Maximize
z: 3 x + 4 y
Subject To
c1: 2 x + y <= 10
c2: x + 2 y <= 12
Bounds
0 <= x
0 <= y
End
"""
@pytest.mark.parametrize("solver", set(solvers.available_solvers))

@@ -76,2 +88,84 @@ def test_free_mps_solution_parsing(solver: str, tmp_path: Path) -> None:

@pytest.mark.skipif(
"knitro" not in set(solvers.available_solvers), reason="Knitro is not installed"
)
def test_knitro_solver_mps(tmp_path: Path) -> None:
"""Test Knitro solver with a simple MPS problem."""
knitro = solvers.Knitro()
mps_file = tmp_path / "problem.mps"
mps_file.write_text(free_mps_problem)
sol_file = tmp_path / "solution.sol"
result = knitro.solve_problem(problem_fn=mps_file, solution_fn=sol_file)
assert result.status.is_ok
assert result.solution is not None
assert result.solution.objective == 30.0
@pytest.mark.skipif(
"knitro" not in set(solvers.available_solvers), reason="Knitro is not installed"
)
def test_knitro_solver_for_lp(tmp_path: Path) -> None:
"""Test Knitro solver with a simple LP problem."""
knitro = solvers.Knitro()
lp_file = tmp_path / "problem.lp"
lp_file.write_text(free_lp_problem)
sol_file = tmp_path / "solution.sol"
result = knitro.solve_problem(problem_fn=lp_file, solution_fn=sol_file)
assert result.status.is_ok
assert result.solution is not None
assert result.solution.objective == pytest.approx(26.666, abs=1e-3)
@pytest.mark.skipif(
"knitro" not in set(solvers.available_solvers), reason="Knitro is not installed"
)
def test_knitro_solver_with_options(tmp_path: Path) -> None:
"""Test Knitro solver with custom options."""
knitro = solvers.Knitro(maxit=100, feastol=1e-6)
mps_file = tmp_path / "problem.mps"
mps_file.write_text(free_mps_problem)
sol_file = tmp_path / "solution.sol"
log_file = tmp_path / "knitro.log"
result = knitro.solve_problem(
problem_fn=mps_file, solution_fn=sol_file, log_fn=log_file
)
assert result.status.is_ok
@pytest.mark.skipif(
"knitro" not in set(solvers.available_solvers), reason="Knitro is not installed"
)
def test_knitro_solver_with_model_raises_error(model: Model) -> None: # noqa: F811
"""Test Knitro solver raises NotImplementedError for model-based solving."""
knitro = solvers.Knitro()
with pytest.raises(
NotImplementedError, match="Direct API not implemented for Knitro"
):
knitro.solve_problem(model=model)
@pytest.mark.skipif(
"knitro" not in set(solvers.available_solvers), reason="Knitro is not installed"
)
def test_knitro_solver_no_log(tmp_path: Path) -> None:
"""Test Knitro solver without log file."""
knitro = solvers.Knitro(outlev=0)
mps_file = tmp_path / "problem.mps"
mps_file.write_text(free_mps_problem)
sol_file = tmp_path / "solution.sol"
result = knitro.solve_problem(problem_fn=mps_file, solution_fn=sol_file)
assert result.status.is_ok
@pytest.mark.skipif(
"gurobi" not in set(solvers.available_solvers), reason="Gurobi is not installed"

@@ -78,0 +172,0 @@ )

Sorry, the diff of this file is too big to display