Class GameSimulator<S extends AbstractProtocol & GameProtocol,​T extends Agent,​R extends MultiAgentSystem<T>>

  • Type Parameters:
    T - The actual type of agents.
    S - The actual type of protocols.
    R - The actual type of the multi-agent system.

    public class GameSimulator<S extends AbstractProtocol & GameProtocol,​T extends Agent,​R extends MultiAgentSystem<T>>
    extends java.lang.Object
    This class implements a game simulator. It takes some agent and multi-agent system generators and runs a series of simulations. In each simulation the winner of the game is determined and recorded.
    Author:
    Matthias Thimm
    • Method Summary

      Modifier and Type Method Description
      SimulationResult<S,​T,​R> run​(int repetitions)
      Simulates the game for the given number of repetitions and returns a map indicating which agent generator won how often.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • GameSimulator

        public GameSimulator​(MultiAgentSystemGenerator<T,​R> masGenerator,
                             ProtocolGenerator<S,​T,​R> protGenerator,
                             java.util.List<AgentGenerator<T,​R>> agentGenerators)
        Creates a new GameSimulator for the given MultiAgentSystemGenerator and AgentGenerators.
        Parameters:
        masGenerator - a MultiAgentSystemGenerator
        protGenerator - a protocol generator
        agentGenerators - some AgentGenerators.
    • Method Detail

      • run

        public SimulationResult<S,​T,​R> run​(int repetitions)
                                                throws ProtocolTerminatedException
        Simulates the game for the given number of repetitions and returns a map indicating which agent generator won how often.
        Parameters:
        repetitions - the number of repetitions.
        Returns:
        a map which assigns to each agent generator the number of times an agent generated by it won the game.
        Throws:
        ProtocolTerminatedException - if a protocol is asked to perform a step but has already terminated.