• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

WDN.h

Go to the documentation of this file.
00001 #ifndef WDN_
00002 #define WDN_
00003 
00004 #include "mies/SerialES/MixedIntegerES.h"
00005 #ifdef MEM
00006 #include "RobustMEM.h"
00007 #endif
00008 #ifdef LHSR
00009 #include "RobustLHSR.h"
00010 #endif
00011 #include "toolkit.h"
00012 
00013 #define EN_ERR_INPUT     302 
00014 #define EN_ERR_OUTPUT    303
00015 
00016 #define HEADER_DIAMETERS "[DIAMETERS]"
00017 #define HEADER_MISC      "[MISC]"
00018 
00019 struct Pipe
00020 {
00021   float length;
00022     
00023   int beginNode,
00024       endNode;
00025 
00026   float roughness;
00027 };
00028 
00029 struct Network
00030 {       
00032   int m, 
00034       n, 
00036       r;
00037 
00039   vector<Pipe> pipe,      
00041                existPipe;
00042 
00044   vector<float> elevation,
00046                 Q;      
00047 };
00048 
00049 struct Diameter
00050 {
00051   float size,
00052         price;
00053 };
00054 
00055 struct DiameterTable:public vector<Diameter> 
00056 { 
00057   int lookupDiameterCode(float diameterSize);
00058 };
00059 
00060 class WDN
00061 #ifdef MEM
00062  :public RobustMEM
00063 #endif
00064 #ifdef LHSR
00065  :public RobustLHSR
00066 #endif
00067 {
00068   public:
00069     WDN(string simInputFileName, string simOutputFileName, double cvDemand_, double cvRoughness_, unsigned sampleSetSize_, bool LH_ = true)
00070 #ifdef MEM
00071     :RobustMEM(sampleSetSize_, LH_)
00072 #endif
00073 #ifdef LHSR
00074     :RobustLHSR(sampleSetSize_)
00075 #endif
00076     {  
00077       cvDemand    = cvDemand_;
00078       cvRoughness = cvRoughness_;
00079       initialize(simInputFileName, simOutputFileName);
00080     }
00081 
00082     void simulate(int* xnom, int nnom) { simulate(NULL, xnom, nnom, NULL); }
00083 
00084     bool isParallelExp() { return parallelExp; }
00085     
00086     vector<double>* getF() { return &F; }
00087 
00088     void getNadirIdeal(vector<double>& nadir, vector<double>& ideal, int numVar);
00089 
00090     virtual ~WDN() { close(); }
00091 
00092   protected:
00093     vector<double> F;
00094 
00095     Network network;
00096     DiameterTable diameterTable;
00097 
00098     float pressureZero,
00099           pressureReq,
00101           convDiamSize;
00102 
00105     bool parallelExp;
00106 
00108     double cvDemand, 
00110            cvRoughness;
00111 
00113     void initialize(string simInputFileName, string simOutputFileName);
00114 
00115     void simulate(Individual* I, int* xnom, int numVar, double* noise); 
00116 
00118     double f1(Individual* I, int* xnom); 
00119 
00121     double f2(vector<float>& pressure); 
00122 
00124     double f3(vector<float>& flow);  
00125 
00127     int* getNumNoiseNorm() { return &network.n; }
00128 
00130     int* getNumNoiseUnif() { if (!parallelExp) return NULL; return &network.m; }
00131 
00133     void close();
00134 };
00135 
00136 #endif

Generated on Tue Oct 4 2011 16:25:19 for WDN by  doxygen 1.7.2