PGROUTING  2.6
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
6 Mail: project@pgrouting.org
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
const PD_Orders & orders() const
friend std::ostream & operator<<(std::ostream &log, const Swap_info &d)
std::string tau() const
Definition: vehicle.cpp:516
Vehicle_pickDeliver from_truck
Definition: book_keeping.h:83
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
Vehicle_pickDeliver to_truck
Definition: book_keeping.h:84