Follow us on Twitter and LinkedIn to get the latest updates from the dev team!
Infrastructure class to enable the inheriting classes type-safe access to instances.
Get the name of this entity.
The name of this entity.
Returns a string representation of this entity (its declaration).
The string representation of this entity.
Get the indexarity of this entity (sum of the dimensions of the indexing sets). This value indicates the arity of the Tuple to be passed to the method get in order to access an instance of this entity. See the following AMPL examples:
get
var x; # indexarity = 0 var y {1..2}; # indexarity = 1 var z {1..2,3..4}; # indexarity = 2 var zz {{(1, 2)}}; # indexarity = 2
The sum of the dimensions of the indexing sets or 0 if the entity is not indexed.
Check whether this entity is scalar. Equivalent to testing whether indexarity is equal to zero.
TRUE if the entity is scalar (not indexed over any set).
TRUE
Get the number of instances in this entity.
The number of instances in this entity.
Get a list with the AMPL string representation of the sets on which this entity is indexed.
The string representation of the indexing sets for this entity or an empty list if the entity is scalar.
Get the names of all entities which depend on this one.
A list with the names of all entities which depend on this one.
Get the principal values of this entity as a data.frame. The specific returned value depends on the type of entity (see list below).
For: * Variables and Objectives it returns the suffix val * Parameters it returns their values * Constraints it returns the suffix dual * Sets it returns all the members of the set. Note that it does not * apply to indexed sets. See getValues
val
dual
getValues
A data.frame containing the values for all instances.
Get the specified suffixes value for all instances in a data.frame.
suffixes (list) – Suffixes to get.
A data.frame containing the specified values.
Set the values of this entiy to the correponding values of a DataFrame indexed over the same sets (or a subset). This function assigns the values in the first data column of the passed dataframe to the entity the function is called from. In particular, the statement:
x.setValues(y.getValues())
is semantically equivalent to the AMPL statement:
let {s in S} x[s] := y[s];
data (data.frame) – The data to set the entity to.
Get the instance with the specified index. Throws an error if an instance with the specified index does not exist, if it has been deleted in the underlying AMPL interpreter, or if the index does not match the indexarity. Also works for scalar entities with an empty list as argument.
index (tuple) – The list specifying the index.
The corresponding instance.
Searches the current entity for an instance with the specified index.
The wanted entity if found, or NULL otherwise.
NULL
Get all the instances of this entity.
A list with all the instances of this entity.
previous
Environment
next
Variable