Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
@assert_rec(model, parameter_stage1_on, name='stage1_on_rec')
def expected_func(timestep, scenario_index):
if timestep.year < 2027:
return 0
else:
return 1
@assert_rec(m, p)
def expected_func(timestep, scenario_index):
v = s.initial_volume
if v >= 80.0:
expected = 0
else:
expected = 1
return expected
@assert_rec(model, p)
def expected_func(timestep, scenario_index):
x = p1.get_value(scenario_index)
y = p2.get_value(scenario_index)
return func(np.array([x,y]))
@assert_rec(m, s.cost)
def expected_func(timestep, scenario_index):
v = s.initial_volume
if v >= 80.0:
expected = 1.0
elif v >= 60:
expected = 0.7
else:
expected = 0.4
return expected
@assert_rec(model, p)
def expected_func(timestep, scenario_index):
if model.timestepper.current.datetime < pandas.to_datetime(date):
return before.get_value(scenario_index)
else:
return after.get_value(scenario_index)
@assert_rec(model, ts)
def expected(timestep, scenario_index):
return ts.dataframe.loc[timestep.datetime]
@assert_rec(model, parameter)
def expected_func(timestep, scenario_index):
if timestep.year < 2030:
return 1
else:
if scenario_index.global_id < 5:
return 2
else:
return 3
@assert_rec(model, p1)
def expected_func(timestep, scenario_index):
return 0.5 + np.pi*x + 2.5*y+ 0.3*x*y
model.setup()
@assert_rec(model, p)
def expected(timestep, scenario_index):
return (timestep.month - 1) * 0.8
@assert_rec(m, p)
def expected_func(timestep, scenario_index):
return expected_values[timestep.index]