Przeglądaj źródła

v2.0.1: tabu tenure bugfix

Jan Potocki 5 lat temu
rodzic
commit
292cd76b9f
2 zmienionych plików z 12 dodań i 12 usunięć
  1. 11
    11
      Graph.cpp
  2. 1
    1
      pea2plus.cpp

+ 11
- 11
Graph.cpp Wyświetl plik

@@ -624,17 +624,17 @@ void Graph::travellingSalesmanTabuSearchEngine(Graph &graph, unsigned tabuSteps,
624 624
             }
625 625
 
626 626
             // Weryfikacja listy tabu...
627
-            // ...aktualizacja kadencji na liscie tabu
628
-            for(int i = 0; i < tabuArray.size(); i++)
629
-            {
630
-                tabuArray.at(i).at(0)--;
631
-            }
632
-
633
-            //...usuniecie zerowych kadencji
634
-            for(int i = 0; i < tabuArray.size(); i++)
635
-            {
636
-                if(tabuArray.at(i).at(0) == 0)
637
-                    tabuArray.erase(tabuArray.begin() + i);
627
+            int tabuPos = 0;
628
+            while(tabuPos < tabuArray.size())
629
+            {   
630
+                // ...aktualizacja kadencji na liscie tabu
631
+                tabuArray.at(tabuPos).at(0)--;
632
+                
633
+                //...usuniecie zerowych kadencji
634
+                if(tabuArray.at(tabuPos).at(0) == 0)
635
+                    tabuArray.erase(tabuArray.begin() + tabuPos);
636
+                else
637
+                    tabuPos++;
638 638
             }
639 639
 
640 640
             // ...dopisanie ostatniego ruchu do listy tabu

+ 1
- 1
pea2plus.cpp Wyświetl plik

@@ -204,7 +204,7 @@ void parseTSPLIB_EUC_2D(const char *filename, Graph **graph)
204 204
 
205 205
 void banner()
206 206
 {
207
-    cout << "PEA Projekt 2 Plus v2.0" << endl;
207
+    cout << "PEA Projekt 2 Plus v2.0.1" << endl;
208 208
     cout << "Jan Potocki 2017-2019" << endl;
209 209
     cout << "(beerware)" << endl;
210 210
 }

Ładowanie…
Anuluj
Zapisz