pub struct Wrapped<T, W> {
pub inner: T,
pub wrapper: W,
}
Expand description
A basic wrapped object.
Consists of the inner object and the wrapper state.
Implementation
To implement a wrapper type, define struct MyWrapper
and implement
impl<T: Environment> Environment for Wrapped<T, MyWrapper>
and
impl<T: EnvStructure> EnvStructure for Wrapped<T, MyWrapper>
.
Fields
inner: T
Wrapped object
wrapper: W
The wrapper
Implementations
Trait Implementations
sourceimpl<EC, W> BuildEnv for Wrapped<EC, W> where
EC: BuildEnv,
W: Clone,
Wrapped<EC::Environment, W>: StructuredEnvironment,
impl<EC, W> BuildEnv for Wrapped<EC, W> where
EC: BuildEnv,
W: Clone,
Wrapped<EC::Environment, W>: StructuredEnvironment,
type Observation = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Observation
type Observation = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Observation
Environment observation type.
type Action = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Action
type Action = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Action
Environment action type.
type Feedback = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Feedback
type Feedback = <<Wrapped<EC, W> as BuildEnv>::Environment as Environment>::Feedback
Environment feedback type.
type ObservationSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::ObservationSpace
type ObservationSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::ObservationSpace
Environment observation space type.
type ActionSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::ActionSpace
type ActionSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::ActionSpace
Environment action space type.
type FeedbackSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::FeedbackSpace
type FeedbackSpace = <<Wrapped<EC, W> as BuildEnv>::Environment as EnvStructure>::FeedbackSpace
Environment feedback space type.
type Environment = Wrapped<<EC as BuildEnv>::Environment, W>
type Environment = Wrapped<<EC as BuildEnv>::Environment, W>
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<EDC, W> BuildEnvDist for Wrapped<EDC, W> where
EDC: BuildEnvDist,
W: Clone,
Wrapped<EDC::EnvDistribution, W>: StructuredEnvDist,
impl<EDC, W> BuildEnvDist for Wrapped<EDC, W> where
EDC: BuildEnvDist,
W: Clone,
Wrapped<EDC::EnvDistribution, W>: StructuredEnvDist,
type Observation = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvDistribution>::Observation
type Action = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvDistribution>::Action
type Feedback = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvDistribution>::Feedback
type ObservationSpace = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvStructure>::ObservationSpace
type ActionSpace = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvStructure>::ActionSpace
type FeedbackSpace = <<Wrapped<EDC, W> as BuildEnvDist>::EnvDistribution as EnvStructure>::FeedbackSpace
type EnvDistribution = Wrapped<<EDC as BuildEnvDist>::EnvDistribution, W>
sourcefn build_env_dist(&self) -> Self::EnvDistribution
fn build_env_dist(&self) -> Self::EnvDistribution
Build an environment distribution instance.
sourceimpl<'de, T, W> Deserialize<'de> for Wrapped<T, W> where
T: Deserialize<'de>,
W: Deserialize<'de>,
impl<'de, T, W> Deserialize<'de> for Wrapped<T, W> where
T: Deserialize<'de>,
W: 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<ED, W> EnvDistribution for Wrapped<ED, W> where
ED: EnvDistribution,
W: Clone,
Wrapped<ED::Environment, W>: Environment,
impl<ED, W> EnvDistribution for Wrapped<ED, W> where
ED: EnvDistribution,
W: Clone,
Wrapped<ED::Environment, W>: Environment,
type State = <<Wrapped<ED, W> as EnvDistribution>::Environment as Environment>::State
type Observation = <<Wrapped<ED, W> as EnvDistribution>::Environment as Environment>::Observation
type Action = <<Wrapped<ED, W> as EnvDistribution>::Environment as Environment>::Action
type Feedback = <<Wrapped<ED, W> as EnvDistribution>::Environment as Environment>::Feedback
type Environment = Wrapped<<ED as EnvDistribution>::Environment, W>
sourcefn sample_environment(&self, rng: &mut Prng) -> Self::Environment
fn sample_environment(&self, rng: &mut Prng) -> Self::Environment
Sample an environment from the distribution. Read more
sourceimpl<E, W> EnvStructure for Wrapped<E, W> where
E: EnvStructure,
W: StructurePreservingWrapper,
impl<E, W> EnvStructure for Wrapped<E, W> where
E: EnvStructure,
W: StructurePreservingWrapper,
type ObservationSpace = <E as EnvStructure>::ObservationSpace
type ActionSpace = <E as EnvStructure>::ActionSpace
type FeedbackSpace = <E as EnvStructure>::FeedbackSpace
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<T: EnvStructure> EnvStructure for Wrapped<T, VisibleStepLimit>
impl<T: EnvStructure> EnvStructure for Wrapped<T, VisibleStepLimit>
type ObservationSpace = StepLimitObsSpace<<T as EnvStructure>::ObservationSpace>
type ActionSpace = <T as EnvStructure>::ActionSpace
type FeedbackSpace = <T as EnvStructure>::FeedbackSpace
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: Environment> Environment for Wrapped<E, LatentStepLimit>
impl<E: Environment> Environment for Wrapped<E, LatentStepLimit>
type State = StepLimitState<<E as Environment>::State>
type State = StepLimitState<<E as Environment>::State>
(inner_state, step_count)
type Observation = <E as Environment>::Observation
type Observation = <E as Environment>::Observation
Observation of the state provided to the agent.
type Action = <E as Environment>::Action
type Action = <E as Environment>::Action
Action selected by the agent.
type Feedback = <E as Environment>::Feedback
type Feedback = <E as Environment>::Feedback
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> Environment for Wrapped<E, TrialEpisodeLimit> where
E: Environment,
E::State: InnerEpisodeDone,
impl<E> Environment for Wrapped<E, TrialEpisodeLimit> where
E: Environment,
E::State: InnerEpisodeDone,
type State = (<E as Environment>::State, u64)
type State = (<E as Environment>::State, u64)
(Inner state, remaining episodes)
type Observation = <E as Environment>::Observation
type Observation = <E as Environment>::Observation
Observation of the state provided to the agent.
type Action = <E as Environment>::Action
type Action = <E as Environment>::Action
Action selected by the agent.
type Feedback = <E as Environment>::Feedback
type Feedback = <E as Environment>::Feedback
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: Environment> Environment for Wrapped<E, VisibleStepLimit>
impl<E: Environment> Environment for Wrapped<E, VisibleStepLimit>
type State = StepLimitState<<E as Environment>::State>
type State = StepLimitState<<E as Environment>::State>
(inner_state, step_count)
type Observation = StepLimitObs<<E as Environment>::Observation>
type Observation = StepLimitObs<<E as Environment>::Observation>
Observation of the state provided to the agent.
type Action = <E as Environment>::Action
type Action = <E as Environment>::Action
Action selected by the agent.
type Feedback = <E as Environment>::Feedback
type Feedback = <E as Environment>::Feedback
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.
impl<T: Copy, W: Copy> Copy for Wrapped<T, W>
impl<T: Eq, W: Eq> Eq for Wrapped<T, W>
impl<T, W> StructuralEq for Wrapped<T, W>
impl<T, W> StructuralPartialEq for Wrapped<T, W>
Auto Trait Implementations
impl<T, W> RefUnwindSafe for Wrapped<T, W> where
T: RefUnwindSafe,
W: RefUnwindSafe,
impl<T, W> Send for Wrapped<T, W> where
T: Send,
W: Send,
impl<T, W> Sync for Wrapped<T, W> where
T: Sync,
W: Sync,
impl<T, W> Unpin for Wrapped<T, W> where
T: Unpin,
W: Unpin,
impl<T, W> UnwindSafe for Wrapped<T, W> where
T: UnwindSafe,
W: 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.