optimisation.design_space.design_space_parameter module
Create a base class for Variable
and Constraint
.
- class DesignSpaceParameter(name: str, element_name: str, limits: tuple[float, float])
Bases:
ABC
Hold a single variable or constraint.
- name
Name of the parameter. Must be compatible with the
SimulationOutput.get()
method, and be inIMPLEMENTED_VARIABLES
orIMPLEMENTED_CONSTRAINTS
.- Type:
str
- element_name
Name of the element concerned by the parameter.
- Type:
str
- limits
Lower and upper bound for the variable.
np.nan
deactivates a bound.- Type:
tuple[float, float]
- __init__(name: str, element_name: str, limits: tuple[float, float]) None
- __post_init__()
Convert values in deg for output if it is angle.
- _abc_impl = <_abc._abc_data object>
- property _fmt_x_0: float
Initial value but with a better output.
- property _fmt_x_max: float
Lower limit in deg if it is has
'phi'
in it’s name.
- property _fmt_x_min: float
Lower limit in deg if it is has
'phi'
in it’s name.
- change_limits(x_min: float | None = None, x_max: float | None = None) None
Change the limits after creation of the object.
- element_name: str
- classmethod from_floats(name: str, element_name: str, x_min: float, x_max: float, x_0: float = nan) Self
Initialize object with
x_min
,x_max
instead oflimits
.- Parameters:
name (str) – Name of the parameter. Must be compatible with the
SimulationOutput.get()
method, and be inIMPLEMENTED_VARIABLES
orIMPLEMENTED_CONSTRAINTS
.element_name (str) – Name of the element concerned by the parameter.
x_min (float) – Lower limit.
np.nan
to deactivate lower bound.x_max (float) – Upper limit.
np.nan
to deactivate lower bound.
- Returns:
A DesignSpaceParameter with limits = (x_min, x_max).
- Return type:
Self
- classmethod from_pd_series(name: str, element_name: str, pd_series: Series) Self
Init object from a pd series (file import).
- classmethod header_of__str__() str
Give information on what
__str__()
is about.
- limits: tuple[float, float]
- name: str
- to_dict(*to_get: str, missing_value: float | None = None, prepend_parameter_name: bool = False) dict[str, float | None | tuple[float, float] | str]
Convert important data to dict to convert it later in pandas df.
- property x_max: float
Return upper variable/constraint bound.
- property x_min: float
Return lower variable/constraint bound.