Search code examples
c++cplexmixed-integer-programming

Finding binding constraints of a mixed-integer-program


I want to find constraints which are binding at the optimal solution of an MIP problem, solved by Cplex in c++. By binding, I mean constraint where the value of the LHS is equal to the value of the RHS. For example, if the solution of a problem is:

x = 1, y = 0,

then constraint x + y <= 2 is non-binding (LHS = 1 + 0 < 2 = RHS), but x - y <= 1 is binding (LHS = 1 - 0 = 1 = RHS).

This could be done for LPs using getSlack or getDual functions of IloRange: If the slack of a constraint is zero, or the dual value is non-zero, the constraint is binding.

I cant find any function of Cplex that gives this property or value for IloRange, IloConstraint, or similar objects, when the problem is an MIP. I would also prefer not to do this manually in c++ (extracting each variable of a constraint and summing their value per constraint). Is there any way to do this?


Solution

  • I found the answer, IloCplex::getValue(IloNumExprArg) actually gives you the value of an expression (similarly constraint LHS) given the current solution. Comparing this value to the RHS constant determines whether or not the constraint is binding.