Struct relearn::envs::SecondPlayerView
source · [−]pub struct SecondPlayerView<E> {
pub inner: E,
}
Expand description
Wraps a two-player game as a one-player game for the second player.
The first player always takes the default action.
Fields
inner: E
Implementations
sourceimpl<E> SecondPlayerView<E>
impl<E> SecondPlayerView<E>
Trait Implementations
sourceimpl<E, OS1, OS2, AS1, AS2, FS1, FS2> BuildEnv for SecondPlayerView<E> where
E: BuildEnv<Observation = (OS1::Element, OS2::Element), Action = (AS1::Element, AS2::Element), Feedback = (FS1::Element, FS2::Element), ObservationSpace = TupleSpace2<OS1, OS2>, ActionSpace = TupleSpace2<AS1, AS2>, FeedbackSpace = TupleSpace2<FS1, FS2>>,
OS1: Space,
OS2: Space,
AS1: Space,
AS1::Element: Default,
AS2: Space,
FS1: Space,
FS2: Space,
impl<E, OS1, OS2, AS1, AS2, FS1, FS2> BuildEnv for SecondPlayerView<E> where
E: BuildEnv<Observation = (OS1::Element, OS2::Element), Action = (AS1::Element, AS2::Element), Feedback = (FS1::Element, FS2::Element), ObservationSpace = TupleSpace2<OS1, OS2>, ActionSpace = TupleSpace2<AS1, AS2>, FeedbackSpace = TupleSpace2<FS1, FS2>>,
OS1: Space,
OS2: Space,
AS1: Space,
AS1::Element: Default,
AS2: Space,
FS1: Space,
FS2: Space,
type Observation = <OS2 as Space>::Element
type Observation = <OS2 as Space>::Element
Environment observation type.
type ObservationSpace = OS2
type ObservationSpace = OS2
Environment observation space type.
type ActionSpace = AS2
type ActionSpace = AS2
Environment action space type.
type FeedbackSpace = FS2
type FeedbackSpace = FS2
Environment feedback space type.
type Environment = SecondPlayerView<<E as BuildEnv>::Environment>
type Environment = SecondPlayerView<<E as BuildEnv>::Environment>
Type of environment to build
sourcefn build_env(&self, rng: &mut Prng) -> Result<Self::Environment, BuildEnvError>
fn build_env(&self, rng: &mut Prng) -> Result<Self::Environment, BuildEnvError>
Build an environment instance. Read more
sourceimpl<E: Clone> Clone for SecondPlayerView<E>
impl<E: Clone> Clone for SecondPlayerView<E>
sourcefn clone(&self) -> SecondPlayerView<E>
fn clone(&self) -> SecondPlayerView<E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<E: Debug> Debug for SecondPlayerView<E>
impl<E: Debug> Debug for SecondPlayerView<E>
sourceimpl<E: Default> Default for SecondPlayerView<E>
impl<E: Default> Default for SecondPlayerView<E>
sourcefn default() -> SecondPlayerView<E>
fn default() -> SecondPlayerView<E>
Returns the “default value” for a type. Read more
sourceimpl<'de, E> Deserialize<'de> for SecondPlayerView<E> where
E: Deserialize<'de>,
impl<'de, E> Deserialize<'de> for SecondPlayerView<E> where
E: Deserialize<'de>,
sourcefn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl<E, OS1, OS2, AS1, AS2, FS1, FS2> EnvStructure for SecondPlayerView<E> where
E: EnvStructure<ObservationSpace = TupleSpace2<OS1, OS2>, ActionSpace = TupleSpace2<AS1, AS2>, FeedbackSpace = TupleSpace2<FS1, FS2>>,
OS2: Space,
AS2: Space,
FS2: Space,
impl<E, OS1, OS2, AS1, AS2, FS1, FS2> EnvStructure for SecondPlayerView<E> where
E: EnvStructure<ObservationSpace = TupleSpace2<OS1, OS2>, ActionSpace = TupleSpace2<AS1, AS2>, FeedbackSpace = TupleSpace2<FS1, FS2>>,
OS2: Space,
AS2: Space,
FS2: Space,
type ObservationSpace = OS2
type ActionSpace = AS2
type FeedbackSpace = FS2
sourcefn observation_space(&self) -> Self::ObservationSpace
fn observation_space(&self) -> Self::ObservationSpace
Space containing all possible observations. Read more
sourcefn action_space(&self) -> Self::ActionSpace
fn action_space(&self) -> Self::ActionSpace
The space of all possible actions. Read more
sourcefn feedback_space(&self) -> Self::FeedbackSpace
fn feedback_space(&self) -> Self::FeedbackSpace
The space of all possible feedback. Read more
sourcefn discount_factor(&self) -> f64
fn discount_factor(&self) -> f64
A discount factor applied to future feedback. Read more
sourceimpl<E, O1, O2, A1, A2, F1, F2> Environment for SecondPlayerView<E> where
E: Environment<Observation = (O1, O2), Action = (A1, A2), Feedback = (F1, F2)>,
A1: Default,
A2: Clone,
impl<E, O1, O2, A1, A2, F1, F2> Environment for SecondPlayerView<E> where
E: Environment<Observation = (O1, O2), Action = (A1, A2), Feedback = (F1, F2)>,
A1: Default,
A2: Clone,
type State = <E as Environment>::State
type State = <E as Environment>::State
Environment state type. Not necessarily observable by the agent.
type Observation = O2
type Observation = O2
Observation of the state provided to the agent.
type Action = A2
type Action = A2
Action selected by the agent.
type Feedback = F2
type Feedback = F2
sourcefn initial_state(&self, rng: &mut Prng) -> Self::State
fn initial_state(&self, rng: &mut Prng) -> Self::State
Sample a state for the start of a new episode. Read more
sourcefn observe(&self, state: &Self::State, rng: &mut Prng) -> Self::Observation
fn observe(&self, state: &Self::State, rng: &mut Prng) -> Self::Observation
Generate an observation for a given state.
sourcefn step(
&self,
state: Self::State,
action: &Self::Action,
rng: &mut Prng,
logger: &mut dyn StatsLogger
) -> (Successor<Self::State>, Self::Feedback)
fn step(
&self,
state: Self::State,
action: &Self::Action,
rng: &mut Prng,
logger: &mut dyn StatsLogger
) -> (Successor<Self::State>, Self::Feedback)
Perform a state transition in reponse to an action. Read more
sourcefn run<T, L>(self, actor: T, seed: SimSeed, logger: L) -> Steps<Self, T, Prng, L>ⓘNotable traits for Steps<E, T, R, L>impl<E, T, R, L> Iterator for Steps<E, T, R, L> where
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
where
T: Actor<Self::Observation, Self::Action>,
L: StatsLogger,
Self: Sized,
fn run<T, L>(self, actor: T, seed: SimSeed, logger: L) -> Steps<Self, T, Prng, L>ⓘNotable traits for Steps<E, T, R, L>impl<E, T, R, L> Iterator for Steps<E, T, R, L> where
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
where
T: Actor<Self::Observation, Self::Action>,
L: StatsLogger,
Self: Sized,
E: Environment,
T: Actor<E::Observation, E::Action>,
R: BorrowMut<Prng>,
L: StatsLogger, type Item = PartialStep<E::Observation, E::Action, E::Feedback>;
Run this environment with the given actor.
sourceimpl<E: Hash> Hash for SecondPlayerView<E>
impl<E: Hash> Hash for SecondPlayerView<E>
sourceimpl<E: PartialEq> PartialEq<SecondPlayerView<E>> for SecondPlayerView<E>
impl<E: PartialEq> PartialEq<SecondPlayerView<E>> for SecondPlayerView<E>
sourcefn eq(&self, other: &SecondPlayerView<E>) -> bool
fn eq(&self, other: &SecondPlayerView<E>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
sourcefn ne(&self, other: &SecondPlayerView<E>) -> bool
fn ne(&self, other: &SecondPlayerView<E>) -> bool
This method tests for !=
.
sourceimpl<E> Serialize for SecondPlayerView<E> where
E: Serialize,
impl<E> Serialize for SecondPlayerView<E> where
E: Serialize,
impl<E: Copy> Copy for SecondPlayerView<E>
impl<E: Eq> Eq for SecondPlayerView<E>
impl<E> StructuralEq for SecondPlayerView<E>
impl<E> StructuralPartialEq for SecondPlayerView<E>
Auto Trait Implementations
impl<E> RefUnwindSafe for SecondPlayerView<E> where
E: RefUnwindSafe,
impl<E> Send for SecondPlayerView<E> where
E: Send,
impl<E> Sync for SecondPlayerView<E> where
E: Sync,
impl<E> Unpin for SecondPlayerView<E> where
E: Unpin,
impl<E> UnwindSafe for SecondPlayerView<E> where
E: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.