def __HYPE(self) -> None: reference_point = BinarySolution(self.__problem.number_of_variables, self.__problem.number_of_objectives, self.__problem.number_of_constraints) reference_point.objectives = [1.0 for _ in range(self.__problem.number_of_objectives)] self.__solver = HYPE( problem=self.__problem, reference_point=reference_point, population_size=POPULATION_SIZE, offspring_population_size=OFFSPRING_SIZE, #mutation=BitFlipMutation(probability=1.0/self.__problem.number_of_variables), mutation=BitFlipMutation(probability=0.035), crossover=SPXCrossover(probability=1.0), termination_criterion=StoppingByEvaluations(max_evaluations=MAX_EVALUATION) )
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
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: solution.objectives = [ func(self, solution) for func in self.objectives ] return solution