Apollo  6.0
Open source self driving car software
gnn_bipartite_graph_matcher.h
Go to the documentation of this file.
1 /******************************************************************************
2  * Copyright 2018 The Apollo Authors. All Rights Reserved.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *****************************************************************************/
16 #pragma once
17 
18 #include <string>
19 #include <vector>
20 
23 
24 namespace apollo {
25 namespace perception {
26 namespace lidar {
27 
28 class MatchCost {
29  public:
30  MatchCost(size_t ridx, size_t cidx, double cost);
31 
32  // @brief access RowIdx
33  size_t RowIdx() const;
34  // @brief access ColIdx
35  size_t ColIdx() const;
36 
37  // @brief access Cost
38  double Cost() const;
39 
40  friend bool operator<(const MatchCost& m1, const MatchCost& m2);
41  friend std::ostream& operator<<(std::ostream& os, const MatchCost& m);
42 
43  private:
44  size_t row_idx_ = 0;
45  size_t col_idx_ = 0;
46  double cost_ = 0.0;
47 };
48 
50  public:
51  explicit GnnBipartiteGraphMatcher(size_t max_size = 1000);
53 
54  // @brief: match interface
55  // @params [in]: match params
56  // @params [out]: matched pair of objects & tracks
57  // @params [out]: unmatched rows
58  // @params [out]: unmatched cols
59  void Match(const BipartiteGraphMatcherOptions& options,
60  std::vector<NodeNodePair>* assignments,
61  std::vector<size_t>* unassigned_rows,
62  std::vector<size_t>* unassigned_cols);
63 
64  std::string Name() const { return "GnnBipartiteGraphMatcher"; }
65 
66  protected:
67  std::vector<int> row_tag_;
68  std::vector<int> col_tag_;
69 }; // class GnnBipartiteGraphMatcher
70 
71 } // namespace lidar
72 } // namespace perception
73 } // namespace apollo
Definition: gnn_bipartite_graph_matcher.h:49
std::string Name() const
Definition: gnn_bipartite_graph_matcher.h:64
MatchCost(size_t ridx, size_t cidx, double cost)
Definition: gnn_bipartite_graph_matcher.h:28
PlanningContext is the runtime context in planning. It is persistent across multiple frames...
Definition: atomic_hash_map.h:25
Definition: base_bipartite_graph_matcher.h:34
std::vector< int > row_tag_
Definition: gnn_bipartite_graph_matcher.h:67
std::vector< int > col_tag_
Definition: gnn_bipartite_graph_matcher.h:68
friend bool operator<(const MatchCost &m1, const MatchCost &m2)
Definition: base_bipartite_graph_matcher.h:39
friend std::ostream & operator<<(std::ostream &os, const MatchCost &m)