Changeset 673
- Timestamp:
- Jul 3, 2007 10:32:37 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/devel/Cbc/src/CbcModel.cpp
r672 r673 63 63 64 64 #include "CoinTime.hpp" 65 static inline double CoinCpuTimeJustChildren() 66 { 67 double cpu_temp; 68 #if defined(_MSC_VER) || defined(__MSVCRT__) 69 unsigned int ticksnow; /* clock_t is same as int */ 70 71 ticksnow = (unsigned int)clock(); 72 73 cpu_temp = (double)((double)ticksnow/CLOCKS_PER_SEC); 74 #else 75 struct rusage usage; 76 # ifdef ZEROFAULT 77 usage.ru_utime.tv_sec = 0 ; 78 usage.ru_utime.tv_usec = 0 ; 79 # endif 80 getrusage(RUSAGE_CHILDREN,&usage); 81 cpu_temp = usage.ru_utime.tv_sec; 82 cpu_temp += 1.0e-6*((double) usage.ru_utime.tv_usec); 83 #endif 84 return cpu_temp; 85 } 65 86 #include "CoinMpsIO.hpp" 66 87 … … 1575 1596 Check for abort on limits: node count, solution count, time, integrality gap. 1576 1597 */ 1577 totalTime = CoinCpuTime()-dblParam_[CbcStartSeconds];1598 totalTime = getCurrentSeconds() ; 1578 1599 if (!(numberNodes_ < intParam_[CbcMaxNumNode] && 1579 1600 numberSolutions_ < intParam_[CbcMaxNumSol] && … … 2230 2251 for (i=0;i<numberThreads_;i++) 2231 2252 time += threadInfo[i].timeInThread; 2232 bool goodTimer = time<( CoinCpuTime() - dblParam_[CbcStartSeconds]);2253 bool goodTimer = time<(getCurrentSeconds()); 2233 2254 for (i=0;i<numberThreads_;i++) { 2234 2255 while (threadInfo[i].returnCode==0) { … … 2287 2308 delete [] threadCount; 2288 2309 mutex_=NULL; 2310 // adjust time to allow for children on some systems 2311 dblParam_[CbcStartSeconds] -= CoinCpuTimeJustChildren(); 2289 2312 } 2290 2313 #endif … … 4526 4549 sumChangeObjective1_ += solver_->getObjValue()*solver_->getObjSense() 4527 4550 - objectiveValue ; 4528 if ( CoinCpuTime()-dblParam_[CbcStartSeconds]> dblParam_[CbcMaximumSeconds] )4551 if ( getCurrentSeconds() > dblParam_[CbcMaximumSeconds] ) 4529 4552 numberTries=0; // exit 4530 4553 //if ((numberNodes_%100)==0) … … 5307 5330 } 5308 5331 feasible = resolve(node ? node->nodeInfo() : NULL,2) ; 5309 if ( CoinCpuTime()-dblParam_[CbcStartSeconds]> dblParam_[CbcMaximumSeconds] )5332 if ( getCurrentSeconds() > dblParam_[CbcMaximumSeconds] ) 5310 5333 numberTries=0; // exit 5311 5334 # ifdef CBC_DEBUG
Note: See TracChangeset
for help on using the changeset viewer.