![]() |
User Manual, Developers Guide and API Documentation |
![]() |
00001 /******************************************************************************* 00002 * This file is part of openWNS (open Wireless Network Simulator) 00003 * _____________________________________________________________________________ 00004 * 00005 * Copyright (C) 2004-2007 00006 * Chair of Communication Networks (ComNets) 00007 * Kopernikusstr. 16, D-52074 Aachen, Germany 00008 * phone: ++49-241-80-27910, 00009 * fax: ++49-241-80-22242 00010 * email: info@openwns.org 00011 * www: http://www.openwns.org 00012 * _____________________________________________________________________________ 00013 * 00014 * openWNS is free software; you can redistribute it and/or modify it under the 00015 * terms of the GNU Lesser General Public License version 2 as published by the 00016 * Free Software Foundation; 00017 * 00018 * openWNS is distributed in the hope that it will be useful, but WITHOUT ANY 00019 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 00020 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 00021 * details. 00022 * 00023 * You should have received a copy of the GNU Lesser General Public License 00024 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00025 * 00026 ******************************************************************************/ 00027 00028 #ifndef WNS_EVALUATION_STATISTICS_DLRE_HPP 00029 #define WNS_EVALUATION_STATISTICS_DLRE_HPP 00030 00031 #include <WNS/evaluation/statistics/stateval.hpp> 00032 00033 #include <cstdlib> 00034 #include <climits> 00035 #include <cfloat> 00036 #include <iomanip> 00037 00038 namespace wns { namespace evaluation { namespace statistics { 00042 class DLRE : public StatEval 00043 { 00044 public: 00045 00049 DLRE(std::vector<double> xValuesArr, 00050 int level, 00051 double error, 00052 double preFirst, 00053 std::string name, 00054 std::string description, 00055 bool forceRMinusAOk, 00056 int maxNrv, 00057 int skipInterval, 00058 formatType format); 00059 00063 DLRE(double xMin, 00064 double xMax, 00065 double intSize, 00066 double error, 00067 double preFirst, 00068 std::string name, 00069 std::string description, 00070 bool forceRMinusAOk, 00071 int maxNrv, 00072 int skipInterval, 00073 formatType format); 00074 00075 DLRE(const wns::pyconfig::View& config); 00076 00077 ~DLRE(); 00078 00082 class ResultLine 00083 { 00084 public: 00085 ResultLine(); 00086 00087 bool 00088 operator != (const ResultLine& other) const; 00089 00093 double vf_; 00094 00095 double x_; 00096 00097 double relErr_; 00098 00102 double rho_; 00103 00107 double sigRho_; 00108 00112 int nx_; 00113 }; 00114 00118 virtual void 00119 reset(); 00120 00124 void 00125 setBase(double newBase); 00126 00130 virtual void 00131 changeError(double newError); 00132 00136 virtual double 00137 curXLev(); 00138 00142 virtual double 00143 p(double xt); 00144 00149 virtual int 00150 minIndex() const; 00151 00156 virtual int 00157 maxIndex() const; 00158 00162 virtual void 00163 put(double value) = 0; 00164 00168 virtual void 00169 getResultLine(const int index, ResultLine& line) const = 0; 00170 00171 virtual void 00172 print(std::ostream& stream = std::cout) const = 0; 00173 00174 protected: 00175 enum Phase { 00176 initialize, 00177 iterate, 00178 finish} phase_; 00179 00183 class Result 00184 { 00185 public: 00186 Result(); 00187 00188 bool operator != (const Result& other) const; 00189 00193 double x_; 00194 00198 int h_; 00199 00204 int sumh_; 00205 00209 int c_; 00210 }; 00211 00215 int 00216 getIndex(double value) const; 00217 00221 void 00222 printAll(std::ostream& stream, 00223 functionType functionType, 00224 const double yMin) const; 00225 00229 bool checkLargeSample(int index) const; 00230 00234 enum ComparisonResult 00235 { 00236 noIndex = -3, 00237 greater = -2, 00238 lower = -1 00239 }; 00240 00244 enum ReasonType 00245 { 00246 ok, 00247 minimum, 00248 last 00249 }; 00250 00254 Result* results_; 00255 00256 double relErrMax_; 00257 00261 int maxNrv_; 00262 00266 int wastedLeft_; 00267 00271 int wastedRight_; 00272 00276 int h_; 00277 00281 int xOffset_; 00282 00283 double xMin_; 00284 00285 double xMax_; 00286 00287 int indexMin_; 00288 00289 int indexMax_; 00290 00294 bool equiDist_; 00295 00299 double intSize_; 00300 00304 int curIndex_; 00305 00309 double preRv_; 00310 00314 int preIndex_; 00315 00319 double base_; 00320 00324 ReasonType reason_; 00325 00329 int curLevelIndex_; 00330 00335 int skipInterval_; 00336 00340 bool forceRminusAOK_; 00341 00345 static const int largeSampleNumTrials_; 00346 00350 static const int largeSampleNumSortedValues_; 00351 00355 static const int largeSampleNumTransitions_; 00356 00357 private: 00361 void initNonEqui(int level, 00362 std::vector<double> xValuesArr, 00363 double preFirst); 00369 void initEqui(double xMin, 00370 double xMax, 00371 double intSize, 00372 double preFirst); 00373 00374 00375 void printLevel(std::ostream& stream, 00376 int level, 00377 const std::string& errorString, 00378 bool discretePointFlag, 00379 functionType functionType) const; 00380 }; 00381 } // statistics 00382 } // evaluation 00383 } // wns 00384 00385 #endif // WNS_EVALUATION_STATISTICS_DLRE_HPP
1.5.5