vrpRouting  0.3
vrprouting::problem::PickDeliver Class Reference

the pick deliver problem More...

#include "pickDeliver.h"

Collaboration diagram for vrprouting::problem::PickDeliver:

Public Member Functions

 PickDeliver (PickDeliveryOrders_t *p_orders, size_t p_orders_size, Vehicle_t *p_vehicles, size_t p_vehicles_size, const Matrix &p_cost_matrix)
 General Constructor. More...
 
 PickDeliver (PickDeliveryOrders_t *p_orders, size_t p_orders_size, Vehicle_t *p_vehicles, size_t p_vehicles_size, std::vector< Short_vehicle > new_stops, const Matrix &p_cost_matrix)
 Override stops constructor. More...
 
virtual ~PickDeliver ()=default
 
void add_node (const Vehicle_node &node)
 add a node to the set of nodes More...
 
std::vector< CompatibleVehicles_rtget_pg_compatibleVehicles () const
 get the vehicles compatibility results as C++ container More...
 
size_t & node_id ()
 
const Ordersorders ()
 
const Matrixtime_matrix ()
 
const Fleetvehicles ()
 

Public Attributes

const Matrixm_cost_matrix
 the cost matrix More...
 
Pgr_messages msg
 message controller for all classes More...
 

Protected Attributes

Orders m_orders
 the set of orders More...
 
Fleet m_trucks
 the set of vehicles More...
 

Private Attributes

size_t m_node_id = 0
 used to keep track of the next index the node gets More...
 
std::vector< Vehicle_nodem_nodes { }
 set of vehicle nodes More...
 

Detailed Description

the pick deliver problem

Definition at line 50 of file pickDeliver.h.

Constructor & Destructor Documentation

◆ PickDeliver() [1/2]

vrprouting::problem::PickDeliver::PickDeliver ( PickDeliveryOrders_t p_orders,
size_t  p_orders_size,
Vehicle_t p_vehicles,
size_t  p_vehicles_size,
const Matrix p_cost_matrix 
)
inline

General Constructor.

Definition at line 53 of file pickDeliver.h.

56  :
57  m_cost_matrix(p_cost_matrix),
58  m_orders(p_orders, p_orders_size, this),
59  m_trucks(p_vehicles, p_vehicles_size, m_orders, m_nodes, m_node_id) {
60  if (!msg.get_error().empty()) return;
61  m_trucks.clean();
64  }

References vrprouting::problem::Fleet::clean(), vrprouting::Pgr_messages::get_error(), m_orders, m_trucks, msg, vrprouting::problem::Orders::set_compatibles(), and vrprouting::problem::Fleet::set_compatibles().

◆ PickDeliver() [2/2]

vrprouting::problem::PickDeliver::PickDeliver ( PickDeliveryOrders_t p_orders,
size_t  p_orders_size,
Vehicle_t p_vehicles,
size_t  p_vehicles_size,
std::vector< Short_vehicle new_stops,
const Matrix p_cost_matrix 
)
inline

Override stops constructor.

Definition at line 67 of file pickDeliver.h.

71  :
72  m_cost_matrix(p_cost_matrix),
73  m_orders(p_orders, p_orders_size, this),
74  m_trucks(p_vehicles, p_vehicles_size, new_stops, m_orders, m_nodes, m_node_id) {
75  if (!msg.get_error().empty()) return;
76  m_trucks.clean();
79  }

References vrprouting::problem::Fleet::clean(), vrprouting::Pgr_messages::get_error(), m_orders, m_trucks, msg, vrprouting::problem::Orders::set_compatibles(), and vrprouting::problem::Fleet::set_compatibles().

◆ ~PickDeliver()

virtual vrprouting::problem::PickDeliver::~PickDeliver ( )
virtualdefault

Member Function Documentation

◆ add_node()

void vrprouting::problem::PickDeliver::add_node ( const Vehicle_node node)
inline

add a node to the set of nodes

Definition at line 108 of file pickDeliver.h.

108 {m_nodes.push_back(node);}

References m_nodes.

◆ get_pg_compatibleVehicles()

std::vector<CompatibleVehicles_rt> vrprouting::problem::PickDeliver::get_pg_compatibleVehicles ( ) const
inline

get the vehicles compatibility results as C++ container

Definition at line 84 of file pickDeliver.h.

84  {
85  std::vector<CompatibleVehicles_rt> result;
86  for (const auto& v : m_trucks) {
87  if (v.is_phony()) continue;
88  for (const auto o : v.feasible_orders()) {
89  result.push_back({m_orders[o].id(), v.id()});
90  }
91  }
92  return result;
93  }

References m_orders, and m_trucks.

Referenced by do_compatibleVehicles().

◆ node_id()

size_t& vrprouting::problem::PickDeliver::node_id ( )
inline

Definition at line 104 of file pickDeliver.h.

104 {return m_node_id;}

References m_node_id.

◆ orders()

const Orders& vrprouting::problem::PickDeliver::orders ( )
inline

Definition at line 95 of file pickDeliver.h.

95 {return m_orders;}

References m_orders.

◆ time_matrix()

const Matrix& vrprouting::problem::PickDeliver::time_matrix ( )
inline

Definition at line 103 of file pickDeliver.h.

103 {return m_cost_matrix;}

References m_cost_matrix.

◆ vehicles()

const Fleet& vrprouting::problem::PickDeliver::vehicles ( )
inline

Definition at line 96 of file pickDeliver.h.

96 {return m_trucks;}

References m_trucks.

Member Data Documentation

◆ m_cost_matrix

const Matrix& vrprouting::problem::PickDeliver::m_cost_matrix

the cost matrix

Definition at line 102 of file pickDeliver.h.

Referenced by time_matrix().

◆ m_node_id

size_t vrprouting::problem::PickDeliver::m_node_id = 0
private

used to keep track of the next index the node gets

The first one will get 0

  • therefore the first one will be located at m_nodes[0]
Precondition
Status before constructors m_node_id == 0

Definition at line 118 of file pickDeliver.h.

Referenced by node_id().

◆ m_nodes

std::vector<Vehicle_node> vrprouting::problem::PickDeliver::m_nodes { }
private

set of vehicle nodes

Precondition
Status before constructors m_nodes.empty() == true

Definition at line 124 of file pickDeliver.h.

Referenced by add_node().

◆ m_orders

Orders vrprouting::problem::PickDeliver::m_orders
protected

the set of orders

Definition at line 128 of file pickDeliver.h.

Referenced by get_pg_compatibleVehicles(), orders(), and PickDeliver().

◆ m_trucks

Fleet vrprouting::problem::PickDeliver::m_trucks
protected

the set of vehicles

Definition at line 132 of file pickDeliver.h.

Referenced by get_pg_compatibleVehicles(), PickDeliver(), and vehicles().

◆ msg

Pgr_messages vrprouting::problem::PickDeliver::msg

The documentation for this class was generated from the following file:
vrprouting::problem::PickDeliver::m_trucks
Fleet m_trucks
the set of vehicles
Definition: pickDeliver.h:132
vrprouting::problem::PickDeliver::m_nodes
std::vector< Vehicle_node > m_nodes
set of vehicle nodes
Definition: pickDeliver.h:124
vrprouting::problem::Orders::set_compatibles
void set_compatibles(Speed=1.0)
set the compatability between all orders
Definition: orders.cpp:128
vrprouting::problem::PickDeliver::msg
Pgr_messages msg
message controller for all classes
Definition: pickDeliver.h:99
vrprouting::problem::Fleet::set_compatibles
void set_compatibles(const Orders &orders)
sets the compatability of orders on the fleet
Definition: fleet.cpp:313
vrprouting::Pgr_messages::get_error
std::string get_error() const
gets the contents of error message
Definition: pgr_messages.cpp:53
vrprouting::problem::PickDeliver::m_cost_matrix
const Matrix & m_cost_matrix
the cost matrix
Definition: pickDeliver.h:102
vrprouting::problem::PickDeliver::m_node_id
size_t m_node_id
used to keep track of the next index the node gets
Definition: pickDeliver.h:118
vrprouting::problem::PickDeliver::m_orders
Orders m_orders
the set of orders
Definition: pickDeliver.h:128
vrprouting::problem::Fleet::clean
void clean()
removes from fleet all invalid vehicles
Definition: fleet.cpp:107