Class Simulator<U extends java.io.Serializable,I extends java.io.Serializable,P>
java.lang.Object
es.uam.eps.ir.relison.diffusion.simulation.Simulator<U,I,P>
- Type Parameters:
U
- type of the users.I
- type of the information pieces.P
- type of the parameters.
- All Implemented Interfaces:
java.io.Serializable
public class Simulator<U extends java.io.Serializable,I extends java.io.Serializable,P>
extends java.lang.Object
implements java.io.Serializable
Class for the execution of information propagation simulations.
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description private int
currentPropagated
Number of items that have propagated information in an iteration.private int
currentPropagatingUsers
Number of users that have propagated information in an iteration.private java.lang.Long
currentTimestamp
For time-based simulations, the current timestamp.private Data<U,I,P>
data
The data to use in the simulation.private long
newlyPropagatedInfo
Number of newly propagated information in an iteration.private int
numIter
The current iteration.private Protocol<U,I,P>
protocol
Communication protocol.private SimulationState<U,I,P>
state
Current state of the simulation.private StopCondition<U,I,P>
stop
Stop condition for the simulation. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
initialize(Data<U,I,P> data)
Initializes and prepares the data.void
initialize(Data<U,I,P> data, Simulation<U,I,P> simulation)
Initializes and prepares the data.Simulation<U,I,P>
simulate()
Executes the simulation and stores the results in a file.Simulation<U,I,P>
simulate(java.lang.String backup)
Executes the simulation and stores the results in a file.
-
Field Details
-
stop
Stop condition for the simulation. -
protocol
Communication protocol. -
data
The data to use in the simulation. -
numIter
private int numIterThe current iteration. -
currentPropagated
private int currentPropagatedNumber of items that have propagated information in an iteration. -
currentPropagatingUsers
private int currentPropagatingUsersNumber of users that have propagated information in an iteration. -
newlyPropagatedInfo
private long newlyPropagatedInfoNumber of newly propagated information in an iteration. -
state
Current state of the simulation. -
currentTimestamp
private java.lang.Long currentTimestampFor time-based simulations, the current timestamp.
-
-
Constructor Details
-
Simulator
Full constructor.- Parameters:
protocol
- the communication protocol to apply.stop
- the stop condition of the simulation.
-
-
Method Details
-
initialize
Initializes and prepares the data.- Parameters:
data
- the complete data for the simulation.
-
initialize
Initializes and prepares the data.- Parameters:
data
- the complete data for the simulation.simulation
- the current state of the simulation.
-
simulate
Executes the simulation and stores the results in a file. This method does not backup the simulation.- Returns:
- the simulation evolution.
-
simulate
Executes the simulation and stores the results in a file.- Parameters:
backup
- file where we want to backup the simulation, to prevent errors.- Returns:
- the simulation evolution.
-