AMPL_INSTANCE#

group AMPL_INSTANCE

Functions for instances:

Functions

AMPL_ERRORINFO *AMPL_InstanceGetDoubleSuffix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, AMPL_NUMERICSUFFIX suffix, double *value)#

Get a double suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – Numeric suffix to get.

  • value – Pointer to the value of the suffix.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_InstanceGetIntSuffix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, AMPL_NUMERICSUFFIX suffix, int *value)#

Get a integer suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – Numeric suffix to get.

  • value – Pointer to the value of the suffix.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_InstanceGetStringSuffix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, AMPL_STRINGSUFFIX suffix, char **value)#

Get a string suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – String suffix to get.

  • value – Pointer to the value of the suffix.

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Get a double custom suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – String suffix to get.

  • value – Pointer to the value of the suffix.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_InstanceGetUserDefinedStringSuffix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, const char *suffix, char **value)#

Get a string custom suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – String suffix to get.

  • value – Pointer to the value of the suffix.

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Set a numeric custom suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – String suffix to set.

  • value – Double value to be set.

Returns:

Pointer to the AMPL_ERRORINFO struct.

AMPL_ERRORINFO *AMPL_InstanceSetStringSuffix(AMPL *ampl, const char *entityname, AMPL_TUPLE *index, const char *suffix, const char *value)#

Set a string custom suffix value of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

  • suffix – String suffix to set.

  • value – String value to be set.

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Get name of instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of entity as string.

  • index – Tuple of indices of the instance.

  • name – Pointer to the name of the instance.

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Returns a string representation of this instance.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

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

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Drop this instance, corresponding to the AMPL code: drop name;.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

Returns:

Pointer to the AMPL_ERRORINFO struct.

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

Restore this instance, corresponding to the AMPL code: restore name;.

Parameters:
  • ampl – Pointer to the AMPL struct.

  • entityname – Name of instance as string.

  • index – Index of instance as tuple.

Returns:

Pointer to the AMPL_ERRORINFO struct.