2
$\begingroup$

I have implemented a pure binary integer combinatorial optimization routine within a Python module (importing gurobipy), and experimented with relaxing a few constraints so some variables may assume values 0, 1 or 2, until I ran first into time-to-result latency problems then into memory problems. That initial effort was based on Gurobi, which I discovered on that occasion... and liked, because it has provisions to build thread-safe compute environments when multi-threading, and it offers a model namespace in which the analyst may write out constraints and the objective function and embed them in code.

I now need to replace the Gurobi solver because my earlier installation is reaching its free one-year term limit. I would like to be able to call a FOSS ILP/MIP solver into my python module. Although I saw a couple of references to lpsolve() (e.g. here), my issue is that I really don't know what is and what isn't available out there for Python v3.9+ environments.

I am looking for a stable solver (no beta implementation) with a Python API.

$\endgroup$
3
  • 3
    $\begingroup$ pySCIPopt, Python-Mip, Pulp and Pyomo are probably the most commonly used python modelling frameworks. Given that you're switching from Gurobi, the first one might be worth a try since it's very similar to gurobipy and supports a couple of special constraint types as well. $\endgroup$
    – joni
    Oct 23, 2023 at 12:07
  • $\begingroup$ Thank you, @joni. I will start with pySCIPopt and continue with Pyomo. great help. $\endgroup$
    – Cbhihe
    Oct 25, 2023 at 7:25
  • 1
    $\begingroup$ @SecretAgentMan: got it: no fluff here... $\endgroup$
    – Cbhihe
    Oct 25, 2023 at 7:26

1 Answer 1

4
$\begingroup$

You can use HiGHS, SCIP and CBC solvers with using PYOMO or other Pyomo supported solvers. Also you can use google or-tools CP solver if you write CP model, google CP solver is very powerfull. PYOMO and GurobiPY have similar modelling structure. For example:

  • Model defining: Gurobi: model = gurobipy.Model("LP Example") Pyomo: model = pyomo.ConcreteModel()

  • Variable adding: Gurobi: x = model.addVar(name="x") Pyomo: model.x = pyomo.Var(within=NonNegativeReals)

If you compare gurobipy and pyomo models side-by-side, you can see similarities and convert easily.

Before deciding solver, you can find performance benchmark of free and commercial solvers on here.

$\endgroup$
1
  • $\begingroup$ As commented before to @joni, I will start with pySCIPopt and continue with Pyomo. Thank you. $\endgroup$
    – Cbhihe
    Oct 25, 2023 at 7:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.