PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
26 
27 #pragma once
28 
29 #include <set>
30 #include <iostream>
31 #include "./vehicle_node.h"
32 
33 namespace pgrouting {
34 namespace vrp {
35 
36 
37 class Pgr_pickDeliver;
38 class Initial_solution;
39 
40 
41 class Order {
42  public:
43  friend class Initial_solution;
44  friend class Pgr_pickDeliver;
45 
46  Order(size_t p_id,
47  const Vehicle_node &p_pickup,
48  const Vehicle_node &p_deliver,
49  const Pgr_pickDeliver *p_problem);
50 
51  Order(const Order &) = default;
52 
53 
54 
55  /*************accesosrs*/
56 
57  inline size_t id() const {return m_id;}
58  const Vehicle_node& delivery() const;
59  const Vehicle_node& pickup() const;
60  void setCompatibles();
61 
68  bool is_valid() const;
69 
70 
71  bool isCompatibleIJ(const Order &other) const;
72 #if 0
73  bool isOrderCompatibleStart(const Vehicle_node &node) const;
74  bool isOrderCompatibleEnd(const Vehicle_node &node) const;
75 #endif
76  std::set<size_t> subsetJ(const std::set<size_t> &J) const;
77  std::set<size_t> subsetI(const std::set<size_t> &I) const;
78 
79  friend std::ostream& operator << (std::ostream&, const Order &);
80 
81  // void moveOrder(const int toRoute);
82  private:
83  size_t m_id;
84 
85  size_t pickup_id;
86  size_t delivery_id;
87 
88  /*
89  * I = this
90  * I -> {J}
91  */
92  std::set<size_t> m_compatibleJ;
93 
94  /*
95  * J = this
96  * {I} -> J
97  */
98  std::set<size_t> m_compatibleI;
99 
100 
101  /* order belongs to this problem */
103 };
104 
105 } // namespace vrp
106 } // namespace pgrouting
bool is_valid() const
An order is valid when:
Definition: order.cpp:110
size_t pickup_id
Definition: order.h:85
size_t id() const
Definition: order.h:57
bool isCompatibleIJ(const Order &other) const
Definition: order.cpp:154
const Vehicle_node & pickup() const
Definition: order.cpp:106
friend std::ostream & operator<<(std::ostream &, const Order &)
Definition: order.cpp:69
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:46
std::set< size_t > subsetI(const std::set< size_t > &I) const
Definition: order.cpp:38
PGDLLEXPORT Datum vrp(PG_FUNCTION_ARGS)
Definition: VRP.c:732
Order(size_t p_id, const Vehicle_node &p_pickup, const Vehicle_node &p_deliver, const Pgr_pickDeliver *p_problem)
Definition: order.cpp:56
size_t delivery_id
Definition: order.h:86
std::set< size_t > m_compatibleI
Definition: order.h:98
const Pgr_pickDeliver * problem
Definition: order.h:102
const Vehicle_node & delivery() const
Definition: order.cpp:102
std::set< size_t > m_compatibleJ
Definition: order.h:92
std::set< size_t > subsetJ(const std::set< size_t > &J) const
Definition: order.cpp:47