Skip to content

Commit 46814ca

Browse files
committed
(trsp/handler) refining trspHandler class
1 parent d3079a3 commit 46814ca

File tree

6 files changed

+79
-288
lines changed

6 files changed

+79
-288
lines changed

include/trsp/trspHandler.hpp

Lines changed: 21 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ namespace trsp {
5050

5151

5252

53-
class Pgr_trspHandler : public pgrouting::Pgr_messages {
53+
class TrspHandler : public pgrouting::Pgr_messages {
5454
/**
5555
* Used in the priority queue
5656
*/
@@ -101,104 +101,54 @@ class Pgr_trspHandler : public pgrouting::Pgr_messages {
101101

102102

103103
public:
104-
Pgr_trspHandler(
104+
TrspHandler(
105105
std::vector<Edge_t> &edges,
106106
const std::vector<Edge_t> &new_edges,
107107
const bool directed,
108108
const std::vector<Rule> &ruleList);
109-
Pgr_trspHandler(
109+
110+
TrspHandler(
110111
std::vector<Edge_t> &edges,
111112
const bool directed,
112113
const std::vector<Rule> &ruleList);
113-
Pgr_trspHandler(
114-
Edge_t *edges,
115-
const size_t edge_count,
116-
const bool directed,
117-
const std::vector<Rule> &ruleList);
118-
Pgr_trspHandler(
119-
Edge_t *edges,
120-
const size_t edge_count,
121-
const std::vector<Edge_t> &new_edges,
122-
const bool directed,
123-
const std::vector<Rule> &ruleList);
124-
125114

126-
Pgr_trspHandler(void) = delete;
127-
~Pgr_trspHandler(void) = default;
128-
129-
130-
Path process(
131-
const int64_t start_vertex,
132-
const int64_t end_vertex);
133-
134-
std::deque<Path> process(
135-
const std::map<int64_t,
136-
std::set<int64_t>> &combinations);
137-
138-
std::deque<Path> process(
139-
const std::vector<int64_t> sources,
140-
const std::vector<int64_t> targets);
115+
~TrspHandler(void) = default;
141116

117+
std::deque<Path> process(const std::map<int64_t, std::set<int64_t>>&);
142118

143119
void clear();
144120

145121
private:
146-
void construct_graph(const std::vector<Edge_t>&, const bool);
147-
void construct_graph(
148-
Edge_t *edges,
149-
const size_t edge_count,
150-
const bool directed);
122+
void construct_graph(const std::vector<Edge_t>&, const std::vector<Edge_t>&, const bool);
151123

152-
void add_point_edges(
153-
const std::vector<Edge_t> &new_edges,
154-
const bool directed);
155-
156-
int initialize_restrictions(
157-
const std::vector<Rule> &ruleList);
124+
int initialize_restrictions(const std::vector<Rule>&);
158125

159126
void initialize_que();
160127

161-
Path process_trsp(
162-
size_t edge_count);
128+
Path process(const int64_t, const int64_t);
129+
130+
Path process_trsp(size_t edge_count);
163131

164132
EdgeInfo dijkstra_exploration();
165133

134+
void explore(int64_t, const EdgeInfo, bool);
166135

167-
void explore(
168-
int64_t cur_node,
169-
const EdgeInfo cur_edge,
170-
bool isStart);
136+
double getRestrictionCost(int64_t, const EdgeInfo&, bool);
171137

172-
double getRestrictionCost(
173-
int64_t cur_node,
174-
const EdgeInfo &new_edge,
175-
bool isStart);
176-
bool addEdge(Edge_t edgeIn, bool);
138+
bool addEdge(Edge_t, bool);
177139

178-
void connectStartEdge(
179-
size_t firstEdge_idx,
180-
size_t secondEdge_idx);
140+
void connectStartEdge(size_t, size_t);
181141

182-
void connectEndEdge(
183-
size_t firstEdge_idx,
184-
size_t secondEdge_idx);
142+
void connectEndEdge(size_t, size_t);
185143

186-
double construct_path(int64_t ed_id, Position pos);
144+
double construct_path(int64_t, Position);
187145

188-
void renumber_edges(Edge_t*, const size_t);
189-
void renumber_edges(Edge_t*, const size_t, std::vector<Edge_t>&);
190146
void renumber_edges(std::vector<Edge_t>&);
191147
void renumber_edges(std::vector<Edge_t>&, std::vector<Edge_t>&);
192148

193-
void add_to_que(
194-
double cost,
195-
size_t e_idx,
196-
bool isStart);
149+
void add_to_que(double, size_t, bool);
197150

198-
double get_tot_cost(
199-
double cost,
200-
size_t edge_idx,
201-
bool isStart);
151+
double get_tot_cost(double, size_t, bool);
202152

203153
private:
204154
std::vector<EdgeInfo> m_edges;
@@ -226,7 +176,7 @@ class Pgr_trspHandler : public pgrouting::Pgr_messages {
226176
/*
227177
* Used in dijkstra_exploration
228178
*/
229-
int64_t current_node;
179+
int64_t m_current_node;
230180

231181
Path m_path;
232182

@@ -238,7 +188,7 @@ class Pgr_trspHandler : public pgrouting::Pgr_messages {
238188
/*
239189
* priority queue
240190
*/
241-
std::priority_queue<PDP, std::vector<PDP>, std::greater<PDP> > que;
191+
std::priority_queue<PDP, std::vector<PDP>, std::greater<PDP>> m_que;
242192
};
243193

244194

0 commit comments

Comments
 (0)