def evaluate(self, solution: BinarySolution) -> BinarySolution: current_budget = Interval(0) objectives = self.number_of_objectives * [Interval(0)] for index, bits in enumerate(solution.variables[0]): if bits: current_budget += self.instance_.projects[index][0] for obj in range(0, self.number_of_objectives): objectives[obj] += self.instance_.projects[index][obj + 1] poss = self.budget.poss_greater_than_or_eq(current_budget) if poss < self.get_preference_model(0).chi: solution.constraints = [self.budget - current_budget] else: solution.constraints = [0] solution.budget = current_budget solution.objectives = objectives return solution
def evaluate(self, solution: BinarySolution) -> BinarySolution: budget = 0 objectives = self.number_of_objectives * [0.0] for index, bits in enumerate(solution.variables[0]): if bits: budget += self.instance_.projects[index][0] for obj in range(0, self.number_of_objectives): objectives[obj] += self.instance_.projects[index][obj + 3] solution.objectives = [-obj for obj in objectives] solution.constraints = [self.budget - budget] return solution