/// Helper function for running experiments.
Helper function for running experiments.
Helper function for running experiments .
pub fn run(
    runner: impl Iterator<Item = Episode>,
    n_episodes: usize,
    logger: Option<Logger>,
) -> Vec<Episode>
{
    let exp = runner.take(n_episodes);
    match logger {
        Some(logger) => exp
            .zip(1..(n_episodes + 1))
            .inspect(|&(ref res, i)| {
                info!(logger, "episode {}", i; res);
            })
            .map(|(res, _)| res)
            .collect(),
        None => exp.collect(),
    }
}
pub fn run ( runner : impl Iterator < Item = Episode > , n_episodes : usize , logger : Option < Logger > , ) -> Vec < Episode > { let exp = runner . take ( n_episodes ) ; match logger { Some ( logger ) => exp . zip ( 1 .. ( n_episodes + 1 ) ) . inspect ( | & ( ref res , i ) | { info ! ( logger " " i res ) ; } ) . map ( | ( res , _ ) | res ) . collect ( ) , None => exp . collect ( ) , } }
Helper function for running experiments.
Helper function for running experiments .
runner
impl Iterator<Item = Episode>
n_episodes
usize
logger
Option<Logger>