-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathmain.cc
194 lines (146 loc) · 4.58 KB
/
main.cc
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
#include "main.ih"
#include <thread>
/* ======================================
* ======================================
* =====================================
* Final run settings: Based on first argument to run paper results.
*
* argv[1] = 1
* -> Create and run the MDATSP instances of our own benchmark
* argv[2]: A = class A
* argv[2]: B = class B
* argv[2]: C = class C-CC
* argv[2]: D = class C-R
* argv[2]: E = class C-RC
*
*
*
* ======================================= */
/* --------------------------------------------------------
*
* [1] = 0: Run x_ij formulation
* [2]: nDepots
* [3]: nCustomers
* [4]: Instance
* [5..6]: if argument = cap -> include cap sep
* if argument = depot -> include depot sep
* if argument = seq -> depot sep only if cap_sep did not find anything
* both cap and depot could be used, in any order
*
* [1] = 1: Run x_ijk formulation
* [2]: nDepots
* [3]: nCustomers
* [4]: Instance
*
* [1] = 9: generate instances
* [2]: nDepots
* [3]: nCustomers
*
*
* --------------------------------------------------------
*/
int main(int argc, char **argv)
try
{
// ----------------------------
// --- Read input arguments ---
// ----------------------------
string const whichRun(argv[1]);
int instanceType = -1;
int idx_instance = -1;
if (argc == 7)
{
instanceType = stoi(argv[2]);
idx_instance = stoi(argv[3]);
}
// ----------------------------
// --- Run the program ---
// ----------------------------
if (whichRun == string("root"))
{
if (argc != 5)
throw string("Root expects three additional parameters\n[int cutPass, bool withCplexCuts, bool withGurobi] (main.cc)");
int cutPass = stoi(argv[2]);
bool withCplexCuts = stoi(argv[3]);
bool withGurobi = stoi(argv[4]);
run_roots(cutPass, withCplexCuts, withGurobi);
}
else if (whichRun == string("base"))
{
int cutPass = stoi(argv[4]);
int cutA = stoi(argv[5]);
int cutB = stoi(argv[6]);
run_base (instanceType, idx_instance, cutPass, cutA, cutB);
}
else if (whichRun == string("base_withCuts"))
{
int cutPass = stoi(argv[4]);
int cutA = stoi(argv[5]);
int cutB = stoi(argv[6]);
run_base_plusCuts(instanceType, idx_instance, cutPass, cutA, cutB);
}
else if (whichRun == string("base_withGurobi"))
{
int cutPass = stoi(argv[4]);
int cutA = stoi(argv[5]);
int cutB = stoi(argv[6]);
run_base_plusGurobi (instanceType, idx_instance, cutPass, cutA, cutB);
}
else if (whichRun == string("base_withBoth"))
{
int cutPass = stoi(argv[4]);
int cutA = stoi(argv[5]);
int cutB = stoi(argv[6]);
run_base_plusBoth (instanceType, idx_instance, cutPass, cutA, cutB);
}
else if (whichRun == string("run-santos"))
{
int const idx_instance = stoi(argv[2]);
int const determinstic = stoi(argv[3]);
int const idx_rep = stoi(argv[4]);
run_benchmark_santos (idx_instance, determinstic, idx_rep);
}
else if (whichRun == string("process-allSolTime"))
process_allSolTime();
else if (whichRun == string("process-allSolTime"))
process_allSolTime();
else if (whichRun == string("process-compareBoth"))
process_compareBoth();
else if (whichRun == string("process-cuts"))
process_output_files_for_cuts();
else if (whichRun == string("process-roots"))
process_all_roots();
else if (whichRun == string("process"))
process_output_files(stoi(argv[2]));
else if (whichRun == string("process-allSettings-short"))
process_allSettings_short();
else if (whichRun == string("process-allSettings-long"))
process_allSettings_long();
// below for creating instances
else if (stoi(argv[1]) == 1)
{
create_MDATSP_benchmarkA();
create_MDATSP_benchmarkB();
create_MDATSP_benchmarkC_RC();
create_MDAmTSP_benchmarkA();
create_MDAmTSP_benchmarkB();
create_MDAmTSP_benchmarkC_RC();
create_MDACVRP_benchmarkA();
create_MDACVRP_benchmarkB();
create_MDACVRP_benchmarkC_RC();
create_ACLRP_benchmarkA();
create_ACLRP_benchmarkB();
create_ACLRP_benchmarkC_RC();
}
else
throw string("Unknown argument (main.cc)");
}
catch (string const &error)
{
cout << "\n\n--------------------------\n\n" << error << endl << endl;
}
catch (IloException const &error)
{
cout << "\n\n--------------------------\n\n" << error << endl << endl;
cout << error << endl;
}