pythonpulpinteger-programming

Does the Order of Modeling Affect Computational Speed in Pulp for Integer Programming Problems?


I am currently solving an integer programming problem using Pulp. I am aware that the order of statements in Pulp modeling can affect the outcome of the computations. However, I am curious to know if a specific order of modeling can also lead to improvements in computational speed. Is the practice of finding a particular order to enhance calculation speed common?

Additionally, I have already implemented optimizations such as eliminating unnecessary variables as much as possible, and dividing the process into pre-processing and post-processing stages.

In my case, I noticed a significant improvement in computation time after changing the modeling order:

Before changing the order: about 50 seconds After changing the order: about 30 seconds Is there any general advice or guidelines for determining the optimal order of modeling in Pulp to achieve faster computational speeds?


Solution

  • Does the Order of Modeling Affect Computational Speed in Pulp for Integer Programming Problems?

    Yes. But that's something bad and solvers try hard to decrease this effect.

    It's also not limited to pulp but applies to discrete-optimization in general. See resource below (focusing on Integer-Programming)!

    Is the practice of finding a particular order to enhance calculation speed common?

    Absolutely not!

    If some entities like locations are country-wise sorted, it's absolutely okay (and a good idea) to iterate it the same way.

    But actively tuning stuff not automatically available... i wouldn't do that.

    Two remarks:

    Before changing the order: about 50 seconds After changing the order: about 30 seconds

    This sounds like a statistical-evaluation with a sample-size of 1. This does not tell much. It probably won't even survive a re-run with a different seed in the solver.


    If your problem is as sensitive as you claim, it's usually indicating, that your model is not good enough. It basically means, that your solver is very much depending on luck!

    Other formulations (not the order) might be better but this is always problem-dependent.

    If there are some insights which can help the solver, there are also more robust methods of giving hints (branch-heuristics and co.) although i'm not sure how much pulp supports here.


    For some background: