pub trait OnPolicyAlgorithmHooks {
type A: Agent;
type S: Sampler;
// Required methods
fn init_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult;
fn post_rollout_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult;
fn post_training_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult;
fn finish_training_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> Result<(), Error>;
}Expand description
Lifecycle hooks that control an OnPolicyAlgorithm training loop.
Required Associated Types§
Required Methods§
Sourcefn init_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult
fn init_hook( &mut self, runtime: &mut OnPolicyRuntime<Self::A, Self::S>, ) -> HookResult
Called once before rollout/training starts.
Sourcefn post_rollout_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult
fn post_rollout_hook( &mut self, runtime: &mut OnPolicyRuntime<Self::A, Self::S>, ) -> HookResult
Called after rollouts are collected and before agent learning.
Sourcefn post_training_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> HookResult
fn post_training_hook( &mut self, runtime: &mut OnPolicyRuntime<Self::A, Self::S>, ) -> HookResult
Called after the agent has learned from the latest rollouts.
Sourcefn finish_training_hook(
&mut self,
runtime: &mut OnPolicyRuntime<Self::A, Self::S>,
) -> Result<(), Error>
fn finish_training_hook( &mut self, runtime: &mut OnPolicyRuntime<Self::A, Self::S>, ) -> Result<(), Error>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".