A multi-method simulation library http://www.aivikasoft.com
|Latest on Hackage:||5.9|
This package is not currently in any snapshots. If you're interested in using it, we recommend adding it to Stackage Nightly. Doing so will make builds more reliable, and allow stackage.org to host generated Haddocks.
Aivika is a discrete event simulation (DES) framework with support of activity-oriented, event-oriented and process-oriented paradigms. It supports resource preemption and other improved simulation techniques. There is also a partial support of system dynamics and agent-based modelling. All the complexity is hidden under easy-to-use computations.
The represented package is a basic simulation library optimized for sequential execution. There are also packages for nested and parallel distributed simulation.
The library has the following features:
allows defining recursive stochastic differential equations of system dynamics (unordered as in maths via the recursive do-notation);
supports the event-driven paradigm of DES as a basis for implementing other paradigms;
supports extensively the process-oriented paradigm of DES with an ability to resume, suspend and cancel the discontinuous processes;
allows working with the resources based on specified queue strategies (FCFS/FIFO, LCFS/LIFO, SIRO, static priorities and so on);
allows customizing the unbounded and bounded queues based on strategies too;
supports the resource preemption;
allows defining a queue network based on streams of data (transacts);
allows using a GPSS-like DSL with help of the additional library;
allows simulating circuits with recursive links and delays;
supports the activity-oriented paradigm of DES;
supports basic constructs for the agent-based modeling such as agents, states, timeout and timer handlers;
allows creating combined discrete-continuous models as all parts of the library are well integrated and this is reflected directly in the type system;
the arrays of simulation variables are inherently supported;
supports the Monte-Carlo simulation;
the simulation model can depend on external parameters;
uses extensively signals for notification;
allows gathering statistics in time points;
hides technical details in high-level simulation computations (monads, streams and arrows).
The simulation engine itself has minimal dependencies. However, there are additional packages [1, 2] that offer the following features:
automating simulation experiments;
saving the results in CSV files;
plotting the deviation chart by rule 3-sigma, histogram, time series, XY chart;
collecting the summary of statistical data;
parallel execution of the Monte-Carlo simulation;
has an extensible architecture.
The charting package has two interchangeable back-ends [3, 4], where one of them uses Cairo and it creates small PNG images, while another creates more detailed SVG files and it can be used on Windows.
There are also additional packages that allow saving the results of simulation in SQL databases. Then the results can be accessed from other software applications. For example, it can be useful when creating flight simulators in other programming languages such as C# or Java.
Moreover, the method was generalized  and applied to nested simulation  and parallel distributed simulation .
The libraries were tested on Linux, Windows and OS X.
The PDF documentation, installation instructions and a more full information about Aivika are available on the the AivikaSoft website .
P.S. Aivika is actually a genuine female Mari name which is pronounced with stress on the last syllable.
- Added the support of GHC 8.6 and dropped the support of old versions that do not have Monad.Fail.
- Satisfying a new requirement of the MonadMask class type.
- Implemented MonadMask and MonadCatch for basic simulation computations.
- Lars Kuhtz added the support of GHC 8.4.
Added the 4th order Runge-Kutta 3/8-method.
Added experimental functions delayByDT and delayIByDT.
- A more correct treating of the stop time. Earlier, the final integration time point was used instead of the stop time in some functions.
- Increased the speed of simulation.
Introduced the result source titles, which can be useful when plotting the charts.
Added functions newSignalInTimeGrid and timeGrid.
- Significantly improved in the examples the speed of simulation after using the mwc-random package by Bryan O’Sullivan for generating random numbers. It was possible to use custom random number generators before, but now the mentioned generator is used by default. Also the type signature of the SimpleGeneratorWithSeed data constructor has changed.
- Updated the pure-functional priority queue so that the events could be yielded in the distributed simulation module too.
Includes changes destined for Aivika Exension Pack.
Minor changes in the resource preemption statistics.
Added the statistics reset.
Added the Composite monad.
Added the Channel computation.
Breaking change: modified signatures of functions signalStream and streamSignal.
Breaking change: the signalProcessor function is replaced with channelProcessor.
Breaking change: the processorSignaling function is replaced with processorChannel.
Added module Signal.Random.
Added functions arrivalTimerSignal and arrivalTimerChannel.
Added functions queuedSignalStream, queuedProcessorChannel and queuedChannelProcessor.
Updated module DoubleLinkedList.
Breaking change: arrows Net and Processor are trying to perform computations in parallel as possible, when using the proc notation. Earlier they executed sequentially.
The Transform computation seems to be not ArrowLoop.
Added the enqueueEventWithStartTime and enqueueEventWithStopTime functions.
- Removed the obsolete preprocessor instructions for conditional compilation.
Yet more safe the resource preemption.
Introducing exception SimulationRetry, which is needed for parallel distributed simulation.
Added function vectorDeleteRange to remove the range of elements from the mutable vector.
Fixed the resource preemption when releasing and requesting again for the resource at the same modeling time.
Added functions splitStreamFiltering, splitStreamFilteringQueueing to filter when splitting the input stream.
Explicit exporting function newRandomGenerator01 for generating random numbers by the specified custom generator returning numbers from 0 to 1.
Added function freezeList for the double linked list.
Added an immutable priority queue.
Improved the timeoutProcessUsingId function: no need in additional cancellation signal. Thanks to Gabriel Garcia who pointed to this issue and suggested a possible solution.
Added functions delaySignal and delaySignalM to delay a signal in time through the event queue.
Added function runSimulationByIndex to run the simulation with an arbitrary run index.
Added optimised queues which have no counters nor signals.
Added assembling functions for streams.
Added the operation activity as a simplification of server.
Added new functions for the queues.
Added new random distributions: lognormal, Gamma, Beta, Weibull and a generic discrete by pdf.
The items can be removed from the queue; moreover, the queue can be cleared.
Added a simplified API for accessing the results of simulation.
Added the Gate entity.
- More counters and statistics for the new resources.
- Added new resource types with counters and statistics.
Minor changes in the Statistics module: replacing functions resetSamplingCounter and resetTimingCounter with their general analogs.
Unifying process preemption signals in modules Server and Activity: renaming four signals like that how they are named in the Process module.
The timing statistics (time persistent one) can be normalized to a sampling-based statistics (based upon observation), which allows, for example, building a deviation chart for the queue size.
- Fixed build issues on GHC 7.10.1.
Added resource preemption.
Fixed misprint in the activityProcessor function.
Added functions failoverStream and failoverProcessor to model servers with failures (temporary cancellation of the process with the further repairing of the server).
Added functions joinStream and joinProcessor to simplify the modeling of servers.
Checking the argument, i.e. time period, in the holdProcess function. It must not be negative.
The taskProcess computation behaves exactly like the background process, i.e. now its cancellation leads to immediate cancelling the background process too.
Functions setStateActivation, setStateDeactivation and setStateTransition are redefined as the Event computations instead of Simulation computations.
Refactored and simplified module Results.