Refactor neighbourhood exploration
This commit is contained in:
parent
e3c55ca89f
commit
193e9046eb
|
@ -82,11 +82,14 @@ def get_random_solution(previous, data):
|
||||||
|
|
||||||
|
|
||||||
def explore_neighbourhood(element, data, max_iterations=100000):
|
def explore_neighbourhood(element, data, max_iterations=100000):
|
||||||
neighbour = DataFrame()
|
neighbourhood = []
|
||||||
|
neighbourhood.append(element)
|
||||||
for _ in range(max_iterations):
|
for _ in range(max_iterations):
|
||||||
neighbour, stop_condition = get_random_solution(element, data)
|
previous_solution = neighbourhood[-1]
|
||||||
if stop_condition:
|
neighbour = get_random_solution(previous=previous_solution, data=data)
|
||||||
|
if neighbour.equals(previous_solution):
|
||||||
break
|
break
|
||||||
|
neighbourhood.append(neighbour)
|
||||||
return neighbour
|
return neighbour
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue