MRC-CSO-SPHSU / UKSEABMLib.jl

MIT License
1 stars 1 forks source link

Making memoization optional #44

Closed AtiyahElsheikh closed 1 year ago

AtiyahElsheikh commented 1 year ago

In #40 it was shown that replacing memoization with pre-computation did not lead only to cleaner and clearer implementation but also unsurprisingly improved performance.

There are also couple of functionalities where (at least for now) memoization does not show any significant improvement. For example, memoizing

Memoization can be made optional by providing an optional accessory functions , that can be implemented by the client, e.g.

AtiyahElsheikh commented 1 year ago

Two API functions to be implemented by the client wanting to make use of the routine marriage! have been specified:

It is up to the client to use memoization.

AtiyahElsheikh commented 1 year ago

Two API functions to be implemented by the client wanting to make use of the routine marriage! have been specified:

  • share_childless_man(model, ageclass::Int)
  • eligible_women(mode)

It is up to the client to use memoization

For recording, memoization was originally used for the agent-based transition function "marriage!". However, pre-computation and storage in an intermediate variable within the model transition function dox! showed much better performance.