v0.7.0
In this release, we have introduced a new feature: stochastic variables.
To run the model stochastically, set the NUM_STOCHASTIC_SCENARIOS
with the desired number of stochastic scenarios.
settings = {
# ...
"NUM_STOCHASTIC_SCENARIOS": 10,
}
Next define create stochastic variables. These variables that have two parameters: t
and stoch
.
@variable()
def discount_rate(t, stoch):
return assumption["discount_rates"+stoch][t]
@variable()
def pv_premiums(t, stoch):
if t == settings["T_MAX_CALCULATION"]:
return premium(t)
else:
return premium(t) + pv_premiums(t+1, stoch) * discount_rate(t+1, stoch)
These stochastic variables will be calculated 10 times, where stoch
value ranging from 1
to 10
.
The output will show the average result from these scenarios.