AMPL_VARIABLEINSTANCE#

group AMPL_VARIABLEINSTANCE

Functions for variable instances:

Functions

AMPL_ERRORINFO *AMPL_VariableInstanceFix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index)#

Fix this variable instance to their current value.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of variable instance as string.

  • index – Index of instance as tuple.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_VariableInstanceFixToValue(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, double value)#

Fix this variable instance to the specified value.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of variable instance as string.

  • index – Index of instance as tuple.

  • value – Value to fix the variable instance to.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_VariableInstanceUnfix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index)#

Unfix this variable instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of variable instance as string.

  • index – Index of instance as tuple.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_VariableInstanceSetValue(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, double value)#

Set the current value of this variable instance (does not fix it), equivalent to the AMPL command let.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of variable instance as string.

  • index – Index of instance as tuple.

  • value – Value to set the variable instance to.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_VariableInstanceToString(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, char **str)#

Returns a string representation of this variable instance.

The format is as follows:

'var' name attrs ';'

where name is the variable instance name method and attrs represent attributes similar to those used in variable declarations.

If the lower bound (lb) is equal to the upper bound (ub), the attributes contain = lb.

If the lower bound is not equal to the upper bound and Double.NEGATIVE_INFINITY , the attributes contain >= lb.

If the upper bound is not equal to the lower bound and Double.POSITIVE_INFINITY, the attributes contain <= ub.

If the variable is integer, the attributes contain integer.

If the variable is binary, the attributes contain binary.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of entity as string.

  • index – Index of instance as tuple.

  • str – Pointer to the string representation of the variable instance.

Returns:

Pointer to the AMPL_ERRORINFO struct.