15 #ifndef UTIL_MACROS_DECOMP_INCLUDED
16 #define UTIL_MACROS_DECOMP_INCLUDED
19 #define UTIL_USE_TIMERS
31 #ifdef UTIL_USE_TIMERS
39 #define UtilException(msg,methodN,classN) \
40 CoinError(msg,methodN,classN,__FILE__,__LINE__)
41 #define UtilExceptionMemory(methodN,classN) \
42 UtilException("Out of memory",methodN,classN)
48 #ifdef UTIL_USE_TIMERS
51 const std::string& classTag,
52 const std::string& funcName,
56 const size_t nDashes = 30;
57 std::string funcKey = classTag + funcName;
59 thisFuncTimer.
reset();
61 if (logLevel >= logLimit) {
63 std::string funcBegin =
"<--- " + funcName +
" ";
65 for (i = funcBegin.size(); i < nDashes; i++) {
69 (*os) << std::left << std::setw(9) << classTag <<
": "
70 << std::setprecision(3) << std::setw(8) << globalTimer.
getRealTime()
71 <<
" [CPU: " << std::setprecision(3) << std::setw(8)
72 << globalTimer.
getCpuTime() <<
"] " << funcBegin <<
"\n";
78 const std::string& classTag,
79 const std::string& funcName,
83 const size_t nDashes = 30;
84 std::string funcKey = classTag + funcName;
87 if (logLevel >= logLimit) {
89 std::string funcEnd =
" --- " + funcName +
" ";
91 for (i = funcEnd.size(); i < nDashes; i++) {
96 (*os) << std::left << std::setw(9) << classTag <<
": "
97 << std::setprecision(3) << std::setw(8) << globalTimer.
getRealTime()
98 <<
" [CPU: " << std::setprecision(4) << std::setw(8)
99 << globalTimer.
getCpuTime() <<
"] " << funcEnd <<
" funcT = "
100 << std::setprecision(3) << std::setw(8) << thisFuncTimer.
getCpuTime()
109 const string& classTag,
110 const string& funcName,
114 const int nDashes = 30;
116 if (logLevel >= logLimit) {
118 string funcBegin =
"<--- " + funcName +
" ";
120 for (i = funcBegin.size(); i < nDashes; i++) {
124 (*os) << left << setw(9) << classTag <<
": " << funcBegin <<
"\n";
130 const string& classTag,
131 const string& funcName,
135 const int nDashes = 30;
137 if (logLevel >= logLimit) {
139 string funcEnd =
" --- " + funcName +
" ";
141 for (i = funcEnd.size(); i < nDashes; i++) {
146 (*os) << left << setw(9) << classTag <<
": " << funcEnd <<
"\n";
162 const double boundUB,
165 double gap = infinity;
167 if (boundLB > -infinity && boundUB < infinity) {
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.
static UtilTimer globalTimer
double UtilCalculateGap(const double boundLB, const double boundUB, double infinity)
Calculate gap: |(ub-lb)|/|lb|.
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.