PGROUTING
3.2
|
Extend Tw_node to evaluate the vehicle at node level. More...
#include "vehicle_node.h"
Public Types | |
enum | NodeType { kStart = 0, kPickup, kDelivery, kDump, kLoad, kEnd } |
Public Member Functions | |
Vehicle_node ()=delete | |
Construct from parameters. More... | |
Vehicle_node (const Tw_node &node) | |
Creates a disconected vehicle node. More... | |
Vehicle_node (const Vehicle_node &)=default | |
double | distance (const Dnode &other) const |
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;
| |
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_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... | |
document functions | |
double | arrival_j_opens_i (const Tw_node &I, double speed) const |
@ { More... | |
bool | is_compatible_IJ (const Tw_node &I, double speed) const |
Node evaluation accessors | |
double | travel_time () const |
@ { More... | |
double | arrival_time () const |
Truck's arrival_time to this node. More... | |
double | wait_time () const |
Truck's wait_time at this node. More... | |
double | departure_time () const |
Truck's departure_time from this node. More... | |
double | delta_time () const |
delta_time = departure_time(this) - departure_time(previous) More... | |
Accumulated evaluation accessors | |
int | twvTot () const |
@ { More... | |
int | cvTot () const |
Truck's total times it has violated cargo limits. More... | |
double | cargo () const |
Truck's total cargo after the node was served. More... | |
double | total_time () const |
Truck's travel duration up to this node. More... | |
double | total_travel_time () const |
_time spent moving between nodes by the truck More... | |
double | total_wait_time () const |
_time spent by the truck waiting for nodes to open More... | |
double | total_service_time () const |
_time spent by the truck servicing the nodes More... | |
State | |
bool | feasible () const |
@ { More... | |
bool | feasible (double cargoLimit) const |
True doesn't have twc nor cv (including total counts) More... | |
bool | has_twv () const |
True when at this node does not violate time windows. More... | |
bool | has_cv (double cargoLimit) const |
True when not violation. More... | |
mutators | |
void | evaluate (double cargoLimit) |
@ { More... | |
void | evaluate (const Vehicle_node &pred, double cargoLimit, double speed) |
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;
| |
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_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... | |
document functions | |
double | arrival_j_opens_i (const Tw_node &I, double speed) const |
@ { More... | |
bool | is_compatible_IJ (const Tw_node &I, double speed) const |
Static Protected Member Functions | |
static Pgr_messages & | msg () |
Static Protected Attributes | |
static Pgr_pickDeliver * | problem |
The problem. More... | |
Private Attributes | |
double | m_closes |
closing time of the node More... | |
double | m_demand |
The demand for the Node. More... | |
int64_t | m_id |
size_t | m_idx |
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... | |
friend | PD_problem |
Node evaluation members | |
double | m_travel_time |
@ { More... | |
double | m_arrival_time |
Arrival time at this node. More... | |
double | m_wait_time |
Wait time at this node when early arrival. More... | |
double | m_departure_time |
double | m_delta_time |
Departure time - last nodes departure time. More... | |
Accumulated evaluation members | |
double | m_cargo |
@ { More... | |
int | m_twvTot |
Total count of TWV. More... | |
int | m_cvTot |
Total count of CV. More... | |
double | m_tot_wait_time |
Accumulated wait time. More... | |
double | m_tot_travel_time |
Accumulated travel time. More... | |
double | m_tot_service_time |
Friends | |
log | |
std::ostream & | operator<< (std::ostream &log, const Vehicle_node &node) |
@ { More... | |
Extend Tw_node to evaluate the vehicle at node level.
This class extends Twnode by adding attributes to store information about the node in a path and provides the tools evaluate the node and to set and get these attribute values.
Definition at line 48 of file vehicle_node.h.
|
inherited |
|
delete |
Construct from parameters.
|
default |
|
explicit |
Creates a disconected vehicle node.
A node that is not served by any vehicle
[in] | node | Time window node |
Definition at line 122 of file vehicle_node.cpp.
|
inherited |
@ {
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 pgrouting::vrp::Tw_node::kStart, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), pgrouting::vrp::Tw_node::service_time(), and pgrouting::vrp::Tw_node::travel_time_to().
Referenced by pgrouting::vrp::Tw_node::is_compatible_IJ().
|
inline |
Truck's arrival_time to this node.
Definition at line 65 of file vehicle_node.h.
References m_arrival_time.
Referenced by evaluate(), and pgrouting::vrp::operator<<().
|
inline |
Truck's total cargo after the node was served.
Definition at line 93 of file vehicle_node.h.
References m_cargo.
Referenced by pgrouting::vrp::operator<<().
|
inlineinherited |
Returns the closing time.
Definition at line 79 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_closes.
Referenced by pgrouting::vrp::Fleet::add_vehicle(), pgrouting::vrp::Tw_node::is_delivery(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Vehicle::is_ok(), pgrouting::vrp::Tw_node::is_pickup(), pgrouting::vrp::Tw_node::is_start(), and pgrouting::vrp::Vehicle::Vehicle().
|
inline |
Truck's total times it has violated cargo limits.
Definition at line 90 of file vehicle_node.h.
References m_cvTot.
Referenced by pgrouting::vrp::operator<<().
|
inline |
delta_time = departure_time(this) - departure_time(previous)
Definition at line 74 of file vehicle_node.h.
References m_delta_time.
|
inlineinherited |
Returns the demand associated with this node.
Definition at line 82 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_demand.
Referenced by evaluate(), pgrouting::vrp::Tw_node::is_delivery(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Tw_node::is_pickup(), and pgrouting::vrp::Tw_node::is_start().
|
inlineinherited |
|
inline |
Truck's departure_time from this node.
Definition at line 71 of file vehicle_node.h.
References m_departure_time.
Referenced by evaluate(), and pgrouting::vrp::operator<<().
|
inherited |
Definition at line 43 of file dnode.cpp.
References pgrouting::tsp::Dmatrix::distance(), pgrouting::vrp::Pgr_pickDeliver::get_cost_matrix(), pgrouting::tsp::Dmatrix::get_index(), pgrouting::Identifier::id(), and pgrouting::vrp::Dnode::problem.
Referenced by pgrouting::vrp::Tw_node::travel_time_to().
void pgrouting::vrp::Vehicle_node::evaluate | ( | const Vehicle_node & | pred, |
double | cargoLimit, | ||
double | speed | ||
) |
[in] | pred | The node preceding this node in the path. |
[in] | cargoLimit | of the vehicle. |
[in] | speed | of the vehicle. |
Definition at line 68 of file vehicle_node.cpp.
References arrival_time(), pgrouting::vrp::Tw_node::demand(), departure_time(), has_cv(), has_twv(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_early_arrival(), m_arrival_time, m_cargo, m_cvTot, m_delta_time, m_departure_time, m_tot_service_time, m_tot_travel_time, m_tot_wait_time, m_travel_time, m_twvTot, m_wait_time, pgrouting::vrp::Tw_node::opens(), pred(), pgrouting::vrp::Tw_node::service_time(), travel_time(), and wait_time().
void pgrouting::vrp::Vehicle_node::evaluate | ( | double | cargoLimit | ) |
@ {
[in] | cargoLimit | of the vehicle |
Definition at line 38 of file vehicle_node.cpp.
References arrival_time(), pgrouting::vrp::Tw_node::demand(), has_cv(), pgrouting::vrp::Tw_node::is_start(), m_arrival_time, m_cargo, m_cvTot, m_delta_time, m_departure_time, m_tot_service_time, m_tot_travel_time, m_tot_wait_time, m_travel_time, m_twvTot, m_wait_time, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
|
inline |
@ {
True when the total count for violations are 0
Definition at line 114 of file vehicle_node.h.
References m_cvTot, and m_twvTot.
Referenced by feasible().
|
inline |
True doesn't have twc nor cv (including total counts)
Definition at line 117 of file vehicle_node.h.
References feasible(), has_cv(), and has_twv().
|
inline |
True when not violation.
Ending's or start's cargo should be 0
Definition at line 130 of file vehicle_node.h.
References pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Tw_node::is_start(), and m_cargo.
Referenced by evaluate(), and feasible().
|
inline |
True when at this node does not violate time windows.
Definition at line 122 of file vehicle_node.h.
References pgrouting::vrp::Tw_node::is_late_arrival(), and m_arrival_time.
Referenced by evaluate(), feasible(), and pgrouting::vrp::operator<<().
|
inherited |
Definition at line 42 of file identifier.cpp.
References pgrouting::Identifier::m_id.
Referenced by pgrouting::vrp::Dnode::distance(), pgrouting::vrp::Vehicle::get_postgres_result(), pgrouting::vrp::Vehicle::is_phony(), pgrouting::vrp::operator<<(), pgrouting::operator<<(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Vehicle::tau(), and pgrouting::vrp::Vehicle::Vehicle().
|
inherited |
Definition at line 37 of file identifier.cpp.
References pgrouting::Identifier::m_idx.
Referenced by pgrouting::vrp::Vehicle::erase(), pgrouting::vrp::Vehicle_pickDeliver::erase(), pgrouting::vrp::Vehicle_pickDeliver::has_order(), pgrouting::vrp::Vehicle_pickDeliver::insert(), pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::operator<<(), pgrouting::operator<<(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Vehicle_pickDeliver::push_back(), pgrouting::vrp::Vehicle_pickDeliver::push_front(), pgrouting::vrp::Vehicle_pickDeliver::semiLIFO(), pgrouting::vrp::Order::set_compatibles(), pgrouting::vrp::Vehicle::tau(), and pgrouting::vrp::Vehicle::Vehicle().
|
inherited |
Definition at line 60 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::arrival_j_opens_i(), pgrouting::vrp::Tw_node::is_late_arrival(), pgrouting::vrp::Tw_node::kEnd, pgrouting::vrp::Tw_node::kStart, and pgrouting::vrp::Tw_node::m_type.
Referenced by pgrouting::vrp::Vehicle::getPosHighLimit(), pgrouting::vrp::Order::is_valid(), and pgrouting::vrp::Order::isCompatibleIJ().
|
inherited |
is_delivery
To be a delivery node:
Definition at line 106 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::Tw_node::kDelivery, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
Referenced by pgrouting::vrp::Order::is_valid().
|
inherited |
is_dump
To be a dump node:
Definition at line 115 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::Tw_node::kDump, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
Referenced by evaluate().
|
inlineinherited |
True when arrivalTime is before it opens.
Definition at line 179 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_opens.
Referenced by evaluate().
|
inherited |
is_end
To be a End node:
Definition at line 126 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::Tw_node::kEnd, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
Referenced by pgrouting::vrp::Fleet::add_vehicle(), and has_cv().
|
inlineinherited |
True when arrivalTime is after it closes.
Definition at line 184 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_closes.
Referenced by has_twv(), and pgrouting::vrp::Tw_node::is_compatible_IJ().
|
inherited |
is_pickup
To be a pickup node:
Definition at line 97 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::Tw_node::kPickup, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
Referenced by pgrouting::vrp::Order::is_valid().
|
inherited |
@ {
is_start
To be a start node:
Definition at line 88 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::Tw_node::kStart, pgrouting::vrp::Tw_node::m_type, pgrouting::vrp::Tw_node::opens(), and pgrouting::vrp::Tw_node::service_time().
Referenced by pgrouting::vrp::Fleet::add_vehicle(), evaluate(), and has_cv().
|
staticprotectedinherited |
|
inlineinherited |
Returns the opening time.
Definition at line 76 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_opens.
Referenced by pgrouting::vrp::Fleet::add_vehicle(), pgrouting::vrp::Tw_node::arrival_j_opens_i(), evaluate(), pgrouting::vrp::Tw_node::is_delivery(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Vehicle::is_ok(), pgrouting::vrp::Tw_node::is_pickup(), pgrouting::vrp::Tw_node::is_start(), and pgrouting::vrp::Vehicle::Vehicle().
|
inherited |
Definition at line 135 of file tw_node.cpp.
References pgrouting::Identifier::id(), pgrouting::Identifier::idx(), pgrouting::vrp::Tw_node::m_closes, pgrouting::vrp::Tw_node::m_demand, pgrouting::vrp::Tw_node::m_opens, pgrouting::vrp::Tw_node::m_order, pgrouting::vrp::Tw_node::m_service_time, and pgrouting::vrp::Tw_node::m_type.
|
inlineinherited |
@ {
Returns the opening time.
Definition at line 73 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_order.
|
inherited |
Definition at line 47 of file identifier.cpp.
References pgrouting::Identifier::m_id.
Referenced by pgrouting::vrp::Tw_node::Tw_node().
|
inlineinherited |
Returns the service time for this node.
Definition at line 86 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_service_time.
Referenced by pgrouting::vrp::Tw_node::arrival_j_opens_i(), evaluate(), pgrouting::vrp::Tw_node::is_delivery(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Tw_node::is_pickup(), pgrouting::vrp::Tw_node::is_start(), and pgrouting::vrp::operator<<().
|
inline |
_time spent by the truck servicing the nodes
Definition at line 105 of file vehicle_node.h.
References m_tot_service_time.
|
inline |
Truck's travel duration up to this node.
Definition at line 96 of file vehicle_node.h.
References m_departure_time.
|
inline |
_time spent moving between nodes by the truck
Definition at line 99 of file vehicle_node.h.
References m_tot_travel_time.
|
inline |
_time spent by the truck waiting for nodes to open
Definition at line 102 of file vehicle_node.h.
References m_tot_wait_time.
|
inline |
@ {
Truck's travel_time from previous node to this node.
Definition at line 62 of file vehicle_node.h.
References m_travel_time.
Referenced by evaluate(), and pgrouting::vrp::operator<<().
|
inherited |
time = distance / speed.
Definition at line 40 of file tw_node.cpp.
References pgrouting::vrp::Dnode::distance(), and pgassert.
Referenced by pgrouting::vrp::Tw_node::arrival_j_opens_i(), and pgrouting::vrp::operator<<().
|
inline |
@ {
Truck's total times it has violated time windows.
Definition at line 87 of file vehicle_node.h.
References m_twvTot.
Referenced by pgrouting::vrp::operator<<().
|
inlineinherited |
Returns the type of this node.
Definition at line 89 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_type.
Referenced by pgrouting::vrp::Tw_node::type_str().
|
inherited |
Definition at line 75 of file tw_node.cpp.
References pgrouting::vrp::Tw_node::kDelivery, pgrouting::vrp::Tw_node::kDump, pgrouting::vrp::Tw_node::kEnd, pgrouting::vrp::Tw_node::kLoad, pgrouting::vrp::Tw_node::kPickup, pgrouting::vrp::Tw_node::kStart, and pgrouting::vrp::Tw_node::type().
Referenced by pgrouting::vrp::operator<<().
|
inline |
Truck's wait_time at this node.
Definition at line 68 of file vehicle_node.h.
References m_wait_time.
Referenced by evaluate(), and pgrouting::vrp::operator<<().
|
inlineinherited |
Returns the length of time between the opening and closing.
Definition at line 92 of file tw_node.h.
References pgrouting::vrp::Tw_node::m_closes, and pgrouting::vrp::Tw_node::m_opens.
|
friend |
|
private |
Arrival time at this node.
Definition at line 156 of file vehicle_node.h.
Referenced by arrival_time(), evaluate(), and has_twv().
|
private |
@ {
Accumulated cargo
Definition at line 166 of file vehicle_node.h.
Referenced by cargo(), evaluate(), and has_cv().
|
privateinherited |
closing time of the node
Definition at line 227 of file tw_node.h.
Referenced by pgrouting::vrp::Tw_node::closes(), pgrouting::vrp::Tw_node::is_late_arrival(), pgrouting::vrp::operator<<(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Tw_node::Tw_node(), and pgrouting::vrp::Tw_node::window_length().
|
private |
Total count of CV.
Definition at line 168 of file vehicle_node.h.
Referenced by cvTot(), evaluate(), and feasible().
|
private |
Departure time - last nodes departure time.
Definition at line 159 of file vehicle_node.h.
Referenced by delta_time(), and evaluate().
|
privateinherited |
The demand for the Node.
Definition at line 229 of file tw_node.h.
Referenced by pgrouting::vrp::Tw_node::demand(), pgrouting::vrp::operator<<(), pgrouting::vrp::Tw_node::operator==(), and pgrouting::vrp::Tw_node::Tw_node().
|
private |
Definition at line 158 of file vehicle_node.h.
Referenced by departure_time(), evaluate(), and total_time().
|
privateinherited |
Definition at line 53 of file identifier.h.
Referenced by pgrouting::Identifier::id(), and pgrouting::Identifier::reset_id().
|
privateinherited |
Definition at line 52 of file identifier.h.
Referenced by pgrouting::Identifier::idx().
|
privateinherited |
opening time of the node
Definition at line 226 of file tw_node.h.
Referenced by pgrouting::vrp::Tw_node::is_early_arrival(), pgrouting::vrp::Tw_node::opens(), pgrouting::vrp::operator<<(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Tw_node::Tw_node(), and pgrouting::vrp::Tw_node::window_length().
|
privateinherited |
order to which it belongs
Definition at line 225 of file tw_node.h.
Referenced by pgrouting::vrp::Tw_node::operator==(), and pgrouting::vrp::Tw_node::order().
|
privateinherited |
Definition at line 228 of file tw_node.h.
Referenced by pgrouting::vrp::operator<<(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Tw_node::service_time(), and pgrouting::vrp::Tw_node::Tw_node().
|
private |
Definition at line 171 of file vehicle_node.h.
Referenced by evaluate(), and total_service_time().
|
private |
Accumulated travel time.
Definition at line 170 of file vehicle_node.h.
Referenced by evaluate(), and total_travel_time().
|
private |
Accumulated wait time.
Definition at line 169 of file vehicle_node.h.
Referenced by evaluate(), and total_wait_time().
|
private |
@ {
Travel time from last node
Definition at line 155 of file vehicle_node.h.
Referenced by evaluate(), and travel_time().
|
private |
Total count of TWV.
Definition at line 167 of file vehicle_node.h.
Referenced by evaluate(), feasible(), and twvTot().
|
privateinherited |
The demand for the Node.
Definition at line 230 of file tw_node.h.
Referenced by pgrouting::vrp::Tw_node::arrival_j_opens_i(), pgrouting::vrp::Tw_node::is_compatible_IJ(), pgrouting::vrp::Tw_node::is_delivery(), pgrouting::vrp::Tw_node::is_dump(), pgrouting::vrp::Tw_node::is_end(), pgrouting::vrp::Tw_node::is_pickup(), pgrouting::vrp::Tw_node::is_start(), pgrouting::vrp::Tw_node::operator==(), pgrouting::vrp::Tw_node::Tw_node(), and pgrouting::vrp::Tw_node::type().
|
private |
Wait time at this node when early arrival.
Definition at line 157 of file vehicle_node.h.
Referenced by evaluate(), and wait_time().
|
staticprotectedinherited |
The problem.
Definition at line 70 of file dnode.h.
Referenced by pgrouting::vrp::Dnode::distance(), and pgrouting::vrp::PD_problem::PD_problem().