Exemple #1
0
    def new(self, problem: Problem):
        if len(self.population) > 0:
            # If we have more solutions to inject, return one from the list
            return self.population.pop()
        else:
            # Otherwise generate a new solution
            solution = problem.create_solution()

        return solution
Exemple #2
0
 def new(self, problem: Problem):
     return problem.create_solution()