Python and Python matrix interface
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.
Java interface
The example concludes with dispose
calls:
// Dispose of model and environment model.dispose(); env.dispose();
These reclaim the resources associated with the model and environment. Garbage collection would reclaim these eventually, but if your program doesn't exit immediately after performing the optimization, it is best to reclaim them explicitly.
Note that all models associated with an environment must be disposed before the environment itself is disposed.
.NET interface
The example concludes with Dispose
calls:
// Dispose of model and env model.Dispose();
These reclaim the resources associated with the model and environment. Garbage collection would reclaim these eventually, but if your program doesn't exit immediately after performing the optimization, it is best to reclaim them explicitly.
Note that all models associated with an environment must be disposed before the environment itself is disposed.
Comments
0 comments
Please sign in to leave a comment.