google / or-tools

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

Cannot create and start GUROBI solver #2473

Closed RonRadtke closed 3 years ago

RonRadtke commented 3 years ago

What version of OR-Tools and what language are you using? Version: master/v7.3/v7.2 etc. Language: C++/Java/Python/C# Version: 8.2.8710 Python 3.7 Which solver are you using (e.g. CP-SAT, Routing Solver, GLOP, BOP, Gurobi) Gurobi 9.1.0, 9.1.1, 9.0.3, 9.0.2 What operating system (Linux, Windows, ...) and version? Linux Debian buster slim What did you do? from ortools.linear_solver import pywraplp solver = pywraplp.Solver('mysolver', pywraplp.Solver.GUROBI_MIXED_INTEGER_PROGRAMMING)

What did you expect to see A solver being created What did you see instead? terminate called after throwing an instance of 'std::bad_function_call' what(): bad_function_call Make sure you include information that can help us debug (full error message, model Proto).

Anything else we should know about your project / environment Running inside of a docker container with a valid floating license server running. Running an example with gurobipy works without an issue. GUROBI_HOME, PATH and LD_LIBRARY_PATH are set correctly to: GUROBI_HOME=/opt/gurobi/linux64 PATH="$PATH:/opt/gurobi/linux64/bin" LD_LIBRARY_PATH="/opt/gurobi/linux64/lib"

RonRadtke commented 3 years ago

Solved it now... I need to use createSolver instead of Solver(). See the following code. solver = pywraplp.Solver.CreateSolver('GUROBI')