library_actuator
RL4CRN.agent2env_interface.library_actuator
Library actuator.
Concrete actuator that maps a policy action to a reaction sampled from a reaction library.
The policy selects a reaction via an integer (or otherwise indexable) identifier, and provides a set of parameters that are applied to the selected reaction before returning it as the environment action.
Expected policy_action structure:
"reaction index": key used to select a reaction from the library"parameters": parameter container passed toreaction.set_parameters(...)
Assumptions about reaction_library:
- provides method
get_reaction(index)returning a reaction-like object - the returned reaction provides
set_parameters(parameters)
LibraryActuator
Bases: AbstractActuator
Actuator that selects and parameterizes a reaction from a reaction library.
__init__(reaction_library)
Initialize the actuator.
| PARAMETER | DESCRIPTION |
|---|---|
reaction_library
|
Object providing
|
actuate(policy_action)
Convert a policy action into a parameterized reaction.
| PARAMETER | DESCRIPTION |
|---|---|
policy_action
|
Dictionary specifying which reaction to select and which
parameters to apply. Must contain
|
| RETURNS | DESCRIPTION |
|---|---|
|
A reaction object obtained from the library and updated via |
| RAISES | DESCRIPTION |
|---|---|
KeyError
|
If required keys ( |
AttributeError
|
If the library or reaction does not provide the required
methods ( |