What is the easiest way to find out whether a constraint is binding?

  • 4 January 2023
  • 1 reply

Userlevel 2
Badge +3

Ideally, I need this information while running a procedure. I would like to assign it to a parameter. Is there maybe a constraint suffix that I could use to get this information? 

I’m thinking about something like this: 

ParameterValue := Constraint.binding


Best answer by Marcel Hunting 17 January 2023, 11:56

View original

1 reply

Userlevel 5
Badge +4

I assume that by a binding constraint you mean that the left-hand-side of the constraint equals the right-hand-side. (To find out whether a constraint is really binding is difficult in a degenerated model, and almost all practical models are degenerated.)

The easiest way would be to use the GMP functions GMP::Row::GetRightHandSide and  GMP::Solution::GetRowValue, and to compare the values returned by both functions. Note that the latter function requires switching on the Solvers General option ‘Always Store Constraint Levels’. Note also that for the first argument you can just use the name of the mathematical program, e.g., if its name is myMP then you can use ‘myMP’ as the first argument (so it is not needed to use the procedure GMP::Instance::Generate first).

In case of LP you can use the constraint suffices .Level and .NominalRightHandSide. The first suffix requires (also) switching on the Solvers General option ‘Always Store Constraint Levels’. The second suffix requires switching on the Solvers General option ‘Calculate Sensitivity Ranges’ and specifying the property RightHandSideRange for the constraints.


Didn't find what you were looking for? Try searching on our documentation pages:

AIMMS Developer & PRO | AIMMS How-To | AIMMS SC Navigator