PGROUTING
3.2
|
Vehicle with time windows. More...
#include "vehicle.h"
Public Types | |
typedef std::tuple< int, int, size_t, double, double > | Cost |
Public Member Functions | |
Vehicle (const Vehicle &)=default | |
Vehicle (size_t idx, int64_t id, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double p_capacity, double p_speed, double p_factor) | |
std::pair< POS, POS > | drop_position_limits (const Vehicle_node node) const |
std::vector< General_vehicle_orders_t > | get_postgres_result (int vid) const |
int64_t | id () const |
size_t | idx () const |
bool | is_phony () const |
std::pair< POS, POS > | position_limits (const Vehicle_node node) const |
void | reset_id (int64_t) |
double | speed () const |
void | swap (POS i, POS j) |
Swap two nodes in the path. More... | |
Static Public Member Functions | |
static Pgr_messages & | msg () |
Access to the problem's message. More... | |
Static Public Attributes | |
static Pgr_pickDeliver * | problem |
Pointer to problem. More... | |
Protected Types | |
using | difference_type = std::deque< Vehicle_node >::difference_type |
typedef size_t | POS |
Protected Attributes | |
std::deque< Vehicle_node > | m_path |
Private Member Functions | |
POS | getDropPosLowLimit (const Vehicle_node &node) const |
POS | getPosHighLimit (const Vehicle_node &node) const |
POS | getPosLowLimit (const Vehicle_node &node) const |
Private Attributes | |
double | m_capacity |
double | m_factor |
int64_t | m_id |
size_t | m_idx |
double | m_speed |
Friends | |
class | PD_problem |
operators | |
std::ostream & | operator<< (std::ostream &log, const Vehicle &v) |
@ { More... | |
bool | operator< (const Vehicle &lhs, const Vehicle &rhs) |
std::string | tau () const |
Vehicle with time windows.
General functionality for a vehicle in a VRP problem
Recommended use:
A vehicle is a sequence of Vehicle_node from starting site to ending site. has: capacity speed factor TODO(vicky)
typedef std::tuple< int, int, size_t, double, double > pgrouting::vrp::Vehicle::Cost |
|
protected |
|
protected |
|
default |
pgrouting::vrp::Vehicle::Vehicle | ( | size_t | idx, |
int64_t | id, | ||
const Vehicle_node & | starting_site, | ||
const Vehicle_node & | ending_site, | ||
double | p_capacity, | ||
double | p_speed, | ||
double | p_factor | ||
) |
Definition at line 419 of file vehicle.cpp.
References capacity(), pgrouting::vrp::Tw_node::closes(), ENTERING, evaluate(), EXITING, pgrouting::Identifier::id(), pgrouting::Identifier::idx(), invariant(), pgrouting::Pgr_messages::log, m_path, msg(), pgrouting::vrp::Tw_node::opens(), pgassert, and tau().
|
inline |
Vehicle::Cost pgrouting::vrp::Vehicle::cost | ( | ) | const |
Definition at line 175 of file vehicle.cpp.
References cvTot(), duration(), m_path, total_wait_time(), and twvTot().
Referenced by insert().
|
inline |
std::pair< size_t, size_t > pgrouting::vrp::Vehicle::drop_position_limits | ( | const Vehicle_node | node | ) | const |
Definition at line 306 of file vehicle.cpp.
References getDropPosLowLimit(), and getPosHighLimit().
Referenced by pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
|
inline |
bool pgrouting::vrp::Vehicle::empty | ( | ) | const |
return true when no nodes are in the truck
Definition at line 259 of file vehicle.cpp.
References invariant(), and m_path.
Referenced by pgrouting::vrp::Optimize::move_order().
|
inline |
void pgrouting::vrp::Vehicle::erase | ( | const Vehicle_node & | node | ) |
Erase node.id()
Numbers are positions before: S .... node.id() .... E after: S .... .... E
Definition at line 198 of file vehicle.cpp.
References evaluate(), pgrouting::Identifier::idx(), invariant(), and m_path.
Referenced by pgrouting::vrp::Vehicle_pickDeliver::erase(), pgrouting::vrp::Vehicle_pickDeliver::insert(), and pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
void pgrouting::vrp::Vehicle::erase | ( | POS | pos | ) |
Erase node at pos
from the path.
Numbers are positions before: S 1 2 3 4 5 6 pos 8 9 E after: S 1 2 3 4 5 6 8 9 E
[in] | pos | to be erased. |
Definition at line 219 of file vehicle.cpp.
References evaluate(), invariant(), m_path, and pgassert.
void pgrouting::vrp::Vehicle::evaluate | ( | ) |
@ {
Evaluate: Evaluate the whole path from the start.
Definition at line 250 of file vehicle.cpp.
References invariant().
Referenced by erase(), insert(), pgrouting::vrp::Vehicle_pickDeliver::push_back(), pgrouting::vrp::Vehicle_pickDeliver::push_front(), swap(), and Vehicle().
void pgrouting::vrp::Vehicle::evaluate | ( | POS | from | ) |
Evaluate: Evaluate a path from the given position.
[in] | from | The starting position in the path for evaluation to the end of the path. |
Definition at line 271 of file vehicle.cpp.
References invariant(), m_capacity, m_path, pgassert, and speed().
std::vector< General_vehicle_orders_t > pgrouting::vrp::Vehicle::get_postgres_result | ( | int | vid | ) | const |
Definition at line 144 of file vehicle.cpp.
References pgrouting::Identifier::id(), pgrouting::Pgr_messages::log, m_path, msg(), and tau().
|
private |
Definition at line 327 of file vehicle.cpp.
References invariant(), m_path, and speed().
Referenced by drop_position_limits().
|
private |
Definition at line 392 of file vehicle.cpp.
References invariant(), pgrouting::vrp::Tw_node::is_compatible_IJ(), m_path, and speed().
Referenced by drop_position_limits(), and position_limits().
|
private |
Definition at line 360 of file vehicle.cpp.
References invariant(), m_path, and speed().
Referenced by position_limits().
|
inline |
Definition at line 222 of file vehicle.h.
References cvTot().
Referenced by pgrouting::vrp::Vehicle_pickDeliver::insert(), is_feasable(), and pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
|
inline |
Definition at line 219 of file vehicle.h.
References twvTot().
Referenced by is_feasable(), and pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
|
inherited |
Definition at line 42 of file identifier.cpp.
References pgrouting::Identifier::m_id.
Referenced by pgrouting::vrp::Dnode::distance(), get_postgres_result(), is_phony(), pgrouting::vrp::operator<<(), pgrouting::operator<<(), pgrouting::vrp::Tw_node::operator==(), tau(), and Vehicle().
|
inherited |
Definition at line 37 of file identifier.cpp.
References pgrouting::Identifier::m_idx.
Referenced by erase(), pgrouting::vrp::Vehicle_pickDeliver::erase(), pgrouting::vrp::Vehicle_pickDeliver::has_order(), pgrouting::vrp::Vehicle_pickDeliver::insert(), 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(), tau(), and Vehicle().
void pgrouting::vrp::Vehicle::insert | ( | POS | pos, |
Vehicle_node | node | ||
) |
@ {
Insert node at pos position.
[in] | pos | The position that the node should be inserted. |
[in] | node | The node to insert. |
Definition at line 183 of file vehicle.cpp.
References evaluate(), pgrouting::Identifier::idx(), invariant(), m_path, and pgassert.
Referenced by pgrouting::vrp::Vehicle_pickDeliver::insert(), insert(), and pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
size_t pgrouting::vrp::Vehicle::insert | ( | std::pair< POS, POS > | position_limits, |
const Vehicle_node & | node | ||
) |
Insert node in best position of the position_limits.
[in] | position_limits | |
[in] | node | The node to insert |
Definition at line 63 of file vehicle.cpp.
References cost(), cost_compare(), pgrouting::Identifier::idx(), insert(), invariant(), m_path, pgassert, position_limits(), and swap().
void pgrouting::vrp::Vehicle::invariant | ( | ) | const |
Invariant The path must:
path: S ..... E
Definition at line 56 of file vehicle.cpp.
References m_path, and pgassert.
Referenced by pgrouting::vrp::Vehicle_pickDeliver::do_while_feasable(), empty(), erase(), pgrouting::vrp::Vehicle_pickDeliver::erase(), evaluate(), getDropPosLowLimit(), getPosHighLimit(), getPosLowLimit(), pgrouting::vrp::Vehicle_pickDeliver::insert(), insert(), pgrouting::vrp::operator<(), pgrouting::vrp::operator<<(), path(), pgrouting::vrp::Vehicle_pickDeliver::push_back(), pgrouting::vrp::Vehicle_pickDeliver::push_front(), pgrouting::vrp::Vehicle_pickDeliver::semiLIFO(), size(), swap(), Vehicle(), and pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver().
|
inline |
Definition at line 226 of file vehicle.h.
References has_cv(), and has_twv().
Referenced by pgrouting::vrp::Vehicle_pickDeliver::do_while_feasable(), pgrouting::vrp::Vehicle_pickDeliver::insert(), and pgrouting::vrp::Vehicle_pickDeliver::semiLIFO().
bool pgrouting::vrp::Vehicle::is_ok | ( | ) | const |
Definition at line 410 of file vehicle.cpp.
References pgrouting::vrp::Tw_node::closes(), end_site(), m_capacity, m_path, pgrouting::vrp::Tw_node::opens(), pgassert, and start_site().
|
inline |
Definition at line 105 of file vehicle.h.
References pgrouting::Identifier::id().
Referenced by pgrouting::vrp::Optimize::move_order().
|
static |
Access to the problem's message.
Definition at line 51 of file vehicle.cpp.
References pgrouting::vrp::Pgr_pickDeliver::msg, and problem.
Referenced by pgrouting::vrp::Vehicle_pickDeliver::do_while_feasable(), get_postgres_result(), and Vehicle().
std::deque< Vehicle_node > pgrouting::vrp::Vehicle::path | ( | ) | const |
@ {
Definition at line 292 of file vehicle.cpp.
References invariant(), and m_path.
Referenced by pgrouting::vrp::operator<<().
std::pair< size_t, size_t > pgrouting::vrp::Vehicle::position_limits | ( | const Vehicle_node | node | ) | const |
Definition at line 299 of file vehicle.cpp.
References getPosHighLimit(), and getPosLowLimit().
Referenced by pgrouting::vrp::Vehicle_pickDeliver::insert(), and insert().
|
inherited |
Definition at line 47 of file identifier.cpp.
References pgrouting::Identifier::m_id.
Referenced by pgrouting::vrp::Tw_node::Tw_node().
size_t pgrouting::vrp::Vehicle::size | ( | ) | const |
return number of nodes in the truck
Definition at line 265 of file vehicle.cpp.
References invariant(), and m_path.
Referenced by pgrouting::vrp::Optimize::move_order().
double pgrouting::vrp::Vehicle::speed | ( | ) | const |
Definition at line 477 of file vehicle.cpp.
References m_factor, and m_speed.
Referenced by evaluate(), getDropPosLowLimit(), getPosHighLimit(), getPosLowLimit(), pgrouting::vrp::operator<<(), and pgrouting::vrp::Vehicle_pickDeliver::set_compatibles().
|
inline |
Swap two nodes in the path.
[in] | i | The position of the first node to swap. |
[in] | j | The position of the second node to swap. |
Definition at line 234 of file vehicle.cpp.
References evaluate(), invariant(), m_path, and pgassert.
Referenced by insert().
std::string pgrouting::vrp::Vehicle::tau | ( | ) | const |
Definition at line 457 of file vehicle.cpp.
References cvTot(), duration(), pgrouting::Identifier::id(), pgrouting::Identifier::idx(), m_path, pgassert, total_wait_time(), and twvTot().
Referenced by get_postgres_result(), pgrouting::vrp::Vehicle_pickDeliver::insert(), pgrouting::vrp::operator<<(), and Vehicle().
|
inline |
|
inline |
|
inline |
|
inline |
Definition at line 502 of file vehicle.cpp.
|
friend |
|
friend |
|
private |
Definition at line 82 of file vehicle.h.
Referenced by capacity(), evaluate(), is_ok(), and pgrouting::vrp::operator<<().
|
private |
Definition at line 83 of file vehicle.h.
Referenced by pgrouting::vrp::operator<<(), and speed().
|
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().
|
protected |
Definition at line 77 of file vehicle.h.
Referenced by cost(), cvTot(), duration(), empty(), end_site(), erase(), evaluate(), get_postgres_result(), getDropPosLowLimit(), getPosHighLimit(), getPosLowLimit(), pgrouting::vrp::Vehicle_pickDeliver::insert(), insert(), invariant(), is_ok(), pgrouting::vrp::operator<(), path(), pgrouting::vrp::Vehicle_pickDeliver::push_back(), pgrouting::vrp::Vehicle_pickDeliver::push_front(), pgrouting::vrp::Vehicle_pickDeliver::semiLIFO(), size(), start_site(), swap(), tau(), total_service_time(), total_travel_time(), total_wait_time(), twvTot(), and Vehicle().
|
private |
Definition at line 84 of file vehicle.h.
Referenced by pgrouting::vrp::operator<<(), and speed().
|
static |
Pointer to problem.
Definition at line 315 of file vehicle.h.
Referenced by msg(), and pgrouting::vrp::PD_problem::PD_problem().