diff --git a/src/processing.py b/src/processing.py index 0feb2bd..664f945 100644 --- a/src/processing.py +++ b/src/processing.py @@ -72,6 +72,17 @@ def local_search(n, m, data): for _ in range(m): pass return solutions +def get_random_solution(previous, data): + solution = previous.copy() + worst_index = previous["distance"].astype(float).idxmin() + random_candidate = data.loc[randint(low=0, high=len(data.index))] + while ( + solution.loc[worst_index, "distance"] <= previous.loc[worst_index, "distance"] + ): + solution.loc[worst_index] = random_candidate + return solution + + def execute_algorithm(choice, n, m, data):