Commit a1a3e66f authored by Jesse VanderWees's avatar Jesse VanderWees 🐘 Committed by Tjerk Vreeken

Fix saving function values of critical goals

Function values of critical goals were not being written to timeseries,
even when the variable function_value_timeseries_id was set.
parent 25856836
......@@ -1025,9 +1025,6 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
# Re-add constraints, this time with epsilon values fixed
for ensemble_member in range(self.ensemble_size):
for j, goal in enumerate(goals):
if goal.critical:
continue
if (
not goal.has_target_bounds or
goal.violation_timeseries_id is not None or
......@@ -1042,6 +1039,9 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
goal.function_value_timeseries_id,
np.full_like(times, function_value), ensemble_member)
if goal.critical:
continue
if goal.has_target_bounds:
epsilon = self.__results[ensemble_member][
'eps_{}_{}'.format(i, j)]
......@@ -1073,9 +1073,6 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
goal, epsilon, ensemble_member, options)
for j, goal in enumerate(path_goals):
if goal.critical:
continue
if (
not goal.has_target_bounds or
goal.violation_timeseries_id is not None or
......@@ -1090,6 +1087,9 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
if goal.function_value_timeseries_id is not None:
self.set_timeseries(goal.function_value_timeseries_id, function_value, ensemble_member)
if goal.critical:
continue
if goal.has_target_bounds:
epsilon = self.__results[ensemble_member][
'path_eps_{}_{}'.format(i, j)]
......
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