Package net.sf.tweety.agents.sim
Class GameSimulator<S extends AbstractProtocol & GameProtocol,T extends Agent,R extends MultiAgentSystem<T>>
- java.lang.Object
-
- net.sf.tweety.agents.sim.GameSimulator<S,T,R>
-
- 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
-
-
Constructor Summary
Constructors Constructor Description 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.
-
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.
-
-
-
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 MultiAgentSystemGeneratorprotGenerator
- a protocol generatoragentGenerators
- 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.
-
-