After developing the MIP model I noticed that solver is taking a lot of time to reach the solution. So, how should I approach to optimize the current model?
Are there any visualization tools or any tools that are helpful in optimizing the model.
After developing the MIP model I noticed that solver is taking a lot of time to reach the solution. So, how should I approach to optimize the current model?
Are there any visualization tools or any tools that are helpful in optimizing the model.
Assuming that your problem is not taking too long simply because it's too large, the most likely reason is that your formulation is not strong enough.
The best tool is the output of the solver itself. You want to monitor the behaviour of your lower and upper bounds, the size of the branching pool, the time between iterations, whether a feasible solution has been found, and how long it takes to find the first one.
The greatest indicator of a weak formulation is that your solver is generating too many nodes which are not fathomed and remain in the branching pool. This typically results in the MIP gap improving very slowly.
If the gap is improving slowly, a likely reason is degeneracy in your problem (multiple/infinite global solutions). This would either manifest as your solver exploring too many nodes, or the number of nodes in your branching pool remaining roughly constant and your MIP gap not really improving much.
Another reason could be that the bounds of your continuous variables (if you have any) are too large.
This would behave identically to the previous case if your solver has found a feasible solution. If it hasn't however, it might be the case that it's taking too long either because (a) your problem is infeasible and it's trying to prove it, or (b) because it's having trouble finding an integer solution.
Another reason could be that your solver can find some primal solution fairly easily, but has trouble finding better ones, which would cause it to run forever even if the lower bound is exact.
Best explanation is that your problem is too large, your computer is too slow, or you don't have enough RAM and the solver is forced to access your swap memory, which makes it much slower.
If none of the above apply, and your solver is taking much longer to iterate than you think it should, it's probably having trouble factorising the coefficient matrix.
To add @ Mark L. Stone mentioned:
I recommended you could try solving your model using a small instance. (E.g. by reducing dimensions of the model's data.). If the model is solved optimality, you could pretty sure (with the large scale data), you would solve the model in an optimal sense.
To ensure that the solution is correct, you could solve the model using other solvers like CBC or GUROBI. To debug your model (if it was infeasible) you might write your model in an LP format and check it. (AFAIK, unfortunately, PuLp can not create LP format!!!).
prob.solve()So, I guess this is some kind of default solver. – ooo Jan 30 '20 at 04:36PULP_CBC_CMD()is the default solver. – ooo Jan 30 '20 at 04:48