LP problem status is not correct when time limit is used in PuLP solver

39 Views Asked by At

I´m solving a Integer linear programming problem in python using the PuLP library Solver "PULP_CBC_CMD". I defined my problem as:

model = pulp.LpProblem("shift assignment problem", sense=p.LpMinimize)

#variables here
#contraints here
#objective function here

solver_pulp = pulp.get_solver('PULP_CBC_CMD', timeLimit=180)
model.solve(solver_pulp)

Once it´s solved, I want to know the status of the solution. So I use the function "LpStatus"

print("Status: {}".format(p.LpStatus[modelo.status]))

Theoretically, if the solver use the time limit cut, it´s because it couldn´t finish evaluating all the posible branches, and the solver gave you the best solution found at the moment of the cut.

The problem here it´s that, the status also shows "Optimal solution found", but that´s actually an "local optimal solution", but not the "global optimal solution".

In both scenarios (when the solver use the time limit cut, and when it don´t) the status is shown as "Optimal"

Is there a way to tell PuLP to distinct that? I want PuLP shows the status as "optimal" just when the solver could evaluate all the branches and objectively found the one optimal solution. I´ve read the documentation of PuLP but I haven´t found something that could help me.

In case PuLP can´t distinct that, how would you do to print a new status in case the solver used the time limit cut?

0

There are 0 best solutions below