1 /* 2 * Name: rtr.h 3 * Author: Pietro Belotti 4 * 5 * This code is published under the Eclipse Public License (EPL). 6 * See http://www.eclipse.org/legal/epl-v10.html 7 */ 8 9 #ifndef RTR_H 10 #define RTR_H 11 12 #include <sys/time.h> 13 #include <sys/resource.h> 14 #include <unistd.h> 15 16 #include "sparse.h" 17 18 enum {USE_RTR = 0, USE_LOCSRCH}; 19 20 /* 21 * input: the unfeasible LP 22 * output: a char vector containing a MFS 23 */ 24 25 int rtr (sparseLP *lp, char *sol); 26 27 /* 28 * Returns cpu time 29 */ 30 CoinCpuTime()31static inline double CoinCpuTime() 32 { 33 double cpu_temp; 34 35 #if defined(_MSC_VER) 36 unsigned int ticksnow; /* clock_t is same as int */ 37 38 ticksnow = (unsigned int)clock(); 39 40 cpu_temp = (double)((double)ticksnow/CLOCKS_PER_SEC); 41 #else 42 struct rusage usage; 43 getrusage(RUSAGE_SELF,&usage); 44 cpu_temp = usage.ru_utime.tv_sec; 45 cpu_temp += 1.0e-6*((double) usage.ru_utime.tv_usec); 46 #endif 47 48 return cpu_temp; 49 } 50 51 #endif 52