11// //////////////////////////////////////////////////////////////////////////
2- // Module : graph_engine.h
3- // Created : 21.03.2002
4- // Modified : 26.11.2003
5- // Author : Dmitriy Iassenev
6- // Description : Graph engine
2+ // Module : graph_engine.h
3+ // Created : 21.03.2002
4+ // Modified : 26.11.2003
5+ // Author : Dmitriy Iassenev
6+ // Description : Graph engine
77// //////////////////////////////////////////////////////////////////////////
88
99#pragma once
2626namespace hash_fixed_vertex_manager
2727{
2828inline u32 to_u32 (const GraphEngineSpace::CWorldState &other)
29- {
30- return other.hash_value ();
31- }
29+ { return other.hash_value (); }
3230}
3331
3432using namespace GraphEngineSpace ;
@@ -56,7 +54,10 @@ class CGraphEngine
5654
5755#ifndef AI_COMPILER
5856 // solver algorithm
59- using CSolverPriorityQueue = CDataStorageBinaryHeap;
57+ static const size_t SolverMaxVertexCount = 16 *1024 ;
58+ using CSolverPriorityQueue = CDataStorageBinaryHeap;
59+ // XXX: originally CSolverAlgorithm is constructed with 16*1024 limit
60+ // while the following definitions use 8*1024 limit -- check if that's a mistake
6061 using CSolverVertexManager = CVertexManagerHashFixed<u32 , _solver_index_type, 256 , 8 *1024 >;
6162 using CSolverVertexAllocator = CVertexAllocatorFixed<8 *1024 >;
6263 using SolverAlgorithmStorage = CEdgePath<_solver_edge_type, true >;
@@ -68,12 +69,13 @@ class CGraphEngine
6869 true ,
6970 SolverAlgorithmStorage>;
7071 // string algorithm
72+ static const size_t StringMaxVertexCount = 1024 ;
7173 using CStringPriorityQueue = CDataStorageBinaryHeap;
72- using CStringVertexManager = CVertexManagerHashFixed<u32 , shared_str, 128 , 1024 >;
73- using CStringVertexAllocator = CVertexAllocatorFixed<1024 >;
74+ using CStringVertexManager = CVertexManagerHashFixed<u32 , shared_str, 128 , StringMaxVertexCount >;
75+ using CStringVertexAllocator = CVertexAllocatorFixed<StringMaxVertexCount >;
7476 using StringAlgorithmStorage = AlgorithmStorage;
7577 using StringAlgorithmDistance = float ;
76- using CStringAlgorithm = CAStar<
78+ using CStringAlgorithm = CAStar<
7779 StringAlgorithmDistance,
7880 CStringPriorityQueue,
7981 CStringVertexManager,
@@ -82,63 +84,43 @@ class CGraphEngine
8284 StringAlgorithmStorage>;
8385#endif // AI_COMPILER
8486
85- CAlgorithm *m_algorithm;
87+ CAlgorithm *m_algorithm;
8688
8789#ifndef AI_COMPILER
88- CSolverAlgorithm *m_solver_algorithm;
89- CStringAlgorithm *m_string_algorithm;
90+ CSolverAlgorithm *m_solver_algorithm;
91+ CStringAlgorithm *m_string_algorithm;
9092#endif
9193 CStatTimer PathTimer;
9294
9395public:
94- inline CGraphEngine (u32 max_vertex_count);
95- virtual ~CGraphEngine ();
96+ inline CGraphEngine (u32 max_vertex_count);
97+ virtual ~CGraphEngine ();
9698#ifndef AI_COMPILER
97- inline const CSolverAlgorithm &solver_algorithm () const ;
99+ inline const CSolverAlgorithm &solver_algorithm () const ;
98100#endif
99101
100- template <typename _Graph, typename _Parameters>
101- inline bool search (
102- const _Graph &graph,
103- const shared_str &start_node,
104- const shared_str &dest_node,
105- xr_vector<shared_str> *node_path,
106- _Parameters ¶meters);
102+ template <typename _Graph, typename _Parameters>
103+ inline bool search (const _Graph &graph, const shared_str &start_node, const shared_str &dest_node,
104+ xr_vector<shared_str> *node_path, _Parameters ¶meters);
107105
108- template <typename _Graph, typename _Parameters>
109- inline bool search (
110- const _Graph &graph,
111- const _index_type &start_node,
112- const _index_type &dest_node,
113- xr_vector<_index_type> *node_path,
114- const _Parameters ¶meters);
106+ template <typename _Graph, typename _Parameters>
107+ inline bool search (const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
108+ xr_vector<_index_type> *node_path, const _Parameters ¶meters);
115109
116- template <typename _Graph, typename _Parameters>
117- inline bool search (
118- const _Graph &graph,
119- const _index_type &start_node,
120- const _index_type &dest_node,
121- xr_vector<_index_type> *node_path,
122- _Parameters ¶meters);
110+ template <typename _Graph, typename _Parameters>
111+ inline bool search (const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
112+ xr_vector<_index_type> *node_path, _Parameters ¶meters);
123113
124- template <typename _Graph, typename _Parameters, typename _PathManager>
125- inline bool search (
126- const _Graph &graph,
127- const _index_type &start_node,
128- const _index_type &dest_node,
129- xr_vector<_index_type> *node_path,
130- const _Parameters ¶meters,
131- _PathManager &path_manager);
114+ template <typename _Graph, typename _Parameters, typename _PathManager>
115+ inline bool search (const _Graph &graph, const _index_type &start_node, const _index_type &dest_node,
116+ xr_vector<_index_type> *node_path, const _Parameters ¶meters, _PathManager &path_manager);
132117
133118#ifndef AI_COMPILER
134- template <typename T1, typename T2, typename T3, typename T4,
135- typename T5, bool T6, typename T7, typename T8, typename _Parameters>
136- inline bool search (
137- const CProblemSolver<T1, T2, T3, T4, T5, T6, T7, T8> &graph,
138- const _solver_index_type &start_node,
139- const _solver_index_type &dest_node,
140- xr_vector<_solver_edge_type> *node_path,
141- const _Parameters ¶meters);
119+ template <typename T1, typename T2, typename T3, typename T4,
120+ typename T5, bool T6, typename T7, typename T8, typename _Parameters>
121+ inline bool search (const CProblemSolver<T1, T2, T3, T4, T5, T6, T7, T8> &graph,
122+ const _solver_index_type &start_node, const _solver_index_type &dest_node,
123+ xr_vector<_solver_edge_type> *node_path, const _Parameters ¶meters);
142124#endif
143125};
144126
0 commit comments