public class ControllerExecutor
extends java.lang.Object
Constructor and Description |
---|
ControllerExecutor(tau.smlab.syntech.controller.Controller controller,
java.lang.String folder)
Instantiates a new symbolic controller executor.
|
ControllerExecutor(tau.smlab.syntech.controller.Controller controller,
java.lang.String folder,
boolean reordering)
Instantiates a new symbolic controller executor.
|
Modifier and Type | Method and Description |
---|---|
void |
free()
Frees the controller at the end of the execution
|
java.util.Map<java.lang.String,java.lang.String> |
getCurrInputs()
Returns a mapping of all environment variables' names to their current values
|
java.util.Map<java.lang.String,java.lang.String> |
getCurrOutputs()
Returns a mapping of all system variables' names to their current values
|
java.lang.String |
getCurrValue(java.lang.String varName)
Returns the current value of the specified variable name (either an input or an output)
|
java.util.Map<java.lang.String,java.lang.String> |
getCurrValues(java.lang.String... varNames)
Returns a mapping of all specified variables' names to their current values.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getEnvVars()
Returns the set of all input (environment controlled) variables' names
|
java.util.List<java.lang.String> |
getNextStates(java.util.Map<java.lang.String,java.lang.String> inputs,
int maxStates)
Gets a list of possible next states according to current controller state and inputs.
|
java.util.Map<java.lang.String,java.lang.String[]> |
getSysVars()
Returns the set of all output (system controlled) variables' names
|
void |
initState(java.util.Map<java.lang.String,java.lang.String> initialInputs)
Picks a valid initial state according to initial inputs from the environment.
|
void |
updateState(java.util.Map<java.lang.String,java.lang.String> inputs)
Picks a valid next state according to the controller and the next inputs from the environment.
|
public ControllerExecutor(tau.smlab.syntech.controller.Controller controller, java.lang.String folder) throws java.io.IOException
controller
- instance of the controller interfacefolder
- location of the controller filesjava.io.IOException
- if the folder does not contain the controller filespublic ControllerExecutor(tau.smlab.syntech.controller.Controller controller, java.lang.String folder, boolean reordering) throws java.io.IOException
controller
- instance of the controller interfacefolder
- location of the controller filesreordering
- whether to turn on bdd reordering during the execution. Reordering may
result in better performance generally but causes spikes (a very long single step) once in a whilejava.io.IOException
- if the folder does not contain the controller filespublic java.util.List<java.lang.String> getNextStates(java.util.Map<java.lang.String,java.lang.String> inputs, int maxStates)
inputs
- map of environment variable names to valuesmaxStates
- maximum number of states to returnpublic java.util.Map<java.lang.String,java.lang.String[]> getSysVars()
public java.util.Map<java.lang.String,java.lang.String[]> getEnvVars()
public void free()
public void initState(java.util.Map<java.lang.String,java.lang.String> initialInputs) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
initialInputs
- map of environment variable names to valuesjava.lang.IllegalStateException
- if the current state is an environment deadlockjava.lang.IllegalArgumentException
- if the current state is not an environment deadlock and the inputs violate the safety assumptions of the environmentpublic void updateState(java.util.Map<java.lang.String,java.lang.String> inputs) throws java.lang.IllegalStateException, java.lang.IllegalArgumentException
inputs
- map of environment variable names to valuesjava.lang.IllegalStateException
- if the current state is an environment deadlockjava.lang.IllegalArgumentException
- if the current state is not an environment deadlock and the inputs violate the safety assumptions of the environmentpublic java.lang.String getCurrValue(java.lang.String varName) throws java.lang.IllegalArgumentException, java.lang.IllegalStateException
varName
- The variable namejava.lang.IllegalArgumentException
- if the variable name does not exist in the controllerjava.lang.IllegalStateException
- if the current state is zeropublic java.util.Map<java.lang.String,java.lang.String> getCurrOutputs() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.util.Map<java.lang.String,java.lang.String> getCurrInputs() throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public java.util.Map<java.lang.String,java.lang.String> getCurrValues(java.lang.String... varNames) throws java.lang.IllegalArgumentException
varNames
- the variables' names that will be mapped to their current valuesjava.lang.IllegalArgumentException
- if there is a variable name that does not exist in the controller