PGROUTING  2.5
pgr_pickDeliver.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: pgr_pickDeliver.h
4 
5 Copyright (c) 2017 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_PGR_PICKDELIVER_H_
29 #define INCLUDE_VRP_PGR_PICKDELIVER_H_
30 #pragma once
31 
32 
33 
34 #include <vector>
35 #include <memory>
36 #include <utility>
37 
42 #include "cpp_common/Dmatrix.h"
43 #include "vrp/fleet.h"
44 #include "vrp/pd_orders.h"
45 #include "vrp/solution.h"
46 
47 namespace pgrouting {
48 namespace vrp {
49 
50 class Order;
51 class Vehicle_node;
52 class Base_node;
53 
54 class Pgr_pickDeliver : public PD_problem {
55  public:
57  const std::vector<PickDeliveryOrders_t> &pd_orders,
58  const std::vector<Vehicle_t> &vehicles,
59  double factor,
60  size_t max_cycles,
61  int initial);
62 
64  const std::vector<PickDeliveryOrders_t> &pd_orders,
65  const std::vector<Vehicle_t> &vehicles,
66  const pgrouting::tsp::Dmatrix &cost_matrix,
67  double factor,
68  size_t max_cycles,
69  int initial);
70 
71  void solve();
72 
73  std::vector<General_vehicle_orders_t>
74  get_postgres_result() const;
75 
76 
77  Solution optimize(const Solution init_solution);
78  size_t max_cycles() const {return m_max_cycles;}
79 
80  inline size_t& node_id() {return m_node_id;}
81 
82  void add_node(const Vehicle_node &node) {
83  m_nodes.push_back(node);
84  }
85 
86  void add_base_node(std::unique_ptr<Base_node> node_ptr) {
87  m_base_nodes.push_back(std::move(node_ptr));
88  }
89 
90 #if 1
91  // TODO(vicky) delete this function
92  bool nodesOK() const;
93 #endif
94  Fleet trucks() const {return m_trucks;}
95 
96  private:
99 
101  size_t m_max_cycles;
102 
104  size_t m_node_id;
105 
106  std::vector<Vehicle_node> m_nodes;
107 
108  public:
109  // TODO(vicky) make this private
110  std::vector<std::unique_ptr<Base_node>> m_base_nodes;
112 
113  private:
116  std::vector<Solution> solutions;
117 };
118 
119 } // namespace vrp
120 } // namespace pgrouting
121 
122 #endif // INCLUDE_VRP_PGR_PICKDELIVER_H_
void add_base_node(std::unique_ptr< Base_node > node_ptr)
void add_node(const Vehicle_node &node)
std::vector< std::unique_ptr< Base_node > > m_base_nodes
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:48
size_t m_node_id
used to keep track of the next id the node gets in the eucledian version
Solution optimize(const Solution init_solution)
std::vector< Solution > solutions
std::vector< Vehicle_node > m_nodes
pgrouting::tsp::Dmatrix m_cost_matrix
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
Pgr_pickDeliver(const std::vector< PickDeliveryOrders_t > &pd_orders, const std::vector< Vehicle_t > &vehicles, double factor, size_t max_cycles, int initial)
size_t m_max_cycles
maximum cycles in the optimization
int m_initial_id
used define the initial solution algorithm to be used
std::vector< General_vehicle_orders_t > get_postgres_result() const