CPAlgoArray.cxx
Go to the documentation of this file.
1 #include "CPAlgoArray.h"
2 
3 namespace cmtool {
4 
5  //-------------------------------------------------------
7  //-------------------------------------------------------
8  {
10  _algo_array.clear();
11  }
12 
13  //----------------------------------------------------------------------------------------------
15  //----------------------------------------------------------------------------------------------
16  {
17 
18  std::vector<float> score_array;
19  score_array.reserve(_algo_array.size());
20 
21  for(auto const& algo : _algo_array) {
22 
23  float score = algo->Priority(cluster);
24 
25  if(_mode != kSimpleAddition && score < 0)
26 
27  return score;
28 
29  score_array.push_back(score);
30 
31  }
32 
33  float score_result = 0;
34 
35  switch(_mode) {
36 
37  case kLastAlgo:
38 
39  score_result = (*score_array.rbegin());
40  break;
41 
42  case kSimpleAddition:
43  case kPositiveAddition:
44 
45  for(auto const& score : score_array) score_result += score;
46  break;
47 
48  case kMultiplication:
49 
50  for(auto const& score : score_array) score_result *= score;
51  break;
52 
53  }
54 
55  return score_result;
56  }
57 
58 }
Cluster finding and building.
CPAlgoArray()
Default constructor.
Definition: CPAlgoArray.cxx:6
Class def header for a class CPAlgoArray.
std::vector< CPriorityAlgoBase * > _algo_array
vector of algorithms
Definition: CPAlgoArray.h:112
virtual float Priority(const ::cluster::ClusterParamsAlg &cluster)
Definition: CPAlgoArray.cxx:14
EvaluationMode_t _mode
evaluation mode
Definition: CPAlgoArray.h:115