16 #ifndef UTIL_MACROS_DECOMP_INCLUDED
17 #define UTIL_MACROS_DECOMP_INCLUDED
20 #define UTIL_USE_TIMERS
32 #ifdef UTIL_USE_TIMERS
40 #define UtilException(msg,methodN,classN) \
41 CoinError(msg,methodN,classN,__FILE__,__LINE__)
42 #define UtilExceptionMemory(methodN,classN) \
43 UtilException("Out of memory",methodN,classN)
49 #ifdef UTIL_USE_TIMERS
52 const std::string& classTag,
53 const std::string& funcName,
57 const size_t nDashes = 30;
58 std::string funcKey = classTag + funcName;
60 thisFuncTimer.
reset();
62 if (logLevel >= logLimit) {
64 std::string funcBegin =
"<--- " + funcName +
" ";
66 for (i = funcBegin.size(); i < nDashes; i++) {
70 (*os) << std::left << std::setw(9) << classTag <<
": "
71 << std::setprecision(3) << std::setw(8) << globalTimer.
getRealTime()
72 <<
" [CPU: " << std::setprecision(3) << std::setw(8)
73 << globalTimer.
getCpuTime() <<
"] " << funcBegin <<
"\n";
79 const std::string& classTag,
80 const std::string& funcName,
84 const size_t nDashes = 30;
85 std::string funcKey = classTag + funcName;
88 if (logLevel >= logLimit) {
90 std::string funcEnd =
" --- " + funcName +
" ";
92 for (i = funcEnd.size(); i < nDashes; i++) {
97 (*os) << std::left << std::setw(9) << classTag <<
": "
98 << std::setprecision(3) << std::setw(8) << globalTimer.
getRealTime()
99 <<
" [CPU: " << std::setprecision(4) << std::setw(8)
100 << globalTimer.
getCpuTime() <<
"] " << funcEnd <<
" funcT = "
101 << std::setprecision(3) << std::setw(8) << thisFuncTimer.
getCpuTime()
110 const string& classTag,
111 const string& funcName,
115 const int nDashes = 30;
117 if (logLevel >= logLimit) {
119 string funcBegin =
"<--- " + funcName +
" ";
121 for (i = funcBegin.size(); i < nDashes; i++) {
125 (*os) << left << setw(9) << classTag <<
": " << funcBegin <<
"\n";
131 const string& classTag,
132 const string& funcName,
136 const int nDashes = 30;
138 if (logLevel >= logLimit) {
140 string funcEnd =
" --- " + funcName +
" ";
142 for (i = funcEnd.size(); i < nDashes; i++) {
147 (*os) << left << setw(9) << classTag <<
": " << funcEnd <<
"\n";
163 const double boundUB)
165 double gap = DecompInf;
167 if (boundLB > -DecompInf && boundUB < DecompInf) {
168 if (boundLB != 0.0) {
169 gap = fabs(boundUB - boundLB) / fabs(boundLB);
189 std::ostream* os = &std::cout,
193 const std::vector<std::string>& colNames,
194 const double* value = NULL);
CoinPackedVector * UtilPackedVectorFromDense(const int len, const double *dense, const double etol)
double getCpuTime()
Get cpu time.
double UtilCalculateGap(const double boundLB, const double boundUB)
Calculate gap: |(ub-lb)|/|lb|.
static UtilTimer globalTimer
double getRealTime()
Get wallClock time.
void UtilPrintPackedVector(const CoinPackedVector &v, ostream *os=&cout, DecompApp *app=0)
void UtilPrintFuncBegin(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
void UtilPrintFuncEnd(std::ostream *os, const std::string &classTag, const std::string &funcName, const int logLevel, const int logLimit)
static std::map< std::string, UtilTimer > globalTimerFuncMap
The main application class.