XPRS_bo_create
XPRS_bo_create |
Purpose
Creates a new user defined branching object for the Optimizer to branch on. This function should be called only from within one of the callback functions set by
XPRSaddcboptnode or
XPRSaddcbchgbranchobject.
Synopsis
int XPRS_CC XPRS_bo_create(XPRSbranchobject* p_object, XPRSprob prob, int isoriginal);
Arguments
p_object
|
Pointer to where the new object should be returned.
|
||||
prob
|
The problem structure that the branching object should be created for.
|
||||
isoriginal
|
If the branching object will be set up for the original matrix, which determines how column indices are interpreted when adding bounds and rows to the object:
|
Example
The following function will create a branching object equivalent to a standard binary branch on a column:
XPRSbranchobject CreateBinaryBranchObject(XPRSprob xp_mip, int icol) { char cBndType; double dBndValue; int isoriginal = 1; XPRSbranchobject bo = NULL; /* Create the new object with two empty branches. */ XPRS_bo_create(&bo, xp_mip, isoriginal); XPRS_bo_addbranches(bo, 2); /* Add bounds to branch the column to either zero or one. */ cBndType = 'U'; dBndValue = 0.0; XPRS_bo_addbounds(bo, 0, 1, &cBndType, &icol, &dBndValue); cBndType = 'L'; dBndValue = 1.0; XPRS_bo_addbounds(bo, 1, 1, &cBndType, &icol, &dBndValue); /* Set a low priority value so our branch object is picked up */ /* before the default branch candidates. */ XPRS_bo_setpriority(bo, 100); return bo; }
Further information
1. In addition to the standard global entities supported by the Optimizer, the Optimizer also allows the user to define their own global entities for branching, using branching objects.
2. A branching object of type
XPRSbranchobject should provide a linear description of how to branch on the current node for a user's global entities. Any number of branches is allowed and each branch description can contain any combination of columns bounds and new constraints.
3. Branching objects must always contain at least one branch and all branches of the object must contain at least one bound or constraint.
4. When the Optimizer branches the current node on a user's branching object, a new child node will be created for each branch defined in the object. The child nodes will inherit the bounds and constraint of the current node, plus any new bounds or constraints defined for that branch in the object.
5. Inside the callback function set by
XPRSaddcboptnode, a user can define any number of branching objects and pass them to the Optimizer. These objects are added to the set of infeasible global entities for the current node and the Optimizer will select a best candidate from this extended set using all of its normal evaluation methods.
6. The callback function set by
XPRSaddcbchgbranchobject can be used to override the Optimizer's selected branching candidate with the user's own object. This can for example be used to modify how to branch on the global entity selected by the Optimizer.
7. The following functions are available to set up a new user branching object:
XPRS_bo_create | Creates a new, empty branching object with no branches. |
XPRS_bo_addbranches | Adds new, empty branches to the object. Branches must be created before column bounds or rows can be added to a branch. |
XPRS_bo_addbounds | Adds new column bounds to a given branch of the object. |
XPRS_bo_addrows | Adds new constraints to a given branch of the object. |
XPRS_bo_setpriority | Sets the priority value for the object. These are equivalent to the priority values for regular global entities that can be set through directives (see also Appendix The Directives (.dir) File). |
XPRS_bo_setpreferredbranch | Specifies which of the child nodes corresponding to the branches of the object should be explored first. |
XPRS_bo_store | Adds the created object to the candidate list for branching. |
Related topics