00001 #include "SMSEMOA_Steady3D_MIES.h" 00002 00003 //------------------------------------------------------------------------------ 00004 // Class SMSEMOA_Steady3D_MIES 00005 //------------------------------------------------- 00006 // Protected Members 00007 00008 /* Normalize Individuals in Q and prepare dataHv */ 00009 void SMSEMOA_Steady3D_MIES::prepComparisonScore(vector<Individual*>& Q) 00010 { 00011 int size = Q.size(); 00012 static vector<int> indices; 00013 if (indices.size() == 0) 00014 { 00015 for (int i = 0; i < size; i++) 00016 indices.push_back(i); 00017 } 00018 00019 /* Normalize to [0,1]->min using Ideal and Nadir points of Individuals in vector Q */ 00020 normalize(indices, size, Q, direction); 00021 00022 /* Prepare dataset to be fed to hv() using normalized F values in normF, excluding the offspring Individuals */ 00023 for (unsigned i = 0; i < numIndividuals-1; i++) 00024 { 00025 for (int j = 0; j < 3; j++) 00026 dataHv[3*i + j] = normF[i][selectFunction[j]]; 00027 } 00028 } 00029 00030 /* Calculates 3D HV contr. approximations for pre-selecting "best" offspring Individual */ 00031 double SMSEMOA_Steady3D_MIES::calcComparisonScore(unsigned offspringIndex) 00032 { 00033 #ifdef DEBUG 00034 cout << "SMSEMOA_Steady3D_MIES::comparisonScore()" << endl; 00035 #endif 00036 00037 /* Add offspring Individual offspringIndex to dataHv */ 00038 for (int j = 0; j < 3; j++) 00039 dataHv[3*(numIndividuals-1) + j] = normF[(numIndividuals-1) + offspringIndex][selectFunction[j]]; 00040 00041 /* Calculate total hypervolume of dataHv; 00042 * dataHv consists of population P and one offspring Individual, 00043 * and optionally excludes the offspring Individual's parent */ 00044 double score = fpli_hv(dataHv, 3, numIndividuals, reference); 00045 00046 return score; 00047 } 00048