[Haskell-cafe] [ANN] Aivika: Branching Discrete Event Simulation in Haskell

David Sorokin david.sorokin at gmail.com
Fri Jan 29 17:58:00 UTC 2016

Hi Cafe,

I’m glad to announce the release of three my simulation libraries [1, 2, 3]. I would like to tell more about the third library especially.

The aivika-brances package [3] is new. It allows creating branches to run nested simulations within simulation so that the source simulation remains intact. It allows us to forecast the behavior looking into the future of the model.

There is a similar method in the financial modeling, when estimating the option instrument. We build a tree of future possible changes to estimate the present value. The present depends on the future.

My library allows building the same tree of nested simulations. At the same time, this is a general purpose discrete event simulation library with such things as random streams of orders (transacts), limited resources, queues, discontinuous processes, the global event queue, event-based activities and so on. I think that we can create very sophisticated simulation models with elements of prediction and forecasting. Probably, the library can be useful for financial modeling.

Initially, a few years ago I created the aivika simulation package [1] trying to repeat what other simulation libraries and software vendors provided in the field. Then an year or two ago I generalized my simulation library and created package aivika-transformers [2] with wide use of monad transformers and type families. I actually had plans to use that second package for the distributed and parallel discrete event simulation, but the package was so general that I could use it for what I would call a «branching discrete event simulation». Today I finished my third package aivika-branches, which is a very small additional package that introduces a new computation and a couple of new functions, where the main function is as follows:

  futureEvent :: Double -> Event BrIO a -> Event BrIO a

It creates a new independent branch of the current simulation and then returns the result of the specified event-based computation in the desired time point, leaving the current computation intact. All pending events will be processed in the derived branch as if it were the current simulation.

The very important thing is that the futureEvent function is relatively cheap. It was possible thanks to wide using the functional programming approach in my libraries. We can clone the simulation world as many times as we need for running nested simulations within simulation and it works. Frankly speaking, I don’t know of other general purpose simulation libraries that would offer the same functionality.

I’m looking forward to hearing of your comments. Especially, I would be interested to participate in the projects related to simulation and modeling. I think that Haskell allows doing fantastic things here!

Best regards,
David Sorokin

[1] http://hackage.haskell.org/package/aivika
[2] http://hackage.haskell.org/package/aivika-transformers
[3] http://hackage.haskell.org/package/aivika-branches

More information about the Haskell-Cafe mailing list