Changeset 877 for cpp/frams/model
 Timestamp:
 05/16/19 22:08:18 (5 years ago)
 Location:
 cpp/frams/model/similarity
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

cpp/frams/model/similarity/simil_model.cpp
r872 r877 86 86 double ModelSimil::EvaluateDistanceGreedy(const Geno *G0, const Geno *G1) 87 87 { 88 double dResult = 0 ;88 double dResult = 0.0; 89 89 90 90 m_Gen[0] = G0; 91 91 m_Gen[1] = G1; 92 92 93 // check whether pointers are not NULL 94 if (m_Gen[0] == NULL  m_Gen[1] == NULL) 95 { 96 logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "NULL genotype pointer(s)"); 93 // create models of objects to compare 94 m_Mod[0] = newModel(m_Gen[0]); 95 m_Mod[1] = newModel(m_Gen[1]); 96 97 if (m_Mod[0] == NULL  m_Mod[1] == NULL) 97 98 return 0.0; 98 }99 // create models of objects to compare100 m_Mod[0] = new Model(*(m_Gen[0]));101 m_Mod[1] = new Model(*(m_Gen[1]));102 103 // validate models104 if (m_Mod[0] == NULL  m_Mod[1] == NULL  !(m_Mod[0]>isValid())  !(m_Mod[1]>isValid()))105 {106 logPrintf("ModelSimil", "EvaluateDistanceGreedy", LOG_ERROR, "NULL or invalid model pointer(s)");107 return 0.0;108 }109 99 110 100 // difference in the number of vertices (Parts)  positive … … 537 527 } 538 528 529 Model* ModelSimil::newModel(const Geno *g) 530 { 531 if (g == NULL) 532 { 533 logPrintf("ModelSimil", "newModel", LOG_ERROR, "NULL genotype pointer"); 534 return NULL; 535 } 536 Model *m = new Model(*g); 537 if (!m>isValid()) 538 { 539 logPrintf("ModelSimil", "newModel", LOG_ERROR, "Invalid model for the genotype of '%s'", g>getName().c_str()); 540 delete m; 541 return NULL; 542 } 543 return m; 544 } 545 546 539 547 /** Creates arrays holding information about organisms' Parts (m_aDegrees) andm_Neigh 540 548 fills them with initial data (original indices and zeros). … … 542 550  Models (m_Mod) are created and available. 543 551 */ 544 int ModelSimil:: CreatePartInfoTables()552 int ModelSimil::ModelSimil::CreatePartInfoTables() 545 553 { 546 554 // check assumptions about models … … 2070 2078 double ModelSimil::EvaluateDistanceHungarian(const Geno *G0, const Geno *G1) 2071 2079 { 2072 double dResult = 0 ;2080 double dResult = 0.0; 2073 2081 2074 2082 m_Gen[0] = G0; 2075 2083 m_Gen[1] = G1; 2076 2084 2077 // check whether pointers are not NULL 2078 if (m_Gen[0] == NULL  m_Gen[1] == NULL) 2079 { 2080 logPrintf("ModelSimil", "EvaluateDistanceHungarian", LOG_ERROR, "NULL genotype pointer(s)"); 2085 // create models of objects to compare 2086 m_Mod[0] = newModel(m_Gen[0]); 2087 m_Mod[1] = newModel(m_Gen[1]); 2088 2089 if (m_Mod[0] == NULL  m_Mod[1] == NULL) 2081 2090 return 0.0; 2082 }2083 // create models of objects to compare2084 m_Mod[0] = new Model(*(m_Gen[0]));2085 m_Mod[1] = new Model(*(m_Gen[1]));2086 2087 // validate models2088 if (m_Mod[0] == NULL  m_Mod[1] == NULL  !(m_Mod[0]>isValid())  !(m_Mod[1]>isValid()))2089 {2090 logPrintf("ModelSimil", "EvaluateDistanceHungarian", LOG_ERROR, "NULL or invalid model pointer(s)");2091 return 0.0;2092 }2093 2091 2094 2092 //Get information about vertex degrees, neurons and 3D location 2095 2093 if (!CreatePartInfoTables()) 2096 return 0 ;2094 return 0.0; 2097 2095 if (!CountPartDegrees()) 2098 return 0 ;2096 return 0.0; 2099 2097 if (!GetPartPositions()) 2100 return 0 ;2098 return 0.0; 2101 2099 if (!CountPartNeurons()) 2102 return 0 ;2100 return 0.0; 2103 2101 2104 2102 m_iSmaller = m_Mod[0]>getPartCount() <= m_Mod[1]>getPartCount() ? 0 : 1; … … 2116 2114 if (!ComputePartsPositionsBySVD()) 2117 2115 { 2118 return 0 ;2116 return 0.0; 2119 2117 } 2120 2118 … … 2177 2175 std::copy(minAssignment.begin(), minAssignment.end(), assignment); 2178 2176 } 2179 2180 2177 else 2181 2178 { 
cpp/frams/model/similarity/simil_model.h
r872 r877 65 65 void FuzzyOrder(); 66 66 67 static Model* newModel(const Geno *g); 67 68 int CreatePartInfoTables(); 68 69 void _PrintDegrees(int i);
Note: See TracChangeset
for help on using the changeset viewer.