gana.sets.variable#
Continuous Variable
Functions
|
Display a Python object in all frontends. |
|
Plot the variable set |
|
Make input into a parameter set (P) |
|
Make input into a theta set (T) |
Classes
|
Represents a relationship between Parameters, Variables, or Expressions. |
|
Type of function |
|
Provides relational operations between parameter, variable, parametric variable, or function sets (F). |
|
function cases |
|
Set of index elements (X). |
|
|
|
Ordered set of variables (Var). |
|
Cartesian product of input iterables. |
- class V(*index: I, itg: bool = False, nn: bool = True, bnr: bool = False, mutable: bool = False, tag: str = '', ltx: str = '', name: str = '')[source]#
Bases:
_EOrdered set of variables (Var).
- Parameters:
index (I or tuple[I], optional) – Indices. Defaults to None.
itg (bool, optional) – If the variable set is integer. Defaults to False.
nn (bool, optional) – If the variable set is non-negative. Defaults to True.
bnr (bool, optional) – If the variable set is binary. Defaults to False.
mutable (bool, optional) – If the variable set is mutable. Defaults to False.
tag (str) – Tag/details
ltx (str) – LaTeX representation of the variable set.
- Variables:
index (I) – Index of the variable set (product of all indices)
_ (list[V]) – List of variables in the set
itg (bool) – Integer variable set flag
nn (bool) – Non-negative variable set flag
bnr (bool) – Binary variable set flag
mutable (bool) – Mutable variable set flag
tag (str) – Tag/details
name (str) – Name, set by the program
n (int) – Number id, set by the program
args (dict[str, bool]) – Arguments for making similar variable sets
ltx (str) – LaTeX representation of the variable set
- Raises:
ValueError – If variable is binary and not non-negative
ValueError – Multiplication by tuple or list of tuples
ValueError – Division by None, tuple, or list of tuples
ZeroDivisionError – Division by zero
ValueError – Division of something by a variable
ValueError – Raising variable to a power, except 0 or 1
- property matrix: dict#
Matrix Representation
- property args: dict[str, str | bool]#
Return the arguments of the variable set
- property A: list[list[float]]#
Generate a diagonal matrix representation of the variable set
- make_function() F[source]#
Make a function
- Returns:
Function representing the variable set
- Return type:
- birth_variables(mutating: bool = False, n_start: int = 0)[source]#
Births a variable at every index in the index set
- Parameters:
mutating (bool, optional) – If the variable set is being mutated. Defaults to False.
n_start (int, optional) – The starting number for positioning the variables. Defaults to 0.
- output(n_sol: int = 0, aslist: bool = False, asdict: bool = False, compare=False) list[float] | dict[tuple[I, ...], float] | None[source]#
Solution
- Parameters:
n_sol (int, optional) – Solution number. Defaults to 0.
aslist (bool, optional) – Returns values taken as list. Defaults to False.
asdict (bool, optional) – Returns values taken as dictionary. Defaults to False.
compare (bool, optional) – Displays a comparison of the solutions across multiple objectives. Defaults to False.
- Returns:
Solution values
- Return type:
list[float] | dict[tuple[I, …], float] | None
- f_eval(*values: float | int, n_sol: int = 0, n_cr: int = 0) float[source]#
Evaluates the variable value as a function of parametric variables
- Parameters:
values (float | int) – values of the parametric variables
n_sol (int, optional) – Solution number. Defaults to 0.
n_cr (int, optional) – Critical region number. Defaults to 0.
- Returns:
evaluated value
- Return type:
float
- eval(*theta_vals: float, n_sol: int = 0) float | None[source]#
Evaluates the variable value as a function of parametric variables
- Parameters:
theta_vals (float) – values of the parametric variables
n_sol (int, optional) – solution number. Defaults to 0.
roundoff (int, optional) – round off the evaluated value. Defaults to 4.
- Returns:
evaluated value
- Return type:
float | None
- property ltx: str#
LaTeX representation
- property index_ltx: str#
LaTeX representation of the index
- latex() str[source]#
LaTeX representation :returns: LaTeX representation of the variable set :rtype: str
- show(descriptive: bool = False)[source]#
Display the variables
- Parameters:
descriptive (bool, optional) – Print members of the index set
- property longname: str#
Long name
- report() V[source]#
Return a reporting binary variable
- Returns:
Reporting binary variable
- Return type:
- line(font_size: float = 16, fig_size: tuple[float, float] = (12, 6), linewidth: float = 0.7, color: str = 'blue', grid_alpha: float = 0.3, usetex: bool = True, str_idx_lim: int = 10)[source]#
Plot the variable set
- Parameters:
font_size (float, optional) – Font size for the plot. Defaults to 16.
fig_size (tuple[float, float], optional) – Size of the figure. Defaults to (12, 6).
linewidth (float, optional) – Width of the line in the plot. Defaults to 0.7.
color (str, optional) – Color of the line in the plot. Defaults to ‘blue’.
grid_alpha (float, optional) – Transparency of the grid lines. Defaults to 0.3.
usetex (bool, optional) – Use LaTeX for text rendering. Defaults to True.
str_idx_lim (int, optional) – Limit for string indices display. Defaults to 10.
- bar(font_size: float = 16, fig_size: tuple[float, float] = (12, 6), linewidth: float = 0.7, color: str = 'blue', grid_alpha: float = 0.3, usetex: bool = True, str_idx_lim: int = 10)[source]#
Plot the variable set
- Parameters:
font_size (float, optional) – Font size for the plot. Defaults to 16.
fig_size (tuple[float, float], optional) – Size of the figure. Defaults to (12, 6).
linewidth (float, optional) – Width of the line in the plot. Defaults to 0.7.
color (str, optional) – Color of the line in the plot. Defaults to ‘blue’.
grid_alpha (float, optional) – Transparency of the grid lines. Defaults to 0.3.
usetex (bool, optional) – Use LaTeX for text rendering. Defaults to True.
str_idx_lim (int, optional) – Limit for string indices display. Defaults to 10.