Compare commits

...

1 Commits

Author SHA1 Message Date
coolneng d5f9ed4ffb
Refacter neighbourhood exploration 2021-04-15 20:12:05 +02:00
1 changed files with 6 additions and 3 deletions

View File

@ -82,11 +82,14 @@ def get_random_solution(previous, data):
def explore_neighbourhood(element, data, max_iterations=100000):
neighbour = DataFrame()
neighbourhood = []
neighbourhood.append(element)
for _ in range(max_iterations):
neighbour, stop_condition = get_random_solution(element, data)
if stop_condition:
previous_solution = neighbourhood[-1]
neighbour = get_random_solution(previous=previous_solution, data=data)
if neighbour.equals(previous_solution):
break
neighbourhood.append(neighbour)
return neighbour