Environment

Trait Environment 

Source
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§

Source

fn perform_action(&mut self, action: Action)

Executes an action in the environment and updates its internal state.

Source

fn get_observation(&self) -> PerceptVal

Returns the current observation produced by the environment.

Source

fn get_reward(&self) -> Reward

Returns the current reward produced by the environment.

Source

fn is_finished(&self) -> bool

Returns true if the environment has reached a terminal state.

Source

fn get_observation_bits(&self) -> usize

Returns the number of bits used to encode observations in this environment.

Source

fn get_reward_bits(&self) -> usize

Returns the number of bits used to encode rewards in this environment.

Source

fn get_action_bits(&self) -> usize

Returns the number of bits required to represent all possible actions.

Provided Methods§

Source

fn drain_observations(&mut self) -> Vec<PerceptVal>

Returns a stream of observation symbols produced by the last action.

Default behavior is a single observation.

Source

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.

Source

fn get_num_actions(&self) -> usize

Returns the total number of valid actions available.

Source

fn max_reward(&self) -> Reward

Returns the maximum possible reward value in this environment.

Source

fn min_reward(&self) -> Reward

Returns the minimum possible reward value in this environment.

Implementors§