[Haskell-cafe] How to combine simulations

martin martin.drautzburg at web.de
Mon Aug 31 16:48:01 UTC 2015


Hello all,

I've been trying hard to come up with an idea how to build a DES from smaller parts. So far, I came to the conclusion,
that somewhere there must be an operation which takes an Event and maybe emits an Event (and appends to a log and
updates some state). Those Events whould come from and go to the "environment" the simulation runs in.

My mental model is two billiard tables, which are connected through a hole in the cushion and which each have a player.
When I look at one such table, it would have to respond to Events from its player and from the other table and it would
send events to its player ("all balls at rest") and to the other table.

If I add the other table and the two players then the combined simulation would not emit any events at all and it would
not respond to any events except maybe as START event. It would only depend on its initial state.

But if I add only the player, but not the other table, it would still send events to the other table and respond to
events from that other table.

My problem is the type of Events. I could create a type which encompasses all possible events, but that violates the
idea of composablitly. Somehow I would need to be able to take a system which accepts "player events" and "other table
events", compose it with an other table and end up with a system which only accepts "player events" but no more "other
table events" and similarly for the emitted events. And I don't quite know how to do this.

Hope this makes some sense.

Any pointers (which go beyond "aivika has a simulation component") would also be much appreciated.


More information about the Haskell-Cafe mailing list