1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
//! Core functionalities.
mod agent;
mod batch;
mod env;
mod policy;
mod replay_buffer;
mod step;
pub use agent::Agent;
pub use batch::StdBatchBase;
pub use env::Env;
pub use policy::Policy;
pub use replay_buffer::{ExperienceBufferBase, ReplayBufferBase};
use std::fmt::Debug;
pub use step::{Info, Step, StepProcessorBase};

/// A set of observations of an environment.
///
/// Old versions of the library support vectorized environment and
/// [Obs] was able to handle multiple observations.
/// In the current version, no vectorized environment is implemented.
/// Thus, [Obs]`::len()` always returns 1.
pub trait Obs: Clone + Debug {
    /// Returns a dummy observation.
    ///
    /// The observation created with this method is ignored.
    fn dummy(n: usize) -> Self;

    /// Returns the number of observations in the object.
    fn len(&self) -> usize;
}

/// A set of actions of the environment.
pub trait Act: Clone + Debug {
    /// Returns the number of actions in the object.
    ///
    /// TODO: Consider to delete.
    fn len(&self) -> usize {
        unimplemented!();
    }
}