00001 00034 #ifndef ABA_DUALBOUND_H 00035 #define ABA_DUALBOUND_H 00036 #include "abacus/intset.h" 00037 class ABA_GLOBAL; 00038 class ABA_DUALBOUND { 00039 public: 00040 00045 ABA_DUALBOUND(ABA_GLOBAL *glob); 00046 00048 ~ABA_DUALBOUND(); 00049 00057 void initialize(int n, bool minIsBest); 00058 00067 void insert(int i, double d); 00068 00073 void remove(int i); 00074 00082 bool better(int i, double d) const; 00083 00092 double best(int *index = 0) const; 00093 00102 double best(double d) const; 00103 00108 double worst() const; 00109 00110 private: 00111 00114 void updateBestAndWorst(); 00115 ABA_GLOBAL *glob_; 00116 ABA_INTSET set_; 00117 double *bounds_; 00118 double best_; 00119 int bestIndex_; 00120 double worst_; 00121 bool minIsBest_; 00122 }; 00123 00124 inline double ABA_DUALBOUND::best(int *index) const 00125 { 00126 if (index) 00127 *index = bestIndex_; 00128 return best_; 00129 } 00130 00131 inline double ABA_DUALBOUND::worst() const 00132 { 00133 return worst_; 00134 } 00135 00136 #endif // ABA_DUALBOUND_H 00137 00138