PGROUTING  3.2
vehicle_pickDeliver.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: vehicle_pickDeliver.h
4 
5 Copyright (c) 2016 pgRouting developers
7 
8 ------
9 
10 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or
13 (at your option) any later version.
14 
15 This program is distributed in the hope that it will be useful,
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 GNU General Public License for more details.
19 
20 You should have received a copy of the GNU General Public License
21 along with this program; if not, write to the Free Software
22 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 
24  ********************************************************************PGR-GNU*/
25 
28 #ifndef INCLUDE_VRP_VEHICLE_PICKDELIVER_H_
29 #define INCLUDE_VRP_VEHICLE_PICKDELIVER_H_
30 #pragma once
31 
32 #include <set>
33 #include "vrp/order.h"
34 #include "vrp/pd_orders.h"
35 #include "vrp/tw_node.h"
36 #include "vrp/vehicle.h"
37 #include "vrp/initials_code.h"
39 
40 namespace pgrouting {
41 namespace vrp {
42 
43 
44 class Initial_solution;
45 class Optimize;
46 
47 class Vehicle_pickDeliver : public Vehicle {
48  protected:
49  double cost;
55 
56 
57  public:
58  friend class Initial_solution;
59  friend class Optimize;
60 
62  size_t idx,
63  int64_t id,
64  const Vehicle_node &starting_site,
65  const Vehicle_node &ending_site,
66  double p_capacity,
67  double p_speed,
68  double factor);
69 
70  Vehicle_pickDeliver(const Vehicle_pickDeliver &) = default;
71 
72 
73  void set_compatibles(const PD_Orders &orders);
74  bool is_order_feasable(const Order &order) const;
76 
77  const PD_Orders& orders() const {return m_orders;}
78  size_t orders_size() const {return m_orders_in_vehicle.size();}
80 
81  bool has_order(const Order &order) const;
82 
100  void push_back(const Order &order);
101 
102 
120  void push_front(const Order &order);
121 
122 
143  bool insert(const Order &order);
144 
165  bool semiLIFO(const Order &order);
166 
167  /* @brief erases the order from the vehicle
168  *
169  * Precondition:
170  * has_order(order)
171  *
172  * Precondition:
173  * !has_order(order)
174  */
175  void erase(const Order &order);
176 
177 
178  void do_while_feasable(
179  Initials_code kind,
180  Identifiers<size_t> &unassigned,
181  Identifiers<size_t> &assigned);
182 
183 
190 };
191 
192 } // namespace vrp
193 } // namespace pgrouting
194 
195 #endif // INCLUDE_VRP_VEHICLE_PICKDELIVER_H_
pgrouting::vrp::Vehicle_pickDeliver::m_orders_in_vehicle
Identifiers< size_t > m_orders_in_vehicle
orders inserted in this vehicle
Definition: vehicle_pickDeliver.h:51
pgrouting::vrp::Vehicle_pickDeliver::erase
void erase(const Order &order)
Definition: vehicle_pickDeliver.cpp:305
pgrouting::vrp::Vehicle_pickDeliver::orders
const PD_Orders & orders() const
Definition: vehicle_pickDeliver.h:77
pgrouting::vrp::Vehicle_pickDeliver::push_back
void push_back(const Order &order)
puts an order at the end of the truck
Definition: vehicle_pickDeliver.cpp:197
pgrouting::vrp::Vehicle_pickDeliver::cost
double cost
Definition: vehicle_pickDeliver.h:49
pgrouting::vrp::Vehicle_pickDeliver::semiLIFO
bool semiLIFO(const Order &order)
Inserts an order In semi-Lifo order.
Definition: vehicle_pickDeliver.cpp:338
pgrouting::vrp::Vehicle_node
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:48
pgrouting::vrp::Vehicle_pickDeliver::m_orders
PD_Orders m_orders
Definition: vehicle_pickDeliver.h:52
pgrouting::vrp::Vehicle_pickDeliver::push_front
void push_front(const Order &order)
Puts an order at the end front of the truck.
Definition: vehicle_pickDeliver.cpp:212
initials_code.h
pd_orders.h
pgrouting::vrp::Vehicle_pickDeliver
Definition: vehicle_pickDeliver.h:47
tw_node.h
pgrouting::Identifier::idx
size_t idx() const
Definition: identifier.cpp:37
pgrouting::vrp::Vehicle_pickDeliver::m_feasable_orders
Identifiers< size_t > m_feasable_orders
orders that fit in the truck
Definition: vehicle_pickDeliver.h:54
Identifiers::size
size_t size() const
Definition: identifiers.hpp:78
pgrouting::vrp::Vehicle_pickDeliver::set_compatibles
void set_compatibles(const PD_Orders &orders)
Definition: vehicle_pickDeliver.cpp:322
pgrouting::vrp::Vehicle
Vehicle with time windows.
Definition: vehicle.h:73
pgrouting::vrp::Initial_solution
Definition: initial_solution.h:46
pgrouting::vrp::Vehicle_pickDeliver::is_order_feasable
bool is_order_feasable(const Order &order) const
Definition: vehicle_pickDeliver.cpp:331
pgrouting::vrp::Vehicle_pickDeliver::orders_size
size_t orders_size() const
Definition: vehicle_pickDeliver.h:78
pgrouting::vrp::Order
Definition: order.h:42
pgrouting::vrp::Vehicle_pickDeliver::feasable_orders
Identifiers< size_t > feasable_orders() const
Definition: vehicle_pickDeliver.h:75
vehicle.h
pgrouting::vrp::Vehicle_pickDeliver::insert
bool insert(const Order &order)
Inserts an order.
Definition: vehicle_pickDeliver.cpp:79
pgrouting::vrp::Vehicle_pickDeliver::orders_in_vehicle
Identifiers< size_t > orders_in_vehicle() const
Definition: vehicle_pickDeliver.h:79
pgrouting::vrp::PD_Orders
Definition: pd_orders.h:48
order.h
pgrouting::vrp::Vehicle_pickDeliver::has_order
bool has_order(const Order &order) const
Definition: vehicle_pickDeliver.cpp:73
pgrouting::vrp::Optimize
Definition: optimize.h:41
pgrouting::vrp::Vehicle_pickDeliver::Vehicle_pickDeliver
Vehicle_pickDeliver(size_t idx, int64_t id, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double p_capacity, double p_speed, double factor)
Definition: vehicle_pickDeliver.cpp:48
pgrouting::vrp::Initials_code
Initials_code
Different kinds to insert an order into the vehicle.
Definition: initials_code.h:36
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
identifiers.hpp
Identifiers< size_t >
pgrouting::vrp::Vehicle_pickDeliver::do_while_feasable
void do_while_feasable(Initials_code kind, Identifiers< size_t > &unassigned, Identifiers< size_t > &assigned)
Definition: vehicle_pickDeliver.cpp:227