Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/algorithms/stochastic/tabu_search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def search(cities, tabu_list_size, candidate_list_size, max_iter)
current = best_candidate
best = best_candidate if best_candidate[:cost] < best[:cost]
best_candidate_edges.each {|edge| tabu_list.push(edge)}
tabu_list.pop while tabu_list.size > tabu_list_size
tabu_list.shift while tabu_list.size > tabu_list_size
end
puts " > iteration #{(iter+1)}, best=#{best[:cost]}"
end
Expand All @@ -99,4 +99,4 @@ def search(cities, tabu_list_size, candidate_list_size, max_iter)
# execute the algorithm
best = search(berlin52, tabu_list_size, max_candidates, max_iter)
puts "Done. Best Solution: c=#{best[:cost]}, v=#{best[:vector].inspect}"
end
end