energia.modeling.indices.sample#
Sample of an Aspect
Functions
|
Minimize the function |
|
Recursively merge two tree-like dicts (values always dicts). |
|
Summation without recursion, also allows better printing |
|
Maximize the function |
Classes
|
Bind constraint |
|
Some Function of Samples |
|
alias of |
|
Sets a bound on a variable (V) within a particular domain. |
|
Ordered set of variables (Var). |
|
|
|
Return a chain object whose .__next__() method returns elements from the first iterable until it is exhausted, then elements from the next iterable, until all of the iterables are exhausted. |
- class Sample(aspect: Aspect, domain: Domain, timed: bool = False, spaced: bool = False, report: bool = False)[source]#
Bases:
_HashSets a bound on a variable (V) within a particular domain.
- Parameters:
aspect (Aspect | None) – Aspect to which the constraint is applied.
domain (Domain | None) – Domain over which the aspect is defined.
timed (bool | None) – If the temporal index is predetermined. Defaults to None.
spaced (bool | None) – If the spatial index is predetermined. Defaults to None.
report (bool, optional) – If a reporting binary variable is needed. Defaults to False.
- Variables:
hasinc (bool) – If incidental calculation is generated.
nominal (float | None) – If nominal is provided and multiplied by the nominal value.
norm (bool) – The input argument is normalized if True.
parameter (P) – Parameter
length (int) – Length of the parameter set.
Note
timedandspacedhelp skip the calculation of finding the appropriate index.For time, this is done based on the length of the input parameter.
opris useful if providing a combined bound to different variables.nameis generated based on the variable.domainsare updated as the program is built.
- property of: Self | None#
Sample being calculated
- property index: list[_Component]#
_Index
- property x: Self#
Binary Reporting Variable
- property add: Self#
Positive Control Response
- property sub: Self#
Negative Control Response
- property F#
Function
- property constraints#
Constraints
- property time[source]#
Matches an appropriate temporal scale Sets domain.periods if needed and returns domain.periods
- prep(nominal: float = 1, norm: bool = True) Self[source]#
Nominal value
- Parameters:
nominal (float, optional) – If the input argument (bounds) are to be scaled, defaults to 1
norm (bool, optional) – If the input argument (bounds) are normalized, defaults to True
- V(parameter: float | list[float] | None = None, length: int | None = None) V[source]#
Returns a gana variable (V) using .domain as the index. If time and space are (or) not given, i.e. .spaced or .timed are False, They can be determined.
- For identifying the appropriate temporal scale (index):
The length of the parameter set is used Alternatively, the length of the parameter set can passed directly If neither are passed, it defaults to horizon
If the spatial index is not given, it defaults to the network.
- Parameters:
parameters (int | list, optional) – the parameter/parameter set. Defaults to None.
length (int, optional) – length of the parameter set. Defaults to None.
report (bool, optional) – to make a binary reporting variable. Defaults to False.
incidental (bool, optional) – if this is an incidental calculation. Defaults to False.
Note
parameters and length are mutually exclusive
- Vinc(parameters: float | list = None, length: int = None) V[source]#
Returns the incidental variable
- Parameters:
parameters (float | list, optional) – the parameter/parameter set. Defaults to None.
length (int, optional) – length of the parameter set. Defaults to None.
- Returns:
the incidental variable
- Return type:
V
- Vb() V[source]#
Bound Variable These apply when there are multiple levels of variable-making Endogenous bounds apply, i.e.
- Returns:
the bound variable
- Return type:
V
\[\mathbf{v}_{\dots, t^{+}} <= {\theta}_{\dots, t^{+}} \cdot \mathbf{v}_{\dots, t^{-}}\]where : - \(\mathbf{v}\) is the variable - \(\theta\) is the parameter set - \(t^{i}\) are bespoke discretizations of the horizon - \(i \in \{-, +\}\) are variable-making levels
- X(parameters: float | list[float] | None = None, length: int | None = None) V[source]#
Binary Reporting Variable These report whether a variable has been made or not Also useful to make the variable space semi-continuous
\[\mathbf{v}_{\dots, t} <= {\theta}_{\dots, t} \cdot \mathbf{x}_{\dots, t}\]- where :
\(\mathbf{v}\) is the variable
\(\mathbf{x}\) is the binary reporting variable
\(\theta\) is the parameter set
\(t\) some bespoke discretization of the horizon
- obj(maximize: bool = False)[source]#
Set the sample itself as the objective
- Parameters:
max (bool, optional) – if maximization, defaults to False
- opt(maximize: bool = False)[source]#
Optimize
- Parameters:
maximize (bool, optional) – if maximization, defaults to False
- eval(*values: float)[source]#
Evaluate the variable using parametric variable values
- Parameters:
values (float) – values for the parametric variables
- output(aslist: bool = False, asdict: bool = False, compare: bool = False)[source]#
Solution
- Parameters:
aslist (bool, optional) – Returns the solution as list, otherwise as a variable
asdict (bool, optional) – Returns the solution as dict, otherwise as a variable
compare (bool, optional) – If True, compares the solutions across multiple solves