google / or-tools

Google's Operations Research tools:
https://developers.google.com/optimization/
Apache License 2.0
11.25k stars 2.13k forks source link

Gurobi Environment handling #3632

Closed torressa closed 1 year ago

torressa commented 1 year ago

What language and solver does this apply to? Every language except C++ (this already exists).

Describe the problem you are trying to solve.

I would like to be able to pass a Gurobi environment as input. In C++ this already exists via https://github.com/google/or-tools/blob/82750ac12f1ee5354e1c7869894d9af3508778f2/ortools/linear_solver/gurobi_proto_solver.h#L35-L36

All other APIs cannot take a user-defined environment (Gurobi has an Env construct for all Python, Java, .NET). Please correct me if this is already possible.

Describe the solution you'd like

To be able to pass an environment for example

import gurobipy as gp

with gp.Env() as env:
  solver = pywraplp.Solver.CreateSolver("GUROBI", env=myenv)
lperron commented 1 year ago

This is not possible.