border_core/
base.rs

1//! Core functionalities.
2mod agent;
3mod batch;
4mod env;
5mod policy;
6mod replay_buffer;
7mod step;
8pub use agent::Agent;
9pub use batch::TransitionBatch;
10pub use env::Env;
11pub use policy::{Configurable, Policy};
12pub use replay_buffer::{ExperienceBufferBase, ReplayBufferBase};
13use std::fmt::Debug;
14pub use step::{Info, Step, StepProcessor};
15
16/// A set of observations of an environment.
17///
18/// Old versions of the library support vectorized environment and
19/// [Obs] was able to handle multiple observations.
20/// In the current version, no vectorized environment is implemented.
21/// Thus, [Obs]`::len()` always returns 1.
22pub trait Obs: Clone + Debug {
23    /// Returns a dummy observation.
24    ///
25    /// The observation created with this method is ignored.
26    fn dummy(n: usize) -> Self;
27
28    /// Returns the number of observations in the object.
29    fn len(&self) -> usize;
30}
31
32/// A set of actions of the environment.
33pub trait Act: Clone + Debug {
34    /// Returns the number of actions in the object.
35    ///
36    /// TODO: Consider to delete.
37    fn len(&self) -> usize {
38        unimplemented!();
39    }
40}