Commit bb84fbfd authored by Teresa Piovesan's avatar Teresa Piovesan Committed by Tjerk Vreeken

Fix examples to comply to new funct_range check

User can not specify (anymore) the function range for minimization goals.
Change the examples to comply with the check introduced in commit
e9f500df.
parent 094cdac4
......@@ -13,11 +13,10 @@ from rtctools.util import run_optimization_problem
class WaterVolumeRangeGoal(StateGoal):
def __init__(self, optimization_problem):
# Call super class first, and pass in the optimization problem
super().__init__(optimization_problem)
# Assign V_min and V_max the the target range
self.target_min = optimization_problem.get_timeseries('V_min')
self.target_max = optimization_problem.get_timeseries('V_max')
super().__init__(optimization_problem)
state = 'storage.V'
priority = 1
......
......@@ -34,10 +34,8 @@ class MinimizeQpumpGoal(Goal):
def function(self, optimization_problem, ensemble_member):
return optimization_problem.integral('Q_pump')
# Every goal needs a rough (over)estimate (enclosure) of the range of the
# function defined above. The nominal is used to scale the value returned by
# The nominal is used to scale the value returned by
# the function method so that the value is on the order of 1.
function_range = (0, 540000.0)
function_nominal = 100.0
# The lower the number returned by this function, the higher the priority.
priority = 2
......@@ -52,7 +50,6 @@ class MinimizeChangeInQpumpGoal(Goal):
# step.
def function(self, optimization_problem, ensemble_member):
return optimization_problem.der('Q_pump')
function_range = (-10.0, 10.0)
function_nominal = 5.0
priority = 3
# Default order is 2, but we want to be explicit
......
......@@ -17,11 +17,10 @@ class WaterVolumeRangeGoal(StateGoal):
# goals can be defined when the optimization problem class instantiates
# this goal.
def __init__(self, optimization_problem):
# Call super class first, and pass in the optimization problem
super().__init__(optimization_problem)
# Assign V_min and V_max the the target range
self.target_min = optimization_problem.get_timeseries('V_min')
self.target_max = optimization_problem.get_timeseries('V_max')
super().__init__(optimization_problem)
state = 'storage.V'
priority = 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment