Coordinator
Provides coordination for discrete event simulation of multiple asynchronous simulations.
Default implementation of Manager.
It can run in a single thread or multi-threaded depending on the singleThread
constructor
parameter. In the multi-threaded setting, task completions are reported to the simulations
asynchronously through a new thread (Future
) each time. This allows simulations to run things
concurrently, with the added overhead of thread spawning.
- Value Params
- scheduler
The Scheduler responsible for task allocation at any given time.
- singleThread
Flag to run everything in a single thread or else use
Future
s.- startingTime
The starting timestamp of the entire simulation.
Document{}
Add a new TaskResource to our map of available resources.
Add a new TaskResource to our map of available resources.
- Value Params
- r
The TaskResource to be added.
Add multiple TaskResources in one go.
Add multiple TaskResources in one go.
- Value Params
- r
The sequence of TaskResources to be added.
Add a new simulation to be run.
Add a new simulation to be run.
Publishes a ESimAdd.
- Value Params
- simulation
The Simulation to run.
- t
The timestamp when the simulation needs to start. Must be greater or equal to the current time.
Add a new simulation to be run in the current virtual time.
Add a new simulation to be run in the current virtual time.
Publishes a ESimAdd for each simulation.
- Value Params
- simulation
The Simulation to run.
Adds multiple simulations at the same time.
Adds multiple simulations at the same time.
This is equivalent to mapping addSimulation over the given sequence, but more efficient.
- Value Params
- sims
A sequence of pairs, each consisting of a starting timestamp and a Simulation. Timestamps must be greater or equal to the current time.
Add multiple simulations to be run in the current virtual time.
Add multiple simulations to be run in the current virtual time.
- Value Params
- sims
A sequence of Simulations.
Returns the current virtual time.
Returns the current virtual time.
- Returns
The current virtual time.
Sets a time limit in virtual time for the simulation to end.
Sets a time limit in virtual time for the simulation to end.
- Value Params
- t
The virtual timestamp to end the simulation.
- Note
Once a time limit is placed it cannot be removed. Multiple time limits can be set so that the earliest one will be triggered.
Handles a SimResponse from a simulation.
Handles a SimResponse from a simulation.
- Definition Classes
Adds a simulation to the waiting list.
Adds a simulation to the waiting list.
The manager needs to wait for that simulation to send a SimResponse.
- Definition Classes
Value members
Concrete methods
Adds a new arrival process to the coordinator.
Adds a new arrival process to the coordinator.
- Value Params
- limit
The number of simulation instances to spawn.
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
- t
The virtual timestamp when the arrival process will begin.
Adds a new arrival process to the coordinator at the next arrival time.
Adds a new arrival process to the coordinator at the next arrival time.
- Value Params
- limit
The number of simulation instances to spawn.
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
Adds a new arrival process to the coordinator at the current virtual time.
Adds a new arrival process to the coordinator at the current virtual time.
- Value Params
- limit
The number of simulation instances to spawn.
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
Adds a new infinite arrival process to the coordinator.
Adds a new infinite arrival process to the coordinator.
- Value Params
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
- t
The virtual timestamp when the arrival process will begin.
- Note
This will generate new simulations infinitely. The Coordinator will not terminate unless you add a TimeLimit event via limit.
Adds a new infinite arrival process to the coordinator at the next arrival time.
Adds a new infinite arrival process to the coordinator at the next arrival time.
- Value Params
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
- Note
This will generate new simulations infinitely. The Coordinator will not terminate unless you add a TimeLimit event via limit.
Adds a new infinite arrival process to the coordinator at the current virtual time.
Adds a new infinite arrival process to the coordinator at the current virtual time.
- Value Params
- rate
The arrival rate of the simulation instances.
- simulationGenerator
The generator used to create new instances.
- Note
This will generate new simulations infinitely. The Coordinator will not terminate unless you add a TimeLimit event via limit.
Inherited methods
Publishes an event into the stream.
Publishes an event into the stream.
Sends the event to all subscribers in the HashMap
.
- Definition Classes
- Inherited from
- HashMapPublisher
Performs any cleaning up required when the stream is finished.
Performs any cleaning up required when the stream is finished.
Notifies all subscribers that the stream is done and clears the HashMap
to prevent any
further events being delivered.
- Definition Classes
- Inherited from
- HashMapPublisher
Subscribes an EventHandler to the stream so they can receive events.
Subscribes an EventHandler to the stream so they can receive events.
Adds the subscriber to the HashMap
and calls its onInit
method.
- Definition Classes
- Inherited from
- HashMapPublisher
Unsubscribes an EventHandler to the stream so they can stop receiving events.
Unsubscribes an EventHandler to the stream so they can stop receiving events.
Removes the subscriber from the HashMap
.
- Definition Classes
- Inherited from
- HashMapPublisher
Inherited fields
The HashMap
of subscribers that receive events.
The HashMap
of subscribers that receive events.
- Inherited from
- HashMapPublisher