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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
//! Core interfaces and traits for reinforcement learning.
//!
//! This module provides the fundamental building blocks for reinforcement learning systems,
//! including interfaces for environments, agents, policies, and experience replay.
//! These interfaces define the core abstractions that enable the implementation of
//! various reinforcement learning algorithms.
pub use Agent;
pub use TransitionBatch;
pub use Env;
pub use ;
pub use ;
use Debug;
pub use ;
/// A trait representing observations from an environment.
///
/// This trait defines the interface for observations in reinforcement learning.
/// Observations represent the state of the environment as perceived by the agent.
///
/// # Requirements
///
/// Implementations must:
/// - Be cloneable for efficient copying
/// - Support debug formatting for logging and debugging
/// - Provide a method to determine the number of observations
///
/// # Note
///
/// While the interface supports vectorized environments through the `len` method,
/// the current implementation only supports single environments. Therefore,
/// `len()` is expected to return 1 in all cases.
///
/// # Examples
///
/// ```ignore
/// #[derive(Clone, Debug)]
/// struct SimpleObservation {
/// position: f32,
/// velocity: f32,
/// }
///
/// impl Obs for SimpleObservation {
/// fn len(&self) -> usize {
/// 1 // Single observation
/// }
/// }
/// ```
/// A trait representing actions that can be taken in an environment.
///
/// This trait defines the interface for actions in reinforcement learning.
/// Actions represent the decisions made by the agent that affect the environment.
///
/// # Requirements
///
/// Implementations must:
/// - Be cloneable for efficient copying
/// - Support debug formatting for logging and debugging
///
/// # Examples
///
/// ```ignore
/// #[derive(Clone, Debug)]
/// struct DiscreteAction {
/// action: usize,
/// num_actions: usize,
/// }
///
/// impl Act for DiscreteAction {
/// fn len(&self) -> usize {
/// self.num_actions
/// }
/// }
/// ```