1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
pub mod hooks;
mod parallel;
mod serial;
pub use hooks::{BuildSimulationHook, GenericSimulationHook, SimulationHook};
pub use parallel::{run_agent_multithread, ParallelSimulator, ParallelSimulatorConfig};
pub use serial::{run_actor, run_agent, SerialSimulator};
use crate::agents::BuildAgentError;
use crate::envs::BuildEnvError;
use crate::logging::TimeSeriesLogger;
use thiserror::Error;
pub trait Simulator {
fn run_simulation(
&mut self,
env_seed: u64,
agent_seed: u64,
logger: &mut dyn TimeSeriesLogger,
) -> Result<(), SimulatorError>;
}
#[derive(Error, Debug)]
pub enum SimulatorError {
#[error("error building agent")]
BuildAgent(#[from] BuildAgentError),
#[error("error building environment")]
BuildEnv(#[from] BuildEnvError),
}