An environment is a multi-purpose data structure in Gurobi. It is typically the first Gurobi object you create and the last one you destroy. While the workings of environments are actually quite simple, the breadth of uses can sometimes cause confusion. This section lays out the different usage scenarios to make this clearer.

At the highest level, environments provide three basic functions: (i) to capture a set of parameter settings, (ii) to delineate a (single-threaded) Gurobi session, and (iii) to hold a Gurobi license. Things only get interesting once you consider the many different ways these capabilities are used throughout the product:

  • Configuration parameters: Environments allow you to configure your session (whether you will run locally or on a Compute Server or on the Instant Cloud, your login credentials, etc.).
  • Algorithmic parameters: Environments enable you to modify algorithmic parameters, which influence how the solver solves your model.
  • Concurrent environments: When using a concurrent algorithm, concurrent environments allow you to control the algorithmic parameters used in each independent solve.
  • Multi-objective environments: When solving a multi-objective model, multi-objective environments allow you to control the algorithmic parameters used for each objective.
  • Session boundaries: Environments indicate when your program starts and stops using Gurobi.