ManuallyDefPseudoHeuristic.cpp
Go to the documentation of this file.
1 
19 #include <boost/lexical_cast.hpp>
20 namespace ISM
21 {
22 
23  ManuallyDefPseudoHeuristic::ManuallyDefPseudoHeuristic(std::vector<std::pair<std::vector<ClusterObject>, uint16_t>>
24  clusters) : Heuristic("ManuallyDefPseudoHeuristic"), mClusters(clusters)
25  {
26 
27  }
29  {
30  }
32  {
33  std::vector<TrackPtr> result;
34  for(std::pair<std::vector<ClusterObject>, uint16_t>& clusterObjectsToCluster : mClusters)
35  {
36  for(ClusterObject& clusterObject : clusterObjectsToCluster.first)
37  {
38  bool found = false;
39  for(TrackPtr& track : tracks->tracks)
40  {
41  if(clusterObject.isCluster)
42  {
43  if(track->type.find("_sub") != std::string::npos)
44  {
45  std::string temp = track->type;
46  temp.erase(temp.begin(), temp.begin() + temp.find_first_of("_sub") + 4);
47  if(boost::get<uint16_t>(clusterObject.mObjectOrCluster) ==
48  boost::lexical_cast<uint16_t>(temp))
49  {
50  found = true;
51  result.push_back(track);
52  }
53  }
54  } else if(track->type == boost::get<std::string>(clusterObject.mObjectOrCluster))
55  {
56  found = true;
57  result.push_back(track);
58  }
59  }
60  if(!found)
61  {
62  result.clear();
63  break;
64  }
65  }
66  if(result.size() == clusterObjectsToCluster.first.size())
67  {
68  cluster = TracksPtr(new Tracks(result));
69  confidence = 1.0;
70  break;
71  }
72  }
73  }
74 }
75 
76 
77 
TracksPtr cluster
Definition: Heuristic.hpp:40
ManuallyDefPseudoHeuristic(std::vector< std::pair< std::vector< ClusterObject >, uint16_t >> clusters)
boost::variant< uint16_t, std::string > mObjectOrCluster
boost::shared_ptr< Tracks > TracksPtr
Definition: Tracks.hpp:42
double confidence
Definition: Heuristic.hpp:39
boost::shared_ptr< Track > TrackPtr
Definition: Track.hpp:55
this namespace contains all generally usable classes.
std::vector< std::pair< std::vector< ClusterObject >, uint16_t > > mClusters
virtual void applyHeuristic(const TracksPtr &tracks)


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:40