pub trait Environment {
// Required methods
fn perform_action(&mut self, action: Action);
fn get_observation(&self) -> PerceptVal;
fn get_reward(&self) -> Reward;
fn is_finished(&self) -> bool;
fn get_observation_bits(&self) -> usize;
fn get_reward_bits(&self) -> usize;
fn get_action_bits(&self) -> usize;
// Provided methods
fn drain_observations(&mut self) -> Vec<PerceptVal> ⓘ { ... }
fn set_random_seed(&mut self, _seed: u64) { ... }
fn get_num_actions(&self) -> usize { ... }
fn max_reward(&self) -> Reward { ... }
fn min_reward(&self) -> Reward { ... }
}Expand description
Interface for an agent’s environment.
An environment consumes actions from the agent and produces percepts (observations and rewards) in response.
Required Methods§
Sourcefn perform_action(&mut self, action: Action)
fn perform_action(&mut self, action: Action)
Executes an action in the environment and updates its internal state.
Sourcefn get_observation(&self) -> PerceptVal
fn get_observation(&self) -> PerceptVal
Returns the current observation produced by the environment.
Sourcefn get_reward(&self) -> Reward
fn get_reward(&self) -> Reward
Returns the current reward produced by the environment.
Sourcefn is_finished(&self) -> bool
fn is_finished(&self) -> bool
Returns true if the environment has reached a terminal state.
Sourcefn get_observation_bits(&self) -> usize
fn get_observation_bits(&self) -> usize
Returns the number of bits used to encode observations in this environment.
Sourcefn get_reward_bits(&self) -> usize
fn get_reward_bits(&self) -> usize
Returns the number of bits used to encode rewards in this environment.
Sourcefn get_action_bits(&self) -> usize
fn get_action_bits(&self) -> usize
Returns the number of bits required to represent all possible actions.
Provided Methods§
Sourcefn drain_observations(&mut self) -> Vec<PerceptVal> ⓘ
fn drain_observations(&mut self) -> Vec<PerceptVal> ⓘ
Returns a stream of observation symbols produced by the last action.
Default behavior is a single observation.
Sourcefn set_random_seed(&mut self, _seed: u64)
fn set_random_seed(&mut self, _seed: u64)
Reseed the environment RNG for deterministic, reproducible runs.
Deterministic environments can ignore this. Stochastic environments
should reseed and reset any stochastic state so the initial percept
sequence is reproducible from seed.
Sourcefn get_num_actions(&self) -> usize
fn get_num_actions(&self) -> usize
Returns the total number of valid actions available.
Sourcefn max_reward(&self) -> Reward
fn max_reward(&self) -> Reward
Returns the maximum possible reward value in this environment.
Sourcefn min_reward(&self) -> Reward
fn min_reward(&self) -> Reward
Returns the minimum possible reward value in this environment.