pub trait Domain {
type StateSpace: Space;
type ActionSpace: Space;
fn emit(&self) -> Observation<<Self::StateSpace as Space>::Value>;
fn step(
&mut self,
a: <Self::ActionSpace as Space>::Value
) -> Transition<<Self::StateSpace as Space>::Value, <Self::ActionSpace as Space>::Value>;
fn is_terminal(&self) -> bool;
fn reward(
&self,
from: &Observation<<Self::StateSpace as Space>::Value>,
to: &Observation<<Self::StateSpace as Space>::Value>
) -> f64;
fn state_space(&self) -> Self::StateSpace;
fn action_space(&self) -> Self::ActionSpace;
}
Expand description
An interface for constructing reinforcement learning problem domains.
Required Associated Types§
sourcetype StateSpace: Space
type StateSpace: Space
State space representation type class.
sourcetype ActionSpace: Space
type ActionSpace: Space
Action space representation type class.
Required Methods§
sourcefn emit(&self) -> Observation<<Self::StateSpace as Space>::Value>
fn emit(&self) -> Observation<<Self::StateSpace as Space>::Value>
Emit an observation of the current state of the environment.
sourcefn step(
&mut self,
a: <Self::ActionSpace as Space>::Value
) -> Transition<<Self::StateSpace as Space>::Value, <Self::ActionSpace as Space>::Value>
fn step(
&mut self,
a: <Self::ActionSpace as Space>::Value
) -> Transition<<Self::StateSpace as Space>::Value, <Self::ActionSpace as Space>::Value>
Transition the environment forward a single step given an action, a
.
sourcefn is_terminal(&self) -> bool
fn is_terminal(&self) -> bool
Returns true if the current state is terminal.
sourcefn reward(
&self,
from: &Observation<<Self::StateSpace as Space>::Value>,
to: &Observation<<Self::StateSpace as Space>::Value>
) -> f64
fn reward(
&self,
from: &Observation<<Self::StateSpace as Space>::Value>,
to: &Observation<<Self::StateSpace as Space>::Value>
) -> f64
Compute the reward associated with a transition from one state to another.
sourcefn state_space(&self) -> Self::StateSpace
fn state_space(&self) -> Self::StateSpace
Returns an instance of the state space type class.
sourcefn action_space(&self) -> Self::ActionSpace
fn action_space(&self) -> Self::ActionSpace
Returns an instance of the action space type class.