PGROUTING  3.2
pgrouting::trsp::Pgr_trspHandler Class Reference

#include "pgr_trspHandler.h"

Collaboration diagram for pgrouting::trsp::Pgr_trspHandler:

Classes

class  CostHolder
 
class  Predecessor
 

Public Member Functions

 Pgr_trspHandler (pgr_edge_t *edges, const size_t edge_count, const bool directed, const std::vector< Rule > &ruleList)
 
 Pgr_trspHandler (void)=delete
 
 ~Pgr_trspHandler (void)=default
 
void clear ()
 
Path process (const int64_t start_vertex, const int64_t end_vertex)
 process More...
 
std::deque< Pathprocess (const std::vector< int64_t > sources, const std::vector< int64_t > targets)
 process More...
 

Private Types

typedef std::pair< double, std::pair< int64_t, bool > > PDP
 Used in the priority queue. More...
 
enum  Position { ILLEGAL = -1, RC_EDGE = 0, C_EDGE = 1 }
 predecesor edge More...
 

Private Member Functions

void add_to_que (double cost, size_t e_idx, bool isStart)
 
bool addEdge (const pgr_edge_t edgeIn)
 
void connectEndEdge (size_t firstEdge_idx, size_t secondEdge_idx)
 
void connectStartEdge (size_t firstEdge_idx, size_t secondEdge_idx)
 
void construct_graph (pgr_edge_t *edges, const size_t edge_count, const bool directed)
 
double construct_path (int64_t ed_id, Position pos)
 
EdgeInfo dijkstra_exploration ()
 
void explore (int64_t cur_node, const EdgeInfo cur_edge, bool isStart)
 
double get_tot_cost (double cost, size_t edge_idx, bool isStart)
 
double getRestrictionCost (int64_t cur_node, const EdgeInfo &new_edge, bool isStart)
 
void initialize_que ()
 
int initialize_restrictions (const std::vector< Rule > &ruleList)
 
Path process_trsp (size_t edge_count)
 
int64_t renumber_edges (pgr_edge_t *edges, const size_t edge_count) const
 

Private Attributes

int64_t current_node
 
std::map< int64_t, std::vector< size_t > > m_adjacency
 m_adjacency[vertex] = {edges} More...
 
std::vector< CostHolderm_dCost
 
std::vector< EdgeInfom_edges
 
int64_t m_end_vertex
 
std::map< int64_t, int64_t > m_mapEdgeId2Index
 Used only to veryfy that there are no reppetitions inserted the way it orks, repeating edges id is not allowed. More...
 
int64_t m_min_id
 
std::vector< Predecessorm_parent
 
Path m_path
 
std::map< int64_t, std::vector< Rule > > m_ruleTable
 
int64_t m_start_vertex
 
std::priority_queue< PDP, std::vector< PDP >, std::greater< PDP > > que
 

Detailed Description

Definition at line 52 of file pgr_trspHandler.h.

Member Typedef Documentation

◆ PDP

typedef std::pair<double, std::pair<int64_t, bool> > pgrouting::trsp::Pgr_trspHandler::PDP
private

Used in the priority queue.

Definition at line 56 of file pgr_trspHandler.h.

Member Enumeration Documentation

◆ Position

predecesor edge

because each row represents 2 edges, this enumeration is needed for the predecessors

  • C_EDGE: If the predecessor comes from the "cost" edge
  • RC_EDGE: If the predecessor comes from the "reverse_cost" edge
  • ILLEGAL: Its not a predecessor of anything

The "legal" values are indices to vectors

Enumerator
ILLEGAL 
RC_EDGE 
C_EDGE 

Definition at line 68 of file pgr_trspHandler.h.

68 {ILLEGAL = -1, RC_EDGE = 0, C_EDGE = 1};

Constructor & Destructor Documentation

◆ Pgr_trspHandler() [1/2]

pgrouting::trsp::Pgr_trspHandler::Pgr_trspHandler ( pgr_edge_t edges,
const size_t  edge_count,
const bool  directed,
const std::vector< Rule > &  ruleList 
)

Definition at line 43 of file pgr_trspHandler.cpp.

47  :
48  m_ruleTable() {
49  initialize_restrictions(ruleList);
50 
51  m_min_id = renumber_edges(edges, edge_count);
52 
54  edges,
55  edge_count,
56  directed);
57 }

References construct_graph(), initialize_restrictions(), m_min_id, and renumber_edges().

◆ Pgr_trspHandler() [2/2]

pgrouting::trsp::Pgr_trspHandler::Pgr_trspHandler ( void  )
delete

◆ ~Pgr_trspHandler()

pgrouting::trsp::Pgr_trspHandler::~Pgr_trspHandler ( void  )
default

Member Function Documentation

◆ add_to_que()

void pgrouting::trsp::Pgr_trspHandler::add_to_que ( double  cost,
size_t  e_idx,
bool  isStart 
)
private

Definition at line 317 of file pgr_trspHandler.cpp.

320  {
321  que.push(std::make_pair(cost,
322  std::make_pair(e_idx, isStart)));
323 }

References que.

Referenced by explore(), and initialize_que().

◆ addEdge()

bool pgrouting::trsp::Pgr_trspHandler::addEdge ( const pgr_edge_t  edgeIn)
private

Definition at line 508 of file pgr_trspHandler.cpp.

508  {
509  /*
510  * The edge was already inserted
511  *
512  * If the user has rows with repeated edge id, the subsequent edges will be ignored
513  *
514  * When changing to boost graph, the additional edges are to be added
515  */
516  if (m_mapEdgeId2Index.find(edgeIn.id) != m_mapEdgeId2Index.end()) {
517  return false;
518  }
519 
520 
521  /*
522  * the index of this new edge in the edges container is
523  * m_edges.size()
524  */
525  EdgeInfo edge(edgeIn, m_edges.size());
526 
527  // Adding edge to the list
528  m_mapEdgeId2Index.insert(
529  std::make_pair(
530  edge.edgeID(),
531  m_edges.size()));
532 
533  m_edges.push_back(edge);
534 
535  EdgeInfo &newEdge = m_edges[m_edges.size()-1];
536 
537 
538 
539  /*
540  * Searching the start node for connectivity
541  */
542  auto itNodeMap = m_adjacency.find(edgeIn.source);
543 
544  if (itNodeMap != m_adjacency.end()) {
545  for (const auto e_idx : itNodeMap->second) {
546  connectStartEdge(edge.idx(), e_idx);
547  }
548  }
549 
550 
551  /*
552  * Searching the end node for connectivity
553  */
554  itNodeMap = m_adjacency.find(edgeIn.target);
555  if (itNodeMap != m_adjacency.end()) {
556  for (const auto e_idx : itNodeMap->second) {
557  connectEndEdge(edge.idx(), e_idx);
558  }
559  }
560 
561 
562  /*
563  * Add the edges to the adjacency list
564  */
565  m_adjacency[edgeIn.source].push_back(newEdge.idx());
566  m_adjacency[edgeIn.target].push_back(newEdge.idx());
567 
568 
569 
570  return true;
571 }

References connectEndEdge(), connectStartEdge(), pgr_edge_t::id, pgrouting::trsp::EdgeInfo::idx(), m_adjacency, m_edges, m_mapEdgeId2Index, pgr_edge_t::source, and pgr_edge_t::target.

Referenced by construct_graph().

◆ clear()

void pgrouting::trsp::Pgr_trspHandler::clear ( )

Definition at line 87 of file pgr_trspHandler.cpp.

87  {
88  m_parent.clear();
89  m_dCost.clear();
90  m_path.clear();
91 }

References Path::clear(), m_dCost, m_parent, and m_path.

Referenced by process().

◆ connectEndEdge()

void pgrouting::trsp::Pgr_trspHandler::connectEndEdge ( size_t  firstEdge_idx,
size_t  secondEdge_idx 
)
private

Definition at line 485 of file pgr_trspHandler.cpp.

487  {
488  EdgeInfo &firstEdge = m_edges[firstEdge_idx];
489  EdgeInfo &secondEdge = m_edges[secondEdge_idx];
490 
491  if (firstEdge.cost() >= 0.0) {
492  firstEdge.connect_endEdge(secondEdge_idx);
493  }
494 
495  if (firstEdge.endNode() == secondEdge.startNode()
496  && secondEdge.r_cost() >= 0.0) {
497  secondEdge.connect_startEdge(firstEdge_idx);
498  }
499 
500  if (firstEdge.endNode() == secondEdge.endNode()
501  && secondEdge.cost() >= 0.0) {
502  secondEdge.connect_endEdge(firstEdge_idx);
503  }
504 }

References pgrouting::trsp::EdgeInfo::connect_endEdge(), pgrouting::trsp::EdgeInfo::connect_startEdge(), pgrouting::trsp::EdgeInfo::cost(), pgrouting::trsp::EdgeInfo::endNode(), m_edges, pgrouting::trsp::EdgeInfo::r_cost(), and pgrouting::trsp::EdgeInfo::startNode().

Referenced by addEdge().

◆ connectStartEdge()

void pgrouting::trsp::Pgr_trspHandler::connectStartEdge ( size_t  firstEdge_idx,
size_t  secondEdge_idx 
)
private

Definition at line 462 of file pgr_trspHandler.cpp.

464  {
465  EdgeInfo &firstEdge = m_edges[firstEdge_idx];
466  EdgeInfo &secondEdge = m_edges[secondEdge_idx];
467 
468  if (firstEdge.r_cost() >= 0.0) {
469  firstEdge.connect_startEdge(secondEdge_idx);
470  }
471 
472  if (firstEdge.startNode() == secondEdge.startNode()
473  && secondEdge.r_cost() >= 0.0) {
474  secondEdge.connect_startEdge(firstEdge_idx);
475  }
476 
477  if (firstEdge.startNode() == secondEdge.endNode()
478  &&secondEdge.cost() >= 0.0) {
479  secondEdge.connect_endEdge(firstEdge_idx);
480  }
481 }

References pgrouting::trsp::EdgeInfo::connect_endEdge(), pgrouting::trsp::EdgeInfo::connect_startEdge(), pgrouting::trsp::EdgeInfo::cost(), pgrouting::trsp::EdgeInfo::endNode(), m_edges, pgrouting::trsp::EdgeInfo::r_cost(), and pgrouting::trsp::EdgeInfo::startNode().

Referenced by addEdge().

◆ construct_graph()

void pgrouting::trsp::Pgr_trspHandler::construct_graph ( pgr_edge_t edges,
const size_t  edge_count,
const bool  directed 
)
private

Definition at line 435 of file pgr_trspHandler.cpp.

438  {
439  for (size_t i = 0; i < edge_count; i++) {
440  auto current_edge = &edges[i];
441 
442  /*
443  * making all costs > 0
444  */
445  if (current_edge->cost < 0 && current_edge->reverse_cost > 0) {
446  std::swap(current_edge->cost, current_edge->reverse_cost);
447  std::swap(current_edge->source, current_edge->target);
448  }
449 
450  if (!directed) {
451  if (current_edge->reverse_cost < 0) {
452  current_edge->reverse_cost = current_edge->cost;
453  }
454  }
455  addEdge(*current_edge);
456  }
457  m_mapEdgeId2Index.clear();
458 }

References addEdge(), and m_mapEdgeId2Index.

Referenced by Pgr_trspHandler().

◆ construct_path()

double pgrouting::trsp::Pgr_trspHandler::construct_path ( int64_t  ed_id,
Position  pos 
)
private

Definition at line 95 of file pgr_trspHandler.cpp.

95  {
96  pgassert(pos != ILLEGAL);
97  if (pos == ILLEGAL) return (std::numeric_limits<double>::max)();
98 
99  if (m_parent[static_cast<size_t>(ed_id)].isIllegal(pos)) {
100  Path_t pelement;
101  auto cur_edge = &m_edges[static_cast<size_t>(ed_id)];
102  if (pos == RC_EDGE) {
103  pelement.node = cur_edge->startNode();
104  pelement.cost = cur_edge->cost();
105  } else {
106  pelement.node = cur_edge->endNode();
107  pelement.cost = cur_edge->r_cost();
108  }
109  pelement.edge = cur_edge->edgeID();
110 
111  m_path.push_back(pelement);
113  return pelement.cost;
114  }
115 
116  double ret = construct_path(
117  static_cast<int64_t>(m_parent[static_cast<size_t>(ed_id)].e_idx[static_cast<size_t>(pos)]),
118  static_cast<Position>(m_parent[static_cast<size_t>(ed_id)].v_pos[static_cast<size_t>(pos)]));
119  Path_t pelement;
120  auto cur_edge = &m_edges[static_cast<size_t>(ed_id)];
121  if (pos == RC_EDGE) {
122  pelement.node = cur_edge->startNode();
123  pelement.cost = m_dCost[static_cast<size_t>(ed_id)].endCost - ret;
124  ret = m_dCost[static_cast<size_t>(ed_id)].endCost;
125  } else {
126  pelement.node = cur_edge->endNode();
127  pelement.cost = m_dCost[static_cast<size_t>(ed_id)].startCost - ret;
128  ret = m_dCost[static_cast<size_t>(ed_id)].startCost;
129  }
130  pelement.edge = cur_edge->edgeID();
131 
132  m_path.push_back(pelement);
133 
134  return ret;
135 }

References Path_t::cost, Path_t::edge, ILLEGAL, m_dCost, m_edges, m_parent, m_path, m_start_vertex, Path_t::node, pgassert, Path::push_back(), RC_EDGE, and Path::start_id().

Referenced by process_trsp().

◆ dijkstra_exploration()

EdgeInfo pgrouting::trsp::Pgr_trspHandler::dijkstra_exploration ( )
private

Definition at line 353 of file pgr_trspHandler.cpp.

353  {
354  EdgeInfo cur_edge;
356 
357  while (!que.empty()) {
358  auto cur_pos = que.top();
359  que.pop();
360 
361  auto cure_idxex = cur_pos.second.first;
362  cur_edge = m_edges[static_cast<size_t>(cure_idxex)];
363 
364  if (cur_pos.second.second) {
365  /*
366  * explore edges connected to end node
367  */
368  current_node = cur_edge.endNode();
369  if (cur_edge.cost() < 0.0) continue;
370  if (current_node == m_end_vertex) break;
371  explore(current_node, cur_edge, false);
372  } else {
373  /*
374  * explore edges connected to start node
375  */
376  current_node = cur_edge.startNode();
377  if (cur_edge.r_cost() < 0.0) continue;
378  if (current_node == m_end_vertex) break;
379  explore(current_node, cur_edge, true);
380  }
381  }
382  return cur_edge;
383 }

References pgrouting::trsp::EdgeInfo::cost(), current_node, pgrouting::trsp::EdgeInfo::endNode(), explore(), m_edges, m_end_vertex, m_start_vertex, pgassert, que, pgrouting::trsp::EdgeInfo::r_cost(), and pgrouting::trsp::EdgeInfo::startNode().

Referenced by process_trsp().

◆ explore()

void pgrouting::trsp::Pgr_trspHandler::explore ( int64_t  cur_node,
const EdgeInfo  cur_edge,
bool  isStart 
)
private

Definition at line 186 of file pgr_trspHandler.cpp.

189  {
190  double totalCost;
191 
192  auto vecIndex = cur_edge.get_idx(isStart);
193 
194  for (const auto &index : vecIndex) {
195  auto edge = m_edges[index];
196 
197  auto extra_cost = getRestrictionCost(
198  static_cast<int64_t>(cur_edge.idx()),
199  edge, isStart);
200 
201  if ((edge.startNode() == cur_node) && (edge.cost() >= 0.0)) {
202  totalCost = get_tot_cost(
203  edge.cost() + extra_cost,
204  cur_edge.idx(),
205  isStart);
206 
207  if (totalCost < m_dCost[index].endCost) {
208  m_dCost[index].endCost = totalCost;
209  m_parent[edge.idx()].v_pos[RC_EDGE] = isStart? C_EDGE : RC_EDGE;
210  m_parent[edge.idx()].e_idx[RC_EDGE] =
211  cur_edge.idx();
212 
213  add_to_que(totalCost, edge.idx(), true);
214  }
215  }
216 
217  if ((edge.endNode() == cur_node) && (edge.r_cost() >= 0.0)) {
218  totalCost = get_tot_cost(
219  edge.r_cost() + extra_cost,
220  cur_edge.idx(),
221  isStart);
222 
223  if (totalCost < m_dCost[index].startCost) {
224  m_dCost[index].startCost = totalCost;
225  m_parent[edge.idx()].v_pos[C_EDGE] = isStart? C_EDGE : RC_EDGE;
226  m_parent[edge.idx()].e_idx[C_EDGE] = cur_edge.idx();
227 
228  add_to_que(totalCost, edge.idx(), false);
229  }
230  }
231  } // for
232 }

References add_to_que(), C_EDGE, edge::cost, pgrouting::trsp::EdgeInfo::get_idx(), get_tot_cost(), getRestrictionCost(), pgrouting::trsp::EdgeInfo::idx(), m_dCost, m_edges, m_parent, and RC_EDGE.

Referenced by dijkstra_exploration().

◆ get_tot_cost()

double pgrouting::trsp::Pgr_trspHandler::get_tot_cost ( double  cost,
size_t  edge_idx,
bool  isStart 
)
private

Definition at line 172 of file pgr_trspHandler.cpp.

175  {
176  if (isStart) {
177  return m_dCost[edge_idx].startCost +
178  cost;
179  }
180  return m_dCost[edge_idx].endCost +
181  cost;
182 }

References m_dCost.

Referenced by explore().

◆ getRestrictionCost()

double pgrouting::trsp::Pgr_trspHandler::getRestrictionCost ( int64_t  cur_node,
const EdgeInfo new_edge,
bool  isStart 
)
private

Definition at line 139 of file pgr_trspHandler.cpp.

142  {
143  double cost = 0.0;
144  int64_t edge_id = edge.edgeID();
145  if (m_ruleTable.find(edge_id) == m_ruleTable.end()) {
146  return(0.0);
147  }
148  auto vecRules = m_ruleTable[edge_id];
149  int64_t st_edge_ind = edge_ind;
150  for (const auto &rule : vecRules) {
151  bool flag = true;
152  int64_t v_pos = (isStart? C_EDGE : RC_EDGE);
153  edge_ind = st_edge_ind;
154 
155  pgassert(!(edge_ind == -1));
156  for (auto const &precedence : rule.precedencelist()) {
157  if (precedence != m_edges[static_cast<size_t>(edge_ind)].edgeID()) {
158  flag = false;
159  break;
160  }
161  auto m_parent_ind = m_parent[static_cast<size_t>(edge_ind)].e_idx[static_cast<size_t>(v_pos)];
162  v_pos = m_parent[static_cast<size_t>(edge_ind)].v_pos[static_cast<size_t>(v_pos)];
163  edge_ind = static_cast<int64_t>(m_parent_ind);
164  }
165  if (flag)
166  cost += rule.cost();
167  }
168  return cost;
169 }

References C_EDGE, m_edges, m_parent, m_ruleTable, pgassert, and RC_EDGE.

Referenced by explore().

◆ initialize_que()

void pgrouting::trsp::Pgr_trspHandler::initialize_que ( )
private

Definition at line 329 of file pgr_trspHandler.cpp.

329  {
330  /*
331  * For each adjacent edge to the start_vertex
332  */
333  for (const auto source : m_adjacency[m_start_vertex]) {
334  EdgeInfo &cur_edge = m_edges[source];
335 
336  if (cur_edge.startNode() == m_start_vertex
337  && cur_edge.cost() >= 0.0) {
338  m_dCost[cur_edge.idx()].endCost = cur_edge.cost();
339  m_parent[cur_edge.idx()].v_pos[0] = ILLEGAL;
340  add_to_que(cur_edge.cost(), cur_edge.idx(), true);
341  }
342 
343  if (cur_edge.endNode() == m_start_vertex
344  && cur_edge.r_cost() >= 0.0) {
345  m_dCost[cur_edge.idx()].startCost =
346  cur_edge.r_cost();
347  m_parent[cur_edge.idx()].v_pos[1] = ILLEGAL;
348  add_to_que(cur_edge.r_cost(), cur_edge.idx(), false);
349  }
350  }
351 }

References add_to_que(), pgrouting::trsp::EdgeInfo::cost(), pgrouting::trsp::EdgeInfo::endNode(), pgrouting::trsp::EdgeInfo::idx(), ILLEGAL, m_adjacency, m_dCost, m_edges, m_parent, m_start_vertex, pgrouting::trsp::EdgeInfo::r_cost(), and pgrouting::trsp::EdgeInfo::startNode().

Referenced by process_trsp().

◆ initialize_restrictions()

int pgrouting::trsp::Pgr_trspHandler::initialize_restrictions ( const std::vector< Rule > &  ruleList)
private

Definition at line 237 of file pgr_trspHandler.cpp.

238  {
239  for (const auto &rule : ruleList) {
240  auto dest_edge_id = rule.dest_id();
241  if (m_ruleTable.find(dest_edge_id) != m_ruleTable.end()) {
242  m_ruleTable[dest_edge_id].push_back(rule);
243  } else {
244  std::vector<Rule> r;
245  r.push_back(rule);
246  m_ruleTable.insert(std::make_pair(dest_edge_id, r));
247  }
248  }
249 
250  return true;
251 }

References m_ruleTable.

Referenced by Pgr_trspHandler().

◆ process() [1/2]

Path pgrouting::trsp::Pgr_trspHandler::process ( const int64_t  start_vertex,
const int64_t  end_vertex 
)

process

does the processisng

Definition at line 259 of file pgr_trspHandler.cpp.

261  {
262  clear();
263 
264  m_start_vertex = start_vertex - m_min_id;
265  m_end_vertex = end_vertex - m_min_id;
266 
268  m_path = tmp;
269 
270  if (m_adjacency.find(m_start_vertex) == m_adjacency.end()) {
271  return Path();
272  }
273 
274  if (m_adjacency.find(m_end_vertex) == m_adjacency.end()) {
275  return Path();
276  }
277 
278  return process_trsp(m_edges.size());
279 }

References clear(), m_adjacency, m_edges, m_end_vertex, m_min_id, m_path, m_start_vertex, and process_trsp().

Referenced by do_trsp(), and process().

◆ process() [2/2]

std::deque< Path > pgrouting::trsp::Pgr_trspHandler::process ( const std::vector< int64_t >  sources,
const std::vector< int64_t >  targets 
)

process

does many to many processisng

Definition at line 292 of file pgr_trspHandler.cpp.

294  {
295  std::deque<Path> paths;
296  for (const auto &s : sources) {
297  for (const auto &t : targets) {
298  paths.push_back(process(s, t));
299  }
300  }
301 
302  std::sort(paths.begin(), paths.end(),
303  [](const Path &e1, const Path &e2)->bool {
304  return e1.end_id() < e2.end_id();
305  });
306  std::stable_sort(paths.begin(), paths.end(),
307  [](const Path &e1, const Path &e2)->bool {
308  return e1.start_id() < e2.start_id();
309  });
310  return paths;
311 }

References process().

◆ process_trsp()

Path pgrouting::trsp::Pgr_trspHandler::process_trsp ( size_t  edge_count)
private

Definition at line 389 of file pgr_trspHandler.cpp.

390  {
393  pgassert(m_parent.empty());
394 
395  m_parent.resize(edge_count + 1);
396  m_dCost.resize(edge_count + 1);
397 
398  initialize_que();
399 
401 
403 
404  auto cur_edge = dijkstra_exploration();
405 
407  if (current_node != m_end_vertex) {
409  return result.renumber_vertices(m_min_id);;
410  }
411 
413 
414  if (current_node == cur_edge.startNode()) {
415  construct_path(static_cast<int64_t>(cur_edge.idx()), C_EDGE);
416  } else {
417  construct_path(static_cast<int64_t>(cur_edge.idx()), RC_EDGE);
418  }
419 
420  Path_t pelement;
421  pelement.node = m_end_vertex;
422  pelement.edge = -1;
423  pelement.cost = 0.0;
424  m_path.push_back(pelement);
425 
426  m_path.Path::recalculate_agg_cost();
428 }

References C_EDGE, construct_path(), Path_t::cost, current_node, dijkstra_exploration(), Path_t::edge, Path::end_id(), initialize_que(), m_dCost, m_end_vertex, m_min_id, m_parent, m_path, m_start_vertex, Path_t::node, pgassert, Path::push_back(), RC_EDGE, Path::renumber_vertices(), and Path::start_id().

Referenced by process().

◆ renumber_edges()

int64_t pgrouting::trsp::Pgr_trspHandler::renumber_edges ( pgr_edge_t edges,
const size_t  edge_count 
) const
private

Definition at line 62 of file pgr_trspHandler.cpp.

64  {
65  int64_t v_min_id = INT64_MAX;
66  size_t z;
67  for (z = 0; z < total_edges; z++) {
68  if (edges[z].source < v_min_id)
69  v_min_id = edges[z].source;
70 
71  if (edges[z].target < v_min_id)
72  v_min_id = edges[z].target;
73  }
74 
75  for (z = 0; z < total_edges; z++) {
76  edges[z].source -= v_min_id;
77  edges[z].target -= v_min_id;
78  }
79 
80  return v_min_id;
81 }

References pgr_edge_t::source, and pgr_edge_t::target.

Referenced by Pgr_trspHandler().

Member Data Documentation

◆ current_node

int64_t pgrouting::trsp::Pgr_trspHandler::current_node
private

Definition at line 199 of file pgr_trspHandler.h.

Referenced by dijkstra_exploration(), and process_trsp().

◆ m_adjacency

std::map<int64_t, std::vector<size_t> > pgrouting::trsp::Pgr_trspHandler::m_adjacency
private

m_adjacency[vertex] = {edges}

Definition at line 190 of file pgr_trspHandler.h.

Referenced by addEdge(), initialize_que(), and process().

◆ m_dCost

std::vector<CostHolder> pgrouting::trsp::Pgr_trspHandler::m_dCost
private

◆ m_edges

std::vector<EdgeInfo> pgrouting::trsp::Pgr_trspHandler::m_edges
private

◆ m_end_vertex

int64_t pgrouting::trsp::Pgr_trspHandler::m_end_vertex
private

Definition at line 194 of file pgr_trspHandler.h.

Referenced by dijkstra_exploration(), process(), and process_trsp().

◆ m_mapEdgeId2Index

std::map<int64_t, int64_t> pgrouting::trsp::Pgr_trspHandler::m_mapEdgeId2Index
private

Used only to veryfy that there are no reppetitions inserted the way it orks, repeating edges id is not allowed.

Definition at line 185 of file pgr_trspHandler.h.

Referenced by addEdge(), and construct_graph().

◆ m_min_id

int64_t pgrouting::trsp::Pgr_trspHandler::m_min_id
private

Definition at line 201 of file pgr_trspHandler.h.

Referenced by Pgr_trspHandler(), process(), and process_trsp().

◆ m_parent

std::vector<Predecessor> pgrouting::trsp::Pgr_trspHandler::m_parent
private

◆ m_path

Path pgrouting::trsp::Pgr_trspHandler::m_path
private

Definition at line 203 of file pgr_trspHandler.h.

Referenced by clear(), construct_path(), process(), and process_trsp().

◆ m_ruleTable

std::map<int64_t, std::vector<Rule> > pgrouting::trsp::Pgr_trspHandler::m_ruleTable
private

Definition at line 208 of file pgr_trspHandler.h.

Referenced by getRestrictionCost(), and initialize_restrictions().

◆ m_start_vertex

int64_t pgrouting::trsp::Pgr_trspHandler::m_start_vertex
private

◆ que

std::priority_queue<PDP, std::vector<PDP>, std::greater<PDP> > pgrouting::trsp::Pgr_trspHandler::que
private

Definition at line 213 of file pgr_trspHandler.h.

Referenced by add_to_que(), and dijkstra_exploration().


The documentation for this class was generated from the following files:
Path::end_id
int64_t end_id() const
Definition: basePath_SSEC.hpp:67
pgrouting::trsp::Pgr_trspHandler::renumber_edges
int64_t renumber_edges(pgr_edge_t *edges, const size_t edge_count) const
Definition: pgr_trspHandler.cpp:62
Path
Definition: basePath_SSEC.hpp:47
Path::start_id
int64_t start_id() const
Definition: basePath_SSEC.hpp:65
Path::push_back
void push_back(Path_t data)
Definition: basePath_SSEC.cpp:52
pgrouting::trsp::Pgr_trspHandler::m_start_vertex
int64_t m_start_vertex
Definition: pgr_trspHandler.h:193
pgrouting::trsp::Pgr_trspHandler::ILLEGAL
@ ILLEGAL
Definition: pgr_trspHandler.h:68
pgrouting::trsp::Pgr_trspHandler::C_EDGE
@ C_EDGE
Definition: pgr_trspHandler.h:68
pgrouting::trsp::Pgr_trspHandler::initialize_que
void initialize_que()
Definition: pgr_trspHandler.cpp:329
edge::cost
float8 cost
Definition: trsp.h:45
Path_t
Definition: path_t.h:36
pgrouting::trsp::Pgr_trspHandler::dijkstra_exploration
EdgeInfo dijkstra_exploration()
Definition: pgr_trspHandler.cpp:353
Path_t::node
int64_t node
Definition: path_t.h:37
pgrouting::trsp::Pgr_trspHandler::process
Path process(const int64_t start_vertex, const int64_t end_vertex)
process
Definition: pgr_trspHandler.cpp:259
pgrouting::trsp::Pgr_trspHandler::explore
void explore(int64_t cur_node, const EdgeInfo cur_edge, bool isStart)
Definition: pgr_trspHandler.cpp:186
pgrouting::trsp::Pgr_trspHandler::m_dCost
std::vector< CostHolder > m_dCost
Definition: pgr_trspHandler.h:206
pgr_edge_t::source
int64_t source
Definition: pgr_edge_t.h:39
pgrouting::trsp::Pgr_trspHandler::m_ruleTable
std::map< int64_t, std::vector< Rule > > m_ruleTable
Definition: pgr_trspHandler.h:208
pgrouting::trsp::Pgr_trspHandler::construct_graph
void construct_graph(pgr_edge_t *edges, const size_t edge_count, const bool directed)
Definition: pgr_trspHandler.cpp:435
Path_t::edge
int64_t edge
Definition: path_t.h:38
pgr_edge_t::target
int64_t target
Definition: pgr_edge_t.h:40
edge
Definition: trsp.h:41
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
pgrouting::trsp::Pgr_trspHandler::m_end_vertex
int64_t m_end_vertex
Definition: pgr_trspHandler.h:194
pgrouting::trsp::Pgr_trspHandler::m_adjacency
std::map< int64_t, std::vector< size_t > > m_adjacency
m_adjacency[vertex] = {edges}
Definition: pgr_trspHandler.h:190
pgrouting::trsp::Pgr_trspHandler::add_to_que
void add_to_que(double cost, size_t e_idx, bool isStart)
Definition: pgr_trspHandler.cpp:317
pgrouting::trsp::Pgr_trspHandler::Position
Position
predecesor edge
Definition: pgr_trspHandler.h:68
pgrouting::trsp::Pgr_trspHandler::RC_EDGE
@ RC_EDGE
Definition: pgr_trspHandler.h:68
pgrouting::trsp::Pgr_trspHandler::m_mapEdgeId2Index
std::map< int64_t, int64_t > m_mapEdgeId2Index
Used only to veryfy that there are no reppetitions inserted the way it orks, repeating edges id is no...
Definition: pgr_trspHandler.h:185
pgrouting::trsp::Pgr_trspHandler::addEdge
bool addEdge(const pgr_edge_t edgeIn)
Definition: pgr_trspHandler.cpp:508
pgrouting::trsp::Pgr_trspHandler::process_trsp
Path process_trsp(size_t edge_count)
Definition: pgr_trspHandler.cpp:389
pgrouting::trsp::Pgr_trspHandler::m_path
Path m_path
Definition: pgr_trspHandler.h:203
pgrouting::trsp::Pgr_trspHandler::m_min_id
int64_t m_min_id
Definition: pgr_trspHandler.h:201
pgrouting::trsp::Pgr_trspHandler::m_edges
std::vector< EdgeInfo > m_edges
Definition: pgr_trspHandler.h:179
pgrouting::trsp::Pgr_trspHandler::get_tot_cost
double get_tot_cost(double cost, size_t edge_idx, bool isStart)
Definition: pgr_trspHandler.cpp:172
pgr_edge_t::id
int64_t id
Definition: pgr_edge_t.h:38
pgrouting::trsp::Pgr_trspHandler::clear
void clear()
Definition: pgr_trspHandler.cpp:87
pgrouting::trsp::Pgr_trspHandler::connectStartEdge
void connectStartEdge(size_t firstEdge_idx, size_t secondEdge_idx)
Definition: pgr_trspHandler.cpp:462
pgrouting::trsp::Pgr_trspHandler::initialize_restrictions
int initialize_restrictions(const std::vector< Rule > &ruleList)
Definition: pgr_trspHandler.cpp:237
pgrouting::trsp::Pgr_trspHandler::m_parent
std::vector< Predecessor > m_parent
Definition: pgr_trspHandler.h:205
pgrouting::trsp::Pgr_trspHandler::getRestrictionCost
double getRestrictionCost(int64_t cur_node, const EdgeInfo &new_edge, bool isStart)
Definition: pgr_trspHandler.cpp:139
pgrouting::trsp::Pgr_trspHandler::connectEndEdge
void connectEndEdge(size_t firstEdge_idx, size_t secondEdge_idx)
Definition: pgr_trspHandler.cpp:485
pgrouting::trsp::Pgr_trspHandler::que
std::priority_queue< PDP, std::vector< PDP >, std::greater< PDP > > que
Definition: pgr_trspHandler.h:213
pgrouting::trsp::Pgr_trspHandler::current_node
int64_t current_node
Definition: pgr_trspHandler.h:199
Path::renumber_vertices
Path & renumber_vertices(int64_t value)
Definition: basePath_SSEC.cpp:38
Path_t::cost
double cost
Definition: path_t.h:39
Path::clear
void clear()
Definition: basePath_SSEC.cpp:87
pgrouting::trsp::Pgr_trspHandler::construct_path
double construct_path(int64_t ed_id, Position pos)
Definition: pgr_trspHandler.cpp:95