PGROUTING  2.6
optimize.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: optimize.cpp
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_OPTIMIZE_H_
29 #define INCLUDE_VRP_OPTIMIZE_H_
30 #pragma once
31 
32 #include "vrp/optimize.h"
33 #include "vrp/book_keeping.h"
34 
35 namespace pgrouting {
36 namespace vrp {
37 
38 class Solution;
39 class Pgr_pickDeliver;
40 
41 
42 class Optimize : public Solution {
43  public:
44  explicit Optimize(const Solution &solution);
45  Optimize(const Solution &solution, size_t times);
46 
47  /* @brief decrease_truck
48  *
49  * Optimization by decreasing trucks
50  */
51  void decrease_truck();
52  void move_wait_time_based();
53  void move_duration_based();
54  void inter_swap(size_t times);
56 
57  private:
58  bool decrease_truck(size_t);
59  void sort_for_move();
60  void sort_by_duration();
61  void sort_by_size();
62  void sort_by_id();
63  void delete_empty_truck();
64 
67  bool inter_swap();
68 
69  void move_order(
70  Order order,
71  Vehicle_pickDeliver &from_truck,
72  Vehicle_pickDeliver &to_truck);
73  bool swap_order();
74  bool swap_order(
75  Order from_order,
76  Vehicle_pickDeliver &from_truck,
77  Order to_order,
78  Vehicle_pickDeliver &to_truck);
79  void save_if_best();
80 
81  private:
83 };
84 
85 } // namespace vrp
86 } // namespace pgrouting
87 
88 #endif // INCLUDE_VRP_OPTIMIZE_H_
bool swap_worse(Vehicle_pickDeliver &from, Vehicle_pickDeliver &to)
Definition: optimize.cpp:137
void move_order(Order order, Vehicle_pickDeliver &from_truck, Vehicle_pickDeliver &to_truck)
Definition: optimize.cpp:544
Optimize(const Solution &solution)
Definition: optimize.cpp:42
Book keeping class for swapping orders between vehicles.
Definition: basic_edge.cpp:28
bool move_reduce_cost(Vehicle_pickDeliver &from, Vehicle_pickDeliver &to)
Definition: optimize.cpp:461