concepts.pdsketch.simulator_interface.PDSketchExecutionInterface#
- class PDSketchExecutionInterface[source]#
Bases:
object
The base class for interaction with the actual executor.
Methods
Get the latest PDSketch state.
get_pd_state
(action_index)Get the PDSketch state at a given action index.
register_action_controller
(name, ...)Register a controller function for a controller name.
run
(action_index, action_name, action_args)Run an action, and return the success flag and the new PDSketch state.
run_operator_applier
(action_index, action)Execute an action, and return the success flag and the new PDSketch state.
set_init_state
(state)Set the initial PDSketch state of the simulator.
Attributes
The last action index.
Registered controllers.
Mappings from action indices to PDSketch states.
- __init__(executor)[source]#
Initialize the executor interface.
- Parameters:
executor (PDSketchExecutor) – the
PDSketchExecutor
instance for grounding action parameters.
- __new__(**kwargs)#
- get_pd_state(action_index)[source]#
Get the PDSketch state at a given action index. -1 is the initial state.
- register_action_controller(name, controller_function)[source]#
Register a controller function for a controller name.
- run(action_index, action_name, action_args, verbose=False)[source]#
Run an action, and return the success flag and the new PDSketch state. This function will also store the restore function corresponding to the action.
- Parameters:
- Returns:
a tuple of (success, new PDSketch state).
- Return type:
- run_operator_applier(action_index, action)[source]#
Execute an action, and return the success flag and the new PDSketch state. This function will not store the restore function corresponding to the action.
- Parameters:
action_index (int) – the action index.
action (OperatorApplier) – the action to execute.
- Returns:
a tuple of (success, new PDSketch state).
- Return type:
- set_init_state(state)[source]#
Set the initial PDSketch state of the simulator.
- Parameters:
state (State)
- property last_action_index#
The last action index.