protected Map<String, Double> weightedGoalsScoreByGroup(Map<String, Map<Goal, Double>> scoreMap) {
        Map<String, Double> groupScoreMap = new HashMap<>();
        for (Map.Entry<String, Map<Goal, Double>> entry : scoreMap.entrySet()) {
            String group = entry.getKey();
            Map<Goal, Double> goalScoreMap = entry.getValue();
            double totalWeight = goalScoreMap.keySet().stream().mapToDouble(Goal::weight).sum();
            double weightedScore = goalScoreMap.entrySet().stream()
                    .mapToDouble(e -> e.getValue() * e.getKey().weight() / totalWeight)
                    .sum();
            groupScoreMap.put(group, weightedScore);
        }
        return groupScoreMap;
    }
Calculate the weighted score of an action based on its scores from goals from same group.

@param scoreMap score map from all goals by group
@return the sum of weighted score by group
core/src/main/java/kafka/autobalancer/goals/AbstractGoal.java