Try our new documentation site (beta).
GRBModel.optimizeasync()
Optimize a model asynchronously. This routine returns immediately.
Your program can perform other computations while optimization
proceeds in the background. To check the state of the asynchronous
optimization, query the Status attribute
for the model. A value of IN_PROGRESS
indicates that the
optimization has not yet completed. When you are done with your
foreground tasks, you must call
sync to sync your foreground
program with the asynchronous optimization task.
Note that the set of Gurobi calls that you are allowed to make while
optimization is running in the background is severely limited.
Specifically, you can only perform attribute queries, and only for a
few attributes (listed below). Any other calls on the running model,
or on any other models that were built within the same Gurobi
environment, will fail with error code
OPTIMIZATION_IN_PROGRESS
.
Note that there are no such restrictions on models built in other environments. Thus, for example, you could create multiple environments, and then have a single foreground program launch multiple simultaneous asynchronous optimizations, each in its own environment.
As already noted, you are allowed to query the value of the Status
attribute while an asynchronous optimization is in progress. The other
attributes that can be queried are:
ObjVal,
ObjBound,
IterCount,
NodeCount, and
BarIterCount.
In each case, the returned value reflects progress in the optimization
to that point. Any attempt to query the value of
an attribute not on this list will return an
OPTIMIZATION_IN_PROGRESS
error.
void | optimizeasync ( ) |