Reputation: 266
I am facing some issue in using google or tools.
from ortools.linear_solver import pywraplp
model = pywraplp.Solver.CreateSolver('CBC')
When I am trying to use Solver.CreateSolver('CBC')
, it shows
AttributeError: type object 'Solver' has no attribute 'CreateSolver'
My installed or-tools version is 6.8.5452. Is there any way so that I can use CBC
here.
Upvotes: 1
Views: 1260
Reputation: 2766
The previous syntax was:
solver = pywraplp.Solver('ProblemName', pywraplp.Solver.CBC_MIXED_INTEGER_PROGRAMMING)
Ref: https://github.com/google/or-tools/blob/v6.8/examples/python/3_jugs_mip.py
Upvotes: 1
Reputation: 614
The simple thing you can do is update ortools or uninstall and install ortools again . I have installed ortools using
pip install ortools
or you can upgrade ortools using
python -m pip install --upgrade --user ortools
and then the above code worked fine you can this in the below image.
Upvotes: 0