OpTaS
1.0.7
An optimization-based task specification library for trajectory optimization and model predictive control.
|
Container for SX variables. More...
Public Member Functions | |
def | __add__ (self, other) |
Add two SXContainer's. More... | |
None | __setitem__ (self, str label, SX value) |
Set new SX item. More... | |
None | variable_is_discrete (self, str label) |
Specify that a given variable is discrete. More... | |
bool | has_discrete_variables (self) |
True if any of the variables in container are discrete, False otherwise. More... | |
List[bool] | discrete (self) |
Returns a list containing discrete classification of each variable. More... | |
SX | vec (self) |
Vectorize SXContainer. More... | |
int | numel (self) |
Return the number of elements. More... | |
dict | vec2dict (self, Union[DM, np.ndarray, list, tuple] vec) |
Convert vector with same layout as SXContainer to dict. More... | |
Union[DM, SX] | dict2vec (self, Dict[str, ArrayType] d) |
Vectorize dictionary with same layout as container. More... | |
dict | zero (self) |
Return dictionary containing layout of container with zero values. More... | |
Static Public Attributes | |
dictionary | is_discrete = {} |
Dict[str, bool]: labels for each item in dict, true means variables are discrete. More... | |
Container for SX variables.
def optas.sx_container.SXContainer.__add__ | ( | self, | |
other | |||
) |
Add two SXContainer's.
@param other Another SXContainer instance. @return An SXContainer instance containing elements from both this and the other instance.
None optas.sx_container.SXContainer.__setitem__ | ( | self, | |
str | label, | ||
SX | value | ||
) |
Set new SX item.
@param label Name for the new item. @param value An array containing symbolic data.
Vectorize dictionary with same layout as container.
@param d Dictionary containing values to be vectorized. @return Vectorized form for the given dictionary.
List[bool] optas.sx_container.SXContainer.discrete | ( | self | ) |
Returns a list containing discrete classification of each variable.
@return List of booleans for each variable, the boolean indicates whether the symbolic variable is considered discrete.
bool optas.sx_container.SXContainer.has_discrete_variables | ( | self | ) |
True if any of the variables in container are discrete, False otherwise.
@return Boolean indicating if the SXContainer instance contains discrete variables.
int optas.sx_container.SXContainer.numel | ( | self | ) |
Return the number of elements.
@return Number of elements in the SXContainer instance.
None optas.sx_container.SXContainer.variable_is_discrete | ( | self, | |
str | label | ||
) |
Specify that a given variable is discrete.
@param label Name for a specific item that appears in the SXContainer instance.
SX optas.sx_container.SXContainer.vec | ( | self | ) |
Vectorize SXContainer.
@return Array containing the vectorized form for the instance.
dict optas.sx_container.SXContainer.vec2dict | ( | self, | |
Union[DM, np.ndarray, list, tuple] | vec | ||
) |
Convert vector with same layout as SXContainer to dict.
@param vec Vector assumed to be arranged with same layout as SXContainer instance. @return Dictionary containing the reconstructed values.
dict optas.sx_container.SXContainer.zero | ( | self | ) |
Return dictionary containing layout of container with zero values.
@return Dictionary containing only zeros as its values.
|
static |
Dict[str, bool]: labels for each item in dict, true means variables are discrete.