1
1
// //////////////////////////////////////////////////////////////////////////
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
7
7
// //////////////////////////////////////////////////////////////////////////
8
8
9
9
#pragma once
26
26
namespace hash_fixed_vertex_manager
27
27
{
28
28
inline u32 to_u32 (const GraphEngineSpace::CWorldState &other)
29
- {
30
- return other.hash_value ();
31
- }
29
+ { return other.hash_value (); }
32
30
}
33
31
34
32
using namespace GraphEngineSpace ;
@@ -56,7 +54,10 @@ class CGraphEngine
56
54
57
55
#ifndef AI_COMPILER
58
56
// 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
60
61
using CSolverVertexManager = CVertexManagerHashFixed<u32 , _solver_index_type, 256 , 8 *1024 >;
61
62
using CSolverVertexAllocator = CVertexAllocatorFixed<8 *1024 >;
62
63
using SolverAlgorithmStorage = CEdgePath<_solver_edge_type, true >;
@@ -68,12 +69,13 @@ class CGraphEngine
68
69
true ,
69
70
SolverAlgorithmStorage>;
70
71
// string algorithm
72
+ static const size_t StringMaxVertexCount = 1024 ;
71
73
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 >;
74
76
using StringAlgorithmStorage = AlgorithmStorage;
75
77
using StringAlgorithmDistance = float ;
76
- using CStringAlgorithm = CAStar<
78
+ using CStringAlgorithm = CAStar<
77
79
StringAlgorithmDistance,
78
80
CStringPriorityQueue,
79
81
CStringVertexManager,
@@ -82,63 +84,43 @@ class CGraphEngine
82
84
StringAlgorithmStorage>;
83
85
#endif // AI_COMPILER
84
86
85
- CAlgorithm *m_algorithm;
87
+ CAlgorithm *m_algorithm;
86
88
87
89
#ifndef AI_COMPILER
88
- CSolverAlgorithm *m_solver_algorithm;
89
- CStringAlgorithm *m_string_algorithm;
90
+ CSolverAlgorithm *m_solver_algorithm;
91
+ CStringAlgorithm *m_string_algorithm;
90
92
#endif
91
93
CStatTimer PathTimer;
92
94
93
95
public:
94
- inline CGraphEngine (u32 max_vertex_count);
95
- virtual ~CGraphEngine ();
96
+ inline CGraphEngine (u32 max_vertex_count);
97
+ virtual ~CGraphEngine ();
96
98
#ifndef AI_COMPILER
97
- inline const CSolverAlgorithm &solver_algorithm () const ;
99
+ inline const CSolverAlgorithm &solver_algorithm () const ;
98
100
#endif
99
101
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);
107
105
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);
115
109
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);
123
113
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);
132
117
133
118
#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);
142
124
#endif
143
125
};
144
126
0 commit comments