# ampl.Entities Namespace¶

namespace ampl.Entities

Classes

class Constraint
This class represents an algebraic or logical constraint. In case the constraint is scalar, its values can be accessed via properties like ampl.Entities.Constraint.Body and ampl.Entities.Constraint.Dual. All the AMPL suffixes for constraints (see http://www.ampl.com/NEW/suffbuiltin.html) are available through methods of this class with the same name (and methods of ampl.ConstraintInstance for indexed constraints). Note that, since this class represents both algebraic and logical constraints, some suffixes might not be available for every entity. An ArgumentException is thrown if one of such methods is called for a non-scalar constraint and if a method corresponding to a suffix which is not supported by the type of the constraint is called. An ArgumentOutOfRangeException is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the class ampl.ConstraintInstance can be accessed via the indexing operator, via the method ampl.Entities.Constraint.Get or via the iterator provided. To gain access to all the values in an entity (for all instances and all suffixes for that entities), see ampl.Entities.Entity.GetValues() and the ampl.DataFrame class.
class ConstraintMap
class Entity

An AMPL entity such as a parameter or a variable.

An entity can either represent a single instance of an AMPL algebraic entity or, if the corresponding declaration has an indexing expression, a mapping from keys to instances.In the derived classes, it has methods to access instance-level properties which can be used in case the represented entity is scalar. To gain access to all the values in an entity (for all instances and all suffixes for that entities), use the function ampl.Entities.Entity.GetValues(). The algebraic entities which currenty have an equivalent class in the API are:

Variables (see ampl.Entities.Variable)

Constraints (see ampl.Entities.Constraint)

Objectives (see ampl.Entities.Objective)

Sets (see ampl.Entities.Set)

Parameters (see ampl.Entities.Parameter)

class EntityMap<ENTITY>
A generic enumerable map storing entities
class Entity<K>
class Objective
Represents an AMPL objective. Note that, in case of a scalar objective, all the properties (corresponding to AMPL suffixes) of the objective instance can be accessed through corresponding properties on the Objective itself. The properties have the same name of the corresponding AMPL suffixes. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes. An ArgumentException is thrown if one of such methods is called for a non-scalar objective. An ArgumentOutOfRangeException is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the class ampl.ObjectiveInstance can be accessed via the indexing operator, via the method ampl.Entities.Objective.Get or via the iterator provided. To gain access to all the values in an entity (for all instances and all suffixes for that entities), see ampl.Entities.Entity.GetValues and the ampl.DataFrame class.
class ObjectiveMap
class Parameter
Represents an AMPL parameter. The values can be double or string (in case of symbolic parameters). Data can be assigned to the parameter using the methods ampl.Entities.Parameter.Set and ampl.Entities.Parameter.SetValues directly from objects of this class or using ampl.AMPL.SetData and a DataFrame object.
class ParameterMap
class Set

Represents an AMPL set. In case of not indexed sets, this class exposes iterators for accessing its elements. The members of the set are tuples, represented by objects of class ampl.Tuple.

All these methods throw an ArgumentException if called for an indexed set.

In case of indexed sets, you can gain access to the instances (of class ampl.SetInstance) using the methods ampl.Set.Get, using the indexing operator or via the iterators.

Data can be assigned to the set using the methods ampl.Set.SetValues (for non-indexed sets only) or using ampl.AMPL.SetData and an object of class ampl.DataFrame.

class SetMap
class Variable
Represents an AMPL variable. Note that, in case of a scalar variable, all the properties (corresponding to AMPL suffixes) of the variable instance can be accessed through corresponding properties on the Variable itself. The properties have the same name of the corresponding AMPL suffixes. See http://www.ampl.com/NEW/suffbuiltin.html for a list of the available suffixes. An ArgumentException is thrown if one of such methods is called for a non-scalar variable. An ArgumentOutOfRangeException is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the class ampl.VariableInstance can be accessed via the indexing operator, via the method ampl.Entities.Variable.Get or via the iterator provided. To gain access to all the values in an entity (for all instances and all suffixes for that entities), see ampl.Entities.Entity.GetValues and the ampl.DataFrame class.
class VariableMap