Try our new documentation site (beta).
GRBcbstoponemultiobj
int | GRBcbstoponemultiobj ( | GRBmodel | *model, |
void* | cbdata, | ||
int | objnum ) |
Interrupt the optimization process of one of the optimization steps in a multi-objective MIP problem without stopping the hierarchical optimization process. Note that this routine can only be called for multi-objective MIP models and when the where value on the callback routine is not equal to GRB_CB_MULTIOBJ (see the Callback Codes section for more information).
You would typically stop a multi-objective optimization step by querying the last finished number of multi-objectives steps, and using that number to stop the current step and move on to the next hierarchical objective (if any) as shown in the following example:
Example usage:
#include <time.h> typedef struct { int objcnt; time_t starttime; } usrdata_t; int mycallback(GRBmodel *model, void *cbdata, int where, void *usrdata) { int error = 0; usrdata_t *ud = (usrdata_t*)usrdata; if (where == GRB_CB_MULTIOBJ) { /* get current objective number */ error = GRBcbget(cbdata, where, MULTIOBJ_OBJCNT, (void*)&ud->objcnt); if (error) goto QUIT; /* reset start time to current time */ ud->starttime = time(); } else if (time() - ud->starttime > BIG || /* takes too long or good enough */) { /* stop only this optimization step */ error = GRBcbstoponemultiobj(model, cbdata, ud->objcnt); if (error) goto QUIT; } QUIT: return error; }
You should refer to the section on Multiple Objectives for information on how to specify multiple objective functions and control the trade-off between them.
Return value:
A non-zero return value indicates that a problem occurred while stopping the multi-objective step specified by objcnt. Refer to the Error Code table for a list of possible return values. Details on the error can be obtained by calling GRBgeterrormsg.
Arguments:
model: The model argument that was passed into the user callback by the Gurobi optimizer. This argument must be passed unmodified from the user callback to GRBcbstoponemultiobj().
cbdata: The cbdata argument that was passed into the user callback by the Gurobi optimizer. This argument must be passed unmodified from the user callback to GRBcbstoponemultiobj().
objnum: The number of the multi-objective optimization step to interrupt. For processes running locally, this argument can have the special value -1, meaning to stop the current step.