pgRouting
pgRouting extends the PostGIS / PostgreSQL geospatial database to provide geospatial routing functionality.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgr_pickDeliver.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: pgr_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 #ifdef __MINGW32__
28 #include <winsock2.h>
29 #include <windows.h>
30 #endif
31 
32 #include "./../../common/src/pgr_types.h"
33 
34 #include <string>
35 #include <vector>
36 #include <sstream>
37 
38 #include "./vehicle_node.h"
39 #include "./order.h"
40 #include "./solution.h"
41 
42 namespace pgrouting {
43 namespace vrp {
44 
45 
46 class Optimize;
47 class Initial_solution;
48 
50  friend class Vehicle_pickDeliver;
51  friend class Optimize;
52  friend class Initial_solution;
53  friend class Solution;
54  typedef size_t ID;
55 
56  public:
58  const Customer_t *c1, size_t total_customers,
59  int VehicleLength,
60  double capacity,
61  double speed,
62  size_t max_cycles,
63  std::string &error);
64 
65  void solve();
66 
68  std::vector< General_vehicle_orders_t > &result) const;
69  /*****************/
70 
71  const Order order_of(const Vehicle_node &node) const;
72  const Vehicle_node& node(ID id) const;
73  const std::vector<Order>& orders() const {return m_orders;}
74  double speed() const {return m_speed;}
75 
81  std::ostream& get_log(std::ostream &p_log) const {
82  p_log << log.str() << "\n";
83  log.str("");
84  log.clear();
85  return p_log;
86  }
87 
88  Solution solve(const Solution init_solution);
89  size_t max_cycles() const {return m_max_cycles;};
90 
91  private:
92  double max_capacity;
93  double m_speed;
94  size_t m_max_cycles;
97  std::vector<Customer_t> m_original_data;
98  std::vector<Vehicle_node> m_nodes;
99  std::vector<Order> m_orders;
100  std::vector<Solution> solutions;
101  mutable std::ostringstream log;
102 #ifndef NDEBUG
103  mutable std::ostringstream dbg_log;
104 #endif
105 };
106 
107 } // namespace vrp
108 } // namespace pgrouting
Pgr_pickDeliver(const Customer_t *c1, size_t total_customers, int VehicleLength, double capacity, double speed, size_t max_cycles, std::string &error)
std::vector< Customer_t > m_original_data
Extend Tw_node to evaluate the vehicle at node level.
Definition: vehicle_node.h:46
std::vector< Solution > solutions
PGDLLEXPORT Datum vrp(PG_FUNCTION_ARGS)
Definition: VRP.c:730
void get_postgres_result(std::vector< General_vehicle_orders_t > &result) const
std::vector< Order > m_orders
std::vector< Vehicle_node > m_nodes
std::ostream & get_log(std::ostream &p_log) const
get_log
const Order order_of(const Vehicle_node &node) const
const Vehicle_node & node(ID id) const
const std::vector< Order > & orders() const