PGROUTING  3.2
pgrouting::vrp::Vehicle_pickDeliver Class Reference

#include "vehicle_pickDeliver.h"

Inheritance diagram for pgrouting::vrp::Vehicle_pickDeliver:
Collaboration diagram for pgrouting::vrp::Vehicle_pickDeliver:

Public Types

typedef std::tuple< int, int, size_t, double, double > Cost
 

Public Member Functions

 Vehicle_pickDeliver (const Vehicle_pickDeliver &)=default
 
 Vehicle_pickDeliver (size_t idx, int64_t id, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double p_capacity, double p_speed, double factor)
 
void do_while_feasable (Initials_code kind, Identifiers< size_t > &unassigned, Identifiers< size_t > &assigned)
 
std::pair< POS, POSdrop_position_limits (const Vehicle_node node) const
 
void erase (const Order &order)
 
Identifiers< size_t > feasable_orders () const
 
std::vector< General_vehicle_orders_tget_postgres_result (int vid) const
 
bool has_order (const Order &order) const
 
int64_t id () const
 
size_t idx () const
 
bool insert (const Order &order)
 Inserts an order. More...
 
bool is_order_feasable (const Order &order) const
 
bool is_phony () const
 
const PD_Ordersorders () const
 
Identifiers< size_t > orders_in_vehicle () const
 
size_t orders_size () const
 
std::pair< POS, POSposition_limits (const Vehicle_node node) const
 
void push_back (const Order &order)
 puts an order at the end of the truck More...
 
void push_front (const Order &order)
 Puts an order at the end front of the truck. More...
 
void reset_id (int64_t)
 
bool semiLIFO (const Order &order)
 Inserts an order In semi-Lifo order. More...
 
void set_compatibles (const PD_Orders &orders)
 
double speed () const
 
void swap (POS i, POS j)
 Swap two nodes in the path. More...
 
deque like functions
Returns
True if the operation was performed
Warning
Assertions are performed for out of range operations
no feasability nor time window or capacity violations checks are performed
Todo:
TODO more deque like functions here
void invariant () const
 Invariant The path must: More...
 
void insert (POS pos, Vehicle_node node)
 @ { More...
 
POS insert (std::pair< POS, POS > position_limits, const Vehicle_node &node)
 Insert node in best position of the position_limits. More...
 
void erase (const Vehicle_node &node)
 Erase node.id() More...
 
void erase (POS pos)
 Erase node at pos from the path. More...
 
bool empty () const
 return true when no nodes are in the truck More...
 
size_t size () const
 return number of nodes in the truck More...
 
Cost cost () const
 
bool cost_compare (const Cost &, const Cost &) const
 
double duration () const
 
double total_wait_time () const
 
double total_travel_time () const
 
double total_service_time () const
 
int twvTot () const
 
int cvTot () const
 
bool has_twv () const
 
bool has_cv () const
 
bool is_feasable () const
 
bool is_ok () const
 
Vehicle_node start_site () const
 
Vehicle_node end_site () const
 
double capacity () const
 
Evaluation

Path evaluation is done incrementally: from a given position to the end of the path, and intermediate values are cached on each node.

So, for example, changing the path at position 100: the evaluation function should be called as evaluate(100, maxcapacity) and from that position to the end of the path will be evaluated. None of the "unaffected" positions get reevaluated

void evaluate ()
 @ { More...
 
void evaluate (POS from)
 Evaluate: Evaluate a path from the given position. More...
 
accessors
std::deque< Vehicle_nodepath () const
 @ { More...
 
deque like functions
Returns
True if the operation was performed
Warning
Assertions are performed for out of range operations
no feasability nor time window or capacity violations checks are performed
Todo:
TODO more deque like functions here
void invariant () const
 Invariant The path must: More...
 
void insert (POS pos, Vehicle_node node)
 @ { More...
 
POS insert (std::pair< POS, POS > position_limits, const Vehicle_node &node)
 Insert node in best position of the position_limits. More...
 
void erase (const Vehicle_node &node)
 Erase node.id() More...
 
void erase (POS pos)
 Erase node at pos from the path. More...
 
bool empty () const
 return true when no nodes are in the truck More...
 
size_t size () const
 return number of nodes in the truck More...
 
Cost cost () const
 
bool cost_compare (const Cost &, const Cost &) const
 
double duration () const
 
double total_wait_time () const
 
double total_travel_time () const
 
double total_service_time () const
 
int twvTot () const
 
int cvTot () const
 
bool has_twv () const
 
bool has_cv () const
 
bool is_feasable () const
 
bool is_ok () const
 
Vehicle_node start_site () const
 
Vehicle_node end_site () const
 
double capacity () const
 
Evaluation

Path evaluation is done incrementally: from a given position to the end of the path, and intermediate values are cached on each node.

So, for example, changing the path at position 100: the evaluation function should be called as evaluate(100, maxcapacity) and from that position to the end of the path will be evaluated. None of the "unaffected" positions get reevaluated

void evaluate ()
 @ { More...
 
void evaluate (POS from)
 Evaluate: Evaluate a path from the given position. More...
 
accessors
std::deque< Vehicle_nodepath () const
 @ { More...
 
operators
std::string tau () const
 

Static Public Member Functions

static Pgr_messagesmsg ()
 Access to the problem's message. More...
 

Static Public Attributes

static Pgr_pickDeliverproblem
 Pointer to problem. More...
 

Protected Types

using difference_type = std::deque< Vehicle_node >::difference_type
 
typedef size_t POS
 

Protected Attributes

double cost
 
Identifiers< size_t > m_feasable_orders
 orders that fit in the truck More...
 
PD_Orders m_orders
 
Identifiers< size_t > m_orders_in_vehicle
 orders inserted in this vehicle More...
 
std::deque< Vehicle_nodem_path
 

Private Member Functions

POS getDropPosLowLimit (const Vehicle_node &node) const
 
POS getPosHighLimit (const Vehicle_node &node) const
 
POS getPosLowLimit (const Vehicle_node &node) const
 

Private Attributes

double m_capacity
 
double m_factor
 
int64_t m_id
 
size_t m_idx
 
double m_speed
 

Friends

class Initial_solution
 
class Optimize
 

Detailed Description

Definition at line 47 of file vehicle_pickDeliver.h.

Member Typedef Documentation

◆ Cost

typedef std::tuple< int, int, size_t, double, double > pgrouting::vrp::Vehicle::Cost
inherited

Definition at line 90 of file vehicle.h.

◆ difference_type

Definition at line 76 of file vehicle.h.

◆ POS

typedef size_t pgrouting::vrp::Vehicle::POS
protectedinherited

Definition at line 75 of file vehicle.h.

Constructor & Destructor Documentation

◆ Vehicle_pickDeliver() [1/2]

pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver ( size_t  idx,
int64_t  id,
const Vehicle_node starting_site,
const Vehicle_node ending_site,
double  p_capacity,
double  p_speed,
double  factor 
)

Definition at line 48 of file vehicle_pickDeliver.cpp.

55  :
56  Vehicle(idx, id, starting_site, ending_site, p_capacity, p_speed, factor),
57  cost((std::numeric_limits<double>::max)()),
59  m_orders(),
61 #if 0
62  ENTERING();
63 #endif
64  invariant();
65 #if 0
66  EXITING();
67 #endif
68  }

References ENTERING, EXITING, and pgrouting::vrp::Vehicle::invariant().

◆ Vehicle_pickDeliver() [2/2]

pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver ( const Vehicle_pickDeliver )
default

Member Function Documentation

◆ capacity()

double pgrouting::vrp::Vehicle::capacity ( ) const
inlineinherited

Definition at line 238 of file vehicle.h.

238 {return m_capacity;}

References pgrouting::vrp::Vehicle::m_capacity.

Referenced by pgrouting::vrp::Vehicle::Vehicle().

◆ cost()

Vehicle::Cost pgrouting::vrp::Vehicle::cost ( ) const
inherited

◆ cost_compare()

bool pgrouting::vrp::Vehicle::cost_compare ( const Cost lhs,
const Cost rhs 
) const
inherited

Definition at line 97 of file vehicle.cpp.

97  {
98  /*
99  * capacity violations
100  */
101  if (std::get<1>(lhs) < std::get<1>(rhs))
102  return true;
103  if (std::get<1>(lhs) > std::get<1>(rhs))
104  return false;
105 
106  /*
107  * time window violations
108  */
109  if (std::get<0>(lhs) < std::get<0>(rhs))
110  return true;
111  if (std::get<0>(lhs) > std::get<0>(rhs))
112  return false;
113 
114  /*
115  * waiting time
116  */
117  if (std::get<3>(lhs) < std::get<3>(rhs))
118  return true;
119  if (std::get<3>(lhs) > std::get<3>(rhs))
120  return false;
121 
122  /*
123  * duration
124  */
125  if (std::get<4>(lhs) < std::get<4>(rhs))
126  return true;
127  if (std::get<4>(lhs) > std::get<4>(rhs))
128  return false;
129 
130  /*
131  * truck size
132  */
133  if (std::get<2>(lhs) < std::get<2>(rhs))
134  return true;
135  if (std::get<2>(lhs) > std::get<2>(rhs))
136  return false;
137 
138  return false;
139 }

Referenced by pgrouting::vrp::Vehicle::insert().

◆ cvTot()

int pgrouting::vrp::Vehicle::cvTot ( ) const
inlineinherited

Definition at line 216 of file vehicle.h.

216  {
217  return m_path.back().cvTot();
218  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::cost(), pgrouting::vrp::Vehicle::has_cv(), and pgrouting::vrp::Vehicle::tau().

◆ do_while_feasable()

void pgrouting::vrp::Vehicle_pickDeliver::do_while_feasable ( Initials_code  kind,
Identifiers< size_t > &  unassigned,
Identifiers< size_t > &  assigned 
)

Definition at line 227 of file vehicle_pickDeliver.cpp.

230  {
232 #if 0
233  msg.log << "unasigned" << unassigned << "\n";
234  msg.log << "m_feasable_orders" << m_feasable_orders << "\n";
235 #endif
236  auto current_feasable = m_feasable_orders * unassigned;
237 
238  while (!current_feasable.empty()) {
239 #if 0
240  msg.log << "current_feasable" << current_feasable << "\n";
241 #endif
242  auto order = m_orders[current_feasable.front()];
243 
244  switch (kind) {
245  case OnePerTruck:
246  push_back(order);
248  assigned += order.idx();
249  unassigned -= order.idx();
250  invariant();
251  return;
252  break;
253  case FrontTruck:
254  push_front(order);
255  break;
256  case BackTruck:
257  push_back(order);
258  break;
259  case BestInsert:
260  insert(order);
261  break;
262  case BestBack:
263  order = m_orders[m_orders.find_best_J(current_feasable)];
264  insert(order);
265  break;
266  case BestFront:
267  order = m_orders[m_orders.find_best_I(current_feasable)];
268  insert(order);
269  break;
270  case OneDepot:
271  semiLIFO(order);
272  break;
273  default: pgassert(false);
274  }
275 
276  if (orders_size() == 1 && !is_feasable()) {
277  pgassert(false);
278  }
279 
280  if (!is_feasable()) {
281  erase(order);
282  } else if (has_order(order)) {
283  assigned += order.idx();
284  unassigned -= order.idx();
285  if (kind == BestBack) {
286  current_feasable = m_orders[order.idx()].subsetJ(
287  current_feasable);
288  }
289  if (kind == BestFront) {
290  current_feasable = m_orders[order.idx()].subsetI(
291  current_feasable);
292  }
293  }
294 
295  current_feasable -= order.idx();
296  invariant();
297  }
298 
300  invariant();
301 }

References pgrouting::vrp::BackTruck, pgrouting::vrp::BestBack, pgrouting::vrp::BestFront, pgrouting::vrp::BestInsert, erase(), pgrouting::vrp::PD_Orders::find_best_I(), pgrouting::vrp::PD_Orders::find_best_J(), pgrouting::vrp::FrontTruck, has_order(), insert(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::is_feasable(), pgrouting::Pgr_messages::log, m_feasable_orders, m_orders, pgrouting::vrp::Vehicle::msg(), pgrouting::vrp::OneDepot, pgrouting::vrp::OnePerTruck, orders_size(), pgassert, push_back(), push_front(), and semiLIFO().

◆ drop_position_limits()

std::pair< size_t, size_t > pgrouting::vrp::Vehicle::drop_position_limits ( const Vehicle_node  node) const
inherited

Definition at line 306 of file vehicle.cpp.

306  {
307  POS high = getPosHighLimit(node);
308  POS low = getDropPosLowLimit(node);
309  return std::make_pair(low, high);
310 }

References pgrouting::vrp::Vehicle::getDropPosLowLimit(), and pgrouting::vrp::Vehicle::getPosHighLimit().

Referenced by semiLIFO().

◆ duration()

double pgrouting::vrp::Vehicle::duration ( ) const
inlineinherited

Definition at line 201 of file vehicle.h.

201  {
202  return m_path.back().departure_time();
203  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::cost(), insert(), and pgrouting::vrp::Vehicle::tau().

◆ empty()

bool pgrouting::vrp::Vehicle::empty ( ) const
inherited

return true when no nodes are in the truck

True: S E
False: S <nodes> E

Definition at line 259 of file vehicle.cpp.

259  {
260  invariant();
261  return m_path.size() <= 2;
262 }

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

Referenced by pgrouting::vrp::Optimize::move_order().

◆ end_site()

Vehicle_node pgrouting::vrp::Vehicle::end_site ( ) const
inlineinherited

Definition at line 235 of file vehicle.h.

235  {
236  return m_path.back();
237  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::is_ok().

◆ erase() [1/3]

void pgrouting::vrp::Vehicle_pickDeliver::erase ( const Order order)

◆ erase() [2/3]

void pgrouting::vrp::Vehicle::erase ( const Vehicle_node node)
inherited

Erase node.id()

Note
start and ending nodes cannot be erased

Numbers are positions before: S .... node.id() .... E after: S .... .... E

Todo:
TODO evaluate with matrix also

Definition at line 198 of file vehicle.cpp.

198  {
199  invariant();
200 
201  POS pos = 0;
202  for ( ; pos < m_path.size() ; ++pos) {
203  if (node.idx() == m_path[pos].idx())
204  break;
205  }
206 
207  erase(pos);
209  evaluate(pos);
210 
211  invariant();
212 }

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

Referenced by erase(), insert(), and semiLIFO().

◆ erase() [3/3]

void pgrouting::vrp::Vehicle::erase ( POS  pos)
inherited

Erase node at pos from the path.

Note
start and ending nodes cannot be erased

Numbers are positions before: S 1 2 3 4 5 6 pos 8 9 E after: S 1 2 3 4 5 6 8 9 E

Parameters
[in]posto be erased.

Definition at line 219 of file vehicle.cpp.

219  {
220  invariant();
221 
222  pgassert(m_path.size() > 2);
223  pgassert(at < m_path.size());
224  pgassert(!m_path[at].is_start());
225  pgassert(!m_path[at].is_end());
226 
227  m_path.erase(m_path.begin() + static_cast<difference_type>(at));
228  evaluate(at);
229 
230  invariant();
231 }

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

◆ evaluate() [1/2]

void pgrouting::vrp::Vehicle::evaluate ( )
inherited

@ {

Evaluate: Evaluate the whole path from the start.

Definition at line 250 of file vehicle.cpp.

250  {
251  invariant();
252 
253  evaluate(0);
254 
255  invariant();
256 }

References pgrouting::vrp::Vehicle::invariant().

Referenced by pgrouting::vrp::Vehicle::erase(), pgrouting::vrp::Vehicle::insert(), push_back(), push_front(), pgrouting::vrp::Vehicle::swap(), and pgrouting::vrp::Vehicle::Vehicle().

◆ evaluate() [2/2]

void pgrouting::vrp::Vehicle::evaluate ( POS  from)
inherited

Evaluate: Evaluate a path from the given position.

Parameters
[in]fromThe starting position in the path for evaluation to the end of the path.

Definition at line 271 of file vehicle.cpp.

271  {
272  invariant();
273  // preconditions
274  pgassert(from < m_path.size());
275 
276 
277  auto node = m_path.begin() + static_cast<difference_type>(from);
278 
279  while (node != m_path.end()) {
280  if (node == m_path.begin()) {
281  node->evaluate(m_capacity);
282  } else {
283  node->evaluate(*(node - 1), m_capacity, speed());
284  }
285 
286  ++node;
287  }
288  invariant();
289 }

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

◆ feasable_orders()

Identifiers<size_t> pgrouting::vrp::Vehicle_pickDeliver::feasable_orders ( ) const
inline

Definition at line 75 of file vehicle_pickDeliver.h.

75 {return m_feasable_orders;}

References m_feasable_orders.

◆ get_postgres_result()

std::vector< General_vehicle_orders_t > pgrouting::vrp::Vehicle::get_postgres_result ( int  vid) const
inherited

Definition at line 144 of file vehicle.cpp.

145  {
146  std::vector<General_vehicle_orders_t> result;
147  /* postgres numbering starts with 1 */
148  int stop_seq(1);
149  msg().log << "getting solution: " << tau() << "\n";
150  for (const auto &p_stop : m_path) {
151  General_vehicle_orders_t data = {
152  vid,
153  id(),
154  stop_seq,
155  /* order_id
156  * The order_id is invalid for stops type 0 and 5
157  */
158  (p_stop.type() == 0 || p_stop.type() == 5)? -1 : p_stop.order(),
159  p_stop.id(),
160  p_stop.type(),
161  p_stop.cargo(),
162  p_stop.travel_time(),
163  p_stop.arrival_time(),
164  p_stop.wait_time(),
165  p_stop.service_time(),
166  p_stop.departure_time()};
167  result.push_back(data);
168  ++stop_seq;
169  }
170  return result;
171 }

References pgrouting::Identifier::id(), pgrouting::Pgr_messages::log, pgrouting::vrp::Vehicle::m_path, pgrouting::vrp::Vehicle::msg(), and pgrouting::vrp::Vehicle::tau().

◆ getDropPosLowLimit()

size_t pgrouting::vrp::Vehicle::getDropPosLowLimit ( const Vehicle_node node) const
privateinherited

Definition at line 327 of file vehicle.cpp.

327  {
328  invariant();
329 
330  POS low = 0;
331  POS high = m_path.size();
332  POS low_limit = high;
333 
334  /* J == m_path[low_limit - 1] */
335  while (low_limit > low
336  && m_path[low_limit - 1].is_compatible_IJ(nodeI, speed())
337  && !m_path[low_limit - 1].is_pickup()) {
338  --low_limit;
339  }
340 
341  invariant();
342  return low_limit;
343 }

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

Referenced by pgrouting::vrp::Vehicle::drop_position_limits().

◆ getPosHighLimit()

size_t pgrouting::vrp::Vehicle::getPosHighLimit ( const Vehicle_node node) const
privateinherited

Definition at line 392 of file vehicle.cpp.

392  {
393  invariant();
394 
395  POS low = 0;
396  POS high = m_path.size();
397  POS high_limit = low;
398 
399  /* I == m_path[high_limit] */
400  while (high_limit < high
401  && nodeJ.is_compatible_IJ(m_path[high_limit], speed())) {
402  ++high_limit;
403  }
404 
405  invariant();
406  return high_limit;
407 }

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

Referenced by pgrouting::vrp::Vehicle::drop_position_limits(), and pgrouting::vrp::Vehicle::position_limits().

◆ getPosLowLimit()

size_t pgrouting::vrp::Vehicle::getPosLowLimit ( const Vehicle_node node) const
privateinherited

Definition at line 360 of file vehicle.cpp.

360  {
361  invariant();
362 
363  POS low = 0;
364  POS high = m_path.size();
365  POS low_limit = high;
366 
367  /* J == m_path[low_limit - 1] */
368  while (low_limit > low
369  && m_path[low_limit - 1].is_compatible_IJ(nodeI, speed())) {
370  --low_limit;
371  }
372 
373  invariant();
374  return low_limit;
375 }

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

Referenced by pgrouting::vrp::Vehicle::position_limits().

◆ has_cv()

bool pgrouting::vrp::Vehicle::has_cv ( ) const
inlineinherited

Definition at line 222 of file vehicle.h.

222  {
223  return cvTot() != 0;
224  }

References pgrouting::vrp::Vehicle::cvTot().

Referenced by insert(), pgrouting::vrp::Vehicle::is_feasable(), and semiLIFO().

◆ has_order()

bool pgrouting::vrp::Vehicle_pickDeliver::has_order ( const Order order) const

◆ has_twv()

bool pgrouting::vrp::Vehicle::has_twv ( ) const
inlineinherited

Definition at line 219 of file vehicle.h.

219  {
220  return twvTot() != 0;
221  }

References pgrouting::vrp::Vehicle::twvTot().

Referenced by pgrouting::vrp::Vehicle::is_feasable(), and semiLIFO().

◆ id()

◆ idx()

◆ insert() [1/3]

bool pgrouting::vrp::Vehicle_pickDeliver::insert ( const Order order)

Inserts an order.

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S <nodes> E
After: S ....P .... D .... E

push_back is performed when

  • pickup

Can generate time window violation No capacity violation

Definition at line 79 of file vehicle_pickDeliver.cpp.

79  {
80  invariant();
81  pgassert(!has_order(order));
82 
83  auto pick_pos(position_limits(order.pickup()));
84  auto deliver_pos(position_limits(order.delivery()));
85 #ifndef NDEBUG
86  std::ostringstream err_log;
87  err_log << "\n\tpickup limits (low, high) = ("
88  << pick_pos.first << ", "
89  << pick_pos.second << ") "
90  << "\n\tdeliver limits (low, high) = ("
91  << deliver_pos.first << ", "
92  << deliver_pos.second << ") "
93  << "\noriginal" << tau();
94 #endif
95 
96  if (pick_pos.second < pick_pos.first) {
97  /*
98  * pickup generates twv evrywhere
99  */
100  return false;
101  }
102 
103  if (deliver_pos.second < deliver_pos.first) {
104  /*
105  * delivery generates twv evrywhere
106  */
107  return false;
108  }
109  /*
110  * Because delivery positions were estimated without
111  * the pickup:
112  * - increase the upper limit position estimation
113  */
114  ++deliver_pos.first;
115  ++deliver_pos.second;
116 
117 
118  auto d_pos_backup(deliver_pos);
119  auto best_pick_pos = m_path.size();
120  auto best_deliver_pos = m_path.size() + 1;
121  auto current_duration(duration());
122  auto min_delta_duration = (std::numeric_limits<double>::max)();
123  auto found(false);
124  pgassertwm(!has_order(order), err_log.str());
125  while (pick_pos.first <= pick_pos.second) {
126 #ifndef NDEBUG
127  err_log << "\n\tpickup cycle limits (low, high) = ("
128  << pick_pos.first << ", "
129  << pick_pos.second << ") ";
130 #endif
131  Vehicle::insert(pick_pos.first, order.pickup());
132 #ifndef NDEBUG
133  err_log << "\npickup inserted: " << tau();
134 #endif
135 
136  if (deliver_pos.first <= pick_pos.first) deliver_pos.first = pick_pos.first + 1;
137 
138  while (deliver_pos.first <= deliver_pos.second) {
139  Vehicle::insert(deliver_pos.first, order.delivery());
140  m_orders_in_vehicle += order.idx();
141  pgassertwm(has_order(order), err_log.str());
142 #ifndef NDEBUG
143  err_log << "\ndelivery inserted: " << tau();
144 #endif
145  if (is_feasable()) {
147  auto delta_duration = duration() - current_duration;
148  if (delta_duration < min_delta_duration) {
149 #ifndef NDEBUG
150  err_log << "\nsuccess" << tau();
151 #endif
152  min_delta_duration = delta_duration;
153  best_pick_pos = pick_pos.first;
154  best_deliver_pos = deliver_pos.first;
155  found = true;
156  }
157  }
158  Vehicle::erase(deliver_pos.first);
159 #ifndef NDEBUG
160  err_log << "\ndelivery erased: " << tau();
161 #endif
162  ++deliver_pos.first;
163  }
164  Vehicle::erase(pick_pos.first);
165 #ifndef NDEBUG
166  err_log << "\npickup erased: " << tau();
167 #endif
168  m_orders_in_vehicle -= order.idx();
169  pgassertwm(!has_order(order), err_log.str());
170 
171  deliver_pos = d_pos_backup;
172 #ifndef NDEBUG
173  err_log << "\n\trestoring deliver limits (low, high) = ("
174  << deliver_pos.first << ", "
175  << deliver_pos.second << ") ";
176 #endif
177  ++pick_pos.first;
178  }
179  pgassertwm(!has_order(order), err_log.str());
180  if (!found) {
181  /* order causes twv or cv */
182  return false;
183  }
184  Vehicle::insert(best_pick_pos, order.pickup());
185  Vehicle::insert(best_deliver_pos, order.delivery());
186 
187  m_orders_in_vehicle += order.idx();
188  pgassertwm(is_feasable(), err_log.str());
189  pgassertwm(has_order(order), err_log.str());
190  pgassertwm(!has_cv(), err_log.str());
191  invariant();
192  return true;
193 }

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::duration(), pgrouting::vrp::Vehicle::erase(), pgrouting::vrp::Vehicle::has_cv(), has_order(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::is_feasable(), m_orders_in_vehicle, pgrouting::vrp::Vehicle::m_path, pgassert, pgassertwm, pgrouting::vrp::Order::pickup(), pgrouting::vrp::Vehicle::position_limits(), and pgrouting::vrp::Vehicle::tau().

Referenced by do_while_feasable(), and pgrouting::vrp::Optimize::move_order().

◆ insert() [2/3]

void pgrouting::vrp::Vehicle::insert ( POS  pos,
Vehicle_node  node 
)
inherited

@ {

Insert node at pos position.

Parameters
[in]posThe position that the node should be inserted.
[in]nodeThe node to insert.

Definition at line 183 of file vehicle.cpp.

183  {
184  invariant();
185  pgassert(at <= m_path.size());
186 
187  m_path.insert(m_path.begin() + static_cast<difference_type>(at), node);
188  evaluate(at);
189 
190  pgassert(at < m_path.size());
191  pgassert(m_path[at].idx() == node.idx());
192  invariant();
193 }

References pgrouting::vrp::Vehicle::evaluate(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, and pgassert.

Referenced by insert(), pgrouting::vrp::Vehicle::insert(), and semiLIFO().

◆ insert() [3/3]

size_t pgrouting::vrp::Vehicle::insert ( std::pair< POS, POS position_limits,
const Vehicle_node node 
)
inherited

Insert node in best position of the position_limits.

Parameters
[in]position_limits
[in]nodeThe node to insert
Returns
position where it was inserted

Definition at line 63 of file vehicle.cpp.

63  {
64  invariant();
65  pgassert(position_limits.first <= m_path.size());
66  pgassert(position_limits.second <= m_path.size());
67 
68  auto low = position_limits.first;
69  auto high = position_limits.second;
70  auto best = low;
71 
72 
73  insert(low, node);
74 
75  Vehicle::Cost best_cost(cost());
76 
77 
78  while (low < high) {
79  swap(low, low + 1);
80  ++low;
81  if (cost_compare(best_cost, cost())) {
82  best_cost = cost();
83  best = low;
84  }
85  }
86  return best;
87 
88  pgassert(best < m_path.size());
89  pgassert(m_path[best].idx() == node.idx());
90  invariant();
91 }

References pgrouting::vrp::Vehicle::cost(), pgrouting::vrp::Vehicle::cost_compare(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, pgassert, pgrouting::vrp::Vehicle::position_limits(), and pgrouting::vrp::Vehicle::swap().

◆ invariant()

◆ is_feasable()

bool pgrouting::vrp::Vehicle::is_feasable ( ) const
inlineinherited

Definition at line 226 of file vehicle.h.

226  {
227  return !(has_twv() || has_cv());
228  }

References pgrouting::vrp::Vehicle::has_cv(), and pgrouting::vrp::Vehicle::has_twv().

Referenced by do_while_feasable(), insert(), and semiLIFO().

◆ is_ok()

bool pgrouting::vrp::Vehicle::is_ok ( ) const
inherited

Definition at line 410 of file vehicle.cpp.

410  {
411  pgassert((m_path.front().opens() <= m_path.front().closes())
412  && (m_path.back().opens() <= m_path.back().closes())
413  && (m_capacity > 0));
414  return (start_site().opens() <= start_site().closes())
415  && (end_site().opens() <= end_site().closes())
416  && (m_capacity > 0);
417 }

References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Vehicle::end_site(), pgrouting::vrp::Vehicle::m_capacity, pgrouting::vrp::Vehicle::m_path, pgrouting::vrp::Tw_node::opens(), pgassert, and pgrouting::vrp::Vehicle::start_site().

◆ is_order_feasable()

bool pgrouting::vrp::Vehicle_pickDeliver::is_order_feasable ( const Order order) const

Definition at line 331 of file vehicle_pickDeliver.cpp.

331  {
332  auto test_truck = *this;
333  test_truck.push_back(order);
334  return test_truck.is_feasable();
335 }

Referenced by set_compatibles().

◆ is_phony()

bool pgrouting::vrp::Vehicle::is_phony ( ) const
inlineinherited

Definition at line 105 of file vehicle.h.

105 {return id() < 0;}

References pgrouting::Identifier::id().

Referenced by pgrouting::vrp::Optimize::move_order().

◆ msg()

Pgr_messages & pgrouting::vrp::Vehicle::msg ( )
staticinherited

Access to the problem's message.

Returns
reference to the problem's message

Definition at line 51 of file vehicle.cpp.

51  {
52  return problem->msg;
53 }

References pgrouting::vrp::Pgr_pickDeliver::msg, and pgrouting::vrp::Vehicle::problem.

Referenced by do_while_feasable(), pgrouting::vrp::Vehicle::get_postgres_result(), and pgrouting::vrp::Vehicle::Vehicle().

◆ orders()

const PD_Orders& pgrouting::vrp::Vehicle_pickDeliver::orders ( ) const
inline

Definition at line 77 of file vehicle_pickDeliver.h.

77 {return m_orders;}

References m_orders.

Referenced by pgrouting::vrp::operator<<(), set_compatibles(), and pgrouting::vrp::Optimize::swap_worse().

◆ orders_in_vehicle()

Identifiers<size_t> pgrouting::vrp::Vehicle_pickDeliver::orders_in_vehicle ( ) const
inline

◆ orders_size()

size_t pgrouting::vrp::Vehicle_pickDeliver::orders_size ( ) const
inline

Definition at line 78 of file vehicle_pickDeliver.h.

78 {return m_orders_in_vehicle.size();}

References m_orders_in_vehicle, and Identifiers< T >::size().

Referenced by do_while_feasable().

◆ path()

std::deque< Vehicle_node > pgrouting::vrp::Vehicle::path ( ) const
inherited

@ {

Definition at line 292 of file vehicle.cpp.

292  {
293  invariant();
294  return m_path;
295 }

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

Referenced by pgrouting::vrp::operator<<().

◆ position_limits()

std::pair< size_t, size_t > pgrouting::vrp::Vehicle::position_limits ( const Vehicle_node  node) const
inherited

Definition at line 299 of file vehicle.cpp.

299  {
300  POS high = getPosHighLimit(node);
301  POS low = getPosLowLimit(node);
302  return std::make_pair(low, high);
303 }

References pgrouting::vrp::Vehicle::getPosHighLimit(), and pgrouting::vrp::Vehicle::getPosLowLimit().

Referenced by insert(), and pgrouting::vrp::Vehicle::insert().

◆ push_back()

void pgrouting::vrp::Vehicle_pickDeliver::push_back ( const Order order)

puts an order at the end of the truck

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S <nodes> E
After: S <nodes> P D E

Can generate time window violation No capacity violation

Definition at line 197 of file vehicle_pickDeliver.cpp.

197  {
198  invariant();
199  pgassert(!has_order(order));
200 
201  m_orders_in_vehicle += order.idx();
202  m_path.insert(m_path.end() - 1, order.pickup());
203  m_path.insert(m_path.end() - 1, order.delivery());
204  evaluate(m_path.size() - 3);
205 
206  pgassert(has_order(order));
207  invariant();
208 }

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::evaluate(), has_order(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::invariant(), m_orders_in_vehicle, pgrouting::vrp::Vehicle::m_path, pgassert, and pgrouting::vrp::Order::pickup().

Referenced by do_while_feasable().

◆ push_front()

void pgrouting::vrp::Vehicle_pickDeliver::push_front ( const Order order)

Puts an order at the end front of the truck.

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S <nodes> E
After: S P D <nodes> E

Can generate time window violation No capacity violation

Definition at line 212 of file vehicle_pickDeliver.cpp.

212  {
213  invariant();
214  pgassert(!has_order(order));
215 
216  m_orders_in_vehicle += order.idx();
217  m_path.insert(m_path.begin() + 1, order.delivery());
218  m_path.insert(m_path.begin() + 1, order.pickup());
219  evaluate(1);
220 
221  pgassert(has_order(order));
222  invariant();
223 }

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::evaluate(), has_order(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::invariant(), m_orders_in_vehicle, pgrouting::vrp::Vehicle::m_path, pgassert, and pgrouting::vrp::Order::pickup().

Referenced by do_while_feasable().

◆ reset_id()

void pgrouting::Identifier::reset_id ( int64_t  _id)
inherited

Definition at line 47 of file identifier.cpp.

47  {
48  m_id = _id;
49 }

References pgrouting::Identifier::m_id.

Referenced by pgrouting::vrp::Tw_node::Tw_node().

◆ semiLIFO()

bool pgrouting::vrp::Vehicle_pickDeliver::semiLIFO ( const Order order)

Inserts an order In semi-Lifo order.

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S .... (P1 ....... P2) ... D2 .... D1 .... E
After: S .... (P .. P1 .. P2) ... D2 .. D .. D1 .... E

push_back is performed when

  • drop generates a time window violation

Can generate time window violation No capacity violation

Definition at line 338 of file vehicle_pickDeliver.cpp.

338  {
339  invariant();
340  pgassert(!has_order(order));
341 
342  /*
343  * Insert pick up as first picked
344  */
345  Vehicle::insert(1, order.pickup());
346 
347  auto deliver_pos(drop_position_limits(order.delivery()));
348 
349  /*
350  * delivery generates twv in all positions
351  */
352  if (deliver_pos.second < deliver_pos.first) {
353  /*
354  * Remove inserted pickup
355  */
356  Vehicle::erase(1);
357  invariant();
358  return false;
359  }
360 
361  pgassert(!has_order(order));
362 
363  while (deliver_pos.first <= deliver_pos.second) {
364  Vehicle::insert(deliver_pos.second, order.delivery());
365 
366  if (is_feasable() && !m_path[deliver_pos.second + 1].is_pickup()) {
367  /*
368  * Found a position to insert the delivery
369  */
370 
371 
372  m_orders_in_vehicle += order.idx();
373 
374  /*
375  * There is one more order in the vehicle
376  */
377  pgassert(has_order(order));
379  pgassert(!has_cv());
380  pgassert(!has_twv());
381  pgassert(has_order(order));
382  invariant();
383  return true;
384  }
385 
386  /*
387  * This position in path is not suitable
388  */
389  Vehicle::erase(deliver_pos.second);
390 
391  /*
392  * got to next position
393  */
394  --deliver_pos.second;
395  }
396 
397  /*
398  * Order could not be inserted
399  */
400  Vehicle::erase(1);
401 
402  pgassert(!has_order(order));
403  invariant();
404  return false;
405 }

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::drop_position_limits(), pgrouting::vrp::Vehicle::erase(), pgrouting::vrp::Vehicle::has_cv(), has_order(), pgrouting::vrp::Vehicle::has_twv(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::is_feasable(), m_orders_in_vehicle, pgrouting::vrp::Vehicle::m_path, pgassert, and pgrouting::vrp::Order::pickup().

Referenced by do_while_feasable(), and pgrouting::vrp::Optimize::move_order().

◆ set_compatibles()

void pgrouting::vrp::Vehicle_pickDeliver::set_compatibles ( const PD_Orders orders)

Definition at line 322 of file vehicle_pickDeliver.cpp.

322  {
323  m_orders = orders;
324  for (const auto &o : orders) {
325  if (is_order_feasable(o)) m_feasable_orders += o.idx();
326  }
328 }

References is_order_feasable(), m_feasable_orders, m_orders, orders(), pgrouting::vrp::PD_Orders::set_compatibles(), and pgrouting::vrp::Vehicle::speed().

◆ size()

size_t pgrouting::vrp::Vehicle::size ( ) const
inherited

return number of nodes in the truck

True: S E
False: S <nodes> E

Definition at line 265 of file vehicle.cpp.

265  {
266  invariant();
267  return m_path.size() - 2;
268 }

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

Referenced by pgrouting::vrp::Optimize::move_order().

◆ speed()

◆ start_site()

Vehicle_node pgrouting::vrp::Vehicle::start_site ( ) const
inlineinherited

Definition at line 232 of file vehicle.h.

232  {
233  return m_path.front();
234  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::is_ok().

◆ swap()

void pgrouting::vrp::Vehicle::swap ( POS  i,
POS  j 
)
inherited

Swap two nodes in the path.

Before: S <nodesA> I <nodesB> J <nodesC> E
After: S <nodesA> J <nodesB> I <nodesC> E
Parameters
[in]iThe position of the first node to swap.
[in]jThe position of the second node to swap.

Definition at line 234 of file vehicle.cpp.

234  {
235  invariant();
236  pgassert(m_path.size() > 3);
237  pgassert(!m_path[i].is_start());
238  pgassert(!m_path[i].is_end());
239  pgassert(!m_path[j].is_start());
240  pgassert(!m_path[j].is_end());
241 
242  std::swap(m_path[i], m_path[j]);
243  i < j ? evaluate(i) : evaluate(j);
244 
245  invariant();
246 }

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

Referenced by pgrouting::vrp::Vehicle::insert().

◆ tau()

std::string pgrouting::vrp::Vehicle::tau ( ) const
inherited

Definition at line 457 of file vehicle.cpp.

457  {
458  pgassert(m_path.size() > 1);
459  std::ostringstream log;
460  log << "Truck " << id() << "(" << idx() << ")"
461  << " (";
462  for (const auto &p_stop : m_path) {
463  if (!(p_stop == m_path.front()))
464  log << ", ";
465  log << p_stop.id();
466  }
467  log << ")" << " \t(cv, twv, wait_time, duration) = ("
468  << cvTot() << ", "
469  << twvTot() << ", "
470  << total_wait_time() << ", "
471  << duration() << ")";
472 
473  return log.str();
474 }

References pgrouting::vrp::Vehicle::cvTot(), pgrouting::vrp::Vehicle::duration(), pgrouting::Identifier::id(), pgrouting::Identifier::idx(), pgrouting::vrp::Vehicle::m_path, pgassert, pgrouting::vrp::Vehicle::total_wait_time(), and pgrouting::vrp::Vehicle::twvTot().

Referenced by pgrouting::vrp::Vehicle::get_postgres_result(), insert(), pgrouting::vrp::operator<<(), and pgrouting::vrp::Vehicle::Vehicle().

◆ total_service_time()

double pgrouting::vrp::Vehicle::total_service_time ( ) const
inlineinherited

Definition at line 210 of file vehicle.h.

210  {
211  return m_path.back().total_service_time();
212  }

References pgrouting::vrp::Vehicle::m_path.

◆ total_travel_time()

double pgrouting::vrp::Vehicle::total_travel_time ( ) const
inlineinherited

Definition at line 207 of file vehicle.h.

207  {
208  return m_path.back().total_travel_time();
209  }

References pgrouting::vrp::Vehicle::m_path.

◆ total_wait_time()

double pgrouting::vrp::Vehicle::total_wait_time ( ) const
inlineinherited

Definition at line 204 of file vehicle.h.

204  {
205  return m_path.back().total_wait_time();
206  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::cost(), and pgrouting::vrp::Vehicle::tau().

◆ twvTot()

int pgrouting::vrp::Vehicle::twvTot ( ) const
inlineinherited

Definition at line 213 of file vehicle.h.

213  {
214  return m_path.back().twvTot();
215  }

References pgrouting::vrp::Vehicle::m_path.

Referenced by pgrouting::vrp::Vehicle::cost(), pgrouting::vrp::Vehicle::has_twv(), and pgrouting::vrp::Vehicle::tau().

Friends And Related Function Documentation

◆ Initial_solution

friend class Initial_solution
friend

Definition at line 58 of file vehicle_pickDeliver.h.

◆ Optimize

friend class Optimize
friend

Definition at line 59 of file vehicle_pickDeliver.h.

Member Data Documentation

◆ cost

double pgrouting::vrp::Vehicle_pickDeliver::cost
protected

Definition at line 49 of file vehicle_pickDeliver.h.

◆ m_capacity

double pgrouting::vrp::Vehicle::m_capacity
privateinherited

◆ m_factor

double pgrouting::vrp::Vehicle::m_factor
privateinherited

Definition at line 83 of file vehicle.h.

Referenced by pgrouting::vrp::operator<<(), and pgrouting::vrp::Vehicle::speed().

◆ m_feasable_orders

Identifiers<size_t> pgrouting::vrp::Vehicle_pickDeliver::m_feasable_orders
protected

orders that fit in the truck

Definition at line 54 of file vehicle_pickDeliver.h.

Referenced by do_while_feasable(), feasable_orders(), and set_compatibles().

◆ m_id

int64_t pgrouting::Identifier::m_id
privateinherited

Definition at line 53 of file identifier.h.

Referenced by pgrouting::Identifier::id(), and pgrouting::Identifier::reset_id().

◆ m_idx

size_t pgrouting::Identifier::m_idx
privateinherited

Definition at line 52 of file identifier.h.

Referenced by pgrouting::Identifier::idx().

◆ m_orders

PD_Orders pgrouting::vrp::Vehicle_pickDeliver::m_orders
protected

Definition at line 52 of file vehicle_pickDeliver.h.

Referenced by do_while_feasable(), orders(), and set_compatibles().

◆ m_orders_in_vehicle

Identifiers<size_t> pgrouting::vrp::Vehicle_pickDeliver::m_orders_in_vehicle
protected

orders inserted in this vehicle

Definition at line 51 of file vehicle_pickDeliver.h.

Referenced by erase(), has_order(), insert(), orders_in_vehicle(), orders_size(), push_back(), push_front(), and semiLIFO().

◆ m_path

◆ m_speed

double pgrouting::vrp::Vehicle::m_speed
privateinherited

Definition at line 84 of file vehicle.h.

Referenced by pgrouting::vrp::operator<<(), and pgrouting::vrp::Vehicle::speed().

◆ problem

Pgr_pickDeliver * pgrouting::vrp::Vehicle::problem
staticinherited

Pointer to problem.

Definition at line 315 of file vehicle.h.

Referenced by pgrouting::vrp::Vehicle::msg(), and pgrouting::vrp::PD_problem::PD_problem().


The documentation for this class was generated from the following files:
pgrouting::vrp::Vehicle::m_path
std::deque< Vehicle_node > m_path
Definition: vehicle.h:77
pgrouting::vrp::Vehicle::getPosHighLimit
POS getPosHighLimit(const Vehicle_node &node) const
Definition: vehicle.cpp:392
pgrouting::vrp::Vehicle::speed
double speed() const
Definition: vehicle.cpp:477
pgrouting::vrp::Vehicle_pickDeliver::m_orders_in_vehicle
Identifiers< size_t > m_orders_in_vehicle
orders inserted in this vehicle
Definition: vehicle_pickDeliver.h:51
EXITING
#define EXITING(x)
Definition: pgr_messages.h:94
pgrouting::vrp::Vehicle::cost
Cost cost() const
Definition: vehicle.cpp:175
pgrouting::vrp::Vehicle::m_capacity
double m_capacity
Definition: vehicle.h:82
pgrouting::vrp::Vehicle_pickDeliver::erase
void erase(const Order &order)
Definition: vehicle_pickDeliver.cpp:305
pgrouting::vrp::Vehicle::cvTot
int cvTot() const
Definition: vehicle.h:216
pgrouting::vrp::Vehicle_pickDeliver::orders
const PD_Orders & orders() const
Definition: vehicle_pickDeliver.h:77
pgrouting::vrp::BestInsert
@ BestInsert
Insetion at the back of the truck.
Definition: initials_code.h:41
pgrouting::vrp::OnePerTruck
@ OnePerTruck
All orders in one truck.
Definition: initials_code.h:38
pgrouting::vrp::Vehicle::duration
double duration() const
Definition: vehicle.h:201
pgrouting::vrp::Vehicle_pickDeliver::push_back
void push_back(const Order &order)
puts an order at the end of the truck
Definition: vehicle_pickDeliver.cpp:197
pgrouting::vrp::Vehicle_pickDeliver::cost
double cost
Definition: vehicle_pickDeliver.h:49
pgrouting::vrp::Vehicle_pickDeliver::semiLIFO
bool semiLIFO(const Order &order)
Inserts an order In semi-Lifo order.
Definition: vehicle_pickDeliver.cpp:338
ENTERING
#define ENTERING(x)
Definition: pgr_messages.h:93
pgrouting::vrp::Vehicle_pickDeliver::m_orders
PD_Orders m_orders
Definition: vehicle_pickDeliver.h:52
pgassertwm
#define pgassertwm(expr, msg)
Adds a message to the assertion.
Definition: pgr_assert.h:117
pgrouting::vrp::Vehicle_pickDeliver::push_front
void push_front(const Order &order)
Puts an order at the end front of the truck.
Definition: vehicle_pickDeliver.cpp:212
pgrouting::Pgr_messages::log
std::ostringstream log
Stores the hint information.
Definition: pgr_messages.h:81
pgrouting::vrp::Pgr_pickDeliver::msg
Pgr_messages msg
message controller for all classes
Definition: pgr_pickDeliver.h:99
pgrouting::vrp::Vehicle::is_feasable
bool is_feasable() const
Definition: vehicle.h:226
pgrouting::vrp::Vehicle::getDropPosLowLimit
POS getDropPosLowLimit(const Vehicle_node &node) const
Definition: vehicle.cpp:327
pgrouting::vrp::BackTruck
@ BackTruck
Insetion at the front of the truck.
Definition: initials_code.h:40
pgrouting::vrp::Vehicle::m_speed
double m_speed
Definition: vehicle.h:84
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94
pgrouting::vrp::Vehicle::getPosLowLimit
POS getPosLowLimit(const Vehicle_node &node) const
Definition: vehicle.cpp:360
pgrouting::Identifier::idx
size_t idx() const
Definition: identifier.cpp:37
pgrouting::vrp::Vehicle_pickDeliver::m_feasable_orders
Identifiers< size_t > m_feasable_orders
orders that fit in the truck
Definition: vehicle_pickDeliver.h:54
pgrouting::vrp::Vehicle::has_cv
bool has_cv() const
Definition: vehicle.h:222
Identifiers::size
size_t size() const
Definition: identifiers.hpp:78
pgrouting::vrp::Vehicle::m_factor
double m_factor
Definition: vehicle.h:83
pgrouting::vrp::OneDepot
@ OneDepot
Push front order that allows more orders to be inserted at the front.
Definition: initials_code.h:44
pgrouting::vrp::Vehicle::twvTot
int twvTot() const
Definition: vehicle.h:213
pgrouting::vrp::Vehicle::evaluate
void evaluate()
@ {
Definition: vehicle.cpp:250
pgrouting::vrp::Vehicle::POS
size_t POS
Definition: vehicle.h:75
pgrouting::vrp::PD_Orders::find_best_J
size_t find_best_J(Identifiers< size_t > &within_this_set) const
Definition: pd_orders.cpp:125
pgrouting::alphashape::E
boost::graph_traits< BG >::edge_descriptor E
Definition: pgr_alphaShape.h:57
pgrouting::Identifier::id
int64_t id() const
Definition: identifier.cpp:42
pgrouting::vrp::Vehicle::end_site
Vehicle_node end_site() const
Definition: vehicle.h:235
pgrouting::vrp::Tw_node::closes
double closes() const
Returns the closing time.
Definition: tw_node.h:79
pgrouting::vrp::Vehicle_pickDeliver::is_order_feasable
bool is_order_feasable(const Order &order) const
Definition: vehicle_pickDeliver.cpp:331
pgrouting::vrp::Vehicle_pickDeliver::orders_size
size_t orders_size() const
Definition: vehicle_pickDeliver.h:78
pgrouting::vrp::Vehicle::difference_type
std::deque< Vehicle_node >::difference_type difference_type
Definition: vehicle.h:76
pgrouting::vrp::BestBack
@ BestBack
Best place to insert Order.
Definition: initials_code.h:42
pgrouting::Identifier::m_idx
size_t m_idx
Definition: identifier.h:52
General_vehicle_orders_t
Definition: general_vehicle_orders_t.h:49
pgrouting::vrp::Vehicle::drop_position_limits
std::pair< POS, POS > drop_position_limits(const Vehicle_node node) const
Definition: vehicle.cpp:306
pgrouting::Identifier::m_id
int64_t m_id
Definition: identifier.h:53
pgrouting::vrp::Vehicle::invariant
void invariant() const
Invariant The path must:
Definition: vehicle.cpp:56
pgrouting::vrp::Tw_node::opens
double opens() const
Returns the opening time.
Definition: tw_node.h:76
Identifiers::has
bool has(const T other) const
true ids() has element
Definition: identifiers.hpp:98
pgrouting::vrp::Vehicle_pickDeliver::insert
bool insert(const Order &order)
Inserts an order.
Definition: vehicle_pickDeliver.cpp:79
pgrouting::vrp::Vehicle::position_limits
std::pair< POS, POS > position_limits(const Vehicle_node node) const
Definition: vehicle.cpp:299
pgrouting::vrp::FrontTruck
@ FrontTruck
One Order per truck.
Definition: initials_code.h:39
pgrouting::vrp::Vehicle::total_wait_time
double total_wait_time() const
Definition: vehicle.h:204
pgrouting::vrp::BestFront
@ BestFront
Push back order that allows more orders to be inserted at the back.
Definition: initials_code.h:43
pgrouting::vrp::Vehicle_pickDeliver::has_order
bool has_order(const Order &order) const
Definition: vehicle_pickDeliver.cpp:73
pgrouting::vrp::PD_Orders::set_compatibles
void set_compatibles(double speed)
Definition: pd_orders.cpp:116
pgrouting::vrp::Vehicle::problem
static Pgr_pickDeliver * problem
Pointer to problem.
Definition: vehicle.h:315
pgrouting::vrp::Vehicle::has_twv
bool has_twv() const
Definition: vehicle.h:219
pgrouting::vrp::PD_Orders::find_best_I
size_t find_best_I(Identifiers< size_t > &within_this_set) const
Definition: pd_orders.cpp:144
pgrouting::vrp::Vehicle::start_site
Vehicle_node start_site() const
Definition: vehicle.h:232
pgrouting::vrp::Vehicle::Vehicle
Vehicle(const Vehicle &)=default
pgrouting::vrp::Vehicle::cost_compare
bool cost_compare(const Cost &, const Cost &) const
Definition: vehicle.cpp:97
pgrouting::vrp::Vehicle::insert
void insert(POS pos, Vehicle_node node)
@ {
Definition: vehicle.cpp:183
pgrouting::vrp::Vehicle::Cost
std::tuple< int, int, size_t, double, double > Cost
Definition: vehicle.h:90
pgrouting::vrp::Vehicle::swap
void swap(POS i, POS j)
Swap two nodes in the path.
Definition: vehicle.cpp:234
pgrouting::vrp::Vehicle::msg
static Pgr_messages & msg()
Access to the problem's message.
Definition: vehicle.cpp:51
pgrouting::vrp::Vehicle::erase
void erase(const Vehicle_node &node)
Erase node.id()
Definition: vehicle.cpp:198
pgrouting::vrp::Vehicle::tau
std::string tau() const
Definition: vehicle.cpp:457