Commit c103e18f authored by Tjerk Vreeken's avatar Tjerk Vreeken

Fix scale_by_problem_size for path target goals

If a path goal has a target min and/or max, the epsilon will be handled in
the normal objective (not path_objective()). We therefore have to make
sure to also divide by the number of time steps after summing an epsilon
over time if the user has enabled the "scale_by_problem_size" options.
parent c19ab862
......@@ -980,9 +980,10 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
if not goal.critical:
if goal.has_target_bounds:
scale_fac = 1.0 / len(self.times()) if options['scale_by_problem_size'] else 1.0
lambda problem, ensemble_member, goal=goal, epsilon=epsilon: (
goal.weight * ca.sum1(ca.constpow(
lambda problem, ensemble_member, goal=goal, epsilon=epsilon, scale_fac=scale_fac: (
goal.weight * scale_fac * ca.sum1(ca.constpow(
problem.state_vector(, ensemble_member=ensemble_member),
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