PGROUTING  2.5
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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
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 238 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().

241  :
242  Identifier(id, data.pick_node_id),
243  m_order(data.id),
244  m_opens(data.pick_open_t),
245  m_closes(data.pick_close_t),
247  m_demand(data.demand),
248  m_type(type) {
249  if (m_type == kDelivery) {
251  m_opens = data.deliver_open_t;
252  m_closes = data.deliver_close_t;
254  m_demand *= -1;
255  }
256  }
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 258 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().

261  :
262  Identifier(id, data.start_node_id),
263  m_opens(data.start_open_t),
264  m_closes(data.start_close_t),
266  m_demand(0),
267  m_type(type) {
268  if (m_type == kEnd) {
269  reset_id(data.end_node_id);
270  m_opens = data.end_open_t;
271  m_closes = data.end_close_t;
273  }
274  }
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_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_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_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 152 of file tw_node.cpp.

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

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

152  {
153  return m_type == kDelivery
154  && (0 <= opens())
155  && (opens() < closes())
156  && (service_time() >= 0)
157  && (demand() < 0);
158 }
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 162 of file tw_node.cpp.

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

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

162  {
163  return m_type == kDump
164  && (0 <= opens())
165  && (opens() < closes())
166  && (service_time() >= 0)
167  && (demand() <= 0);
168 }
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 182 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(), and is_valid().

182  {
183  return m_type == kEnd
184  && (0 <= opens())
185  && (opens() < closes())
186  && (service_time() >= 0)
187  && (demand() == 0);
188 }
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 172 of file tw_node.cpp.

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

Referenced by is_valid().

172  {
173  return m_type == kLoad
174  && (0 <= opens())
175  && (opens() < closes())
176  && (service_time() >= 0)
177  && (demand() >= 0);
178 }
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 is_early_arrival(), and is_late_arrival().

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().

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:

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().

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:

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

is_pickup

To be a pickup node:

  • type is kPickup
  • demand > 0

Definition at line 142 of file tw_node.cpp.

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

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

142  {
143  return m_type == kPickup
144  && (0 <= opens())
145  && (opens() < closes())
146  && (service_time() >= 0)
147  && (demand() > 0);
148 }
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(), and is_valid().

132  {
133  return
134  m_type == kStart
135  && (0 <= opens())
136  && (opens() < closes())
137  && (service_time() >= 0)
138  && (demand() == 0);
139 }
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().

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:

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

Definition at line 203 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().

203  {
204  switch (type()) {
205  case kStart:
206  return is_start();
207  break;
208 
209  case kEnd:
210  return is_end();
211  break;
212 
213  case kDump:
214  return is_dump();
215  break;
216 
217  case kDelivery:
218  return is_delivery();
219  break;
220 
221  case kPickup:
222  return is_pickup();
223  break;
224 
225  case kLoad:
226  return is_load();
227  break;
228 
229  default:
230  return false;
231  break;
232  }
233 
234  return false;
235 }
bool is_load() const
is_Load
Definition: tw_node.cpp:172
bool is_end() const
is_end
Definition: tw_node.cpp:182
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:142
bool is_delivery() const
is_delivery
Definition: tw_node.cpp:152
bool is_dump() const
is_dump
Definition: tw_node.cpp:162

Here is the call 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().

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:

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 192 of file tw_node.cpp.

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

192  {
193  if (&other == this) return true;
194  auto lhs = static_cast<const Node&>(
195  *problem->m_base_nodes[idx()].get());
196  auto rhs = static_cast<const Node&>(
197  *problem->m_base_nodes[other.idx()].get());
198  return lhs == rhs;
199 }
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:

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(), and pgrouting::vrp::operator<<().

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_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<<().

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 m_closes, and m_opens.

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

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 278 of file tw_node.cpp.

278  {
279  log << static_cast<const Node&>(
280  *n.problem->m_base_nodes[n.idx()].get())
281  << "[opens = " << n.m_opens
282  << "\tcloses = " << n.m_closes
283  << "\tservice = " << n.m_service_time
284  << "\tdemand = " << n.m_demand
285  << "\ttype = " << n.type_str()
286  << "]"
287  << "\n";
288  return log;
289 }

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: