My Project
builddir
build
BUILD
coin-or-OS-2.10.3-build
OS-releases-2.10.3
OS
applications
columnGen
code
OSColGenMain.cpp
Go to the documentation of this file.
1
//===========================================================================//
2
//Id: OSColGenMain.cpp 3561 2010-06-24 19:27:07Z kmartin $
14
//
15
//===========================================================================//
16
17
18
//===========================================================================//
19
#include "
OSColGenApp.h
"
20
#include "
OSFileUtil.h
"
21
#include "CoinTime.hpp"
22
#include "
OSGeneral.h
"
23
24
25
26
#ifdef HAVE_CTIME
27
# include <ctime>
28
#else
29
# ifdef HAVE_TIME_H
30
# include <time.h>
31
# else
32
# error "don't have header file for time"
33
# endif
34
#endif
35
//===========================================================================//
36
37
//===========================================================================//
38
int
main
(
int
argc,
char
** argv){
39
try
{
40
41
42
OSColGenApp
*colgenApp;
43
OSOption
*
osoption
= NULL;
44
OSoLReader
*osolreader = NULL;
45
46
FileUtil
*fileUtil = NULL;
47
std::string osolFileName;
48
std::string osol;
49
50
//there should be 1 argument which is the option file
51
if
(argc > 2) {
52
std::cout <<
"Too Many Input Parameters"
<< std::endl;
53
return
1;
54
}
55
56
if
(argc < 2) {
57
std::cout <<
"usage: parsingtest <filename> "
<< std::endl;
58
return
1;
59
}
60
61
62
// define the classes
63
double
cpuTime;
64
double
masterCpuTime;
65
double
start = CoinCpuTime();
66
fileUtil =
new
FileUtil
();
67
osolFileName = argv[1];
68
osol = fileUtil->
getFileAsString
( osolFileName.c_str());
69
70
// get the option object
71
osolreader =
new
OSoLReader
();
72
osoption
= osolreader->
readOSoL
( osol) ;
73
74
75
//now create the column generation object
76
colgenApp =
new
OSColGenApp
(
osoption
);
77
78
79
//now generate the restriced master
80
//colgenApp->getInitialRestrictedMaster( );
81
82
colgenApp->
getInitialRestrictedMaster
( );
83
84
85
masterCpuTime = CoinCpuTime() - start;
86
87
//exit( 1);
88
//now solve the problem
89
colgenApp->
solve
();
90
91
//garbage collection
92
delete
fileUtil;
93
delete
osolreader;
94
delete
colgenApp;
95
96
cpuTime = CoinCpuTime() - start;
97
98
std::cout <<
"CPU TIME FOR GETTING INITIAL SOLUTION "
<< masterCpuTime << std::endl;
99
100
std::cout <<
"CPU TIME "
<< cpuTime << std::endl;
101
}
102
catch
(
const
ErrorClass
& eclass){
103
std::cout <<
"Something went wrong:"
<< std::endl;
104
std::cout << eclass.
errormsg
<< std::endl;
105
106
return
1;
107
}
108
return
0;
109
}
110
OSColGenApp.h
main
int main(int argc, char **argv)
Definition
OSColGenMain.cpp:38
OSFileUtil.h
OSGeneral.h
osoption
OSOption * osoption
Definition
OSParseosol.tab.cpp:3982
ErrorClass
used for throwing exceptions.
Definition
OSErrorClass.h:32
ErrorClass::errormsg
std::string errormsg
errormsg is the error that is causing the exception to be thrown
Definition
OSErrorClass.h:42
FileUtil
class used to make it easy to read and write files.
Definition
OSFileUtil.h:38
FileUtil::getFileAsString
std::string getFileAsString(const char *fname)
read a file and return contents as a string.
Definition
OSFileUtil.cpp:35
OSColGenApp
Definition
OSColGenApp.h:40
OSColGenApp::getInitialRestrictedMaster
void getInitialRestrictedMaster()
Definition
OSColGenApp.cpp:129
OSColGenApp::solve
void solve()
Definition
OSColGenApp.cpp:268
OSOption
The Option Class.
Definition
OSOption.h:3565
OSoLReader
Used to read an OSoL string.
Definition
OSoLReader.h:38
OSoLReader::readOSoL
OSOption * readOSoL(const std::string &osol)
parse the OSoL solver options.
Definition
OSoLReader.cpp:76
Generated by
1.11.0