thalerjonathan / chimera

A library for pure functional Agent-Based Simulation in Haskell
GNU General Public License v3.0
13 stars 0 forks source link

Major restructuring #11

Open thalerjonathan opened 6 years ago

thalerjonathan commented 6 years ago

After longer discussions with Henrik Nilsson and Thorsten Altenkirch the following restructurings will be done:

  1. Remove Sequential Update-Strategy: exists only because of "transactional" reasons where agents actions must not interfere with each other e.g. trading with each other or only one agent can be on a cell of the environment at a given time - this can be solved also with a parallel approach using STM. Also it is not natural to FP and causes only problems, also it has nothing in commong with the real world
  2. Remove Environment completely from In/Out in Agent-SF and Simulation Scheduling. Easier to reason, makes environment-access more explicit and unifies it: pro-active environment is then just another agent and can get rid of all the annoying environment-fold / environment-behaviour stuff. If we need read/write access to the environment we simply use STM.
  3. Conversations are now not as directly possible as before where they were only available in the sequential update. Still there is a need for this functionality, which we term now "transactions" between agents. STM should allow us to implement this but we need threads for this which involves then real concurrency which brings an uncontrolled source of non-determinism. But still there is hope: there exists research in which effects where functionally specified and implemented which allowes to "simulate" the effectful behaviour of IO e.g. threads and STM in a deterministic / purely functional way which is a big hope for this approach.
thalerjonathan commented 6 years ago

After experimenting with STM it becomes apparent that it its the right choice for the shared environment but NOT for conversations / Transactions - see Issue #7