pub struct MemoryGame {
    pub num_actions: usize,
    pub history_len: usize,
}
Expand description

Memory Game Environment

The agent must remember the inital state and choose the corresponding action as the final action in an episode.

  • The environment consists of (NUM_ACTIONS + HISTORY_LEN) states.
  • An episode starts in a state [0, NUM_ACTIONS) uniformly at random.
  • Step i in [0, HISTORY_LEN) transitions to state NUM_ACTIONS + i with 0 reward regardless of the action.
  • On step HISTORY_LEN, the agent chooses one of NUM_ACTIONS actions and if the action index matches the index of the inital state then the agent earns +1 reward, otherwise it earns -1 reward. This step is terminal.
  • Every episode has length HISTORY_LEN + 1.

Fields

num_actions: usize

The number of actions.

history_len: usize

Length of remembered history required to solve the environment.

Implementations

Create a new MemoryGame instance

Args
  • num_actions - Number of possible actions.
  • history_len - Length of remembered history required to solve the environment.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

Space containing all possible observations. Read more

The space of all possible actions. Read more

The space of all possible feedback. Read more

A discount factor applied to future feedback. Read more

(current_state, initial_state)

Observation of the state provided to the agent.

Action selected by the agent.

Feedback provided to a learning agent as the result of each step. Reward, for example. Read more

Sample a state for the start of a new episode. Read more

Generate an observation for a given state.

Perform a state transition in reponse to an action. Read more

Run this environment with the given actor.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Convert into an Any trait reference.

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Compare self to key and return true if they are equal.

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.

The type for initializers.

Initializes a with the given initializer. Read more

Dereferences the given pointer. Read more

Mutably dereferences the given pointer. Read more

Drops the object pointed to by the given pointer. Read more

Should always be Self

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.