AMPL_CONSTRAINT#

group AMPL_CONSTRAINT

Functions for constraints:

Functions

AMPL_ERRORINFO *AMPL_ConstraintIsLogical(AMPL *ampl, const char *entityname, bool *isLogical)#

Check if the constraint is a logical constraint.

The available suffixes differ between logical and non logical constraints. See https://dev.ampl.com/ampl/suffixes.html

for a list of the available suffixes for algebraic constraints. The suffixes available for logical constraints are marked on the method description by “Valid only for logical

constraints”.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of constraint as string.

  • isLogical – True if the constraint is logical, false otherwise (pointer to bool).

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_ConstraintSetDual(AMPL *ampl, const char *entityname, 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 name := 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 to false (see AMPL_SetDblOption).

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of constraint as string.

  • dual – Value to set the dual variable to.

Returns:

Pointer to the AMPL_ERRORINFO struct.