WeightedSum.cpp
Go to the documentation of this file.
1 
18 #include "WeightedSum.hpp"
19 
20 namespace ISM {
21 
23  {
24  double normalisedFalsePositives =
25  getNormalisedFalsePositives(instance->evaluationResult.falsePositives);
26  double normalisedAverageRecognitionRuntime =
27  getNormalisedAverageRecognitionRuntime(instance->evaluationResult.averageRecognitionRuntime);
28 
29  if (normalisedFalsePositives < 0 || normalisedAverageRecognitionRuntime < 0)
30  {
31  return std::numeric_limits<double>::infinity();
32  }
33 
34  double cost = mAlpha * normalisedFalsePositives + mBeta * normalisedAverageRecognitionRuntime;
35  instance->cost = cost;
36  return cost;
37  }
38 
39  double WeightedSum::getNormalisedFalsePositives(double falsePositives)
40  {
41  if (falsePositives > mMaxFalsePositives)
42  {
43  //False Postivies are higher than the false positves of the worst star topology.
44  return -1;
45  }
46 
48  {
49  return 0;
50  }
51 
52  return (falsePositives - mMinFalsePositives) / (mMaxFalsePositives - mMinFalsePositives);
53  }
54 
55 
56  double WeightedSum::getNormalisedAverageRecognitionRuntime(double averageRecognitionRuntime)
57  {
58  if (averageRecognitionRuntime > mMaxAverageRecognitionRuntime)
59  {
60  //Average recognition runtime is longer than the average recognition runtime of the fully meshed topology.
61  return -1;
62  }
63 
64  if (mMaxAverageRecognitionRuntime == averageRecognitionRuntime)
65  {
66  return 0;
67  }
68 
69  return (averageRecognitionRuntime - mMinAverageRecognitionRuntime) /
71  }
72 
73 
74 
75 }
76 
double calculateCost(TopologyPtr instance)
Definition: WeightedSum.cpp:22
boost::shared_ptr< Topology > TopologyPtr
Definition: Topology.hpp:51
double mMinAverageRecognitionRuntime
Definition: WeightedSum.hpp:45
double mMaxFalsePositives
Definition: WeightedSum.hpp:43
double mMinFalsePositives
Definition: WeightedSum.hpp:42
double getNormalisedAverageRecognitionRuntime(double averageRecognitionRuntime)
Definition: WeightedSum.cpp:56
double getNormalisedFalsePositives(double falsePositives)
Definition: WeightedSum.cpp:39
this namespace contains all generally usable classes.
double mMaxAverageRecognitionRuntime
Definition: WeightedSum.hpp:46


asr_lib_ism
Author(s): Hanselmann Fabian, Heller Florian, Heizmann Heinrich, Kübler Marcel, Mehlhaus Jonas, Meißner Pascal, Qattan Mohamad, Reckling Reno, Stroh Daniel
autogenerated on Wed Jan 8 2020 04:02:41