-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_generator.cpp
More file actions
32 lines (24 loc) · 793 Bytes
/
test_generator.cpp
File metadata and controls
32 lines (24 loc) · 793 Bytes
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
#include <iostream>
#include <fstream>
#include <random>
#include <string>
int main(int argc, char *argv[]) {
int num_taxi = std::stoi(argv[1]);
int num_passenger = std::stoi(argv[2]);
std::ofstream ofile(argv[3]);
std::random_device rd;
std::default_random_engine randeng(rd());
ofile << num_taxi << "\n";
int MAP_MAX = 1000;
for (int i = 0; i < num_taxi; i++) {
ofile << randeng() % MAP_MAX << " " << randeng() % MAP_MAX << " "
<< randeng() % 2 + 4<< "\n";
}
ofile << num_passenger << "\n";
for (int i = 0; i < num_passenger; i++) {
ofile << i + 1 << " " << randeng() % MAP_MAX << " " << randeng() % MAP_MAX << " "
<< randeng() % MAP_MAX << " " << randeng() % MAP_MAX << " "
<< randeng() % 3 + 1 << "\n";
}
return 0;
}