pub trait Agent<E: Env, R: ReplayBufferBase>: Policy<E> {
// Required methods
fn train(&mut self);
fn eval(&mut self);
fn is_train(&self) -> bool;
fn opt_with_record(&mut self, buffer: &mut R) -> Record;
fn save_params<T: AsRef<Path>>(&self, path: T) -> Result<()>;
fn load_params<T: AsRef<Path>>(&mut self, path: T) -> Result<()>;
// Provided method
fn opt(&mut self, buffer: &mut R) { ... }
}
Expand description
Represents a trainable policy on an environment.
Required Methods§
Sourcefn opt_with_record(&mut self, buffer: &mut R) -> Record
fn opt_with_record(&mut self, buffer: &mut R) -> Record
Performs an optimization step and returns some information.
Sourcefn save_params<T: AsRef<Path>>(&self, path: T) -> Result<()>
fn save_params<T: AsRef<Path>>(&self, path: T) -> Result<()>
Save the parameters of the agent in the given directory.
This method commonly creates a number of files consisting the agent
in the directory. For example, the DQN agent in border_tch_agent
crate saves
two Q-networks corresponding to the original and target networks.
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.