mwg API
    Preparing search index...

    Function runRolloutsAsync

    • One worker per episode shard, with isolated environments and bounded concurrency. A model and environment stay loaded for the shard's whole batch. Returned episodes stay in seed order independent of worker completion order. Abort or failure kills every lane; no partial result is applied to a game. Keep the factory self-contained and pass structured-cloneable configuration, not closures or class instances.

      Type Parameters

      • Config
      • State
      • Command
      • Event

      Parameters

      Returns Promise<RolloutEpisode[]>

      import { runRolloutsAsync, type TrainingFactory } from '@datamoc/mwg/simulation';
      import type { NeuralModel } from '@datamoc/mwg/ai';
      declare const factory: TrainingFactory<{ maxSteps: number }, { x: number }, number, never>;
      declare const model: NeuralModel;
      const episodes = await runRolloutsAsync(factory, { maxSteps: 20 }, model, { seeds: [1, 2], jobs: 2 });