OpTaS  1.0.7
An optimization-based task specification library for trajectory optimization and model predictive control.
Public Member Functions | Static Public Attributes | List of all members
optas.sx_container.SXContainer Class Reference

Container for SX variables. More...

Inheritance diagram for optas.sx_container.SXContainer:
Inheritance graph
[legend]
Collaboration diagram for optas.sx_container.SXContainer:
Collaboration graph
[legend]

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, SXdict2vec (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...
 

Detailed Description

Container for SX variables.

Member Function Documentation

◆ __add__()

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.

◆ __setitem__()

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.

◆ dict2vec()

Union[DM, SX] optas.sx_container.SXContainer.dict2vec (   self,
Dict[str, ArrayType]  d 
)

Vectorize dictionary with same layout as container.

   @param d Dictionary containing values to be vectorized.
   @return Vectorized form for the given dictionary.

◆ discrete()

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.

◆ has_discrete_variables()

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.

◆ numel()

int optas.sx_container.SXContainer.numel (   self)

Return the number of elements.

   @return Number of elements in the SXContainer instance.

◆ variable_is_discrete()

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.

◆ vec()

SX optas.sx_container.SXContainer.vec (   self)

Vectorize SXContainer.

   @return Array containing the vectorized form for the instance.

◆ vec2dict()

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.

◆ zero()

dict optas.sx_container.SXContainer.zero (   self)

Return dictionary containing layout of container with zero values.

   @return Dictionary containing only zeros as its values.

Member Data Documentation

◆ is_discrete

dictionary optas.sx_container.SXContainer.is_discrete = {}
static

Dict[str, bool]: labels for each item in dict, true means variables are discrete.


The documentation for this class was generated from the following file: