PGROUTING  3.2
book_keeping.cpp
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: book_keeping.cpp
4 
5 Copyright (c) 2017 pgRouting developers
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
26 
27 #include "vrp/book_keeping.h"
28 
29 #include <queue>
30 #include <iostream>
31 
32 namespace pgrouting {
33 namespace vrp {
34 
36  const Vehicle_pickDeliver &to,
37  size_t from_o,
38  size_t to_o,
39  double delta) :
40  from_truck(from),
41  to_truck(to),
42  from_order(from_o),
43  to_order(to_o),
44  estimated_delta(delta)
45  { }
46 
47 std::ostream& operator << (std::ostream& log, const Swap_info &d) {
48  log << "\n" << d.from_truck.tau() << " --> "
49  << d.from_order
50  << "("
51  << d.from_truck.orders()[d.from_order].pickup().id()
52  << ")"
53  << "\n" << d.to_truck.tau() << " --> "
54  << d.to_order
55  << "("
56  << d.to_truck.orders()[d.to_order].pickup().id()
57  << ")"
58  << "\n" << "delta = " << d.estimated_delta;
59  return log;
60 }
61 
62 
63 std::ostream& operator<< (std::ostream &log, const Swap_bk &data) {
64  auto q = data.m_swaps;
65  while (!q.empty()) {
66  log << q.top() << " ";
67  q.pop();
68  }
69  log << '\n';
70  return log;
71 }
72 
73 
74 } // namespace vrp
75 } // namespace pgrouting
pgrouting::vrp::Swap_info::Swap_info
Swap_info()=delete
pgrouting::vrp::Vehicle_pickDeliver::orders
const PD_Orders & orders() const
Definition: vehicle_pickDeliver.h:77
pgrouting::vrp::Swap_info
Definition: book_keeping.h:44
pgrouting::vrp::Swap_info::from_order
size_t from_order
Definition: book_keeping.h:77
pgrouting::vrp::operator<<
std::ostream & operator<<(std::ostream &log, const Swap_info &d)
Definition: book_keeping.cpp:47
pgrouting::vrp::Vehicle_pickDeliver
Definition: vehicle_pickDeliver.h:47
pgrouting::vrp::Swap_info::estimated_delta
double estimated_delta
Definition: book_keeping.h:79
pgrouting::vrp::Swap_info::from_truck
Vehicle_pickDeliver from_truck
Definition: book_keeping.h:75
pgrouting::vrp::Swap_info::to_order
size_t to_order
Definition: book_keeping.h:78
pgrouting::vrp::Swap_bk::m_swaps
Swaps_queue m_swaps
Definition: book_keeping.h:99
pgrouting::vrp::Swap_bk
Definition: book_keeping.h:83
pgrouting::vrp::Swap_info::to_truck
Vehicle_pickDeliver to_truck
Definition: book_keeping.h:76
book_keeping.h
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::vrp::Vehicle::tau
std::string tau() const
Definition: vehicle.cpp:457