public interface EntityMap<E extends BasicEntity<?>> extends Iterable<E>

Represents an immutable and synchronised list of AMPL entities. It can be obtained using the functions AMPL.getVariables, AMPL.getConstraints, AMPL.getSets, AMPL.getObjectives, AMPL.getParameters.

The collection cannot be modified by the user (entities cannot be added nor deleted) and is linked to an AMPL object. When the corresponding AMPL entities are modified (through AMPL.eval or any other operation which influences the number of entities), the collection is automatically invalidated. It is updated lazily at the next access.

If the corresponding AMPL object is not running anymore, or it is null, an exception is thrown on all operations.



public E find(String name)

Get an entity by name.

  • name – Name of the entity to get


The corresponding ampl.Entity


public int size()

Get the number of items in the collection