![]() |
vrpRouting
0.3
|
Time window attributes of a node. More...
#include "tw_node.h"
Public Member Functions | |
Tw_node ()=delete | |
Creating a Tw_node is not permitted. More... | |
Tw_node (const Tw_node &)=default | |
Copy constructor. More... | |
Tw_node (size_t id, const PickDeliveryOrders_t &data, const NodeType &type) | |
Creating a Tw_node from a postgreSQL order. More... | |
Tw_node (size_t id, const Vehicle_t &data, const NodeType &type) | |
Creating a Tw_node from a postgreSQL vehicle. More... | |
TTimestamp | arrival_j_closes_i (const Tw_node &I, Speed=1.0) const |
arrival time at This node, when arrived at I at closing time TODO refine description More... | |
TTimestamp | arrival_j_opens_i (const Tw_node &I, Speed=1.0) const |
arrival time at This node, when arrived at I at opening time TODO refine description More... | |
TTimestamp | closes () const |
Returns the closing time. More... | |
Amount | demand () const |
Returns the demand associated with this node. More... | |
bool | is_compatible_IJ (const Tw_node &I, Speed=1.0) const |
is possible to arrive to this after visiting other? More... | |
bool | is_delivery () const |
Is the node a valid order's delivery node. More... | |
bool | is_dump () const |
Is the node a valid vehicle's dumping node. More... | |
bool | is_early_arrival (TTimestamp arrival_time) const |
True when arrivalTime is before it opens. More... | |
bool | is_end () const |
Is the node a valid vehicle's ending node. More... | |
bool | is_late_arrival (TTimestamp arrival_time) const |
True when arrivalTime is after it closes. More... | |
bool | is_load () const |
Is the node a valid vehicle's loading node. More... | |
bool | is_on_time (TTimestamp arrival_time) const |
True when arrivalTime in the time window. More... | |
bool | is_partially_compatible_IJ (const Tw_node &I, Speed=1.0) const |
can arrive to this after visiting as late as possible I? TODO refine description More... | |
bool | is_partially_waitTime_compatible_IJ (const Tw_node &I, Speed=1.0) const |
can arrive to this after visiting as late as possible I? TODO refine description More... | |
bool | is_pickup () const |
Is the node a valid order's pickup node. More... | |
bool | is_start () const |
Is the node a valid vehicle's starting node. More... | |
bool | is_tight_compatible_IJ (const Tw_node &I, Speed=1.0) const |
can arrive to this after visiting as late as possible I? TODO refine description More... | |
bool | is_valid () const |
is the node valid? More... | |
bool | is_waitTime_compatible_IJ (const Tw_node &I, Speed=1.0) const |
can arrive to this after visiting as late as possible I? TODO refine description More... | |
TTimestamp | opens () const |
Returns the opening time. More... | |
bool | operator== (const Tw_node &rhs) const |
equality operator More... | |
int64_t | order () const |
Returns the order to which it belongs. More... | |
TInterval | service_time () const |
Returns the service time for this node. More... | |
TInterval | travel_time_to (const Tw_node &, TTimestamp, Speed=1.0) const |
travel time to other node. More... | |
auto | type () const |
Returns the type of this node. More... | |
std::string | type_str () const |
returns a string code of the kind of node More... | |
TInterval | window_length () const |
Returns the length of time between the opening and closing. More... | |
Static Public Attributes | |
static const Matrix * | m_time_matrix_ptr = nullptr |
Protected Member Functions | |
void | demand (Amount value) |
Sets the demand value to a new value. More... | |
Private Attributes | |
TTimestamp | m_closes |
closing time of the node More... | |
Amount | m_demand |
The demand for the Node. More... | |
int64_t | m_id |
size_t | m_idx |
TTimestamp | m_opens |
opening time of the node More... | |
int64_t | m_order { } |
order to which it belongs (idx) More... | |
TInterval | m_service_time |
time it takes to be served More... | |
NodeType | m_type |
The kind of Node. More... | |
Friends | |
std::ostream & | operator<< (std::ostream &, const Tw_node &) |
Print the contents of a Twnode object. More... | |
Time window attributes of a node.
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
.
|
delete |
Creating a Tw_node is not permitted.
|
default |
Copy constructor.
vrprouting::problem::Tw_node::Tw_node | ( | size_t | id, |
const PickDeliveryOrders_t & | data, | ||
const NodeType & | type | ||
) |
Creating a Tw_node from a postgreSQL order.
[in] | id | the internal id of the node |
[in] | data | the postgrSQL order information |
[in] | type | the kind of node to be created |
Definition at line 313 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, vrprouting::problem::kDelivery, m_closes, m_demand, m_opens, m_service_time, m_type, and vrprouting::Identifier::reset_id().
Creating a Tw_node from a postgreSQL vehicle.
[in] | id | the internal id of the node |
[in] | data | the postgrSQL vehicle information |
[in] | type | the kind of node to be created |
Definition at line 338 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, vrprouting::problem::kEnd, m_closes, m_opens, m_service_time, m_type, and vrprouting::Identifier::reset_id().
TTimestamp vrprouting::problem::Tw_node::arrival_j_closes_i | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
arrival time at This node, when arrived at I at closing time TODO refine description
[in] | I | the previous node before this node |
[in] | speed | - speed used for calculation |
I -> this Value of TWC when arriving to this node after visiting node I at closing time
Definition at line 81 of file tw_node.cpp.
References closes(), vrprouting::problem::kStart, m_type, service_time(), and travel_time_to().
Referenced by is_partially_compatible_IJ(), and is_tight_compatible_IJ().
TTimestamp vrprouting::problem::Tw_node::arrival_j_opens_i | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
arrival time at This node, when arrived at I at opening time TODO refine description
[in] | I | the previous node before this node |
[in] | speed | - speed used for calculation |
I -> this Value of TWC when arriving to this node after visiting node I at opening time
Definition at line 66 of file tw_node.cpp.
References vrprouting::problem::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().
|
inline |
Returns the closing time.
Definition at line 81 of file tw_node.h.
References m_closes.
Referenced by arrival_j_closes_i(), is_delivery(), is_dump(), is_end(), is_load(), vrprouting::problem::Vehicle::is_ok(), is_pickup(), and is_start().
|
inline |
Returns the demand associated with this node.
Definition at line 163 of file tw_node.h.
References m_demand.
Referenced by vrprouting::problem::Vehicle_node::evaluate(), is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), and is_start().
|
inlineprotected |
|
inherited |
get the original id
Definition at line 42 of file identifier.cpp.
References vrprouting::Identifier::m_id.
Referenced by vrprouting::problem::Vehicle_node::get_postgres_result(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle::is_phony(), vrprouting::operator<<(), vrprouting::problem::operator<<(), operator==(), vrprouting::problem::Vehicle_pickDeliver::set_initial_solution(), vrprouting::problem::Vehicle_pickDeliver::set_unmovable(), vrprouting::problem::Vehicle::tau(), and travel_time_to().
|
inherited |
get the internal index
Definition at line 37 of file identifier.cpp.
References vrprouting::Identifier::m_idx.
Referenced by vrprouting::problem::Vehicle_pickDeliver::erase(), vrprouting::problem::Vehicle::erase(), vrprouting::problem::Vehicle_pickDeliver::has_order(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::operator<<(), vrprouting::problem::operator<<(), operator==(), vrprouting::problem::Vehicle_pickDeliver::push_back(), vrprouting::problem::Vehicle_pickDeliver::push_front(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), vrprouting::problem::Order::set_compatibles(), and vrprouting::problem::Vehicle::tau().
is possible to arrive to this after visiting other?
[in] | I | node visited before visiting this node |
[in] | speed | - speed used for calculation |
Definition at line 94 of file tw_node.cpp.
References arrival_j_opens_i(), is_late_arrival(), vrprouting::problem::kEnd, vrprouting::problem::kStart, and m_type.
Referenced by vrprouting::problem::Vehicle::getPosHighLimit(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), vrprouting::problem::Order::is_valid(), is_waitTime_compatible_IJ(), and vrprouting::problem::Order::isCompatibleIJ().
bool vrprouting::problem::Tw_node::is_delivery | ( | ) | const |
Is the node a valid order's delivery node.
Definition at line 210 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kDelivery, m_type, opens(), and service_time().
Referenced by vrprouting::problem::Order::is_valid(), and is_valid().
bool vrprouting::problem::Tw_node::is_dump | ( | ) | const |
Is the node a valid vehicle's dumping node.
Definition at line 222 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kDump, m_type, opens(), and service_time().
Referenced by vrprouting::problem::Vehicle_node::evaluate(), and is_valid().
|
inline |
True when arrivalTime is before it opens.
Definition at line 126 of file tw_node.h.
References m_opens.
Referenced by vrprouting::problem::Vehicle_node::evaluate(), is_on_time(), is_partially_compatible_IJ(), is_partially_waitTime_compatible_IJ(), is_tight_compatible_IJ(), and is_waitTime_compatible_IJ().
bool vrprouting::problem::Tw_node::is_end | ( | ) | const |
Is the node a valid vehicle's ending node.
Definition at line 245 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kEnd, m_type, opens(), and service_time().
Referenced by vrprouting::problem::Fleet::add_vehicle(), vrprouting::problem::Vehicle::erase(), vrprouting::problem::Vehicle_node::has_cv(), and is_valid().
|
inline |
True when arrivalTime is after it closes.
Definition at line 121 of file tw_node.h.
References m_closes.
Referenced by vrprouting::problem::Vehicle_node::deltaGeneratesTWV(), vrprouting::problem::Vehicle_node::has_twv(), is_compatible_IJ(), is_on_time(), is_partially_compatible_IJ(), and is_tight_compatible_IJ().
bool vrprouting::problem::Tw_node::is_load | ( | ) | const |
Is the node a valid vehicle's loading node.
Definition at line 234 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kLoad, m_type, opens(), and service_time().
Referenced by is_valid().
|
inline |
True when arrivalTime in the time window.
Definition at line 131 of file tw_node.h.
References is_early_arrival(), and is_late_arrival().
bool vrprouting::problem::Tw_node::is_partially_compatible_IJ | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
can arrive to this after visiting as late as possible I? TODO refine description
[in] | I | node visited before visiting this node |
[in] | speed | - speed used for calculation |
Definition at line 116 of file tw_node.cpp.
References arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_early_arrival(), and is_late_arrival().
bool vrprouting::problem::Tw_node::is_partially_waitTime_compatible_IJ | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
can arrive to this after visiting as late as possible I? TODO refine description
[in] | I | node visited before visiting this node |
[in] | speed | - speed used for calculation |
Definition at line 146 of file tw_node.cpp.
References arrival_j_opens_i(), is_compatible_IJ(), and is_early_arrival().
bool vrprouting::problem::Tw_node::is_pickup | ( | ) | const |
Is the node a valid order's pickup node.
Definition at line 199 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kPickup, m_type, opens(), and service_time().
Referenced by vrprouting::problem::Order::is_valid(), and is_valid().
bool vrprouting::problem::Tw_node::is_start | ( | ) | const |
Is the node a valid vehicle's starting node.
Definition at line 187 of file tw_node.cpp.
References closes(), demand(), vrprouting::problem::kStart, m_type, opens(), and service_time().
Referenced by vrprouting::problem::Vehicle::erase(), vrprouting::problem::Vehicle_node::evaluate(), vrprouting::problem::Vehicle_node::has_cv(), and is_valid().
bool vrprouting::problem::Tw_node::is_tight_compatible_IJ | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
can arrive to this after visiting as late as possible I? TODO refine description
[in] | I | node visited before visiting this node |
[in] | speed | - speed used for calculation |
Definition at line 131 of file tw_node.cpp.
References arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_early_arrival(), and is_late_arrival().
bool vrprouting::problem::Tw_node::is_valid | ( | ) | const |
is the node valid?
Definition at line 274 of file tw_node.cpp.
References is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), is_start(), vrprouting::problem::kDelivery, vrprouting::problem::kDump, vrprouting::problem::kEnd, vrprouting::problem::kLoad, vrprouting::problem::kPickup, vrprouting::problem::kStart, and type().
bool vrprouting::problem::Tw_node::is_waitTime_compatible_IJ | ( | const Tw_node & | I, |
Speed | speed = 1.0 |
||
) | const |
can arrive to this after visiting as late as possible I? TODO refine description
[in] | I | node visited before visiting this node |
[in] | speed | - speed used for calculation |
Definition at line 162 of file tw_node.cpp.
References arrival_j_opens_i(), is_compatible_IJ(), and is_early_arrival().
|
inline |
Returns the opening time.
Definition at line 78 of file tw_node.h.
References m_opens.
Referenced by arrival_j_opens_i(), vrprouting::problem::Vehicle_node::evaluate(), is_delivery(), is_dump(), is_end(), is_load(), vrprouting::problem::Vehicle::is_ok(), is_pickup(), and is_start().
bool vrprouting::problem::Tw_node::operator== | ( | const Tw_node & | other | ) | const |
equality operator
[in] | other |
Definition at line 258 of file tw_node.cpp.
References vrprouting::Identifier::id(), vrprouting::Identifier::idx(), m_closes, m_demand, m_opens, m_order, m_service_time, and m_type.
|
inline |
Returns the order to which it belongs.
Definition at line 75 of file tw_node.h.
References m_order.
Referenced by vrprouting::problem::Vehicle_node::get_postgres_result().
|
inherited |
change the original id
Definition at line 47 of file identifier.cpp.
References vrprouting::Identifier::m_id.
Referenced by Tw_node().
|
inline |
Returns the service time for this node.
Definition at line 84 of file tw_node.h.
References m_service_time.
Referenced by arrival_j_closes_i(), arrival_j_opens_i(), vrprouting::problem::Vehicle_node::evaluate(), vrprouting::problem::Vehicle_node::get_postgres_result(), is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), is_start(), and vrprouting::problem::operator<<().
TInterval vrprouting::problem::Tw_node::travel_time_to | ( | const Tw_node & | other, |
TTimestamp | time, | ||
Speed | speed = 1.0 |
||
) | const |
travel time to other node.
[in] | other | - pointer to the other Tw_node |
[in] | time | - time of departure from previous node |
[in] | speed | - speed used for calculation |
Definition at line 51 of file tw_node.cpp.
References vrprouting::Identifier::id(), m_time_matrix_ptr, pgassert, and vrprouting::problem::Matrix::travel_time().
Referenced by arrival_j_closes_i(), arrival_j_opens_i(), and vrprouting::problem::Vehicle_node::evaluate().
|
inline |
Returns the type of this node.
Definition at line 87 of file tw_node.h.
References m_type.
Referenced by vrprouting::problem::Vehicle_node::get_postgres_result(), is_valid(), and type_str().
std::string vrprouting::problem::Tw_node::type_str | ( | ) | const |
returns a string code of the kind of node
Definition at line 171 of file tw_node.cpp.
References vrprouting::problem::kDelivery, vrprouting::problem::kDump, vrprouting::problem::kEnd, vrprouting::problem::kLoad, vrprouting::problem::kPickup, vrprouting::problem::kStart, and type().
Referenced by vrprouting::problem::operator<<().
|
inline |
|
friend |
Print the contents of a Twnode object.
[in] | log | |
[in] | n |
Definition at line 362 of file tw_node.cpp.
|
private |
closing time of the node
Definition at line 180 of file tw_node.h.
Referenced by closes(), is_late_arrival(), vrprouting::problem::operator<<(), operator==(), Tw_node(), and window_length().
|
private |
The demand for the Node.
Definition at line 186 of file tw_node.h.
Referenced by demand(), vrprouting::problem::operator<<(), operator==(), and Tw_node().
|
privateinherited |
Definition at line 87 of file identifier.h.
Referenced by vrprouting::Identifier::id(), and vrprouting::Identifier::reset_id().
|
privateinherited |
Definition at line 86 of file identifier.h.
Referenced by vrprouting::Identifier::idx().
|
private |
opening time of the node
Definition at line 177 of file tw_node.h.
Referenced by is_early_arrival(), opens(), vrprouting::problem::operator<<(), operator==(), Tw_node(), and window_length().
|
private |
order to which it belongs (idx)
Definition at line 174 of file tw_node.h.
Referenced by operator==(), and order().
|
private |
time it takes to be served
Definition at line 183 of file tw_node.h.
Referenced by vrprouting::problem::operator<<(), operator==(), service_time(), and Tw_node().
|
static |
Definition at line 139 of file tw_node.h.
Referenced by vrprouting::problem::Orders::Orders(), and travel_time_to().
|
private |
The kind of Node.
Definition at line 189 of file tw_node.h.
Referenced by arrival_j_closes_i(), arrival_j_opens_i(), is_compatible_IJ(), is_delivery(), is_dump(), is_end(), is_load(), is_pickup(), is_start(), operator==(), Tw_node(), and type().