Closed AtiyahElsheikh closed 1 year ago
Currently, the data structure of the model definition in mainHelpers.jl (within LPM.jl V0.2) is deficient. Parameters are not part of the model definition while data is.
Temporarily, this deficiency will be taken into consideration but shall probably be removed in future.
The generic API that will be followed for the various simulation processes would be:
function doX!(model,time,parameters) # operating on a whole model
# ...
end
doX!(model,time) = doX!(model,time,allParameters(model)
&
funcX!(agent,time,model,parameters) # operates on a single agent
when a special set of parameters is needed in an internal function, this will be made clear by accessory functions:
xpars = xParameters(parameters)
Sometimes only the data part of the model is being accessed. In this case, this will be made clear by introducing the sentence
data = dataOf(model) # using this variable throughout function
The outputs of generic functions, if any and needed, will be formatted as a named tuple, i.e.
output1 = .. , output2 = ... , ...
doX!(model,time) = doX!(model,time,allParameters(model)
Rather than making use of a function that is subject to removal (i.e. doX! with three arguments) it could make more sense to rather depend on the internal implementation directly, e.g.
doX!(model,time) = doX_!(model, time, xParametes(parameter), dataOf(model),...)
funcX!(agent,time,model,parameters) # operates on a single agent
the last argument is also not preferred. As it is natural to have parameters as a part of the model data structure (the same with model data being part of the model data structure), preferably the new interface would be better to be reformulated as:
funcX!(agent,time,model) # operates on a single agent
The outputs of generic functions, if any and needed, will be formatted as a named tuple, i.e.
output1 = .. , output2 = ... , ...
funcX!(*)::Bool # process X occurred or not for a person
First draft has been accomplished via PR #29
The tunning of this module is further carried out in issues #28 & #29
currently, the simulation functions takes model as an argument with a fixed data structure. This is to be resolved via an API for model accessory functions.