PGROUTING  2.6
pgrouting::vrp::Tw_node Class Reference

Extends the Node class to create a Node with time window attributes. More...

#include "tw_node.h"

Inheritance diagram for pgrouting::vrp::Tw_node:
Collaboration diagram for pgrouting::vrp::Tw_node:

Public Types

enum  NodeType {
  kStart = 0, kPickup, kDelivery, kDump,
  kLoad, kEnd
}
 

Public Member Functions

 Tw_node ()=default
 
 Tw_node (const Tw_node &)=default
 
 Tw_node (size_t id, PickDeliveryOrders_t data, NodeType type)
 
 Tw_node (size_t id, Vehicle_t data, NodeType type)
 
int64_t id () const
 
size_t idx () const
 
void reset_id (int64_t)
 
accessors
int64_t order () const
 @ { More...
 
double opens () const
 Returns the opening time. More...
 
double closes () const
 Returns the closing time. More...
 
double demand () const
 Returns the demand associated with this node. More...
 
void demand (double value)
 
double service_time () const
 Returns the service time for this node. More...
 
NodeType type () const
 Returns the type of this node. More...
 
double window_length () const
 Returns the length of time between the opening and closing. More...
 
double travel_time_to (const Tw_node &other, double speed) const
 time = distance / speed. More...
 
kind of node

A true value when;

  • 0 < opens < closes
  • the type is the requested type
  • the demand are valid for the requested type
bool is_start () const
 @ { More...
 
bool is_pickup () const
 is_pickup More...
 
bool is_delivery () const
 is_delivery More...
 
bool is_dump () const
 is_dump More...
 
bool is_load () const
 is_Load More...
 
bool is_end () const
 is_end More...
 
std::string type_str () const
 
to be or not to be
bool operator== (const Tw_node &rhs) const
 
bool is_early_arrival (double arrival_time) const
 True when arrivalTime is before it opens. More...
 
bool is_late_arrival (double arrival_time) const
 True when arrivalTime is after it closes. More...
 
bool is_on_time (double arrival_time) const
 True when arrivalTime in the time window. More...
 
document functions
double arrival_j_opens_i (const Tw_node &I, double speed) const
 @ { More...
 
double arrival_j_closes_i (const Tw_node &I, double speed) const
 The actual arrival time at this node, given that: this node is visited directly after other node and that the actual arrival time at other node was closes(other) More...
 
bool is_compatible_IJ (const Tw_node &I, double speed) const
 
bool is_partially_compatible_IJ (const Tw_node &I, double speed) const
 
bool is_tight_compatible_IJ (const Tw_node &I, double speed) const
 
bool is_partially_waitTime_compatible_IJ (const Tw_node &I, double speed) const
 
bool is_waitTime_compatible_IJ (const Tw_node &I, double speed) const
 

Static Public Attributes

static Pgr_messages msg
 

Protected Member Functions

bool is_valid () const
 

Static Protected Attributes

static Pgr_pickDeliverproblem
 

Private Attributes

double m_closes
 closing time of the node More...
 
double m_demand
 The demand for the Node. More...
 
double m_opens
 opening time of the node More...
 
int64_t m_order
 order to which it belongs More...
 
double m_service_time
 
NodeType m_type
 The demand for the Node. More...
 

Friends

std::ostream & operator<< (std::ostream &log, const Tw_node &node)
 Print the contents of a Twnode object. More...
 

Detailed Description

Extends the Node class to create a Node with time window attributes.

A Time Window node is a Node with addition attributes and methods to to support Time Windows and to model a more complex Node need in many vehicle routing problems.

Most application specific code will extend this class and define the specific values and requirements for type and streetid.

Definition at line 57 of file tw_node.h.

Member Enumeration Documentation

Enumerator
kStart 

starting site

kPickup 

pickup site

kDelivery 

delivery site

kDump 

dump site, empties truck

kLoad 

load site, fills the truck

kEnd 

ending site

Definition at line 59 of file tw_node.h.

59  {
60  kStart = 0,
61  kPickup,
62  kDelivery,
63  kDump,
64  kLoad,
65  kEnd
66  } NodeType;
dump site, empties truck
Definition: tw_node.h:63
load site, fills the truck
Definition: tw_node.h:64

Constructor & Destructor Documentation

pgrouting::vrp::Tw_node::Tw_node ( )
default

Referenced by is_on_time().

Here is the caller graph for this function:

pgrouting::vrp::Tw_node::Tw_node ( const Tw_node )
default
pgrouting::vrp::Tw_node::Tw_node ( size_t  id,
PickDeliveryOrders_t  data,
NodeType  type 
)

Definition at line 232 of file tw_node.cpp.

References PickDeliveryOrders_t::deliver_close_t, PickDeliveryOrders_t::deliver_node_id, PickDeliveryOrders_t::deliver_open_t, PickDeliveryOrders_t::deliver_service_t, kDelivery, m_closes, m_demand, m_opens, m_service_time, m_type, and pgrouting::Identifier::reset_id().

235  :
236  Identifier(id, data.pick_node_id),
237  m_order(data.id),
238  m_opens(data.pick_open_t),
239  m_closes(data.pick_close_t),
241  m_demand(data.demand),
242  m_type(type) {
243  if (m_type == kDelivery) {
245  m_opens = data.deliver_open_t;
246  m_closes = data.deliver_close_t;
248  m_demand *= -1;
249  }
250  }
double m_opens
opening time of the node
Definition: tw_node.h:274
double m_demand
The demand for the Node.
Definition: tw_node.h:277
double m_closes
closing time of the node
Definition: tw_node.h:275
int64_t m_order
order to which it belongs
Definition: tw_node.h:273
NodeType type() const
Returns the type of this node.
Definition: tw_node.h:89
void reset_id(int64_t)
Definition: identifier.cpp:47
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

pgrouting::vrp::Tw_node::Tw_node ( size_t  id,
Vehicle_t  data,
NodeType  type 
)

Definition at line 252 of file tw_node.cpp.

References Vehicle_t::end_close_t, Vehicle_t::end_node_id, Vehicle_t::end_open_t, Vehicle_t::end_service_t, kEnd, m_closes, m_opens, m_service_time, m_type, and pgrouting::Identifier::reset_id().

255  :
256  Identifier(id, data.start_node_id),
257  m_opens(data.start_open_t),
258  m_closes(data.start_close_t),
260  m_demand(0),
261  m_type(type) {
262  if (m_type == kEnd) {
263  reset_id(data.end_node_id);
264  m_opens = data.end_open_t;
265  m_closes = data.end_close_t;
267  }
268  }
double m_opens
opening time of the node
Definition: tw_node.h:274
double end_service_t
Definition: vehicle_t.h:81
double m_demand
The demand for the Node.
Definition: tw_node.h:277
double start_open_t
Definition: vehicle_t.h:71
double end_close_t
Definition: vehicle_t.h:80
double end_open_t
Definition: vehicle_t.h:79
double m_closes
closing time of the node
Definition: tw_node.h:275
double start_close_t
Definition: vehicle_t.h:72
double start_service_t
Definition: vehicle_t.h:73
int64_t end_node_id
Definition: vehicle_t.h:77
NodeType type() const
Returns the type of this node.
Definition: tw_node.h:89
int64_t start_node_id
Definition: vehicle_t.h:67
void reset_id(int64_t)
Definition: identifier.cpp:47
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Member Function Documentation

double pgrouting::vrp::Tw_node::arrival_j_closes_i ( const Tw_node I,
double  speed 
) const

The actual arrival time at this node, given that: this node is visited directly after other node and that the actual arrival time at other node was closes(other)

Definition at line 64 of file tw_node.cpp.

References closes(), kStart, m_type, service_time(), and travel_time_to().

Referenced by is_on_time(), is_partially_compatible_IJ(), and is_tight_compatible_IJ().

64  {
65  if (m_type == kStart) return (std::numeric_limits<double>::max)();
66  return I.closes() + I.service_time() + I.travel_time_to(*this, speed);
67 }
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::arrival_j_opens_i ( const Tw_node I,
double  speed 
) const

@ {

The actual arrival time at This node, given that: this node is visited directly after other node and that the actual arrival time at other node was opens(other)

Definition at line 58 of file tw_node.cpp.

References kStart, m_type, opens(), service_time(), and travel_time_to().

Referenced by is_compatible_IJ(), is_on_time(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), and is_waitTime_compatible_IJ().

58  {
59  if (m_type == kStart) return (std::numeric_limits<double>::max)();
60  return I.opens() + I.service_time() + I.travel_time_to(*this, speed);
61 }
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::closes ( ) const
inline

Returns the closing time.

Definition at line 79 of file tw_node.h.

References m_closes.

Referenced by pgrouting::vrp::Fleet::add_vehicle(), arrival_j_closes_i(), pgrouting::vrp::Vehicle::deltaTime(), is_delivery(), is_dump(), is_end(), is_load(), pgrouting::vrp::Vehicle::is_ok(), is_pickup(), is_start(), and pgrouting::vrp::Vehicle::Vehicle().

79 {return m_closes;}
double m_closes
closing time of the node
Definition: tw_node.h:275

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::demand ( ) const
inline

Returns the demand associated with this node.

Definition at line 82 of file tw_node.h.

References m_demand.

Referenced by pgrouting::vrp::Vehicle_node::evaluate(), is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), and is_start().

82 {return m_demand;}
double m_demand
The demand for the Node.
Definition: tw_node.h:277

Here is the caller graph for this function:

void pgrouting::vrp::Tw_node::demand ( double  value)
inline

Definition at line 83 of file tw_node.h.

References m_demand.

83 {m_demand = value;}
double m_demand
The demand for the Node.
Definition: tw_node.h:277
bool pgrouting::vrp::Tw_node::is_compatible_IJ ( const Tw_node I,
double  speed 
) const

Definition at line 73 of file tw_node.cpp.

References arrival_j_opens_i(), is_late_arrival(), kEnd, kStart, and m_type.

Referenced by pgrouting::vrp::Vehicle::getPosHighLimit(), is_on_time(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), pgrouting::vrp::Order::is_valid(), is_waitTime_compatible_IJ(), and pgrouting::vrp::Order::isCompatibleIJ().

73  {
74  /*
75  * I /-> kStart
76  */
77  if (m_type == kStart) return false;
78  /*
79  * kEnd /-> (*this)
80  */
81  if (I.m_type == kEnd) return false;
82 
83  return !is_late_arrival(arrival_j_opens_i(I, speed));
84 }
bool is_late_arrival(double arrival_time) const
True when arrivalTime is after it closes.
Definition: tw_node.h:192
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278
double arrival_j_opens_i(const Tw_node &I, double speed) const
@ {
Definition: tw_node.cpp:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_delivery ( ) const

is_delivery

To be a delivery node:

  • type is kDelivery
  • demand < 0

Definition at line 150 of file tw_node.cpp.

References closes(), demand(), kDelivery, m_type, opens(), and service_time().

Referenced by pgrouting::vrp::Order::is_valid(), is_valid(), and window_length().

150  {
151  return m_type == kDelivery
152  && (opens() < closes())
153  && (service_time() >= 0)
154  && (demand() < 0);
155 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
double opens() const
Returns the opening time.
Definition: tw_node.h:76
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_dump ( ) const

is_dump

To be a dump node:

  • type is kDump
  • demand <= 0

Definition at line 159 of file tw_node.cpp.

References closes(), demand(), kDump, m_type, opens(), and service_time().

Referenced by pgrouting::vrp::Vehicle_node::evaluate(), is_valid(), and window_length().

159  {
160  return m_type == kDump
161  && (opens() < closes())
162  && (service_time() >= 0)
163  && (demand() <= 0);
164 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
dump site, empties truck
Definition: tw_node.h:63
double opens() const
Returns the opening time.
Definition: tw_node.h:76
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_early_arrival ( double  arrival_time) const
inline

True when arrivalTime is before it opens.

Definition at line 187 of file tw_node.h.

References m_opens.

Referenced by pgrouting::vrp::Vehicle::deltaTime(), pgrouting::vrp::Vehicle_node::evaluate(), is_on_time(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), and is_waitTime_compatible_IJ().

187  {
188  return arrival_time < m_opens;
189  }
double m_opens
opening time of the node
Definition: tw_node.h:274

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_end ( ) const

is_end

To be a End node:

  • type is kEnd
  • demand == 0

Definition at line 177 of file tw_node.cpp.

References closes(), demand(), kEnd, m_type, opens(), and service_time().

Referenced by pgrouting::vrp::Fleet::add_vehicle(), pgrouting::vrp::Vehicle_node::has_cv(), is_valid(), and window_length().

177  {
178  return m_type == kEnd
179  && (opens() < closes())
180  && (service_time() >= 0)
181  && (demand() == 0);
182 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
double opens() const
Returns the opening time.
Definition: tw_node.h:76
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_late_arrival ( double  arrival_time) const
inline

True when arrivalTime is after it closes.

Definition at line 192 of file tw_node.h.

References m_closes.

Referenced by pgrouting::vrp::Vehicle_node::deltaGeneratesTWV(), pgrouting::vrp::Vehicle_node::has_twv(), is_compatible_IJ(), is_on_time(), is_partially_compatible_IJ(), and is_tight_compatible_IJ().

192  {
193  return arrival_time > m_closes;
194  }
double m_closes
closing time of the node
Definition: tw_node.h:275

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_load ( ) const

is_Load

To be a Load node:

  • type is kLoad
  • demand >= 0

Definition at line 168 of file tw_node.cpp.

References closes(), demand(), kLoad, m_type, opens(), and service_time().

Referenced by is_valid(), and window_length().

168  {
169  return m_type == kLoad
170  && (opens() < closes())
171  && (service_time() >= 0)
172  && (demand() >= 0);
173 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
double opens() const
Returns the opening time.
Definition: tw_node.h:76
load site, fills the truck
Definition: tw_node.h:64
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_on_time ( double  arrival_time) const
inline

True when arrivalTime in the time window.

Definition at line 196 of file tw_node.h.

References arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_early_arrival(), is_late_arrival(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), is_valid(), is_waitTime_compatible_IJ(), Tw_node(), and type().

196  {
197  return !is_early_arrival(arrival_time)
198  && !is_late_arrival(arrival_time);
199  }
bool is_early_arrival(double arrival_time) const
True when arrivalTime is before it opens.
Definition: tw_node.h:187
bool is_late_arrival(double arrival_time) const
True when arrivalTime is after it closes.
Definition: tw_node.h:192

Here is the call graph for this function:

bool pgrouting::vrp::Tw_node::is_partially_compatible_IJ ( const Tw_node I,
double  speed 
) const

Definition at line 87 of file tw_node.cpp.

References arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_early_arrival(), and is_late_arrival().

Referenced by is_on_time().

87  {
88  return
89  is_compatible_IJ(I, speed)
90  && !is_early_arrival(arrival_j_opens_i(I, speed))
91  && is_late_arrival(arrival_j_closes_i(I, speed));
92 }
bool is_early_arrival(double arrival_time) const
True when arrivalTime is before it opens.
Definition: tw_node.h:187
bool is_compatible_IJ(const Tw_node &I, double speed) const
Definition: tw_node.cpp:73
bool is_late_arrival(double arrival_time) const
True when arrivalTime is after it closes.
Definition: tw_node.h:192
double arrival_j_closes_i(const Tw_node &I, double speed) const
The actual arrival time at this node, given that: this node is visited directly after other node and ...
Definition: tw_node.cpp:64
double arrival_j_opens_i(const Tw_node &I, double speed) const
@ {
Definition: tw_node.cpp:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_partially_waitTime_compatible_IJ ( const Tw_node I,
double  speed 
) const

Definition at line 103 of file tw_node.cpp.

References arrival_j_opens_i(), is_compatible_IJ(), and is_early_arrival().

Referenced by is_on_time().

105  {
106  return
107  is_compatible_IJ(I, speed)
108  && is_early_arrival(arrival_j_opens_i(I, speed));
109 }
bool is_early_arrival(double arrival_time) const
True when arrivalTime is before it opens.
Definition: tw_node.h:187
bool is_compatible_IJ(const Tw_node &I, double speed) const
Definition: tw_node.cpp:73
double arrival_j_opens_i(const Tw_node &I, double speed) const
@ {
Definition: tw_node.cpp:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_pickup ( ) const

is_pickup

To be a pickup node:

  • type is kPickup
  • demand > 0

Definition at line 141 of file tw_node.cpp.

References closes(), demand(), kPickup, m_type, opens(), and service_time().

Referenced by pgrouting::vrp::Order::is_valid(), is_valid(), and window_length().

141  {
142  return m_type == kPickup
143  && (opens() < closes())
144  && (service_time() >= 0)
145  && (demand() > 0);
146 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
double opens() const
Returns the opening time.
Definition: tw_node.h:76
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_start ( ) const

@ {

is_start

To be a start node:

  • type is kStart
  • demand == 0

Definition at line 132 of file tw_node.cpp.

References closes(), demand(), kStart, m_type, opens(), and service_time().

Referenced by pgrouting::vrp::Fleet::add_vehicle(), pgrouting::vrp::Vehicle_node::evaluate(), pgrouting::vrp::Vehicle_node::has_cv(), is_valid(), and window_length().

132  {
133  return
134  m_type == kStart
135  && (opens() < closes())
136  && (service_time() >= 0)
137  && (demand() == 0);
138 }
double demand() const
Returns the demand associated with this node.
Definition: tw_node.h:82
double service_time() const
Returns the service time for this node.
Definition: tw_node.h:86
double opens() const
Returns the opening time.
Definition: tw_node.h:76
double closes() const
Returns the closing time.
Definition: tw_node.h:79
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_tight_compatible_IJ ( const Tw_node I,
double  speed 
) const

Definition at line 95 of file tw_node.cpp.

References arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_early_arrival(), and is_late_arrival().

Referenced by is_on_time().

95  {
96  return
97  is_compatible_IJ(I, speed)
98  && !is_early_arrival(arrival_j_opens_i(I, speed))
99  && !is_late_arrival(arrival_j_closes_i(I, speed));
100 }
bool is_early_arrival(double arrival_time) const
True when arrivalTime is before it opens.
Definition: tw_node.h:187
bool is_compatible_IJ(const Tw_node &I, double speed) const
Definition: tw_node.cpp:73
bool is_late_arrival(double arrival_time) const
True when arrivalTime is after it closes.
Definition: tw_node.h:192
double arrival_j_closes_i(const Tw_node &I, double speed) const
The actual arrival time at this node, given that: this node is visited directly after other node and ...
Definition: tw_node.cpp:64
double arrival_j_opens_i(const Tw_node &I, double speed) const
@ {
Definition: tw_node.cpp:58

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_valid ( ) const
protected

Definition at line 197 of file tw_node.cpp.

References is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), is_start(), kDelivery, kDump, kEnd, kLoad, kPickup, kStart, and type().

Referenced by is_on_time().

197  {
198  switch (type()) {
199  case kStart:
200  return is_start();
201  break;
202 
203  case kEnd:
204  return is_end();
205  break;
206 
207  case kDump:
208  return is_dump();
209  break;
210 
211  case kDelivery:
212  return is_delivery();
213  break;
214 
215  case kPickup:
216  return is_pickup();
217  break;
218 
219  case kLoad:
220  return is_load();
221  break;
222 
223  default:
224  return false;
225  break;
226  }
227 
228  return false;
229 }
bool is_load() const
is_Load
Definition: tw_node.cpp:168
bool is_end() const
is_end
Definition: tw_node.cpp:177
dump site, empties truck
Definition: tw_node.h:63
load site, fills the truck
Definition: tw_node.h:64
bool is_start() const
@ {
Definition: tw_node.cpp:132
NodeType type() const
Returns the type of this node.
Definition: tw_node.h:89
bool is_pickup() const
is_pickup
Definition: tw_node.cpp:141
bool is_delivery() const
is_delivery
Definition: tw_node.cpp:150
bool is_dump() const
is_dump
Definition: tw_node.cpp:159

Here is the call graph for this function:

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::is_waitTime_compatible_IJ ( const Tw_node I,
double  speed 
) const

Definition at line 112 of file tw_node.cpp.

References arrival_j_opens_i(), is_compatible_IJ(), and is_early_arrival().

Referenced by is_on_time().

112  {
113  return
114  is_compatible_IJ(I, speed)
115  && is_early_arrival(arrival_j_opens_i(I, speed));
116 }
bool is_early_arrival(double arrival_time) const
True when arrivalTime is before it opens.
Definition: tw_node.h:187
bool is_compatible_IJ(const Tw_node &I, double speed) const
Definition: tw_node.cpp:73
double arrival_j_opens_i(const Tw_node &I, double speed) const
@ {
Definition: tw_node.cpp:58

Here is the call graph for this function:

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::opens ( ) const
inline

Returns the opening time.

Definition at line 76 of file tw_node.h.

References m_opens.

Referenced by pgrouting::vrp::Fleet::add_vehicle(), arrival_j_opens_i(), pgrouting::vrp::Vehicle_node::evaluate(), is_delivery(), is_dump(), is_end(), is_load(), pgrouting::vrp::Vehicle::is_ok(), is_pickup(), is_start(), and pgrouting::vrp::Vehicle::Vehicle().

76 {return m_opens;}
double m_opens
opening time of the node
Definition: tw_node.h:274

Here is the caller graph for this function:

bool pgrouting::vrp::Tw_node::operator== ( const Tw_node rhs) const

Definition at line 186 of file tw_node.cpp.

References pgrouting::Identifier::idx(), pgrouting::vrp::Pgr_pickDeliver::m_base_nodes, and pgrouting::vrp::PD_problem::problem.

Referenced by window_length().

186  {
187  if (&other == this) return true;
188  auto lhs = static_cast<const Node&>(
189  *problem->m_base_nodes[idx()].get());
190  auto rhs = static_cast<const Node&>(
191  *problem->m_base_nodes[other.idx()].get());
192  return lhs == rhs;
193 }
static Pgr_pickDeliver * problem
Definition: pd_problem.h:51
std::vector< std::unique_ptr< Base_node > > m_base_nodes
size_t idx() const
Definition: identifier.cpp:37

Here is the call graph for this function:

Here is the caller graph for this function:

int64_t pgrouting::vrp::Tw_node::order ( ) const
inline

@ {

Returns the opening time.

Definition at line 73 of file tw_node.h.

References m_order.

73 {return m_order;}
int64_t m_order
order to which it belongs
Definition: tw_node.h:273
void pgrouting::Identifier::reset_id ( int64_t  _id)
inherited

Definition at line 47 of file identifier.cpp.

References pgrouting::Identifier::m_id.

Referenced by Tw_node().

47  {
48  m_id = _id;
49 }

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::service_time ( ) const
inline
double pgrouting::vrp::Tw_node::travel_time_to ( const Tw_node other,
double  speed 
) const

time = distance / speed.

TODO(vicky) shall call Node or Dnode static cast won't work I think

Todo:
TODO evaluate with matrix also

Definition at line 40 of file tw_node.cpp.

References pgrouting::Identifier::idx(), pgrouting::vrp::Pgr_pickDeliver::m_base_nodes, pgassert, and pgrouting::vrp::PD_problem::problem.

Referenced by pgrouting::vrp::Vehicle_node::arrival_i_arrives_j(), arrival_j_closes_i(), arrival_j_opens_i(), pgrouting::vrp::Vehicle::deltaTime(), pgrouting::vrp::Vehicle_node::evaluate(), pgrouting::vrp::operator<<(), and window_length().

40  {
46  auto from = problem->m_base_nodes[idx()].get();
47  auto destination = problem->m_base_nodes[to.idx()].get();
48  pgassert(speed != 0);
50  return from->distance(destination) / speed;
51 }
static Pgr_pickDeliver * problem
Definition: pd_problem.h:51
std::vector< std::unique_ptr< Base_node > > m_base_nodes
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:81
size_t idx() const
Definition: identifier.cpp:37

Here is the call graph for this function:

Here is the caller graph for this function:

NodeType pgrouting::vrp::Tw_node::type ( ) const
inline

Returns the type of this node.

Definition at line 89 of file tw_node.h.

References m_type.

Referenced by is_on_time(), is_valid(), and type_str().

89 {return m_type;}
NodeType m_type
The demand for the Node.
Definition: tw_node.h:278

Here is the caller graph for this function:

std::string pgrouting::vrp::Tw_node::type_str ( ) const

Definition at line 119 of file tw_node.cpp.

References kDelivery, kDump, kEnd, kLoad, kPickup, kStart, and type().

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

119  {
120  switch (type()) {
121  case kStart: return "START"; break;
122  case kEnd: return "END"; break;
123  case kDump: return "DUMP"; break;
124  case kLoad: return "LOAD"; break;
125  case kPickup: return "PICKUP"; break;
126  case kDelivery: return "DELIVERY"; break;
127  default: return "UNKNOWN";
128  }
129 }
dump site, empties truck
Definition: tw_node.h:63
load site, fills the truck
Definition: tw_node.h:64
NodeType type() const
Returns the type of this node.
Definition: tw_node.h:89

Here is the call graph for this function:

Here is the caller graph for this function:

double pgrouting::vrp::Tw_node::window_length ( ) const
inline

Returns the length of time between the opening and closing.

Definition at line 92 of file tw_node.h.

References is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), is_start(), m_closes, m_opens, operator<<, operator==(), travel_time_to(), and type_str().

92 {return m_closes - m_opens;}
double m_opens
opening time of the node
Definition: tw_node.h:274
double m_closes
closing time of the node
Definition: tw_node.h:275

Here is the call graph for this function:

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  log,
const Tw_node node 
)
friend

Print the contents of a Twnode object.

Definition at line 272 of file tw_node.cpp.

Referenced by window_length().

272  {
273  log << static_cast<const Node&>(
274  *n.problem->m_base_nodes[n.idx()].get())
275  << "[opens = " << n.m_opens
276  << "\tcloses = " << n.m_closes
277  << "\tservice = " << n.m_service_time
278  << "\tdemand = " << n.m_demand
279  << "\ttype = " << n.type_str()
280  << "]"
281  << "\n";
282  return log;
283 }

Member Data Documentation

double pgrouting::vrp::Tw_node::m_closes
private

closing time of the node

Definition at line 275 of file tw_node.h.

Referenced by closes(), is_late_arrival(), pgrouting::vrp::operator<<(), Tw_node(), and window_length().

double pgrouting::vrp::Tw_node::m_demand
private

The demand for the Node.

Definition at line 277 of file tw_node.h.

Referenced by demand(), pgrouting::vrp::operator<<(), and Tw_node().

double pgrouting::vrp::Tw_node::m_opens
private

opening time of the node

Definition at line 274 of file tw_node.h.

Referenced by is_early_arrival(), opens(), pgrouting::vrp::operator<<(), Tw_node(), and window_length().

int64_t pgrouting::vrp::Tw_node::m_order
private

order to which it belongs

Definition at line 273 of file tw_node.h.

Referenced by order().

double pgrouting::vrp::Tw_node::m_service_time
private

Definition at line 276 of file tw_node.h.

Referenced by pgrouting::vrp::operator<<(), service_time(), and Tw_node().

NodeType pgrouting::vrp::Tw_node::m_type
private

The documentation for this class was generated from the following files: