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

Lack of validation in output variables causes two issues #272

Open
richfitz opened this issue Sep 21, 2022 · 0 comments
Open

Lack of validation in output variables causes two issues #272

richfitz opened this issue Sep 21, 2022 · 0 comments

Comments

@richfitz
Copy link
Member

richfitz commented Sep 21, 2022

Two models that break:

deriv(S) <- Births - b*S - beta * S * I / N 
deriv(I) <- beta * S * I / N - (b+sigma) * I
deriv(R) <- sigma * I - b*R 
 
# initial conditions of the variables
initial(S) <- N - I0
initial(I) <- I0
initial(R) <- 0
 
# parameter values
N <- 1e6                  # total population size
I0 <- user(1)             # num infectious cases at start of epidemic
beta <- R0*(sigma+b)          # transmission parameter
sigma <- user(2)          # recovery rate (1/mean duration infectiousness)
R0 <- user(5)             # av num new cases caused by single infectious case
b <- user(0.02)           # death rate (average life expectancy of 1 year or 52 weeks) = 1/52
Births <- b*N             # number of births (for a constant population size)
 
output(R0) <- S + I + R

this one validates but won't compile (this is not great in the web version, as the user has no indication of what is wrong). There's a slightly different variant if the target of output is a constant rather than user parameter:

deriv(S) <- Births - b*S - beta * S * I / N 
deriv(I) <- beta * S * I / N - (b+sigma) * I
deriv(R) <- sigma * I - b*R 
 
# initial conditions of the variables
initial(S) <- N - I0
initial(I) <- I0
initial(R) <- 0
 
# parameter values
N <- 1e6                  # total population size
I0 <- user(1)             # num infectious cases at start of epidemic
beta <- R0*(sigma+b)          # transmission parameter
sigma <- user(2)          # recovery rate (1/mean duration infectiousness)
R0 <- user(5)             # av num new cases caused by single infectious case
b <- user(0.02)           # death rate (average life expectancy of 1 year or 52 weeks) = 1/52
Births <- b*N             # number of births (for a constant population size)
 
output(N) <- S + I + R

In this case N is full of junk and eventually crashes R.

Not sure what effect these might have in non-C targets but it can't be good either way really.

Also logged as mrc-3628, same issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant