Only parameterize and discretize variables when they are called by solution[variable_name]
#2242
Labels
difficulty: hard
Will take several weeks
Currently, we only evaluate a variable the first time it is called by by
solution[variable_name]
(here)The motivation is that evaluating every single variable is slow and unnecessary if we're not going to evaluate the variables.
We could go further with this and only process (set parameters, discretize) when it is called. Most of the model processing time is spent processing variables, so this would speed up model processing a lot.
This would require storing the
ParameterValues
andDiscretisation
objects as attributes of the processed model, which I think @martinjrobins said wasn't ideal, but would it be worth it?Implementing this should be quite straightforward:
model.variables
dict) inParameterValues
andDiscretisation
classesParameterValues
andDiscretisation
as attributes of the processed model at the end of theprocess_model
function in each of these classesSolution.update
, replacewith something like
The text was updated successfully, but these errors were encountered: