lgp/core/environment.rs
1/// Defines a single state which can use the current context to get the next data.
2pub trait State: Sized {
3 fn get_value(&self, at_idx: usize) -> f64;
4 /// Updates the impact of the factor.
5 /// For example, if data[0] has been accessed, we increase the index so data[1] is accessed next (in classification).
6 /// In RL, we act on the environment and internally update the termination state, and hold the new state.
7 fn execute_action(&mut self, action: usize) -> f64;
8
9 /// We take a mutable reference and return self.
10 fn get(&mut self) -> Option<&mut Self>;
11}
12
13pub trait RlState: State {
14 /// Returns true if episode count > MAX or terminal_signal sent from environment.
15 fn is_terminal(&mut self) -> bool;
16
17 // Returns the initial state.
18 fn get_initial_state(&self) -> Vec<f64>;
19}