PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vehicle_pickDeliver.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: vehicle_pickDeliver.h
4 
5 Copyright (c) 2015 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 #pragma once
26 
27 #include <set>
28 #include "./order.h"
29 #include "./tw_node.h"
30 #include "./vehicle.h"
31 
32 namespace pgrouting {
33 namespace vrp {
34 
35 
36 class Initial_solution;
37 class Optimize;
38 
39 class Vehicle_pickDeliver : public Vehicle {
40  protected:
41  double cost;
42  std::set<ID> orders_in_vehicle; // /< orders inserted in this vehicle
43  const Pgr_pickDeliver *problem; // /< The vehicle belongs to this problem
44 
45 
46  public:
47  friend class Initial_solution;
48  friend class Optimize;
49 
51  ID id,
52  const Vehicle_node &starting_site,
53  const Vehicle_node &ending_site,
54  double max_capacity,
55  const Pgr_pickDeliver *p_problem);
56 
57  Vehicle_pickDeliver(const Vehicle_pickDeliver &) = default;
58 
59  size_t orders_size() const {return orders_in_vehicle.size();}
60 
61  bool has_order(const Order &order) const;
62 
80  void push_back(const Order &order);
81 
82 
83 
101  void push_front(const Order &order);
102 
103 
104 
125  void insert(const Order &order);
126 
127  /* @brief erases the order from the vehicle
128  *
129  * Precondition:
130  * has_order(order)
131  *
132  * Precondition:
133  * !has_order(order)
134  */
135  void erase(const Order &order);
136 
137  /* @brief
138  */
139  Order get_first_order() const;
140  Order get_worse_order(std::set<size_t> of_this_subset) const;
141 
142 
149  ID pop_back();
150  ID pop_front();
151 };
152 
153 } // namespace vrp
154 } // namespace pgrouting
155 
bool has_order(const Order &order) const
Order get_worse_order(std::set< size_t > of_this_subset) 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.
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:46
ID pop_back()
The order that is picked last is removed.
Vehicle with time windows.
Definition: vehicle.h:62
PGDLLEXPORT Datum vrp(PG_FUNCTION_ARGS)
Definition: VRP.c:732
void insert(const Order &order)
Inserts an order.
Vehicle_pickDeliver(ID id, const Vehicle_node &starting_site, const Vehicle_node &ending_site, double max_capacity, const Pgr_pickDeliver *p_problem)