nopasaran.primitives.condition_primitives.variable_comparisons.VariableComparisons¶
- class nopasaran.primitives.condition_primitives.variable_comparisons.VariableComparisons¶
Bases:
objectClass containing methods for comparing variables in a state machine.
- __init__()¶
Methods
__init__()equal(inputs, outputs, state_variables)Check if the two variables stored in the state are equal before the transition occurs.
gt(inputs, outputs, state_variables)Check if the first value stored in the state variables is greater than the second value before the transition occurs.
gte(inputs, outputs, state_variables)Check if the first value stored in the state variables is greater than or equal to the second value before the transition occurs.
lt(inputs, outputs, state_variables)Check if the first value stored in the state variables is less than the second value before the transition occurs.
lte(inputs, outputs, state_variables)Check if the first value stored in the state variables is less than or equal to the second value before the transition occurs.
no_value(inputs, outputs, state_variables)Check if the variable from the machine, whose name is provided as input, is None.
- static equal(inputs, outputs, state_variables)¶
Check if the two variables stored in the state are equal before the transition occurs.
Number of input arguments: 2
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments, which are the names of the variables to be compared.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the values are equal, False otherwise.
- static gt(inputs, outputs, state_variables)¶
Check if the first value stored in the state variables is greater than the second value before the transition occurs.
Number of input arguments: 2
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments, which are the names of the variables to be compared.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the first value is greater, False otherwise.
- static gte(inputs, outputs, state_variables)¶
Check if the first value stored in the state variables is greater than or equal to the second value before the transition occurs.
Number of input arguments: 2
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments, which are the names of the variables to be compared.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the first value is greater or equal, False otherwise.
- static lt(inputs, outputs, state_variables)¶
Check if the first value stored in the state variables is less than the second value before the transition occurs.
Number of input arguments: 2
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments, which are the names of the variables to be compared.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the first value is less, False otherwise.
- static lte(inputs, outputs, state_variables)¶
Check if the first value stored in the state variables is less than or equal to the second value before the transition occurs.
Number of input arguments: 2
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains two mandatory input arguments, which are the names of the variables to be compared.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the first value is less or equal, False otherwise.
- static no_value(inputs, outputs, state_variables)¶
Check if the variable from the machine, whose name is provided as input, is None.
Number of input arguments: 1
Number of output arguments: 0
Optional input arguments: No
Optional output arguments: No
- Args:
inputs (List[str]): The list of input variable names. It contains one mandatory input argument, which is the name of the variable to be checked.
outputs (List[str]): The list of output variable names.
state_variables (dict): The dictionary of state variables.
- Returns:
bool: True if the only variable from the machine is None, False otherwise.