-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgenerate_csv_dataset.cpp
211 lines (180 loc) · 8.94 KB
/
generate_csv_dataset.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#include <fstream> // ifstream, ofstream
#include <iostream> // cout
#include <sstream> // stringstream
#include <string> // string, getline
#include <string_view> // string_view
#include <random> // mt19937_64, random_device
#include <chrono> // system_clock
using namespace std;
// абсолютный путь до набора данных
static constexpr auto kDatasetPathQuickSort = string_view{PROJECT_DATASET_DIR_QUICK_SORT};
//static constexpr auto kDatasetPathSelection = string_view{PROJECT_DATASET_DIR_SELECTION_SORT};
int main() {
//const auto pathToSelectionSort = string(kDatasetPathSelection);
const auto pathToQuickSort = string(kDatasetPathQuickSort);
cout << "Dataset path To Data Quick Sort: " << pathToQuickSort << endl;
//cout << "Dataset path To Data SelectionSort: " << pathToSelectionSort << endl;
vector<string> output_streams;
output_streams.emplace_back("/100.csv");
output_streams.emplace_back("/500.csv");
output_streams.emplace_back("/1000.csv");
output_streams.emplace_back("/5000.csv");
output_streams.emplace_back("/10000.csv");
output_streams.emplace_back("/50000.csv");
output_streams.emplace_back("/100000.csv");
output_streams.emplace_back("/500000.csv");
output_streams.emplace_back("/1000000.csv");
vector<int> integers = {100, 500, 1000, 5000, 10000, 50000, 100000, 500000, 1000000};
while (!integers.empty()) {
/*
auto outputStreamSelectionSort01 = ofstream(pathToSelectionSort + "/01" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort02 = ofstream(pathToSelectionSort + "/02" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort03 = ofstream(pathToSelectionSort + "/03" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort04 = ofstream(pathToSelectionSort + "/04" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort05 = ofstream(pathToSelectionSort + "/05" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort06 = ofstream(pathToSelectionSort + "/06" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort07 = ofstream(pathToSelectionSort + "/07" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort08 = ofstream(pathToSelectionSort + "/08" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort09 = ofstream(pathToSelectionSort + "/09" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamSelectionSort10 = ofstream(pathToSelectionSort + "/10" + output_streams.front(), ios::ios_base::trunc);
*/
auto outputStreamQuickSort01 = ofstream(pathToQuickSort + "/01" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort02 = ofstream(pathToQuickSort + "/02" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort03 = ofstream(pathToQuickSort + "/03" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort04 = ofstream(pathToQuickSort + "/04" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort05 = ofstream(pathToQuickSort + "/05" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort06 = ofstream(pathToQuickSort + "/06" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort07 = ofstream(pathToQuickSort + "/07" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort08 = ofstream(pathToQuickSort + "/08" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort09 = ofstream(pathToQuickSort + "/09" + output_streams.front(), ios::ios_base::trunc);
auto outputStreamQuickSort10 = ofstream(pathToQuickSort + "/10" + output_streams.front(), ios::ios_base::trunc);
const auto seed = chrono::system_clock::now().time_since_epoch().count();
auto engine = mt19937(seed); // без seed`а генератор будет выдавать одни и те же значения
auto dist = uniform_int_distribution(0, 10000000); // равновероятное распределение генерируемых чисел
/*
if (outputStreamSelectionSort01) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort01 << dist(engine) << ',';
}
outputStreamSelectionSort01 << dist(engine) << '\n';
}
if (outputStreamSelectionSort02) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort02 << dist(engine) << ',';
}
outputStreamSelectionSort02 << dist(engine) << '\n';
}
if (outputStreamSelectionSort03) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort03 << dist(engine) << ',';
}
outputStreamSelectionSort03 << dist(engine) << '\n';
}
if (outputStreamSelectionSort04) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort04 << dist(engine) << ',';
}
outputStreamSelectionSort04 << dist(engine) << '\n';
}
if (outputStreamSelectionSort05) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort05 << dist(engine) << ',';
}
outputStreamSelectionSort05 << dist(engine) << '\n';
}
if (outputStreamSelectionSort06) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort06 << dist(engine) << ',';
}
outputStreamSelectionSort06 << dist(engine) << '\n';
}
if (outputStreamSelectionSort07) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort07 << dist(engine) << ',';
}
outputStreamSelectionSort07 << dist(engine) << '\n';
}
if (outputStreamSelectionSort08) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort08 << dist(engine) << ',';
}
outputStreamSelectionSort08 << dist(engine) << '\n';
}
if (outputStreamSelectionSort09) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort09 << dist(engine) << ',';
}
outputStreamSelectionSort09 << dist(engine) << '\n';
}
if (outputStreamSelectionSort10) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamSelectionSort10 << dist(engine) << ',';
}
outputStreamSelectionSort10 << dist(engine) << '\n';
}
*/
if (outputStreamQuickSort01) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort01 << dist(engine) << ',';
}
outputStreamQuickSort01 << dist(engine) << '\n';
}
if (outputStreamQuickSort02) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort02 << dist(engine) << ',';
}
outputStreamQuickSort02 << dist(engine) << '\n';
}
if (outputStreamQuickSort03) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort03 << dist(engine) << ',';
}
outputStreamQuickSort03 << dist(engine) << '\n';
}
if (outputStreamQuickSort04) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort04 << dist(engine) << ',';
}
outputStreamQuickSort04 << dist(engine) << '\n';
}
if (outputStreamQuickSort05) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort05 << dist(engine) << ',';
}
outputStreamQuickSort05 << dist(engine) << '\n';
}
if (outputStreamQuickSort06) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort06 << dist(engine) << ',';
}
outputStreamQuickSort06 << dist(engine) << '\n';
}
if (outputStreamQuickSort07) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort07 << dist(engine) << ',';
}
outputStreamQuickSort07 << dist(engine) << '\n';
}
if (outputStreamQuickSort08) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort08 << dist(engine) << ',';
}
outputStreamQuickSort08 << dist(engine) << '\n';
}
if (outputStreamQuickSort09) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort09 << dist(engine) << ',';
}
outputStreamQuickSort09 << dist(engine) << '\n';
}
if (outputStreamQuickSort10) {
for (int counter = 0; counter < integers.front() - 1; counter++) {
outputStreamQuickSort10 << dist(engine) << ',';
}
outputStreamQuickSort10 << dist(engine) << '\n';
}
integers.erase(integers.begin());
output_streams.erase(output_streams.begin());
}
return 0;
}