Cleaning up

Cleaning up

In our other interfaces, we encourage you to explicitly dispose of your Gurobi environment when you are done using it in order to release the associated resources. Our recommendation in the Python interface is a bit more nuanced.

Most Gurobi Python programs use the default environment, which is automatically created when you first construct a Gurobi Model object and automatically disposed when your program ends. You can call disposeDefaultEnv() to dispose of it manually, but if you want detailed control of environments (for example, if you are using a Compute Server or the Gurobi Instant Cloud), we recommend that you work with explicit environment objects instead.

Please refer to the mip1_remote.py example for details on how you would do this.