MRC-CSO-SPHSU / UKSEABMLib.jl

MIT License
1 stars 1 forks source link

passing the exact sub-population to doX! #21

Open AtiyahElsheikh opened 1 year ago

AtiyahElsheikh commented 1 year ago

Related to #2

Currently, simulation doX! functions assume that the whole population is being passed to the simulation function from which a sub-population (e.g. married women giving births) is subject to birth in each iteration.

An efficient alternative if the client is maintaining subpopulations, e.g.:

Initially, it is thought to provide various interfaces s.a.

function doDeath!() end 
function doDeathAlivePeople!() end
...
function doBirths() end 
function doBirthsWomenSubjectToBirth!()   
... 

Edit: after achieving the traits concept, see below: the interfaces looks as follows:

function dodeaths!(*,::AlivePopulation) end 
function dodeaths(*,::Full Population) end
...
# potential aim: 
function domarriages(*,::MalePopulation) 
function dobirths(*,::ReproducableWomen) 
...

There will be always a default population type if the client does not specify it. That would be FullPopulation type resulting in more checks and less performance.

AtiyahElsheikh commented 1 year ago

This is now accomplished using traits of type PopulationFeature, SE Version 0.2.7

This can be used as within death.jl

practically, the traits controls how the simulation function is computationally simplified when more exact sub-populations are specified.