PGROUTING  3.1
pgrouting::vrp Namespace Reference

Classes

class  Base_node
 The Base_node class defines the operations that can be performed in a 2D node. More...
 
class  Dnode
 The Dnode class defines a the basic operations when data is a matrix. More...
 
class  Fleet
 
class  Initial_solution
 
class  Node
 The Node class defines a point in 2D space with an id. More...
 
class  Optimize
 
class  Order
 
class  PD_Orders
 
class  PD_problem
 
class  Pgr_pickDeliver
 
class  Solution
 
class  Swap_bk
 
class  Swap_info
 
class  Tw_node
 Extends the Node class to create a Node with time window attributes. More...
 
class  Vehicle
 Vehicle with time windows. More...
 
class  Vehicle_node
 Extend Tw_node to evaluate the vehicle at node level. More...
 
class  Vehicle_pickDeliver
 

Enumerations

enum  Initials_code {
  OneTruck, OnePerTruck, FrontTruck, BackTruck,
  BestInsert, BestBack, BestFront, OneDepot
}
 Different kinds to insert an order into the vehicle. More...
 

Functions

bool operator< (const Vehicle &lhs, const Vehicle &rhs)
 
std::ostream & operator<< (std::ostream &os, const Base_node &node)
 
std::ostream & operator<< (std::ostream &log, const Dnode &node)
 
std::ostream & operator<< (std::ostream &log, const Swap_info &d)
 
std::ostream & operator<< (std::ostream &log, const Node &node)
 
std::ostream & operator<< (std::ostream &log, const Order &order)
 
std::ostream & operator<< (std::ostream &log, const Swap_bk &data)
 
std::ostream & operator<< (std::ostream &log, const Vehicle_node &v)
 
std::ostream & operator<< (std::ostream &log, const Solution &solution)
 
std::ostream & operator<< (std::ostream &log, const Tw_node &n)
 Print the contents of a Twnode object. More...
 
std::ostream & operator<< (std::ostream &log, const Fleet &f)
 
std::ostream & operator<< (std::ostream &log, const Vehicle &v)
 

Enumeration Type Documentation

◆ Initials_code

Different kinds to insert an order into the vehicle.

Enumerator
OneTruck 
OnePerTruck 

All orders in one truck.

FrontTruck 

One Order per truck.

BackTruck 

Insetion at the front of the truck.

BestInsert 

Insetion at the back of the truck.

BestBack 

Best place to insert Order.

BestFront 

Push back order that allows more orders to be inserted at the back.

OneDepot 

Push front order that allows more orders to be inserted at the front.

Pick at front, drop at back, OneDepot for all vehicles

Definition at line 36 of file initials_code.h.

36  {
37  OneTruck,
38  OnePerTruck,
39  FrontTruck,
40  BackTruck,
41  BestInsert,
42  BestBack,
43  BestFront,
44  OneDepot
45 };
Insetion at the front of the truck.
Definition: initials_code.h:40
Push front order that allows more orders to be inserted at the front.
Definition: initials_code.h:44
Push back order that allows more orders to be inserted at the back.
Definition: initials_code.h:43
Best place to insert Order.
Definition: initials_code.h:42
Insetion at the back of the truck.
Definition: initials_code.h:41
One Order per truck.
Definition: initials_code.h:39
All orders in one truck.
Definition: initials_code.h:38

Function Documentation

◆ operator<()

bool pgrouting::vrp::operator< ( const Vehicle lhs,
const Vehicle rhs 
)

Definition at line 625 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::invariant(), and pgrouting::vrp::Vehicle::m_path.

625  {
626  lhs.invariant();
627  rhs.invariant();
628 
629  if (lhs.m_path.size() < rhs.m_path.size()) return true;
630 
631  /* here because sizes are equal */
632 
633  if (lhs.m_path.back().total_travel_time()
634  < rhs.m_path.back().total_travel_time()) return true;
635 
636  return false;
637 }

◆ operator<<() [1/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  os,
const Base_node node 
)

Definition at line 33 of file base_node.cpp.

References pgrouting::Identifier::id(), and pgrouting::Identifier::idx().

33  {
34  return os << node.id()
35  << "(" << node.idx() << ")";
36 }

◆ operator<<() [2/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Dnode node 
)

Definition at line 35 of file dnode.cpp.

References pgrouting::Identifier::id(), and pgrouting::Identifier::idx().

35  {
36  log << node.id()
37  << "(" << node.idx() << ")";
38  return log;
39 }

◆ operator<<() [3/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Swap_info d 
)

Definition at line 47 of file book_keeping.cpp.

References pgrouting::vrp::Swap_info::estimated_delta, pgrouting::vrp::Swap_info::from_order, pgrouting::vrp::Swap_info::from_truck, pgrouting::vrp::Vehicle_pickDeliver::orders(), pgrouting::vrp::Vehicle::tau(), pgrouting::vrp::Swap_info::to_order, and pgrouting::vrp::Swap_info::to_truck.

47  {
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 }

◆ operator<<() [4/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Node node 
)

Definition at line 49 of file node.cpp.

References pgrouting::vrp::Node::print().

49  {
50  node.print(log);
51  return log;
52 }

◆ operator<<() [5/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Order order 
)

Definition at line 55 of file order.cpp.

References pgrouting::vrp::Order::delivery(), pgrouting::Identifier::idx(), pgrouting::vrp::Order::m_compatibleI, pgrouting::vrp::Order::m_compatibleJ, pgrouting::vrp::Order::pickup(), Identifiers< T >::size(), and pgrouting::vrp::Tw_node::travel_time_to().

55  {
56  log << "\n\nOrder "
57  << static_cast<Identifier>(order) << ": \n"
58  << "\tPickup: " << order.pickup() << "\n"
59  << "\tDelivery: " << order.delivery() << "\n\n"
60  << "\tTravel time: "
61  << order.pickup().travel_time_to(order.delivery(), 1);
62  log << "\nThere are | {I}| = "
63  << order.m_compatibleI.size()
64  << " -> order(" << order.idx()
65  << ") -> | {J}| = " << order.m_compatibleJ.size()
66  << "\n\n {";
67  for (const auto o : order.m_compatibleI) {
68  log << o << ", ";
69  }
70  log << "} -> " << order.idx() << " -> {";
71  for (const auto o : order.m_compatibleJ) {
72  log << o << ", ";
73  }
74  log << "}";
75 
76  return log;
77 }

◆ operator<<() [6/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Swap_bk data 
)

Definition at line 63 of file book_keeping.cpp.

References pgrouting::vrp::Swap_bk::m_swaps.

63  {
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 }

◆ operator<<() [7/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Vehicle_node v 
)

Definition at line 101 of file vehicle_node.cpp.

References pgrouting::vrp::Vehicle_node::arrival_time(), pgrouting::vrp::Vehicle_node::cargo(), pgrouting::vrp::Vehicle_node::cvTot(), pgrouting::vrp::Vehicle_node::departure_time(), pgrouting::vrp::Vehicle_node::has_twv(), pgrouting::vrp::Tw_node::service_time(), pgrouting::vrp::Vehicle_node::travel_time(), pgrouting::vrp::Vehicle_node::twvTot(), and pgrouting::vrp::Vehicle_node::wait_time().

101  {
102  log << static_cast<const Tw_node&>(v)
103  << " twv = " << v.has_twv()
104  << ", twvTot = " << v.twvTot()
105  << ", cvTot = " << v.cvTot()
106  << ", cargo = " << v.cargo()
107  << ", travel_time = " << v.travel_time()
108  << ", arrival_time = " << v.arrival_time()
109  << ", wait_time = " << v.wait_time()
110  << ", service_time = " << v.service_time()
111  << ", departure_time = " << v.departure_time();
112  return log;
113 }

◆ operator<<() [8/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Solution solution 
)

Definition at line 185 of file solution.cpp.

References pgrouting::vrp::Solution::fleet, and pgrouting::vrp::Solution::tau().

185  {
186  for (const auto &vehicle : solution.fleet) {
187  log << vehicle;
188  }
189 
190  log << "\n SOLUTION:\n\n "
191  << solution.tau();
192 
193  return log;
194 }

◆ operator<<() [9/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Tw_node n 
)

Print the contents of a Twnode object.

Definition at line 286 of file tw_node.cpp.

References pgrouting::Identifier::id(), pgrouting::vrp::Tw_node::m_closes, pgrouting::vrp::Tw_node::m_demand, pgrouting::vrp::Tw_node::m_opens, pgrouting::vrp::Tw_node::m_service_time, and pgrouting::vrp::Tw_node::type_str().

286  {
287  log << n.id()
288  << "[opens = " << n.m_opens
289  << "\tcloses = " << n.m_closes
290  << "\tservice = " << n.m_service_time
291  << "\tdemand = " << n.m_demand
292  << "\ttype = " << n.type_str()
293  << "]"
294  << "\n";
295  return log;
296 }

◆ operator<<() [10/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Fleet f 
)

Definition at line 436 of file fleet.cpp.

References pgrouting::vrp::Fleet::m_trucks.

436  {
437  log << "fleet\n";
438  for (const auto &v : f.m_trucks) {
439  log << v;
440  }
441  log << "end fleet\n";
442 
443  return log;
444 }

◆ operator<<() [11/11]

std::ostream& pgrouting::vrp::operator<< ( std::ostream &  log,
const Vehicle v 
)

Definition at line 607 of file vehicle.cpp.

References pgrouting::Identifier::id(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_capacity, pgrouting::vrp::Vehicle::m_factor, pgrouting::vrp::Vehicle::m_speed, pgrouting::vrp::Vehicle::path(), and pgrouting::vrp::Vehicle::speed().

607  {
608  v.invariant();
609  int i(0);
610  log << "\n\n****************** " << v.idx() << "th VEHICLE*************\n";
611  log << "id = " << v.id()
612  << "\tcapacity = " << v.m_capacity
613  << "\tfactor = " << v.m_factor << "\n"
614  << "\tspeed = " << v.m_speed << "\n"
615  << "\tnew speed = " << v.speed() << "\n";
616 
617  for (const auto &path_stop : v.path()) {
618  log << "Path_stop" << ++i << "\n";
619  log << path_stop << "\n";
620  }
621  return log;
622 }