PGROUTING  2.4
 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:
pgrouting::vrp::Node pgrouting::vrp::Vehicle_node

Public Types

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

Public Member Functions

 Tw_node (const Tw_node &other)=default
 
 Tw_node (size_t id, Customer_t data, NodeType type, const Pgr_pickDeliver *problem)
 
 Tw_node (size_t id, int64_t p_original_id, double x, double y, double opens, double closes, double service_time, double demand, NodeType type, const Pgr_pickDeliver *problem)
 
size_t Did () 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...
 
bool operator== (const Tw_node &rhs) const
 
size_t Pid () const
 
void set_Did (size_t id)
 
void set_Pid (size_t id)
 
accessors
double opens () const
 @ { More...
 
double closes () const
 Returns the closing time. More...
 
double demand () const
 Returns the demand associated with this node. More...
 
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 Node &other) 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
 
document functions
double arrival_j_opens_i (const Tw_node &I) const
 @ { More...
 
double arrival_j_closes_i (const Tw_node &I) 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) const
 
bool is_partially_compatible_IJ (const Tw_node &I) const
 
bool is_tight_compatible_IJ (const Tw_node &I) const
 
bool is_partially_waitTime_compatible_IJ (const Tw_node &I) const
 
bool is_waitTime_compatible_IJ (const Tw_node &I) const
 
accessors
size_t id () const
 @ { More...
 
int64_t original_id () const
 
state
bool isSamePos (const Node &other) const
 @ { More...
 
bool operator== (const Node &rhs) const
 
double distance (const Node &other) const
 
double comparable_distance (const Node &other) const
 

Protected Member Functions

bool is_valid () const
 

Protected 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...
 
size_t m_otherid
 the other's internal id More...
 
double m_service_time
 
NodeType m_type
 The demand for the Node. More...
 
const Pgr_pickDeliverproblem
 

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 50 of file tw_node.h.

Member Enumeration Documentation

Enumerator
kStart 
kPickup 
kDelivery 
kDump 
kLoad 
kEnd 

ending site

Definition at line 52 of file tw_node.h.

Constructor & Destructor Documentation

pgrouting::vrp::Tw_node::Tw_node ( const Tw_node other)
default
pgrouting::vrp::Tw_node::Tw_node ( size_t  id,
Customer_t  data,
NodeType  type,
const Pgr_pickDeliver problem 
)

Definition at line 224 of file tw_node.cpp.

pgrouting::vrp::Tw_node::Tw_node ( size_t  id,
int64_t  p_original_id,
double  x,
double  y,
double  opens,
double  closes,
double  service_time,
double  demand,
NodeType  type,
const Pgr_pickDeliver problem 
)

Definition at line 239 of file tw_node.cpp.

Member Function Documentation

double pgrouting::vrp::Tw_node::arrival_j_closes_i ( const Tw_node I) 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 56 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().

double pgrouting::vrp::Tw_node::arrival_j_opens_i ( const Tw_node I) 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 50 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().

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

Returns the closing time.

Definition at line 91 of file tw_node.h.

References m_closes.

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

double pgrouting::vrp::Node::comparable_distance ( const Node other) const
inherited

Definition at line 56 of file node.cpp.

References pgrouting::vrp::Node::m_point.

Referenced by pgrouting::vrp::Node::isSamePos().

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

Returns the demand associated with this node.

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

size_t pgrouting::vrp::Tw_node::Did ( ) const
inline
double pgrouting::vrp::Node::distance ( const Node other) const
inherited

Definition at line 49 of file node.cpp.

References pgrouting::vrp::Node::m_point.

Referenced by travel_time_to().

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

is_delivery

To be a delivery node:

  • type is kDelivery
  • demand < 0

Definition at line 142 of file tw_node.cpp.

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

Referenced by pgrouting::vrp::Order::is_valid(), is_valid(), pgrouting::vrp::m_original_data(), pgrouting::vrp::operator<<(), pgrouting::vrp::Pgr_pickDeliver::order_of(), Pid(), and set_Pid().

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

is_dump

To be a dump node:

  • type is kDump
  • demand <= 0

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

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

is_end

To be a End node:

  • type is kEnd
  • demand == 0

Definition at line 172 of file tw_node.cpp.

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

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

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

is_Load

To be a Load node:

  • type is kLoad
  • demand >= 0

Definition at line 162 of file tw_node.cpp.

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

Referenced by is_valid().

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

True when arrivalTime in the time window.

Definition at line 205 of file tw_node.h.

References is_early_arrival(), and is_late_arrival().

bool pgrouting::vrp::Tw_node::is_partially_compatible_IJ ( const Tw_node I) const
bool pgrouting::vrp::Tw_node::is_partially_waitTime_compatible_IJ ( const Tw_node I) const

Definition at line 95 of file tw_node.cpp.

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

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

is_pickup

To be a pickup node:

  • type is kPickup
  • demand > 0

Definition at line 132 of file tw_node.cpp.

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

Referenced by Did(), pgrouting::vrp::Order::is_valid(), is_valid(), pgrouting::vrp::operator<<(), pgrouting::vrp::Pgr_pickDeliver::order_of(), and set_Did().

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

@ {

is_start

To be a start node:

  • type is kStart
  • demand == 0

Definition at line 122 of file tw_node.cpp.

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

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

bool pgrouting::vrp::Tw_node::is_tight_compatible_IJ ( const Tw_node I) const
bool pgrouting::vrp::Tw_node::is_valid ( ) const
protected
bool pgrouting::vrp::Tw_node::is_waitTime_compatible_IJ ( const Tw_node I) const

Definition at line 102 of file tw_node.cpp.

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

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

bool pgrouting::vrp::Node::isSamePos ( const Node other) const
inherited

@ {

Definition at line 31 of file node.cpp.

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

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

@ {

Returns the opening time.

Definition at line 88 of file tw_node.h.

References m_opens.

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

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

Definition at line 182 of file tw_node.cpp.

int64_t pgrouting::vrp::Node::original_id ( ) const
inlineinherited

Definition at line 52 of file node.h.

References pgrouting::vrp::Node::m_original_id.

Referenced by pgrouting::vrp::Node::operator==().

size_t pgrouting::vrp::Tw_node::Pid ( ) const
inline

Definition at line 77 of file tw_node.h.

References is_delivery(), m_otherid, and pgassert.

double pgrouting::vrp::Tw_node::service_time ( ) const
inline
void pgrouting::vrp::Tw_node::set_Did ( size_t  id)
inline

Definition at line 67 of file tw_node.h.

References pgrouting::vrp::Node::id(), is_pickup(), m_otherid, and pgassert.

void pgrouting::vrp::Tw_node::set_Pid ( size_t  id)
inline

Definition at line 62 of file tw_node.h.

References pgrouting::vrp::Node::id(), is_delivery(), m_otherid, and pgassert.

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

double pgrouting::vrp::Tw_node::travel_time_to ( const Node other) const
NodeType pgrouting::vrp::Tw_node::type ( ) const
inline

Returns the type of this node.

Definition at line 100 of file tw_node.h.

References m_type.

Referenced by is_valid(), and type_str().

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

Definition at line 109 of file tw_node.cpp.

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

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

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

Returns the length of time between the opening and closing.

Definition at line 103 of file tw_node.h.

References m_closes, and m_opens.

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

Member Data Documentation

double pgrouting::vrp::Tw_node::m_closes
protected

closing time of the node

Definition at line 290 of file tw_node.h.

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

double pgrouting::vrp::Tw_node::m_demand
protected

The demand for the Node.

Definition at line 292 of file tw_node.h.

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

double pgrouting::vrp::Tw_node::m_opens
protected

opening time of the node

Definition at line 289 of file tw_node.h.

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

size_t pgrouting::vrp::Tw_node::m_otherid
protected

the other's internal id

Definition at line 293 of file tw_node.h.

Referenced by Did(), pgrouting::vrp::operator<<(), Pid(), set_Did(), and set_Pid().

double pgrouting::vrp::Tw_node::m_service_time
protected

Definition at line 291 of file tw_node.h.

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

NodeType pgrouting::vrp::Tw_node::m_type
protected
const Pgr_pickDeliver* pgrouting::vrp::Tw_node::problem
protected

Definition at line 295 of file tw_node.h.

Referenced by travel_time_to().


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