1/* 2================================================================================ 3 PROJECT: 4 5 John Eddy's Genetic Algorithms (JEGA) 6 7 CONTENTS: 8 9 Inline methods of class MetricTracker. 10 11 NOTES: 12 13 See notes of MetricTracker.hpp. 14 15 PROGRAMMERS: 16 17 John Eddy (jpeddy@sandia.gov) (JE) 18 19 ORGANIZATION: 20 21 Sandia National Laboratories 22 23 COPYRIGHT: 24 25 See the LICENSE file in the top level JEGA directory. 26 27 VERSION: 28 29 1.0.0 30 31 CHANGES: 32 33 Tue Jul 22 10:29:01 2003 - Original Version (JE) 34 35================================================================================ 36*/ 37 38 39 40 41/* 42================================================================================ 43Document This File 44================================================================================ 45*/ 46/** \file 47 * \brief Contains the inline methods of the MetricTracker class. 48 */ 49 50 51 52 53/* 54================================================================================ 55Includes 56================================================================================ 57*/ 58 59 60 61 62 63 64 65 66/* 67================================================================================ 68Begin Namespace 69================================================================================ 70*/ 71namespace JEGA { 72 namespace Algorithms { 73 74 75 76 77 78 79 80/* 81================================================================================ 82Inline Mutators 83================================================================================ 84*/ 85 86 87 88 89 90 91 92 93/* 94================================================================================ 95Inline Accessors 96================================================================================ 97*/ 98 99 100inline 101std::size_t 102MetricTracker::GetStackDepth( 103 ) const 104{ 105 return this->_stack.size(); 106} 107 108inline 109std::size_t 110MetricTracker::GetStackMaxDepth( 111 ) const 112{ 113 return this->_maxDepth; 114} 115 116inline 117const DoubleStack& 118MetricTracker::GetStack( 119 ) const 120{ 121 return this->_stack; 122} 123 124 125 126 127 128 129/* 130================================================================================ 131Inline Public Methods 132================================================================================ 133*/ 134 135 136inline 137double 138MetricTracker::Top( 139 ) const 140{ 141 return this->_stack.back(); 142} 143 144inline 145double 146MetricTracker::Bottom( 147 ) const 148{ 149 return this->_stack.front(); 150} 151 152inline 153bool 154MetricTracker::IsFull( 155 ) const 156{ 157 return this->_stack.size() == this->_maxDepth; 158} 159 160inline 161void 162MetricTracker::Push( 163 double val 164 ) 165{ 166 this->_stack.push_back(val); 167 this->PruneTheStack(); 168} 169 170inline 171void 172MetricTracker::Pop( 173 ) 174{ 175 this->_stack.pop_back(); 176} 177 178inline 179void 180MetricTracker::PopBottom( 181 ) 182{ 183 this->_stack.erase(this->_stack.begin()); 184} 185 186inline 187double 188MetricTracker::GetPercentDifference( 189 ) const 190{ 191 return this->GetPercentDifference(0, this->_stack.size()-1); 192} 193 194/* 195================================================================================ 196Inline Subclass Visible Methods 197================================================================================ 198*/ 199 200 201 202 203 204 205 206 207/* 208================================================================================ 209Inline Private Methods 210================================================================================ 211*/ 212 213 214 215 216 217 218 219 220/* 221================================================================================ 222Inline Structors 223================================================================================ 224*/ 225 226 227 228 229 230 231 232 233/* 234================================================================================ 235End Namespace 236================================================================================ 237*/ 238 } // namespace Algorithms 239} // namespace JEGA 240