ConstraintInstance¶
-
public class
ConstraintInstance
extends BasicInstance<ConstraintInstanceBase>¶ This class represent an instance of a constraint.
In general, all AMPL suffixes for a constraint are available through methods with the same name in this class. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes.
Note that, since this class represents instances of both algebraic and logical constraints, some suffixes might not be available for every instance. If a wrong suffix for the specific class of constraint is accessed, an
UnsupportedOperationException
is thrown.All the accessors in this class throw a
IllegalArgumentException
if the instance has been deleted in the underlying AMPL interpreter.
Methods¶
astatus¶
defvar¶
-
public int
defvar
()¶ Get the index in
_var
of “defined variable” substituted out by the constraint
dual¶
-
public double
dual
()¶ Get the current value of the constraint’s dual variable.
Note that dual values are often reset by the underlying AMPL interpreter by the presolve functionalities triggered by some methods. A possible workaround is to set the option
presolve
tofalse
(seeAMPL.setBoolOption
).
lbs¶
-
public double
lbs
()¶ Get the constraint lower bound sent to the solver (reflecting adjustment for fixed variables)
restore¶
-
public void
restore
()¶ Restore this constraint instance (if it had been dropped, no effect otherwise)
setDual¶
-
public void
setDual
(double dual)¶ Set the value of the dual variable associated to this constraint (valid only if the constraint is scalar). Equivalent to the AMPL statement:
let c := dual;
Note that dual values are often reset by the underlying AMPL interpreter by the presolve functionalities triggered by some methods. A possible workaround is to set the option
presolve
tofalse
(seeAMPL.setBoolOption
).Parameters: - dual – The value to be assigned to the dual variable