Pulp Solvers - Python 3.8 & Spyder 4

1k Views Asked by At

I am using Pulp with Python 3.8 and Spyder 4.

I am able to run optimization problems without issues, but I am not able to change the parameters of the solvers. Indeed, no solver seems to be recognized by Pulp.

When I enter

my_lp_problem.solve(PULP_CBC_CMD())

I have the error :

name 'PULP_CBC_CMD' is not defined

How can I manage this problem?

Thank you!

1

There are 1 best solutions below

0
On

If you get a NameError (i.e., name 'PULP_CBC_CMD' is not defined) it's because you have not imported the pulp.PULP_CBC_CMD class.

The solution is either to import it

from pulp import PULP_CBC_CMD

or to specify the pulp module

my_lp_problem.solve(pulp.PULP_CBC_CMD())