NO FRAMES

CPXgetcallbacknodeinfo

int CPXPUBLIC CPXgetcallbacknodeinfo(CPXCENVptr env, void * cbdata, int wherefrom, int nodenum, int whichinfo, void * result_p)
Definition file: cplex.h
Include files: cplex.h

The routine CPXgetcallbacknodeinfo is called from within user-written callbacks during a MIP optimization and accesses information about nodes.

The primary purpose of this routine is to examine nodes in order to select one from which to proceed. In this case the wherefrom argument is CPX_CALLBACK_MIP_NODE, and a node with any nodeindex value can be queried. A secondary purpose of this routine is to obtain information about the current node. When the wherefrom argument is any one of the following values, only the current node can be queried.

To query the current node, specify a nodeindex value of 0. Other values of the wherefrom argument are invalid for this routine. An invalid nodeindex value or wherefrom argument value will result in an error return value.

Note

The values returned for CPX_CALLBACK_INFO_NODE_SIINF and CPX_CALLBACK_INFO_NODE_NIINF for the current node are the values that applied to the node when it was stored and thus before the branch was solved. As a result, these values should not be used to assess the feasibility of the node.

This routine cannot retrieve information about nodes that have been moved to node files. For more information about node files, see the ILOG CPLEX User's Manual. If the argument nodeindex refers to a node in a node file, CPXgetnodecallbackinfo returns the value CPXERR_NODE_ON_DISK. Nodes still in memory have the lowest index numbers so a user can loop through the nodes until CPXgetcallbacknodeinfo returns an error, and then exit the loop.

Example

 status = CPXgetnodecallbackinfo(env,
                                 curlp,
                                 wherefrom,
                                 0,
                                 CPX_CALLBACK_INFO_NODE_NIINF,
                                 &numiinf);
 
Table 1: Information Requested for a User-Written Node Callback
Symbolic ConstantC TypeMeaning
CPX_CALLBACK_INFO_NODE_SIINFdoublesum of integer infeasibilities
CPX_CALLBACK_INFO_NODE_NIINFintnumber of integer infeasibilities
CPX_CALLBACK_INFO_NODE_ESTIMATEdoubleestimated integer objective
CPX_CALLBACK_INFO_NODE_DEPTHintdepth of node in branch & cut tree
CPX_CALLBACK_INFO_NODE_OBJVALdoubleobjective value of LP subproblem
CPX_CALLBACK_INFO_NODE_TYPEinttype of branch at this node; see Table 2
CPX_CALLBACK_INFO_NODE_VARintfor nodes of type CPX_TYPE_VAR, the branching variable for this node; for other types, -1 is returned
CPX_CALLBACK_INFO_NODE_SOSintfor nodes of type CPX_TYPE_SOS1 or CPX_TYPE_SOS2 the number of the SOS used in branching; -1 otherwise
CPX_CALLBACK_INFO_NODE_SEQNUMintsequence number of the node
CPX_CALLBACK_INFO_NODE_NODENUMintnode index of the node (only available for CPXgetcallbackseqinfo)
Table 2: Branch Types Returned when whichinfo = CPX_CALLBACK_INFO_NODE_TYPE
Symbolic ConstantValueBranch Type
CPX_TYPE_VAR'0'variable branch
CPX_TYPE_SOS1'1'SOS1 branch
CPX_TYPE_SOS2'2'SOS2 branch
CPX_TYPE_USER'X'user-defined
CPX_TYPE_ANY'A'multiple bound changes and/or constraints were used for branching

See also Advanced MIP Control Interface in the ILOG CPLEX User's Manual.

See Also:

Parameters:

env

A pointer to the CPLEX environment, as returned by CPXopenCPLEX.

cbdata

The pointer passed to the user-written callback. This parameter must be the value of cbdata passed to the user-written callback.

wherefrom

An integer value indicating where the user-written callback was called from. This parameter must be the value of wherefrom passed to the user-written callback.

nodenum

The index of the node for which information is requested. Nodes are indexed from 0 (zero) to (nodecount - 1) where nodecount is obtained from the callback information function CPXgetcallbackinfo, with a whichinfo value of CPX_CALLBACK_INFO_NODES_LEFT.

whichinfo

An integer indicating which information is requested. Table 1 summarizes the possible values. Table 2 summarizes possible values returned when the type of information requested is branch type (that is, whichinfo = CPX_CALLBACK_INFO_NODE_TYPE).

result_p

A generic pointer to a variable of type double or int, representing the value returned by whichinfo. (The column “C Type” in Table 1 indicates the type of various values returned by whichinfo.)

Returns:

The routine returns zero on success and nonzero if an error occurs. The return value CPXERR_NODE_ON_DISK indicates an attempt to access a node currently located in a node file on disk.