|
@@ -17,7 +17,7 @@ const int measureIterations = 10;
|
17
|
17
|
// liczba automatycznych pomiarow
|
18
|
18
|
const int measureNumber = 4;
|
19
|
19
|
// Czas zatrzymania algorytmu tabu search w kazdym z automatycznych pomiarow
|
20
|
|
-const int measureTabuStop[4] = {1, 5, 10, 15};
|
|
20
|
+const int measureTabuStop[4] = {30, 60, 120, 240};
|
21
|
21
|
// Maksymalna odleglosc miast przy automatycznym generowaniu
|
22
|
22
|
const int measureSalesmanDistance = 400;
|
23
|
23
|
|
|
@@ -503,8 +503,8 @@ int main(int argc, char *argv[])
|
503
|
503
|
break;
|
504
|
504
|
case 7:
|
505
|
505
|
{
|
506
|
|
- // PEA 2
|
507
|
|
- // Jan Potocki 2017
|
|
506
|
+ // PEA 2 Plus
|
|
507
|
+ // Jan Potocki 2019
|
508
|
508
|
if(graph != NULL)
|
509
|
509
|
{
|
510
|
510
|
unsigned effectiveTabuLength;
|
|
@@ -519,12 +519,8 @@ int main(int argc, char *argv[])
|
519
|
519
|
effectiveTabuLength = tabuLength;
|
520
|
520
|
}
|
521
|
521
|
|
522
|
|
- double measureResults[measureNumber], measureResultsDiv[measureNumber];
|
523
|
|
- for(int i = 0; i < measureNumber; i++)
|
524
|
|
- {
|
525
|
|
- measureResults[i] = 0;
|
526
|
|
- measureResultsDiv[i] = 0;
|
527
|
|
- }
|
|
522
|
+ int measureResult = -1;
|
|
523
|
+ int measureResultDiv = -1;
|
528
|
524
|
|
529
|
525
|
cout << "Pomiary dla problemu komiwojazera, tabu search" << tabuLength << endl;
|
530
|
526
|
|
|
@@ -552,7 +548,9 @@ int main(int argc, char *argv[])
|
552
|
548
|
routeLength = 0;
|
553
|
549
|
for(int j = 1; j < route.size(); j++)
|
554
|
550
|
routeLength += graph->getWeight(route.at(j - 1), route.at(j));
|
555
|
|
- measureResults[i] += routeLength;
|
|
551
|
+
|
|
552
|
+ if(measureResult = -1 || measureResult > routeLength)
|
|
553
|
+ measureResult = routeLength;
|
556
|
554
|
|
557
|
555
|
// Z dywersyfikacja
|
558
|
556
|
cout << "Pomiar " << measureTabuStop[i] << " [s] (" << krok + 1 << " z " << measureIterations << " z dywersyfikacja)..." << endl;
|
|
@@ -562,16 +560,10 @@ int main(int argc, char *argv[])
|
562
|
560
|
routeLength = 0;
|
563
|
561
|
for(int j = 1; j < route.size(); j++)
|
564
|
562
|
routeLength += graph->getWeight(route.at(j - 1), route.at(j));
|
565
|
|
- measureResultsDiv[i] += routeLength;
|
566
|
|
- }
|
567
|
|
- }
|
568
|
|
-
|
569
|
|
- cout << "Opracowywanie wynikow..." << endl;
|
570
|
563
|
|
571
|
|
- for(int i = 0; i < measureNumber; i++)
|
572
|
|
- {
|
573
|
|
- measureResults[i] = nearbyint(measureResults[i] / measureIterations);
|
574
|
|
- measureResultsDiv[i] = nearbyint(measureResultsDiv[i] / measureIterations);
|
|
564
|
+ if(measureResultDiv = -1 || measureResultDiv > routeLength)
|
|
565
|
+ measureResultDiv = routeLength;
|
|
566
|
+ }
|
575
|
567
|
}
|
576
|
568
|
|
577
|
569
|
cout << "Zapis wynikow..." << endl;
|
|
@@ -581,7 +573,7 @@ int main(int argc, char *argv[])
|
581
|
573
|
salesmanToFile << "czas - bez dywersyfikacji - z dywersyfikacja" << endl;
|
582
|
574
|
for(int i = 0; i < measureNumber; i++)
|
583
|
575
|
{
|
584
|
|
- salesmanToFile << measureTabuStop[i] << " [s]: " << (int)measureResults[i] << ' ' << (int)measureResultsDiv[i] << endl;
|
|
576
|
+ salesmanToFile << measureTabuStop[i] << " [s]: " << measureResult << ' ' << measureResultsDiv << endl;
|
585
|
577
|
}
|
586
|
578
|
salesmanToFile.close();
|
587
|
579
|
|