Optimization, Algorithms, Heuristics, Operations Research, Python.
registry of the best solution is kept. In the end, the best solution is returned. class MultiRandom(RandomChoice): def solve(self, n_iter: int = 10) -> Graph: best_sol = None best_cost = 0 for _ in range(n_iter): G = super().solve() if len(G.N) > best_cost: best_cost = len(G.N) best_sol = G return