Package org.tweetyproject.agents.sim
Class GameSimulator<S extends AbstractProtocol & GameProtocol,T extends Agent,R extends MultiAgentSystem<T>>
java.lang.Object
org.tweetyproject.agents.sim.GameSimulator<S,T,R>
- Type Parameters:
S
- The actual type of protocols.T
- The actual type of agents.R
- The actual type of the multi-agent system.
public class GameSimulator<S extends AbstractProtocol & GameProtocol,T extends Agent,R extends MultiAgentSystem<T>>
extends 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
ConstructorDescriptionGameSimulator
(MultiAgentSystemGenerator<T, R> masGenerator, ProtocolGenerator<S, T, R> protGenerator, List<AgentGenerator<T, R>> agentGenerators) Creates a new GameSimulator for the given MultiAgentSystemGenerator and AgentGenerators. -
Method Summary
Modifier and TypeMethodDescriptionrun
(int repetitions) Simulates the game for the given number of repetitions and returns a map indicating which agent generator won how often.
-
Constructor Details
-
GameSimulator
public GameSimulator(MultiAgentSystemGenerator<T, R> masGenerator, ProtocolGenerator<S, T, R> protGenerator, 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 Details
-
run
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.
-