Initializing help system before first use

XPRSaddcbbeforeobjective

Purpose
Declares a callback which will be called before each objective in a multi-objective problem is solved.
Topic areas
Synopsis
int XPRS_CC XPRSaddcbbeforeobjective (XPRSprob prob, void (XPRS_CC *beforeobjective)(XPRSprob cbprob, void *cbdata), void *data, int priority);
Arguments
prob 
The current problem.
beforeobjective 
The callback function itself. This takes two arguments, cbprob and cbdata. This function is called before every solve.
cbprob 
The problem passed to the callback function, beforeobjective.
cbdata 
The user-defined data passed as data when setting up the callback with XPRSaddcbbeforeobjective.
data 
A user-defined data to be passed to the callback function, beforeobjective.
priority 
An integer that determines the order in which multiple before-objective callbacks will be invoked. The callback added with a higher priority will be called before a callback with a lower priority. Set to 0 if not required.
Example
This example sets a node limit for the second multi-objective solve:
XPRSaddcbbeforeobjective(prob,beforeobjective,NULL,0);
XPRSoptimize(prob,"",NULL,NULL);
The callback function might resemble:
int XPRS_CC beforeobjective(XPRSprob prob, void *data)
{
  int solvedobjs;
  XPRSgetintattribute(prob, XPRS_SOLVEDOBJS, &solvedobjs);
  if (solvedobjs == 1) {
    XPRSsetintcontrol(prob, XPRS_MAXNODE, 100);
  }
}
Further information
1. If the solve does not stop early, this callback will be invoked OBJSTOSOLVE times. Note that this can be less than than OBJECTIVES times, since all objectives with the same priority are combined into a single objective and solved at once.
2. During this callback, the main objective (as queried with XPRSgetobj) will reflect the current objective being solved, which may be a weighted combination of several objectives with the same priority level. But changes made to the problem to fix earlier objectives at their optimal value will not be visible in the problem during this callback.
3. Controls set during this callback will retain their values when solving all subsequent objectives, except for controls which set resource limits: TIMELIMIT, SOLTIMELIMIT, MAXTIME, MAXNODE, LPITERLIMIT, NLPMAXTIME and SLPITERLIMIT. These are recomputed before each call to beforeobjective, based on their original values before the solve and the resources consumed when solving all previous objectives. Changes to resource limit controls will therefore only be retained while solving the current objective.
Related topics

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.