Apollo 10.0
自动驾驶开放平台
a_star_strategy.h
浏览该文件的文档.
1/******************************************************************************
2 * Copyright 2017 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
17#pragma once
18
19#include <unordered_map>
20#include <unordered_set>
21#include <vector>
22
24
25namespace apollo {
26namespace routing {
27
28class AStarStrategy : public Strategy {
29 public:
30 explicit AStarStrategy(bool enable_change);
31 ~AStarStrategy() = default;
32
33 virtual bool Search(const TopoGraph* graph, const SubTopoGraph* sub_graph,
34 const TopoNode* src_node, const TopoNode* dest_node,
35 std::vector<NodeWithRange>* const result_nodes);
36
37 private:
38 void Clear();
39 double HeuristicCost(const TopoNode* src_node, const TopoNode* dest_node);
40 double GetResidualS(const TopoNode* node);
41 double GetResidualS(const TopoEdge* edge, const TopoNode* to_node);
42
43 private:
44 bool change_lane_enabled_;
45 std::unordered_set<const TopoNode*> open_set_;
46 std::unordered_set<const TopoNode*> closed_set_;
47 std::unordered_map<const TopoNode*, const TopoNode*> came_from_;
48 std::unordered_map<const TopoNode*, double> g_score_;
49 std::unordered_map<const TopoNode*, double> enter_s_;
50};
51
52} // namespace routing
53} // namespace apollo
virtual bool Search(const TopoGraph *graph, const SubTopoGraph *sub_graph, const TopoNode *src_node, const TopoNode *dest_node, std::vector< NodeWithRange > *const result_nodes)
class register implement
Definition arena_queue.h:37