-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.cpp
45 lines (36 loc) · 913 Bytes
/
main.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
//
// Created by LyxnO on 2019/11/16.
//
#include <ctime>
#include <iostream>
#include "tree.h"
#include "network_utils.h"
using namespace std;
using namespace network;
int main(int argc, char *argv[]) {
if (argc < 2) {
auto self = argv[0];
printf("USAGE:\n%s $FILE_NWK [$DEBUG]\n", self);
return 0;
}
auto filename = string(argv[1]);
bool debug = argc >= 3;
clock_t start;
TreeAPI tree{};
tree.debug_ = debug;
start = clock();
int ret = ReadNetwork(filename, tree);
printf("Network TimeCost %ld\n", clock() - start);
if (ret != RET_SUCCESS) {
return ret;
}
start = clock();
tree.InitArtificialBasis();
printf("Basis TimeCost %ld\n", clock() - start);
start = clock();
tree.RunSimplex();
printf("Simplex TimeCost %ld\n", clock() - start);
PrintTree(tree);
PrintArcFlow(tree);
return 0;
}