Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache model-point independent variables #327

Open
zchmielewska opened this issue Oct 7, 2023 · 0 comments
Open

Cache model-point independent variables #327

zchmielewska opened this issue Oct 7, 2023 · 0 comments
Labels
enhancement New feature or request runtime Improve runtime performance

Comments

@zchmielewska
Copy link
Collaborator

zchmielewska commented Oct 7, 2023

If you look at a model, there are variables that are not dependent on the model point.

For example, in the basic term, the model starts with:

@variable()
def duration(t):
    return t//12

@variable()
def inflation_factor(t):
    return (1 + assumption["inflation_rate"])**(t/12)

@variable()
def age(t):
    return main.get("age_at_entry") + duration(t)
    
... 

From these 3 variables, duration and inflation_factor don't differ between model points so we could calculate it only once.

So generally speaking all variables that don't depend on model points data can be calculate only once.

@zchmielewska zchmielewska added the enhancement New feature or request label Oct 16, 2023
@zchmielewska zchmielewska added the runtime Improve runtime performance label Dec 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request runtime Improve runtime performance
Projects
None yet
Development

No branches or pull requests

1 participant