The ConstraintInstance object stores the information regarding a specific instance of a costraint.
The instances can be accessed through the function Constraint.get
of the parent
entity.
body()
-
classmethod ConstraintInstance.body()
Syntax
v = body()
Description
v = body()
Get the current value of the constraint’s body.
Output Arguments
v
The current body of the constraint.
Example
Create a constraint c (using AMPL.eval
), get an instance and display its body.
ampl.eval('var x{i in 1..2} := i*0.9;');
ampl.eval('c{i in 1..2} : 0<= x[i] <= 5;');
c1 = ampl.getConstraint('c').get(1);
c1.body
gives: