use crate::traits::entities::{Action, Context, Reward};
pub trait Environment<A, R, C>: Clone + Send + Sync + 'static
where
A: Action,
R: Reward,
C: Context,
{
fn get_context(&self) -> C;
fn get_reward(&self, action: &A, context: &C) -> R;
fn get_optimal_reward(&self, context: &C, actions: &[A]) -> R {
actions
.iter()
.map(|a| self.get_reward(a, context))
.max_by(|r1, r2| r1.value().partial_cmp(&r2.value()).unwrap())
.expect("No actions provided")
}
}