This class represents an algebraic or logical constraint. In case the constraint is scalar, its values can be accessed via functions like Constraint.body
and Constraint.dual
. All the AMPL suffixes for constraints (see http://www.ampl.com/NEW/suffbuiltin.html) are available through methods of this class with the same name (and methods of ConstraintInstance
for indexed constraints).
Note that, since this class represents both algebraic and logical constraints, some suffixes might not be available for every entity.
An UnsupportedOperationException
is thrown if one of such methods is called for a non-scalar constraint and if a method corresponding to a suffix which is not supported by the type of the constraint is called.
The instances, represented by the class ConstraintInstance
can be accessed via the method Constraint.get
(see section Access to instances and values for further information on how to access instances).
To gain access to all the values in an entity (for all instances and all suffixes for that entities), see Entity.getValues
and the DataFrame
class.