PGROUTING  2.6
order.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: order.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 
28 #ifndef INCLUDE_VRP_ORDER_H_
29 #define INCLUDE_VRP_ORDER_H_
30 #pragma once
31 
32 
33 #include <iosfwd>
34 #include "cpp_common/identifier.h"
36 #include "vrp/vehicle_node.h"
37 
38 namespace pgrouting {
39 namespace vrp {
40 
41 
42 class Order : public Identifier {
43  public:
47  Order(size_t p_id, int64_t p_idx,
48  const Vehicle_node &p_pickup,
49  const Vehicle_node &p_deliver);
50 
51  Order(const Order &) = default;
64  const Vehicle_node& delivery() const;
65 
70  const Vehicle_node& pickup() const;
71 
94  void set_compatibles(const Order order, double speed);
108  bool is_valid(double speed) const;
109 
110 
127  bool isCompatibleIJ(const Order &I, double speed) const;
136  friend std::ostream& operator << (std::ostream&, const Order &);
139  private:
146 
152 
169 
183 };
184 
185 } // namespace vrp
186 } // namespace pgrouting
187 
188 #endif // INCLUDE_VRP_ORDER_H_
bool is_valid(double speed) const
validate a pickup/delivery order
Definition: order.cpp:94
const Vehicle_node & pickup() const
The delivery node identifier.
Definition: order.cpp:88
friend std::ostream & operator<<(std::ostream &, const Order &)
Definition: order.cpp:55
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:48
Vehicle_node m_delivery
The delivery node identifier.
Definition: order.h:151
Vehicle_node m_pickup
The pick up node identifier.
Definition: order.h:145
bool isCompatibleIJ(const Order &I, double speed) const
Can order I be placed before this order?
Definition: order.cpp:135
void set_compatibles(const Order order, double speed)
Definition: order.cpp:111
Identifiers< size_t > subsetJ(const Identifiers< size_t > &J) const
Get a subset of the orders that can be placed after this order.
Definition: order.cpp:40
Identifiers< size_t > subsetI(const Identifiers< size_t > &I) const
Definition: order.cpp:35
Order(size_t p_id, int64_t p_idx, const Vehicle_node &p_pickup, const Vehicle_node &p_deliver)
Definition: order.cpp:45
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
Identifiers< size_t > m_compatibleI
Stores all the orders that can be placed before this order.
Definition: order.h:182
Identifiers< size_t > m_compatibleJ
Stores all the orders that can be placed after this order.
Definition: order.h:168
const Vehicle_node & delivery() const
The delivery node identifier.
Definition: order.cpp:82