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
andampl.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 ofampl.ConstraintInstance
for indexed constraints). Note that, since this class represents both algebraic and logical constraints, some suffixes might not be available for every entity. AnArgumentException
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. AnArgumentOutOfRangeException
is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the classampl.ConstraintInstance
can be accessed via the indexing operator, via the methodampl.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), seeampl.Entities.Entity.GetValues()
and theampl.DataFrame
class. - class
ConstraintMap
- Enables iterable access to the constraints
- 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. AnArgumentOutOfRangeException
is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the classampl.ObjectiveInstance
can be accessed via the indexing operator, via the methodampl.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), seeampl.Entities.Entity.GetValues
and theampl.DataFrame
class. - class
ObjectiveMap
- Enables iterable access to the objectives
- 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
andampl.Entities.Parameter.SetValues
directly from objects of this class or usingampl.AMPL.SetData
and aDataFrame
object. - class
ParameterMap
- Enables iterable access to the parameters
- 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 methodsampl.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 usingampl.AMPL.SetData
and an object of classampl.DataFrame
.- class
SetMap
- Enables iterable access to the sets
- 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. AnArgumentOutOfRangeException
is thrown if any property of an entity which has been deleted from the underlying interpreter is accessed. The instances, represented by the classampl.VariableInstance
can be accessed via the indexing operator, via the methodampl.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), seeampl.Entities.Entity.GetValues
and theampl.DataFrame
class. - class
VariableMap
- Enables iterable access to the variables
- class