- Procedure GMP::SolverSession::GenerateBinaryEliminationRow(solverSession, solution, branch)
GMP::SolverSession::GenerateBinaryEliminationRow
The procedure GMP::SolverSession::GenerateBinaryEliminationRow
adds
a binary row to a solver session which will eliminate a binary solution.
GMP::SolverSession::GenerateBinaryEliminationRow(
solverSession, ! (input) a solver session
solution, ! (input) a solution
branch ! (input) a scalar value
)
Arguments
- solverSession
An element in the set
AllSolverSessions
.- solution
An integer scalar reference to a solution.
- branch
An integer scalar reference to a branch. Value should be either 1 or 2.
Return Value
The procedure returns 1 on success, or 0 otherwise.
Note
This procedure will fail if the GMP corresponding to the solver session does not have model type MIP.
This procedure can only be called from within a
CallbackBranch
,CallbackAddCut
orCallbackAddLazyConstraint
callback procedure.The branch argument will be ignored if this procedure is called from within a
CallbackAddCut
orCallbackAddLazyConstraint
callback procedure.Every call to
GMP::SolverSession::GenerateBinaryEliminationRow
adds the following row:\[\begin{aligned} \sum_{i\in S_{0}} x_i - \sum_{i\in S_{1}} x_i \geq 1 - |S_{1}| \end{aligned}\]where \(S_{0}\) defines the set of binary columns whose level values equals 0 and \(S_{1}\) the set of binary columns whose level values equals 1.
Example
The procedure GMP::SolverSession::GenerateBinaryEliminationRow
can
be used to enforce a MIP solver to branch a node that would have been
fathomed otherwise. We can achieve this by installing a branching
callback using procedure GMP::Instance::SetCallbackBranch
and adding
the following code to the callback procedure:
! Get LP solution at the current node.
GMP::Solution::RetrieveFromSolverSession(ThisSession,1);
! Get the number of nodes that the MIP solver wants to create from the
! current branch.
NrBranches := GMP::SolverSession::GetNumberOfBranchNodes(ThisSession);
if ( NrBranches = 0 ) then
! The LP solution at the current node appears to be integer feasible.
! We enforce the MIP solver to branch the current node by creating a
! branch containing one constraint that cuts off this LP solution.
GMP::SolverSession::GenerateBinaryEliminationRow(ThisSession,1,1);
endif;
return 1;
Here ThisSession
is an input argument of the callback procedure and a
scalar element parameter into the set AllSolverSessions
.