CPXXgetcallbacknodex and CPXgetcallbacknodex

The routine CPXXgetcallbacknodex/CPXgetcallbacknodex retrieves the primal variable (x) values for the subproblem at the current node during MIP optimization from within a user-written callback.

int  CPXXgetcallbacknodex( CPXCENVptr env, void * cbdata, int wherefrom, double * x, CPXDIM begin, CPXDIM end )

int  CPXgetcallbacknodex( CPXCENVptr env, void * cbdata, int wherefrom, double * x, int begin, int end )

Description

Warning:

This is an advanced routine. Advanced routines typically demand a thorough understanding of the algorithms used by CPLEX. Thus they incur a higher risk of incorrect behavior in your application, behavior that can be difficult to debug. Therefore, the team encourages you to consider carefully whether you can accomplish the same task by means of other Callable Library routines instead.

The routine CPXXgetcallbacknodex/CPXgetcallbacknodex retrieves the primal variable (x) values for the subproblem at the current node during MIP optimization from within a user-written callback. The values are from the original problem if the MIP callback switch between original model and reduced, presolved model (CPXPARAM_MIP_Strategy_CallbackReducedLP) is set to CPX_OFF; otherwise, they are from the presolved problem.

In the case where the node LP is unbounded, CPXXgetcallbacknodex/CPXgetcallbacknodex returns a vector that corresponds to an unbounded direction. The vector is scaled in such a way that the maximum absolute value of one of its elements is CPX_INFBOUND. Thus, often the vector can be used directly, for example to separate lazy constraints. However, due to the large values, care must be taken to deal with potential numerical errors. If in doubt, rescale the vector, and use it as an unbounded ray rather than a primal vector.

This routine can be called with any value of wherefrom except CPX_CALLBACK_MIP_DELETENODE.

Arguments

env
A pointer to the CPLEX environment, as returned by CPXXopenCPLEX/CPXopenCPLEX.
cbdata
The pointer passed to the user-written callback. This argument must be the value of cbdata passed to the user-written callback.
wherefrom
An integer value reporting from where the user-written callback was called. The argument must be the value of wherefrom passed to the user-written callback. Do not call this routine with wherefrom==CPX_CALLBACK_MIP_DELETENODE.
x
An array to receive the values of the primal variables for the node subproblem. This array must be of length at least (end-begin+1). If successful, x[0] through x[end-begin] contain the primal values.
begin
An integer specifying the beginning of the range of primal variable values for the node subproblem to be returned.
end
An integer specifying the end of the range of primal variable values for the node subproblem to be returned.

Return

The routine returns 0 (zero) if successful and nonzero if an error occurs.

Example


 status = CPXgetcallbacknodex (env, cbdata, wherefrom,
                               nodex, 0, cols-1);

See also admipex1.c, admipex3.c, and admipex5.c in the standard distribution.

Solution vector, objective value, and dual bounds: some special considerations

The values returned in the array x represent a solution vector of the relaxation of the current node problem.

For mixed integer linear programs (MIP) and mixed integer quadratic programs (MIQP), the returned value in the array is typically an optimal solution vector to the relaxation, and its objective value c*x n the case of a MIP or c*x+1/2*x^T*Q*x in the case of a MIQP is identical to the dual bound at the current node that is returned by the routine CPXXgetcallbacknodeobjval/CPXgetcallbacknodeobjval.

However, the situation is different for mixed integer quadratically constrained programs (MIQCP). For such models, when the MIQCP strategy switch (CPXPARAM_MIP_Strategy_MIQCPStrat) is set to 0 (zero) or 2, then CPLEX may solve an outer approximation relaxation for the search nodes. The outer approximation contains auxiliary variables that do not exist in the original problem formulation as stated by the user.

Consequently, if the MIP callback switch between original model and reduced, presolved model (CPXPARAM_MIP_Strategy_CallbackReducedLP) is set to 0 (zero) meaning that callback routines work with the original problem formulation, then the vector x returned by CPXXgetcallbacknodex/CPXgetcallbacknodex is the projection of the extended space used in the relaxation of the space of the original variables of the problem. This fact implies that x is not necessarily an optimal solution or even a feasible solution to the QCP relaxation of the current node problem. Moreover, the objective function value as calculated by c*x+1/2*x^T*Q*x does not need to match the dual bound at the current node as returned by CPXXgetcallbacknodeobjval/CPXgetcallbacknodeobjval.

Still, the vector x can be used, for example, to separate cutting planes in a cut callback, as a starting point for primal heuristics in a heuristic callback, or to guide branching decisions in a branch callback.