PGROUTING  2.4
 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 
28 #include "./../../common/src/pgr_types.h"
29 
30 #include <string>
31 #include <vector>
32 #include <sstream>
33 
34 #include "./vehicle_node.h"
35 #include "./order.h"
36 #include "./solution.h"
37 
38 namespace pgrouting {
39 namespace vrp {
40 
41 
42 class Optimize;
43 class Initial_solution;
44 
46  friend class Vehicle_pickDeliver;
47  friend class Optimize;
48  friend class Initial_solution;
49  friend class Solution;
50  typedef size_t ID;
51 
52  public:
54  const Customer_t *c1, size_t total_customers,
55  int VehicleLength,
56  double capacity,
57  double speed,
58  size_t max_cycles,
59  std::string &error);
60 
61  void solve();
62 
64  std::vector< General_vehicle_orders_t > &result) const;
65  /*****************/
66 
67  const Order order_of(const Vehicle_node &node) const;
68  const Vehicle_node& node(ID id) const;
69  const std::vector<Order>& orders() const {return m_orders;}
70  double speed() const {return m_speed;}
71 
77  std::ostream& get_log(std::ostream &p_log) const {
78  p_log << log.str() << "\n";
79  log.str("");
80  log.clear();
81  return p_log;
82  }
83 
84  Solution solve(const Solution init_solution);
85  size_t max_cycles() const {return m_max_cycles;};
86 
87  private:
88  double max_capacity;
89  double m_speed;
90  size_t m_max_cycles;
93  std::vector<Customer_t> m_original_data;
94  std::vector<Vehicle_node> m_nodes;
95  std::vector<Order> m_orders;
96  std::vector<Solution> solutions;
97  mutable std::ostringstream log;
98 #ifndef NDEBUG
99  mutable std::ostringstream dbg_log;
100 #endif
101 };
102 
103 } // namespace vrp
104 } // 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:732
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