Flocc
    Preparing search index...

    Interface ExperimentOptions

    Configuration options for an Experiment.

    interface ExperimentOptions {
        maxTicks?: number;
        model: ModelFactory;
        parameters: Record<string, ParameterSpec | any>;
        record?: ExperimentRecordOptions;
        replications?: number;
        seed?: number;
        stopCondition?: (env: Environment) => boolean;
    }
    Index

    Properties

    maxTicks?: number

    Maximum number of ticks to run each simulation.

    1000
    

    Factory function that creates an Environment for each run. Receives parameters and seed for the run.

    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: Record<string, ParameterSpec | any>

    Parameter space to explore. Each key maps to either:

    • An array of values to use
    • A range object { min, max, step } that generates values
    • A single value (constant across all runs)
    parameters: {
    agentCount: [10, 20, 30], // array of values
    speed: { min: 1, max: 3, step: 0.5 }, // range → [1, 1.5, 2, 2.5, 3]
    worldSize: 400, // constant
    }
    record?: ExperimentRecordOptions

    Recording configuration (same format as RecorderOptions, plus 'end' interval). Defaults to interval: 'end' for experiments.

    replications?: number

    Number of replications per parameter combination. Each replication uses a different random seed.

    1
    
    seed?: number

    Base seed for random number generation.

    Seeds are assigned sequentially across all runs in the order they execute (combinations × replications). The Nth run receives seed baseSeed + N. Adding new parameter combinations therefore shifts seeds for subsequent combinations. Use a fixed seed when you need fully reproducible results and keep the parameter space stable between runs.

    0
    
    stopCondition?: (env: Environment) => boolean

    Optional condition to stop a run early. If provided, the run stops when this returns true OR maxTicks is reached.

    stopCondition: (env) => env.getAgents().length === 0