A multi-method simulation library

Latest on Hackage:5.0.1

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 to host generated Haddocks.

BSD3 licensed by David Sorokin
Maintained by David Sorokin

Aivika is a multi-method simulation library focused on discrete event simulation (DES) with partial support of system dynamics and agent-based modeling.

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 basic core 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 infinite and finite queues based on strategies too;

  • supports the resource preemption;

  • allows defining a queue network based on streams of data (transacts) and their processors;

  • 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).

Aivika itself is a light-weight engine with minimal dependencies. However, it has 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 is more preferable.

The PDF documentation and installation instructions are available on the Aivika Wiki website [5].

Moreover, the method was generalized [6] and applied to nested simulation [7] and parallel distributed simulation [8].

The libraries were tested on Linux, Windows and OS X.

A more full information about Aivika is available on the project website [9].










P.S. Aivika is actually a genuine female Mari name which is pronounced with stress on the last syllable.


Version 5.0

  • 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.

Version 4.6

  • 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.

Version 4.5

  • The Transform computation seems to be not ArrowLoop.

  • Added the enqueueEventWithStartTime and enqueueEventWithStopTime functions.

Version 4.3.5

  • Removed the obsolete preprocessor instructions for conditional compilation.

Version 4.3.4

  • Yet more safe the resource preemption.

  • Introducing exception SimulationRetry, which is needed for parallel distributed simulation.

Version 4.3.3

  • 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.

Version 4.3.2

  • 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.

Version 4.3.1

  • 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.

Version 4.3

  • 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.

Version 4.2

  • 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.

Version 4.1.1

  • More counters and statistics for the new resources.

Version 4.1

  • Added new resource types with counters and statistics.

Version 4.0.2

  • 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.

Version 4.0.1

  • Fixed build issues on GHC 7.10.1.

Version 4.0

  • Added resource preemption.

  • Fixed misprint in the activityProcessor function.

Version 3.1

  • 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.

comments powered byDisqus