-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
94 lines (85 loc) · 1.93 KB
/
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
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
#include <iostream>
#include <string>
#include "solver.h"
#include "integer_solver.h"
using namespace std;
void disp_help()
{
cout << "This program Solves the optimization problem in which all\n"
"variables are restricted to integer.\n\n"
"An integer linear program in canonical form is expressed as:\n\n"
" maximise *** C_transpose.*x ***\n"
" subject to\n"
" __________________________\n"
" | |\n"
" | Ax <= b |\n"
" | x > 0 |\n"
" | x belong to integer, |\n"
" |__________________________|\n";
}
int autosolve(int m,int n)
{
cout << "Allocating the Space for Solver\n";
return 0;
}
int solve(int m,int n)
{
Solver Isolver(m,n);
return 0;
}
int solve()
{
Integer_solver isolver(NULL);
isolver.print();
isolver.solve();
return 0;
}
int sim_solve()
{
Simplex_solver solver;
solver.print();
solver.solve();
return 0;
}
int main(int argc, char** argv )
{
cout << "Integer Program Solver\n\n";
if (argc == 2)
{
string temp = "--help";
if ( temp.compare(argv[1]) == 0 )
{
disp_help();
return 0;
}
temp ="-s";
if ( temp.compare(argv[1]) == 0 )
{
sim_solve();
return 0;
}
temp = "--auto";
if ( temp.compare(argv[1]) == 0 )
{
return autosolve(20,10);
}
else
{
cout << " [Main Error] Unknown Args \n";
return 1;
}
}
if (argc == 4)
{
string temp = "--auto";
if ( temp.compare(argv[1]) == 0 )
{
return autosolve(20,10);
}
}
else
{
return solve();
}
return 0;
}