-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMain.cpp
More file actions
51 lines (45 loc) · 978 Bytes
/
Copy pathMain.cpp
File metadata and controls
51 lines (45 loc) · 978 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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#ifndef __MAIN__CPP__
#define __MAIN__CPP__
#include <iostream>
#include "Tools.h"
#include "Instance.h"
#include "kMST_ILP.h"
using namespace std;
void usage()
{
cout << "USAGE:\t<program> -f filename -m model [-k <nodes to connect>]\n";
cout << "EXAMPLE:\t" << "./kmst -f data/g01.dat -m scf -k 5\n\n";
exit( 1 );
} // usage
int main( int argc, char *argv[] )
{
// read parameters
int opt;
// default values
string file( "data/g01.dat" );
string model_type( "flow" );
int k = 5;
while( (opt = getopt( argc, argv, "f:m:k:" )) != EOF ) {
switch( opt ) {
case 'f': // instance file
file = optarg;
break;
case 'm': // algorithm to use
model_type = optarg;
break;
case 'k': // nodes to connect
k = atoi( optarg );
break;
default:
usage();
break;
}
}
// read instance
Instance instance( file );
// solve instance
kMST_ILP ilp( instance, model_type, k );
ilp.solve();
return 0;
} // main
#endif // __MAIN__CPP__