Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #ifndef AlpsHelperFunctions_h_
00024 #define AlpsHelperFunctions_h_
00025
00026 #if defined(NF_DEBGU)
00027 #include <iostream>
00028 #endif
00029 #include <cmath>
00030
00031 #include "CoinTime.hpp"
00032
00033 #include "AlpsTreeNode.h"
00034
00035
00036
00038 class TotalWorkload : public std::unary_function<AlpsTreeNode*, void> {
00039
00040 private:
00041 double totalLoad_;
00042 double incVal_;
00043 double rho_;
00044
00045 public:
00046 TotalWorkload(const double incVal, const double rho)
00047 :
00048 totalLoad_(0.0),
00049 incVal_(incVal),
00050 rho_(rho)
00051 {}
00052
00053 void operator()(AlpsTreeNode*& node) {
00054 totalLoad_ += pow(fabs(incVal_ - node->getQuality()), rho_);
00055 }
00056
00057 double result() const { return totalLoad_; }
00058 };
00059
00060
00062 struct DeletePtrObject
00063 {
00064 template<class T>
00065 void operator()(const T* ptr) const
00066 {
00067 delete ptr;
00068 }
00069 };
00070
00071
00073 inline void AlpsSleep(double sec)
00074 {
00075 double start = CoinCpuTime();
00076 while ( (CoinCpuTime() - start) < sec) { };
00077 }
00078 #endif