Introduction:
The main idea is to "classify population as they age". Let me further explain it with an example:
Example:
There are 50k population (we are not going to care about if male or female for now). Inside these number there are kids [0 - 16], fertile[16 - 40], non-fertile [40 - 100].
Question
Which would be a nice implementation to represent an evolving population data that is better or at least not too resource intensive as my example below?
My Idea
(Pseudo code)
Population[] // Array
Age [0 -> 5] //Array
a pop obj that stores data
Age [5 -> 10]
pop obj
.
.
.
Age[95 - 100]
pop obj
This would be the structure and each tick happens this calculation:
FertilePop.count * fertility rate * (some other stuff) = numberOfBirths
where numberOfBirths
are added to the Age[0-5].obj.count
and the rest of Age[rang]
are subtracted a number and added onto the next Age[rang]
until Age[95 - 100]
where they "die of old age".
Notes:
This is purely background data and i am asking for a better solution/implementation that could be less complex, more dynamic and learn from it.
I expect to be able to do a graph plot so the user sees the pop evolution.
I took my interest in the matter from this link here to a population simulator.
https://niko.roorda.nu/computer-programs/popsim-population-simulation/
Thanks for your interest in this question.