-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Labels
enhancementNew feature or requestNew feature or requestmediumWe have estimated that the issue should take an average amount of development time (2 points)We have estimated that the issue should take an average amount of development time (2 points)
Description
DoubleVariables can only store one number per individual. But sometimes you want several numbers to represent a variable. So that you can access and update them together. e.g.
# there are 4 aspects of diarrhoea we want to model
diarrhoea_variables <- list(
DoubleVariable$new(rep(0, parameters$population)), # diarrhoea_bacteria_prior
DoubleVariable$new(rep(0, parameters$population)), # diarrhoea_virus_prior
DoubleVariable$new(rep(0, parameters$population)), # diarrhoea_parasite_prior
DoubleVariable$new(rep(0, parameters$population)) # diarrhoea_rotavirus_prior
)
# in process...
for (v in diarrhoea_variables) {
prior <- v$get_values()
# do something with this aspect of diarrhoea (or perhaps combine with another aspect)
v$queue_update(new_prior, changed_individuals)
}It would be much easier to write:
diarrhoea_priors <- DoubleVectorVariable$new(matrix(0, ncol=4, nrow=parameters$population))
# in process...
priors <- diarrhoea_priors$get_values(
individual_index = NULL, # get all individuals
column_index = NULL # get all columns
)
# process your priors
diarrhoea_priors$queue_update(
values = new_priors # matrix of updated priors
individual_index = NULL, # update all individuals
column_index = NULL # update all columns
) # will update the priors matrix at the end of the timestepReactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or requestmediumWe have estimated that the issue should take an average amount of development time (2 points)We have estimated that the issue should take an average amount of development time (2 points)