PGROUTING  2.5
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
6 Mail: project@pgrouting.org
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"
38 
39 namespace pgrouting {
40 namespace vrp {
41 
42 
43 class Initial_solution;
44 class Optimize;
45 
46 class Vehicle_pickDeliver : public Vehicle {
47  protected:
48  double cost;
54 
55 
56  public:
57  friend class Initial_solution;
58  friend class Optimize;
59 
61  size_t id,
62  size_t kind,
63  const Vehicle_node &starting_site,
64  const Vehicle_node &ending_site,
65  double p_capacity,
66  double p_speed,
67  double factor);
68 
69  Vehicle_pickDeliver(const Vehicle_pickDeliver &) = default;
70 
71 
72  void set_compatibles(const PD_Orders &orders);
73  bool is_order_feasable(const Order &order) const;
75 
76  const PD_Orders& orders() const {return m_orders;}
77  size_t orders_size() const {return m_orders_in_vehicle.size();}
79 
80  bool has_order(const Order &order) const;
81 
99  void push_back(const Order &order);
100 
101 
119  void push_front(const Order &order);
120 
121 
142  void insert(const Order &order);
143 
144 #if 0
145  void insert_while_compatibleJ(
146  Identifiers<PD_Orders::OID> &unassigned,
147  Identifiers<PD_Orders::OID> &assigned);
148 #endif
149  /* @brief erases the order from the vehicle
150  *
151  * Precondition:
152  * has_order(order)
153  *
154  * Precondition:
155  * !has_order(order)
156  */
157  void erase(const Order &order);
158 
159  /* @brief
160  */
161  Order get_first_order() const;
162  Order get_worse_order(Identifiers<size_t> of_this_subset) const;
163 
164  void do_while_feasable(
165  int kind,
166  Identifiers<size_t> &unassigned,
167  Identifiers<size_t> &assigned);
168 
169 
176  size_t pop_back();
177  size_t pop_front();
178 };
179 
180 } // namespace vrp
181 } // namespace pgrouting
182 
183 #endif // INCLUDE_VRP_VEHICLE_PICKDELIVER_H_
const PD_Orders & orders() const
bool has_order(const Order &order) const
void push_back(const Order &order)
puts an order at the end of the truck
void push_front(const Order &order)
Puts an order at the end front of the truck.
void do_while_feasable(int kind, Identifiers< size_t > &unassigned, Identifiers< size_t > &assigned)
Identifiers< size_t > m_feasable_orders
orders that fit in the truck
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:48
size_t pop_back()
The order that is picked last is removed.
Vehicle with time windows.
Definition: vehicle.h:72
void set_compatibles(const PD_Orders &orders)
Identifiers< size_t > orders_in_vehicle() const
void insert(const Order &order)
Inserts an order.
Order get_worse_order(Identifiers< size_t > of_this_subset) const
size_t size() const
Definition: identifiers.hpp:77
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
Identifiers< size_t > feasable_orders() const
bool is_order_feasable(const Order &order) const
Vehicle_pickDeliver(size_t id, size_t kind, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double p_capacity, double p_speed, double factor)
Identifiers< size_t > m_orders_in_vehicle
orders inserted in this vehicle