Struct TestEnv

Source
pub struct TestEnv { /* private fields */ }
Expand description

Environment for testing.

Trait Implementations§

Source§

impl Agent<TestEnv, SimpleReplayBuffer<TestObsBatch, TestActBatch>> for TestAgent

Source§

fn train(&mut self)

Set the policy to training mode.
Source§

fn is_train(&self) -> bool

Return if it is in training mode.
Source§

fn eval(&mut self)

Set the policy to evaluation mode.
Source§

fn opt_with_record( &mut self, _buffer: &mut SimpleReplayBuffer<TestObsBatch, TestActBatch>, ) -> Record

Performs an optimization step and returns some information.
Source§

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.
Source§

fn load_params<T: AsRef<Path>>(&mut self, _path: T) -> Result<()>

Load the parameters of the agent from the given directory.
Source§

fn opt(&mut self, buffer: &mut R)

Performs an optimization step. Read more
Source§

impl Configurable<TestEnv> for TestAgent

Source§

type Config = TestAgentConfig

Configuration.
Source§

fn build(_config: Self::Config) -> Self

Builds the object.
Source§

fn build_from_path(path: impl AsRef<Path>) -> Result<Self>
where Self: Sized,

Build the object with the configuration in the yaml file of the given path.
Source§

impl Env for TestEnv

Source§

type Config = usize

Configurations.
Source§

type Obs = TestObs

Observation of the environment.
Source§

type Act = TestAct

Action of the environment.
Source§

type Info = TestInfo

Information in the self::Step object.
Source§

fn reset(&mut self, _is_done: Option<&Vec<i8>>) -> Result<Self::Obs>

Resets the environment if is_done[0] == 1. or is_done.is_none(). Read more
Source§

fn reset_with_index(&mut self, _ix: usize) -> Result<Self::Obs>

Resets the environment with a given index. Read more
Source§

fn step_with_reset(&mut self, a: &Self::Act) -> (Step<Self>, Record)
where Self: Sized,

Performes an environment step and reset the environment if an episode ends.
Source§

fn step(&mut self, a: &Self::Act) -> (Step<Self>, Record)
where Self: Sized,

Performes an environment step.
Source§

fn build(config: &Self::Config, _seed: i64) -> Result<Self>
where Self: Sized,

Builds an environment with a given random seed.
Source§

impl Policy<TestEnv> for TestAgent

Source§

fn sample(&mut self, _obs: &TestObs) -> TestAct

Sample an action given an observation.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V