Explorar el Código

Fixed crash when entire neighborhood is on tabu list

Jan Potocki hace 5 años
padre
commit
4292c63a15
Se han modificado 1 ficheros con 4 adiciones y 2 borrados
  1. 4
    2
      Graph.cpp

+ 4
- 2
Graph.cpp Ver fichero

@@ -516,7 +516,9 @@ void Graph::travellingSalesmanTabuSearchEngine(Graph &graph, unsigned tabuSteps,
516 516
 
517 517
         while(cheeseSupplied == true)
518 518
         {
519
-            std::vector<unsigned> nextRoute;
519
+            std::vector<unsigned> nextRoute = currentRoute;
520
+            // ...na wszelki wypadek, gdyby cale sasiedztwo bylo na liscie tabu
521
+            // (zeby algorytm sie nie wywalil)
520 522
             int nextRouteLength = -1;
521 523
 
522 524
             std::vector<unsigned> nextTabu(3, 0);
@@ -665,7 +667,7 @@ void Graph::travellingSalesmanTabuSearchEngine(Graph &graph, unsigned tabuSteps,
665 667
                 // Intensyfikacja przeszukiwania przez skrócenie kadencji
666 668
                 // (jezeli w ostatnim przebiegu znaleziono nowe minimum)
667 669
                 currentRoute = optimalRoute;
668
-                currentTabuSteps = tabuSteps / 4;
670
+                currentTabuSteps = tabuSteps; /// 4;
669 671
                 intensification = false;
670 672
                 // PEA 2 Plus
671 673
                 // Jan Potocki 2019

Loading…
Cancelar
Guardar