MPCPlannerBase¶
- class torchrl.modules.MPCPlannerBase(*args, **kwargs)[source]¶
MPCPlannerBase abstract Module.
This class inherits from
SafeModule
. Provided aTensorDict
, this module will perform a Model Predictive Control (MPC) planning step. At the end of the planning step, theMPCPlanner
will return a proposed action.- Parameters:
env (EnvBase) – The environment to perform the planning step on (Can be
ModelBasedEnvBase
orEnvBase
).action_key (str, optional) – The key that will point to the computed action.
- forward(tensordict: TensorDictBase, tensordict_out: Optional[TensorDictBase] = None, **kwargs) TensorDictBase [source]¶
When the tensordict parameter is not set, kwargs are used to create an instance of TensorDict.
- abstract planning(td: TensorDictBase) Tensor [source]¶
Performs the MPC planning step.
- Parameters:
td (TensorDict) – The TensorDict to perform the planning step on.