I am working through the Udemy course "Optimizing Travelling Salesman and Vehicle Routing Problems".
A part of the course is looking at Tabu search as a solution to the vehicle routing problem.
I am wondering whether the last line of code below might be a mistake - i.e. it seems to say that if the best result from the most recent neighbourhood search is not in the Tabu list, then we get rid of it in favour of the best solution so far. Should we not be doing the reverse?
# Aspiration Criteria
if len(Save_Solutions_Here) >= 1:
if Solution_in_Hand in Tabu_List: # If the solution is already in the tabu list
while Solution_in_Hand[0] in Tabu_List[:,0]: # The distance of the solution is the same as one in the tabu list
if Solution_in_Hand[0] < Best_So_Far[0]: # If it is less, then...
Solution_in_Hand = Best_So_Far # It becomes best so far
break # Then break
else:
Solution_in_Hand = OF_Values_all_N_Ordered[t] # If it wasn't less, the current solution becomes what was chosen in the list
t = t+1 # Add one to move to the next element
else:
Solution_in_Hand = Best_So_Far # If solution was not in tabu list, the best so far becomes the current solution*****
Variables:
Save_Solutions_Here = saving the best solutions as the search iterates
Best_So_Far = the best of the best solutions as the search iterates
Solution_in_Hand = the best result from the current neighbourhood search
OF_Values_all_N_Ordered[t] = the t-best result from the current neighbourhood search
Tabu_List = the usual tabu list