Go to the documentation of this file.00001 #include "RobustMEM.h"
00002
00003
00004
00005
00006
00007
00008
00009 void RobustMEM::generateSampleSet()
00010 {
00011 #ifdef DEBUG
00012 cout << "RobustMEM::generateSampleSet()" << endl;
00013 #endif
00014
00015 static int* numNoiseNorm = getNumNoiseNorm(),
00016 * numNoiseUnif = getNumNoiseUnif();
00017
00018 static int numNoise = ((numNoiseNorm != NULL) ? *numNoiseNorm : 0) + ((numNoiseUnif != NULL) ? *numNoiseUnif : 0);
00019
00020 if (LH)
00021 Robust::generateSampleSet_LH(numNoise, numNoiseNorm, numNoiseUnif);
00022 else
00023 Robust::generateSampleSet_MC(numNoise, numNoiseNorm, numNoiseUnif);
00024 }
00025
00026
00027
00028
00029
00030
00031 void RobustMEM::robustSimulate(Individual* I, int* xnom, int numVar)
00032 {
00033 #ifdef DEBUG
00034 cout << "RobustMEM::robustSimulate()" << endl;
00035 #endif
00036
00037 static vector<double>* F = getF();
00038 if (numF == 0)
00039 numF = F->size();
00040 vector<double> F_eff(numF, 0);
00041
00042 for (unsigned i = 0; i < sampleSetSize; i++)
00043 {
00044
00045 simulate(I, xnom, numVar, sampleSet[i]);
00046
00047
00048 for (int j = 0; j < numF; j++)
00049 F_eff[j] += F->at(j);
00050 }
00051
00052
00053 for (int j = 0; j < numF; j++)
00054 F->at(j) = F_eff[j] /= sampleSetSize;
00055
00056 if (I != NULL)
00057 I->F = F_eff;
00058
00059 #ifdef ROBUSTNESS_EVAL
00060
00061 generateSampleSet();
00062 #endif
00063 }
00064