Home

David Sorokin edited this page Jun 3, 2016 · 23 revisions
Clone this wiki locally

Welcome to the Aivika wiki!

Introduction

Aivika is a multi-paradigm simulation library written in Haskell. It is mainly focused on modeling and simulation of dynamic systems using the following paradigms:

  • discrete event simulation (event-oriented, process-oriented, activity-oriented);
  • system dynamics (ordinary differential and difference equations);
  • agent-based modeling (a very basic support).

It has additional packages that allow automating the simulation experiments, saving the results in CSV files and plotting the charts.

Documentation

The PDF documentation for Aivika v3.1 is available here:

Aivika 3: Creating a Simulation Library based on Functional Programming

Tutorial

There is a tutorial for beginners:

Aivika Tutorial for Beginners

Installation

To install Aivika on OS X, Linux and MS Windows, the easiest way is to use the recent stable version from the Hackage DB repository with help of Haskell Platform:

$ cabal update

$ cabal install Chart Chart-diagrams

$ cabal install aivika aivika-experiment aivika-experiment-chart aivika-experiment-diagrams

The last line is related to Aivika. The first package aivika is a simulation library. The second package represents a platform for running automated simulation experiments, when the simulation results are exported in the HTML file, which can be then observed in your favorite Internet browser. The third package allows plotting charts when running such experiments. The fourth one can render the charts with help of the Chart-diagrams package.

The first three packages have examples. Probably, the most interesting and illustrative examples are contained in the aivika-experiment-chart package.

There is also another renderer that uses the Chart-cairo library. Then the installation commands look differently:

$ cabal update

$ cabal install gtk2hs-buildtools

$ cabal install Chart Chart-diagrams Chart-cairo

$ cabal install aivika aivika-experiment aivika-experiment-chart aivika-experiment-diagrams aivika-experiment-cairo

In my personal opinion the last renderer creates more beautiful charts. Moreover, they have a significantly less size as they can be saved in the PNG format. This renderer consumes less memory and usually works faster, but it depends on the Linux-oriented cairo library, which is not ideally suited to OS X and especially MS Windows.

Unfortunately, there can be some strange issues with installation when using GHC 7.10.1 and Chart-1.5. I added the lens package and the installation went smooth:

$ cabal install aivika aivika-experiment aivika-experiment-chart aivika-experiment-diagrams aivika-experiment-cairo lens

Developing Client Web Application

The Aivika library can also be compiled to JavaScript and then used in a client Web application, for example, to create a flight simulator.

Earlier I played with haste and recently I tested Aivika with ghcjs.

Consulting

Please contact me if you need my consulting by any question related to Aivika in particular or simulation in general. I can help to develop the simulation models.

Aivika for .NET

Regarding the simulation library, I also released [Aivika for .NET] (https://github.com/dsorokin/aivika-fsharp-ce) of similar capabilities but written in F#. It literally means that you can create simulation models in F# and integrate them with the code written in C#. You can edit your models in Visual Studio on Microsoft Windows, in Xamarin Studio on OS X and in MonoDevelop on Linux.

The .NET version is described in the following PDF document:

[Aivika 3 User Guide: Version for .NET Framework and Mono] (pdf/aivika-user-guide.pdf)

It is worth noting that the Haskell version can do all the described in that document and even can do more, including such things as plotting charts and histograms. The Haskell version is the most complete.

Feedback

The feedback is very welcome.