Orchestrates multiple simulation runs with parameter variations.
const experiment = new Experiment({ model: ({ parameters, seed }) => { utils.seed(seed); const env = new Environment({ width: 400, height: 400 }); for (let i = 0; i < parameters.agentCount; i++) { env.addAgent(new Agent({ speed: parameters.speed })); } return env; }, parameters: { agentCount: [10, 20, 30], speed: { min: 1, max: 2, step: 0.5 }, }, replications: 10, maxTicks: 500, record: { model: { population: (env) => env.getAgents().length, }, },});const results = await experiment.run();console.log(results.summary()); Copy
const experiment = new Experiment({ model: ({ parameters, seed }) => { utils.seed(seed); const env = new Environment({ width: 400, height: 400 }); for (let i = 0; i < parameters.agentCount; i++) { env.addAgent(new Agent({ speed: parameters.speed })); } return env; }, parameters: { agentCount: [10, 20, 30], speed: { min: 1, max: 2, step: 0.5 }, }, replications: 10, maxTicks: 500, record: { model: { population: (env) => env.getAgents().length, }, },});const results = await experiment.run();console.log(results.summary());
0.7.0
Get all parameter combinations that will be tested.
Get the total number of runs that will be executed.
Run the experiment.
Optional callbacks for progress and run completion
Promise resolving to ExperimentResults
Orchestrates multiple simulation runs with parameter variations.
Example
Since
0.7.0