friendlysam.opt.VariableCollection¶
-
class
friendlysam.opt.VariableCollection(name=None, **kwargs)¶ A lazy collection of
Variableinstances.Use this class to create a family of variables.
Variableinstances are created as needed, and then kept in the collection.Parameters: - name (str, optional) – Name of the variable family.
- **kwargs (optional) – Passed on as keyword arguments to
Variableconstructor.
Examples
>>> x = VariableCollection('x') >>> x <friendlysam.opt.VariableCollection at 0x...: x> >>> x(1) <friendlysam.opt.Variable at 0x...: x(1)>
>>> x = VariableCollection('y', lb=0, domain=Domain.integer) >>> x(1).lb 0 >>> x(1).domain <Domain.integer: 1>
VariableCollection.__call__(index) |
Get a variable from the collection. |
VariableCollection.domain |
Gets the domain of the contained variables. |
VariableCollection.lb |
Gets the lower bound of the contained variables. |
VariableCollection.ub |
Gets the upper bound of the contained variables. |