Concurrent environments


Concurrent environments

One algorithmic option available in Gurobi is concurrent optimization, where multiple independent solves are performed in parallel and Gurobi takes care of collecting and combining the results. Concurrent optimization can be quite powerful; it is actually the default approach for solving linear programming models.

The power of concurrent optimization comes from the fact that different approaches to solving a model may have different performance characteristics, and performing them in parallel allows you to stop when the first one finishes. All of our concurrent schemes have default choices for determining the strategy that each independent solve uses. However, it is also possible for you to pick different strategies. This is done through concurrent environments. By creating two or more concurrent environments for a model, and setting parameters on these environments, you can control exactly what each concurrent solve does.

Concurrent environments are created via API routines (in C, C++, Java, .NET, or Python). You set parameters on these environments as you would with any other environment, but in this case they only affect one of the several independent solves.

To give a simple example, in Python you could do the following:

  # Create concurrent environments
  env0 = model.getConcurrentEnv(0)
  env1 = model.getConcurrentEnv(1)

  # Set parameters on concurrent environments
  env0.setParam('MIPFocus', 1)
  env1.setParam('MIPFocus', 2)

  # Perform (concurrent) optimization
  model.optimize()
This would launch two concurrent solves on your model, one with the MIPFocus parameter set to 1 and the other with it set to 2.

Users of our command-line interface can set concurrent optimization parameters with .prm files using the ConcurrentSettings parameter.