Try our new documentation site (beta).


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.

Please note that parameter values are copied from the model when the concurrent environment is created. Therefore, changes to parameter values on the model have no effect on concurrent environments that have already been created. This is a frequent source of confusion.

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

Try Gurobi for Free

Choose the evaluation license that fits you best, and start working with our Expert Team for technical guidance and support.

Evaluation License
Get a free, full-featured license of the Gurobi Optimizer to experience the performance, support, benchmarking and tuning services we provide as part of our product offering.
Academic License
Gurobi supports the teaching and use of optimization within academic institutions. We offer free, full-featured copies of Gurobi for use in class, and for research.
Cloud Trial

Request free trial hours, so you can see how quickly and easily a model can be solved on the cloud.

Search

Gurobi Optimization