PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgrouting::vrp::Vehicle_pickDeliver Class Reference

#include "vehicle_pickDeliver.h"

Inheritance diagram for pgrouting::vrp::Vehicle_pickDeliver:
pgrouting::vrp::Vehicle

Public Types

typedef std::tuple< int, int,
size_t, double, double > 
Cost
 

Public Member Functions

 Vehicle_pickDeliver (ID id, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double max_capacity, const Pgr_pickDeliver *p_problem)
 
 Vehicle_pickDeliver (const Vehicle_pickDeliver &)=default
 
double deltaTime (const Vehicle_node &node, POS pos) const
 
void erase (const Order &order)
 
Order get_first_order () const
 
void get_postgres_result (int vid, std::vector< General_vehicle_orders_t > &result) const
 
Order get_worse_order (std::set< size_t > of_this_subset) const
 
bool has_order (const Order &order) const
 
void insert (const Order &order)
 Inserts an order. More...
 
POS insert_less_travel_time (const Vehicle_node &node, POS after_pos=0)
 
size_t orders_size () const
 
ID pop_back ()
 The order that is picked last is removed. More...
 
ID pop_front ()
 
std::pair< POS, POSposition_limits (const Vehicle_node node) const
 
void push_back (const Order &order)
 puts an order at the end of the truck More...
 
void push_front (const Order &order)
 Puts an order at the end front of the truck. More...
 
void swap (POS i, POS j)
 Swap two nodes in the path. More...
 
deque like functions
Returns
True if the operation was performed
Warning
Assertions are performed for out of range operations
no feasability nor time window or capacity violations checks are performed
Todo:
TODO more deque like functions here
void invariant () const
 Invariant The path must: More...
 
void insert (POS pos, Vehicle_node node)
 @ { More...
 
POS insert (std::pair< POS, POS > position_limits, const Vehicle_node &node)
 Insert node in best position of the position_limits. More...
 
void push_back (const Vehicle_node &node)
 Evaluated: push_back a node to the path. More...
 
void push_front (const Vehicle_node &node)
 Evaluated: push_back a node to the path. More...
 
void erase (const Vehicle_node &node)
 Erase node.id() More...
 
void erase (POS pos)
 Erase node at pos from the path. More...
 
bool empty () const
 return true when no nodes are in the truck More...
 
ID id () const
 
Cost cost () const
 @ { More...
 
bool cost_compare (const Cost &, const Cost &) const
 
double duration () const
 
double total_wait_time () const
 
double total_travel_time () const
 
double total_service_time () const
 
double free_time () const
 
int twvTot () const
 
int cvTot () const
 
bool has_twv () const
 
bool has_cv () const
 
bool is_feasable () const
 
Evaluation

Path evaluation is done incrementally: from a given position to the end of the path, and intermediate values are cached on each node.

So, for example, changing the path at position 100: the evaluation function should be called as evaluate(100, maxcapacity) and from that position to the end of the path will be evaluated. None of the "unaffected" positions get reevaluated

void evaluate ()
 @ { More...
 
void evaluate (POS from)
 Evaluate: Evaluate a path from the given position. More...
 
accessors
std::deque< Vehicle_nodepath () const
 @ { More...
 
operators
std::string tau () const
 

Protected Types

typedef size_t ID
 
typedef size_t POS
 

Protected Attributes

double cost
 
ID m_id
 
std::deque< Vehicle_nodem_path
 
double max_capacity
 
std::set< IDorders_in_vehicle
 
const Pgr_pickDeliverproblem
 

Friends

class Initial_solution
 
class Optimize
 

Detailed Description

Definition at line 39 of file vehicle_pickDeliver.h.

Member Typedef Documentation

typedef std::tuple< int, int, size_t, double, double > pgrouting::vrp::Vehicle::Cost
inherited

Definition at line 74 of file vehicle.h.

typedef size_t pgrouting::vrp::Vehicle::ID
protectedinherited

Definition at line 64 of file vehicle.h.

typedef size_t pgrouting::vrp::Vehicle::POS
protectedinherited

Definition at line 65 of file vehicle.h.

Constructor & Destructor Documentation

pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver ( ID  id,
const Vehicle_node starting_site,
const Vehicle_node ending_site,
double  max_capacity,
const Pgr_pickDeliver p_problem 
)
pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver ( const Vehicle_pickDeliver )
default

Member Function Documentation

bool pgrouting::vrp::Vehicle::cost_compare ( const Cost lhs,
const Cost rhs 
) const
inherited

Definition at line 88 of file vehicle.cpp.

Referenced by pgrouting::vrp::Vehicle::insert().

int pgrouting::vrp::Vehicle::cvTot ( ) const
inlineinherited
double pgrouting::vrp::Vehicle::duration ( ) const
inlineinherited
bool pgrouting::vrp::Vehicle::empty ( void  ) const
inherited
void pgrouting::vrp::Vehicle::erase ( const Vehicle_node node)
inherited

Erase node.id()

Note
start and ending nodes cannot be erased

Numbers are positions before: S .... node.id() .... E after: S .... .... E

Definition at line 228 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Node::id(), pgrouting::vrp::Vehicle::invariant(), and pgrouting::vrp::Vehicle::m_path.

Referenced by erase(), insert(), pgrouting::vrp::Vehicle::pop_back(), and pgrouting::vrp::Vehicle::pop_front().

void pgrouting::vrp::Vehicle::erase ( POS  pos)
inherited

Erase node at pos from the path.

Note
start and ending nodes cannot be erased

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

Parameters
[in]posto be erased.

Definition at line 303 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, and pgassert.

void pgrouting::vrp::Vehicle::evaluate ( )
inherited
void pgrouting::vrp::Vehicle::evaluate ( POS  from)
inherited

Evaluate: Evaluate a path from the given position.

Parameters
[in]fromThe starting position in the path for evaluation to the end of the path.

Definition at line 349 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, pgrouting::vrp::Vehicle::max_capacity, and pgassert.

double pgrouting::vrp::Vehicle::free_time ( ) const
inlineinherited
void pgrouting::vrp::Vehicle::get_postgres_result ( int  vid,
std::vector< General_vehicle_orders_t > &  result 
) const
inherited

Definition at line 135 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::m_path.

Order pgrouting::vrp::Vehicle_pickDeliver::get_worse_order ( std::set< size_t >  of_this_subset) const
bool pgrouting::vrp::Vehicle::has_cv ( ) const
inlineinherited
bool pgrouting::vrp::Vehicle_pickDeliver::has_order ( const Order order) const
bool pgrouting::vrp::Vehicle::has_twv ( ) const
inlineinherited

Definition at line 234 of file vehicle.h.

References pgrouting::vrp::Vehicle::twvTot().

Referenced by pgrouting::vrp::Vehicle::is_feasable().

ID pgrouting::vrp::Vehicle::id ( ) const
inlineinherited

Definition at line 206 of file vehicle.h.

References pgrouting::vrp::Vehicle::m_id.

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

void pgrouting::vrp::Vehicle::insert ( POS  pos,
Vehicle_node  node 
)
inherited

@ {

Insert node at pos position.

Parameters
[in]posThe position that the node should be inserted.
[in]nodeThe node to insert.

Definition at line 164 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Node::id(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, and pgassert.

Referenced by pgrouting::vrp::Vehicle::insert(), insert(), pgrouting::vrp::Vehicle::insert_less_travel_time(), pgrouting::vrp::Vehicle::push_back(), and pgrouting::vrp::Vehicle::push_front().

size_t pgrouting::vrp::Vehicle::insert ( std::pair< POS, POS position_limits,
const Vehicle_node node 
)
inherited

Insert node in best position of the position_limits.

Parameters
[in]position_limits
[in]nodeThe node to insert
Returns
position where it was inserted

Definition at line 54 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::cost(), pgrouting::vrp::Vehicle::cost_compare(), pgrouting::vrp::Node::id(), pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, pgassert, and pgrouting::vrp::Vehicle::swap().

size_t pgrouting::vrp::Vehicle::insert_less_travel_time ( const Vehicle_node node,
POS  after_pos = 0 
)
inherited
std::deque< Vehicle_node > pgrouting::vrp::Vehicle::path ( ) const
inherited
std::pair< size_t, size_t > pgrouting::vrp::Vehicle::position_limits ( const Vehicle_node  node) const
inherited
void pgrouting::vrp::Vehicle_pickDeliver::push_back ( const Order order)

puts an order at the end of the truck

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S <nodes> E
After: S <nodes> P D E

Can generate time window violation No capacity violation

Definition at line 218 of file vehicle_pickDeliver.cpp.

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Vehicle::has_cv(), has_order(), pgrouting::vrp::Order::id(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, orders_in_vehicle, pgassert, and pgrouting::vrp::Order::pickup().

Referenced by insert(), pgrouting::vrp::m_original_data(), and pgrouting::vrp::Initial_solution::push_back_while_feasable().

void pgrouting::vrp::Vehicle::push_back ( const Vehicle_node node)
inherited

Evaluated: push_back a node to the path.

before: S <nodes> E
after: S <nodes> n E
Parameters
[in]nodeto be push_back.

Definition at line 269 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::insert(), pgrouting::vrp::Vehicle::invariant(), and pgrouting::vrp::Vehicle::m_path.

void pgrouting::vrp::Vehicle_pickDeliver::push_front ( const Order order)

Puts an order at the end front of the truck.

Precondition: !has_order(order)

Postcondition: has_order(order) !has_cv();

Before: S <nodes> E
After: S P D <nodes> E

Can generate time window violation No capacity violation

Definition at line 235 of file vehicle_pickDeliver.cpp.

References pgrouting::vrp::Order::delivery(), pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Vehicle::has_cv(), has_order(), pgrouting::vrp::Order::id(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, orders_in_vehicle, pgassert, and pgrouting::vrp::Order::pickup().

Referenced by pgrouting::vrp::Initial_solution::push_front_while_feasable().

void pgrouting::vrp::Vehicle::push_front ( const Vehicle_node node)
inherited

Evaluated: push_back a node to the path.

before: S <nodes> E
after: S n <nodes> E
Parameters
[in]nodeto be push_back.

Definition at line 252 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::insert(), and pgrouting::vrp::Vehicle::invariant().

void pgrouting::vrp::Vehicle::swap ( POS  i,
POS  j 
)
inherited

Swap two nodes in the path.

Before: S <nodesA> I <nodesB> J <nodesC> E
After: S <nodesA> J <nodesB> I <nodesC> E
Parameters
[in]iThe position of the first node to swap.
[in]jThe position of the second node to swap.

Definition at line 318 of file vehicle.cpp.

References pgrouting::vrp::Vehicle::evaluate(), pgrouting::vrp::Vehicle::invariant(), pgrouting::vrp::Vehicle::m_path, and pgassert.

Referenced by pgrouting::vrp::Vehicle::insert().

double pgrouting::vrp::Vehicle::total_service_time ( ) const
inlineinherited

Definition at line 222 of file vehicle.h.

References pgrouting::vrp::Vehicle::m_path.

double pgrouting::vrp::Vehicle::total_travel_time ( ) const
inlineinherited

Definition at line 219 of file vehicle.h.

References pgrouting::vrp::Vehicle::m_path.

double pgrouting::vrp::Vehicle::total_wait_time ( ) const
inlineinherited
int pgrouting::vrp::Vehicle::twvTot ( ) const
inlineinherited

Friends And Related Function Documentation

friend class Initial_solution
friend

Definition at line 47 of file vehicle_pickDeliver.h.

friend class Optimize
friend

Definition at line 48 of file vehicle_pickDeliver.h.

Member Data Documentation

double pgrouting::vrp::Vehicle_pickDeliver::cost
protected

Definition at line 41 of file vehicle_pickDeliver.h.

ID pgrouting::vrp::Vehicle::m_id
protectedinherited

Definition at line 66 of file vehicle.h.

Referenced by pgrouting::vrp::Vehicle::id().

double pgrouting::vrp::Vehicle::max_capacity
protectedinherited

Definition at line 68 of file vehicle.h.

Referenced by pgrouting::vrp::Vehicle::evaluate().

const Pgr_pickDeliver* pgrouting::vrp::Vehicle_pickDeliver::problem
protected

Definition at line 43 of file vehicle_pickDeliver.h.

Referenced by get_first_order(), get_worse_order(), pop_back(), and pop_front().


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