com.workflowfm.proter
Type members
Classlikes
Event used to model a repeating process.
Event used to model a repeating process.
An arrival rate is used to indicate when new instances of a simulation should be added to the coordinator.
- Value Params
- count
A counter of the next simulation instance that will be generated
- rate
The arrival rate of the simulation
- simulationGenerator
The simulation generator for getting new instances of a simulation
- time
The timestamp of the event
Asynchronous Simulation implementation with callback functions.
Asynchronous Simulation implementation with callback functions.
Each task needs to be accompanied by a callback function that implements the simulation logic to be followed when the task completes.
A constant value generator.
A constant value generator.
Always generates the same value.
- Value Params
- value
The value to generate.
A constant Long value generator.
A constant Long value generator.
Always generates the same value.
- Value Params
- value
The value to generate.
Provides coordination for discrete event simulation of multiple asynchronous simulations.
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.
Discrete Events that need to be handled by the Coordinator..
Discrete Events that need to be handled by the Coordinator..
A random function sampling some probability distribution to produce a Double
value.
A random function sampling some probability distribution to produce a Double
value.
It can be used to generate a value for simulation parameters (typically duration and cost). It can be a Constant which always provides the same value or any probability distribution.
Distributions must also provide an estimate of the generated values such that can be used in an environment of imperfect knowledge. For example, the Scheduler does not know the actual durations of tasks, which can vary from the expected estimate for various reasons.
Extends AsyncSimulation with callbacks that fulfil a Promise
/Future
.
Extends AsyncSimulation with callbacks that fulfil a Promise
/Future
.
This can be helpful for simulation implementations that use Future
s to capture their
asynchronous logic.
A random function sampling some probability distribution to produce a Long
value.
A random function sampling some probability distribution to produce a Long
value.
It can be used to generate a value for simulation parameters (typically duration). It can be a ConstantLong which always provides the same value or any probability distribution.
Distributions must also provide an estimate of the generated values such that can be used in an environment of imperfect knowledge. For example, the Scheduler does not know the actual durations of tasks, which can vary from the expected estimate for various reasons.
A Lookahead contains information about the order in which tasks run.
A Lookahead contains information about the order in which tasks run.
The structure is immutable. It is built by the simulation and passed to the scheduler where it is used for scheduling by revealing information about future tasks so that look-ahead can be achieved.
A trait that adds Lookahead capabilities to a simulation.
A trait that adds Lookahead capabilities to a simulation.
Works in conjunction with LookaheadScheduler.
Provides a lookahead structure that can be built up by the simulation and then sent to the scheduler for use in making schedules which look into the future to consider upcoming tasks in scheduling.
Response issued when the simulation has completed.
Response issued when the simulation has completed.
- Value Params
- result
The (successful or failed) result of the simulation.
- simulation
The name of the SimulationRef.
Response issued when the simulation is still running and waiting for virtual time to pass.
Response issued when the simulation is still running and waiting for virtual time to pass.
- Value Params
- abort
A sequence of IDs of existing tasks that need to be aborted.
- lookahead
An updated Lookahead structure.
- simulation
The name of the SimulationRef.
- tasks
A sequence of new tasks to be added for scheduling.
Captures the potential responses of a simulation case to an event.
Captures the potential responses of a simulation case to an event.
A simulation is notified by its Manager when relevant events have taken place, such as one of its tasks completing. The simulation can use subclasses of this trait to respond to such notification. The Manager will wait for such a response before it resumes the virtual time.
A manager for a single simulation case.
A manager for a single simulation case.
We view a simulation as a case or workflow of simulated tasks. This class is responsible for keeping track of all the tasks for the corresponding simulation, informing the Coordinator of new tasks to be added and informing the simulation processes when a task is completed.
=Basic Interaction Flow= The interaction flow with the Coordinator is expected as follows:
- The simulation logic starts executing via run.
- Tasks are added via task.
- When the simulation logic finishes producing tasks, it should call ready.
- Eventually, one of the tasks completes and complete is called. The simulation logic resumes execution.
- The simulation may now produce further tasks in reaction to the completed one(s). It can either handle and acknowledge each completed task individually using ack or use ready in one go as above.
- When the simulation logic completes, it can use succeed (instead of ack or ready) to notify the Coordinator of its result.
=Additional Functions= The simulation may also:
- React to things happening to other simulations. It can send a request to
wait
using simWait. The Coordinator will then wait for the Simulation to send new tasks or to complete, as if a task just completed. This needs to happen while the Coordinator is still waiting for the other simulation(s) we are reacting to. - Abort previously added tasks using abort.
- Report completion due to failure using fail.
- Optionally maintain a Lookahead structure of future tasks, returning it through getLookahead.
- Companion
- object
A generator of simulation instances.
A generator of simulation instances.
This is used to model repeating processes, for instance with a given arrival rate.
It generates copies of a SimulationRef. It must ensure that each copy has a unique name and is independent from all other copies. An integer counter is provided as an argument for that purpose, though it is not necessary to use that.
An abstract reference to simulation logic.
An abstract reference to simulation logic.
Includes the basic interface that we expect from a simulation case:
- Starting the simulation.
- Notifying when tasks complete.
- Stopping/aborting the simulation.
A generator of simulation instances.
A generator of simulation instances.
This is used to model repeating processes, for instance with a given arrival rate.
It generates copies of a SimulationRef. It must ensure that each copy has a unique name and is independent from all other copies. An integer counter is provided as an argument for that purpose, though it is not necessary to use that.
A Simulation that simulates a single Task.
A Simulation that simulates a single Task.
- Value Params
- cost
A Distribution for the cost of the Task.
- duration
A Distribution for the duration of the Task.
- interrupt
The Task.interrupt parameter.
- manager
The Manager of the simulation.
- name
The simulation name.
- priority
The explicit priority of the Task.
- resources
The names of the TaskResources the Task will require.
A SimulationGenerator for SingleTaskSimulation instances.
A SimulationGenerator for SingleTaskSimulation instances.
- Value Params
- baseName
The base string (prefix) to use in the name.
- cost
The cost of the task.
- duration
The duration distribution of the task.
- priority
The priority to be given to the task.
- resources
The resources required by the task.
Event fired when a simulation needs to start.
Event fired when a simulation needs to start.
- Value Params
- simulation
The Simulation that needs to start.
- time
The timestamp of the event
A generator/factory of tasks (specifically TaskInstances).
A generator/factory of tasks (specifically TaskInstances).
As a case class, it can be easily manipulated dynamically to alter its values.
Uses Distributions for the duration and cost. These may be based on random variables. The actual values are sampled at task creation time.
Although typically only 1 task is generated, in principle it can generate multiple task instances with the same properties. However, each task generated will have different samples of the Distributions.
- Value Params
- cost
The generator of the cost.
- createTime
A custom creation time. Negative values correspond to the current time.
- duration
The generator of the duration.
- id
An optional unique id of the task. Otherwise a random ID will be used.
- interrupt
The TaskInstance.interrupt property of the task.
- minStartTime
The earliest possible starting time of the task.
- name
The name of the task.
- priority
The explicit priority of the task.
- resources
The resources of this task
- Companion
- object
An instance of a task to be performed in virtual time.
An instance of a task to be performed in virtual time.
- Value Params
- created
The timestamp when this task was created.
- duration
The actual duration of the task.
- estimatedDuration
The estimated duration of the task.
- id
A unique id that separates this task from any other task. A workflow may spawn multiple tasks with the same name, so this is necessary.
- initialCost
A one-off cost of performing this task.
- interrupt
The number of times the task can be interrupted in favour of a more urgent one. This parameter is not currently being used.
- minStartTime
The earliest possible starting time of this task.
- name
A descriptive name.
- priority
The explicit priority of the task.
- resources
The names of the TaskResources required by this task.
- simulation
A unique name of the simulation this task belongs to.
- Note
We expect that task instances are only generated through a Task. The samples of the parameters are generated by the Coordinator. The duration can be specified through random sampling in a Distribution. We store the estimated value as well as the actual sampled value.
A persistent resource to be used by Tasks/TaskInstances.
A persistent resource to be used by Tasks/TaskInstances.
A TaskResource, or simply "resource", corresponds to a persistent resource. Typical examples are human actors or persistent machinery.
Each Task may require a different combination of resources.
Each TaskResource is assumed to have a unique name and a costPerTick
, i.e. the cost (if
any) of using the resource per unit of time.
We say a TaskResource is ''attached'' to a TaskInstance when the task that uses this
resource is being performed. The currentTask
variable holds the task that is currently
attached to the resource (if any) coupled with the virtual timestamp of when it started. A
TaskResource is ''idle''' when it has no tasks attached to it.
The Coordinator calls upon startTask to attach a task to the resource and finishTask to detach it. The Coordinator has full control over the resource and makes all necessary checks to ensure consistent behaviour (e.g. not starting a TaskInstance when another TaskInstance is already attached).
- Value Params
- costPerTick
The cost of using the resource per unit of time.
- name
The name of the resource.
Event fired when a global time limit has been reached.
Event fired when a global time limit has been reached.
- Value Params
- time
The timestamp of the event
A uniform distribution.
A uniform distribution.
Samples a random variable uniformly between min and max.
- Value Params
- max
The maximum possible value.
- min
The minimum possible value.