Search code examples
pythonlinear-programmingcplexmixed-integer-programmingdocplex

DoCplex MILP problem: Running Benders & Branch and Bound Parallel


I am working on MILP model (In DoCplex) and solver reaches the solution faster with Benders Method sometime and sometimes using Branch & Bound. Is there an easy way to run both solve methods parallel without changing variable names (cloning the model) on same model. And use output from one of the solve.


Solution

  • You cannot solve the same model with two algorithms simultaneously. However, it should be easy to create the same model twice and then solve it concurrently in two different threads or processes. You will have to use the threading or multiprocessing Python modules for this.

    One very simple and convenient way on a Unix-like operation system (like Linux or MacOS) would be to use os.fork() to create a new process for each solve and then control them from the initial process. fork() implicitly clones the model, so it can save you some lines of programming.