-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathVRP_TS.cpp
39 lines (32 loc) · 946 Bytes
/
VRP_TS.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// TSP_TS.cpp : Defines the entry point for the console application.
//
#include "TabuSearch.h"
#include "VehicleRouteProblem.h"
#include <fstream>
int main()
{
VehicleRouteProblem vrp;
vrp.readCitiesDataFromFileToCitiesMatrix("´ó×÷Òµ1.txt");
TabuSearch* tabu=new TabuSearch(vrp);
int tabu_list_size = 40;
int neighbours_count = 1000;
int steps_without_change = 50;
int steps_with_random_neighbourhood = 10;
tabu->startAlgorithm(tabu_list_size, neighbours_count, steps_without_change, steps_with_random_neighbourhood);
std::ofstream record;
record.open("results.txt");
for (int i = 0; i < tabu->pathStruc.size(); i++)
{
record << "car " << i << " path: ";
for (int j = 0; j < tabu->pathStruc.at(i).size(); j++)
{
record << tabu->pathStruc.at(i).at(j) << " ";
}
record << std::endl;
}
record << tabu->min_cost;
record.close();
delete tabu;
system("pause");
return 0;
}