Commit e7b7c863 authored by Tjerk Vreeken's avatar Tjerk Vreeken

Improve goal scale by problem size

The weighing of goals and path goals should not depend on whether they are
part of the objective or path objective. To make sure it does not, we have
to divide both objectives by the _total_ number of subproblem objectives.
parent c103e18f
......@@ -382,7 +382,8 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
acc_objective = ca.sum1(ca.vertcat(*[o(self, ensemble_member) for o in self.__subproblem_objectives]))
if self.goal_programming_options()['scale_by_problem_size']:
acc_objective = acc_objective / len(self.__subproblem_objectives)
n_objectives = len(self.__subproblem_objectives) + len(self.__subproblem_path_objectives)
acc_objective = acc_objective / n_objectives
return acc_objective
else:
......@@ -393,7 +394,8 @@ class GoalProgrammingMixin(OptimizationProblem, metaclass=ABCMeta):
acc_objective = ca.sum1(ca.vertcat(*[o(self, ensemble_member) for o in self.__subproblem_path_objectives]))
if self.goal_programming_options()['scale_by_problem_size']:
acc_objective = acc_objective / len(self.__subproblem_path_objectives) / len(self.times())
n_objectives = len(self.__subproblem_objectives) + len(self.__subproblem_path_objectives)
acc_objective = acc_objective / n_objectives / len(self.times())
return acc_objective
else:
......
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