![]() |
vrpRouting
0.3
|
Vehicle with time windows. More...
#include "vehicle.h"
Public Member Functions | |
PAmount | capacity () const |
returns the capacity of the vehicle More... | |
int | cvTot () const |
TInterval | duration () const |
duration of vehicle while not in a "depot" More... | |
bool | empty () const |
const Vehicle_node & | end_site () const |
std::vector< Solution_rt > | get_postgres_result (int vid) const |
std::vector< Id > | get_stops () const |
bool | has_cv () const |
bool | has_twv () const |
void | invariant () const |
bool | is_feasible () const |
bool | is_ok () const |
bool | is_phony () const |
bool | is_real () const |
size_t | length () const |
std::string | path_str () const |
Speed | speed () const |
the speed of the vehicle More... | |
const Vehicle_node & | start_site () const |
std::string | tau () const |
TInterval | total_service_time () const |
total time spent moving from one node to another More... | |
TInterval | total_travel_time () const |
total time spent moving from one node to another More... | |
TInterval | total_wait_time () const |
duration of vehicle while waiting for a node to open More... | |
int | twvTot () const |
Protected Member Functions | |
Vehicle ()=delete | |
Vehicle (const Vehicle &)=default | |
Vehicle (Idx idx, Id id, const Vehicle_node &p_starting_site, const Vehicle_node &p_ending_site, PAmount p_capacity, Speed p_speed=1.0) | |
std::pair< size_t, size_t > | drop_position_limits (const Vehicle_node &node) const |
void | erase (const Vehicle_node &node) |
deletes a node if it exists More... | |
void | erase (size_t pos) |
void | erase_node (size_t pos) |
void | evaluate () |
void | evaluate (size_t from) |
size_t | getDropPosLowLimit (const Vehicle_node &node) const |
size_t | getPosHighLimit (const Vehicle_node &node) const |
Get the highest position on the path where node can be placed. More... | |
size_t | getPosLowLimit (const Vehicle_node &node) const |
Get the lowest position on the path where node can be placed. More... | |
void | insert (size_t pos, const Vehicle_node &node) |
void | insert_node (size_t pos, const Vehicle_node &node) |
void | pop_back () |
void | pop_front () |
std::pair< size_t, size_t > | position_limits (const Vehicle_node &node) const |
Get the limits to insert the node. More... | |
void | push_back (const Vehicle_node &node) |
void | push_back_node (const Vehicle_node &node) |
void | push_front (const Vehicle_node &node) |
void | push_front_node (const Vehicle_node &node) |
void | swap (size_t i, size_t j) |
Protected Attributes | |
T | elements |
STL member. More... | |
int | m_user_cv {0} |
Time window violations on solution. More... | |
int | m_user_twv {0} |
Time window violations on solution. More... | |
Private Attributes | |
PAmount | m_capacity |
int64_t | m_id |
size_t | m_idx |
Speed | m_speed = 1.0 |
Friends | |
bool | operator< (const Vehicle &lhs, const Vehicle &rhs) |
Vehicle with time windows.
General functionality for a vehicle in a PROBLEM problem
Recommended use:
A vehicle is a sequence of N from starting site to ending site. has: capacity
|
protecteddelete |
|
protecteddefault |
|
protected |
PAmount vrprouting::problem::Vehicle::capacity | ( | ) | const |
returns the capacity of the vehicle
Definition at line 66 of file vehicle.cpp.
References m_capacity.
Referenced by evaluate().
int vrprouting::problem::Vehicle::cvTot | ( | ) | const |
Definition at line 94 of file vehicle.cpp.
Referenced by vrprouting::problem::Solution::cvTot(), has_cv(), vrprouting::problem::operator<(), vrprouting::problem::Vehicle_pickDeliver::set_initial_solution(), and tau().
|
protected |
Definition at line 426 of file vehicle.cpp.
References getDropPosLowLimit(), and getPosHighLimit().
Referenced by vrprouting::problem::Vehicle_pickDeliver::semiLIFO().
TInterval vrprouting::problem::Vehicle::duration | ( | ) | const |
duration of vehicle while not in a "depot"
Definition at line 72 of file vehicle.cpp.
References is_phony().
Referenced by vrprouting::problem::Solution::duration(), vrprouting::problem::operator<(), and tau().
bool vrprouting::problem::Vehicle::empty | ( | ) | const |
Definition at line 112 of file vehicle.cpp.
Referenced by vrprouting::problem::Vehicle_pickDeliver::get_first_order(), vrprouting::problem::Vehicle_pickDeliver::pop_back(), and vrprouting::problem::Vehicle_pickDeliver::pop_front().
const Vehicle_node & vrprouting::problem::Vehicle::end_site | ( | ) | const |
|
protected |
deletes a node if it exists
[in] | node |
Definition at line 184 of file vehicle.cpp.
References erase(), evaluate(), vrprouting::Identifier::idx(), vrprouting::problem::Tw_node::is_end(), vrprouting::problem::Tw_node::is_start(), and pgassert.
|
protected |
Definition at line 172 of file vehicle.cpp.
References erase_node(), and evaluate().
Referenced by erase().
|
protected |
Definition at line 152 of file vehicle.cpp.
References pgassert.
Referenced by erase(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), pop_back(), and pop_front().
|
protected |
Definition at line 126 of file vehicle.cpp.
Referenced by erase(), insert(), pop_back(), pop_front(), vrprouting::problem::Vehicle_pickDeliver::push_back(), push_back(), vrprouting::problem::Vehicle_pickDeliver::push_front(), push_front(), vrprouting::problem::Vehicle_pickDeliver::set_initial_solution(), swap(), and Vehicle().
|
protected |
[in] | from | The position in the path for evaluation to the end of the path. |
Definition at line 131 of file vehicle.cpp.
References capacity(), invariant(), pgassert, and speed().
std::vector< Solution_rt > vrprouting::problem::Vehicle::get_postgres_result | ( | int | vid | ) | const |
[in] | vid | it is the vid-th vehicle in the solution |
Definition at line 292 of file vehicle.cpp.
std::vector< Id > vrprouting::problem::Vehicle::get_stops | ( | ) | const |
|
protected |
Definition at line 331 of file vehicle.cpp.
References invariant(), and speed().
Referenced by drop_position_limits().
|
protected |
Get the highest position on the path where node can be placed.
Definition at line 397 of file vehicle.cpp.
References invariant(), vrprouting::problem::Tw_node::is_compatible_IJ(), and speed().
Referenced by drop_position_limits(), and position_limits().
|
protected |
Get the lowest position on the path where node can be placed.
[in] | nodeI | start searching from postition low = pos(E) |
S 1 2 3 4 5 6 7 ..... E node -> E node -> ... node -> 7 node -> 6 node -> 5 node /-> 4
return low_limit = 5
Definition at line 366 of file vehicle.cpp.
References invariant().
Referenced by position_limits().
bool vrprouting::problem::Vehicle::has_cv | ( | ) | const |
Definition at line 98 of file vehicle.cpp.
References cvTot(), and m_user_cv.
Referenced by is_feasible(), and vrprouting::problem::Vehicle_pickDeliver::semiLIFO().
bool vrprouting::problem::Vehicle::has_twv | ( | ) | const |
Definition at line 96 of file vehicle.cpp.
References m_user_twv, and twvTot().
Referenced by is_feasible(), and vrprouting::problem::Vehicle_pickDeliver::semiLIFO().
|
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(), is_phony(), vrprouting::operator<<(), vrprouting::problem::operator<<(), vrprouting::problem::Tw_node::operator==(), vrprouting::problem::Vehicle_pickDeliver::set_initial_solution(), vrprouting::problem::Vehicle_pickDeliver::set_unmovable(), tau(), and vrprouting::problem::Tw_node::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(), erase(), vrprouting::problem::Vehicle_pickDeliver::has_order(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::operator<<(), vrprouting::problem::operator<<(), vrprouting::problem::Tw_node::operator==(), vrprouting::problem::Vehicle_pickDeliver::push_back(), vrprouting::problem::Vehicle_pickDeliver::push_front(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), vrprouting::problem::Order::set_compatibles(), and tau().
|
protected |
Definition at line 202 of file vehicle.cpp.
References evaluate(), and insert_node().
Referenced by vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), and vrprouting::problem::Vehicle_pickDeliver::set_initial_solution().
|
protected |
Definition at line 158 of file vehicle.cpp.
References pgassert.
Referenced by insert(), vrprouting::problem::Vehicle_pickDeliver::push_back(), push_back(), push_back_node(), vrprouting::problem::Vehicle_pickDeliver::push_front(), push_front(), and push_front_node().
void vrprouting::problem::Vehicle::invariant | ( | ) | const |
Definition at line 100 of file vehicle.cpp.
References pgassert.
Referenced by evaluate(), getDropPosLowLimit(), getPosHighLimit(), getPosLowLimit(), vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle_pickDeliver::pop_back(), vrprouting::problem::Vehicle_pickDeliver::pop_front(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), and tau().
bool vrprouting::problem::Vehicle::is_feasible | ( | ) | const |
Definition at line 120 of file vehicle.cpp.
References has_cv(), and has_twv().
Referenced by vrprouting::problem::Vehicle_pickDeliver::hillClimb(), vrprouting::problem::Vehicle_pickDeliver::semiLIFO(), and vrprouting::problem::Vehicle_pickDeliver::set_initial_solution().
bool vrprouting::problem::Vehicle::is_ok | ( | ) | const |
Definition at line 106 of file vehicle.cpp.
References vrprouting::problem::Tw_node::closes(), end_site(), m_capacity, vrprouting::problem::Tw_node::opens(), and start_site().
bool vrprouting::problem::Vehicle::is_phony | ( | ) | const |
Definition at line 116 of file vehicle.cpp.
References vrprouting::Identifier::id().
Referenced by duration(), get_stops(), is_real(), vrprouting::optimizers::simple::Optimize::move_order(), vrprouting::problem::Vehicle_pickDeliver::objective(), vrprouting::optimizers::tabu::Optimize::swap_between_routes(), total_service_time(), total_travel_time(), and total_wait_time().
bool vrprouting::problem::Vehicle::is_real | ( | ) | const |
size_t vrprouting::problem::Vehicle::length | ( | ) | const |
Definition at line 114 of file vehicle.cpp.
std::string vrprouting::problem::Vehicle::path_str | ( | ) | const |
Definition at line 272 of file vehicle.cpp.
|
protected |
Definition at line 218 of file vehicle.cpp.
References erase_node(), and evaluate().
|
protected |
Definition at line 223 of file vehicle.cpp.
References erase_node(), and evaluate().
|
protected |
Get the limits to insert the node.
[in] | node | to try to be tested |
Definition at line 419 of file vehicle.cpp.
References getPosHighLimit(), and getPosLowLimit().
Referenced by vrprouting::problem::Vehicle_pickDeliver::hillClimb().
|
protected |
Definition at line 208 of file vehicle.cpp.
References evaluate(), and insert_node().
|
protected |
Definition at line 164 of file vehicle.cpp.
References insert_node().
|
protected |
Definition at line 213 of file vehicle.cpp.
References evaluate(), and insert_node().
|
protected |
Definition at line 168 of file vehicle.cpp.
References insert_node().
|
inherited |
change the original id
Definition at line 47 of file identifier.cpp.
References vrprouting::Identifier::m_id.
Referenced by vrprouting::problem::Tw_node::Tw_node().
Speed vrprouting::problem::Vehicle::speed | ( | ) | const |
the speed of the vehicle
When the matrix is a time matrix: speed should be in t / t^2 When the matrix is a distance matrix: speed should be in d / t^2
where: d = distance units t = time units
The calculated value of the traveling time will become tt(a, b) = matrix(a,b) / speed;
Definition at line 63 of file vehicle.cpp.
References m_speed.
Referenced by evaluate(), getDropPosLowLimit(), and getPosHighLimit().
const Vehicle_node & vrprouting::problem::Vehicle::start_site | ( | ) | const |
|
protected |
Definition at line 228 of file vehicle.cpp.
References evaluate(), and pgassert.
Referenced by vrprouting::problem::Vehicle_pickDeliver::hillClimb().
std::string vrprouting::problem::Vehicle::tau | ( | ) | const |
Definition at line 251 of file vehicle.cpp.
References cvTot(), duration(), vrprouting::Identifier::id(), vrprouting::Identifier::idx(), invariant(), total_travel_time(), total_wait_time(), and twvTot().
Referenced by vrprouting::problem::Vehicle_pickDeliver::set_initial_solution().
TInterval vrprouting::problem::Vehicle::total_service_time | ( | ) | const |
total time spent moving from one node to another
Definition at line 90 of file vehicle.cpp.
References is_phony().
Referenced by vrprouting::problem::Solution::total_service_time().
TInterval vrprouting::problem::Vehicle::total_travel_time | ( | ) | const |
total time spent moving from one node to another
Definition at line 84 of file vehicle.cpp.
References is_phony().
Referenced by vrprouting::problem::Vehicle_pickDeliver::objective(), vrprouting::problem::operator<(), tau(), and vrprouting::problem::Solution::total_travel_time().
TInterval vrprouting::problem::Vehicle::total_wait_time | ( | ) | const |
duration of vehicle while waiting for a node to open
Definition at line 78 of file vehicle.cpp.
References is_phony().
Referenced by vrprouting::problem::operator<(), tau(), and vrprouting::problem::Solution::wait_time().
int vrprouting::problem::Vehicle::twvTot | ( | ) | const |
Definition at line 92 of file vehicle.cpp.
Referenced by has_twv(), vrprouting::problem::operator<(), vrprouting::problem::Vehicle_pickDeliver::set_initial_solution(), tau(), and vrprouting::problem::Solution::twvTot().
Definition at line 433 of file vehicle.cpp.
|
inherited |
STL member.
|
private |
Definition at line 182 of file vehicle.h.
Referenced by capacity(), and is_ok().
|
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 |
|
protected |
Time window violations on solution.
The user can give a solution that has capacity violations
Definition at line 179 of file vehicle.h.
Referenced by has_cv(), and vrprouting::problem::Vehicle_pickDeliver::set_initial_solution().
|
protected |
Time window violations on solution.
The user can give a solution that has time window violations
Definition at line 173 of file vehicle.h.
Referenced by has_twv(), and vrprouting::problem::Vehicle_pickDeliver::set_initial_solution().