PGROUTING  3.2
optimize.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: optimize.cpp
4 
5 Copyright (c) 2015 pgRouting developers
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 
34 namespace pgrouting {
35 namespace vrp {
36 
37 class Solution;
38 class Pgr_pickDeliver;
39 
40 
41 class Optimize : public Solution {
42  public:
43  explicit Optimize(const Solution &solution);
44  Optimize(const Solution &solution, size_t times);
45 
46  /* @brief decrease_truck
47  *
48  * Optimization by decreasing trucks
49  */
50  void decrease_truck();
51  void inter_swap(size_t times);
53 
54  private:
55  bool decrease_truck(size_t);
56  void sort_by_duration();
57  void sort_by_size();
58  void delete_empty_truck();
59 
62  bool inter_swap();
63 
64  bool move_order(
65  Order order,
66  Vehicle_pickDeliver &from_truck,
67  Vehicle_pickDeliver &to_truck);
68  void save_if_best();
69 
70 #if 0
71  private:
72  Swap_bk p_swaps;
73 #endif
74 };
75 
76 } // namespace vrp
77 } // namespace pgrouting
78 
79 #endif // INCLUDE_VRP_OPTIMIZE_H_
pgrouting::vrp::Optimize::delete_empty_truck
void delete_empty_truck()
Definition: optimize.cpp:288
pgrouting::vrp::Optimize::swap_worse
bool swap_worse(Vehicle_pickDeliver &from, Vehicle_pickDeliver &to)
Definition: optimize.cpp:133
pgrouting::vrp::Solution
Definition: solution.h:44
pgrouting::vrp::Optimize::decrease_truck
void decrease_truck()
Definition: optimize.cpp:446
pgrouting::vrp::Optimize::sort_by_duration
void sort_by_duration()
Definition: optimize.cpp:279
pgrouting::vrp::Optimize::move_order
bool move_order(Order order, Vehicle_pickDeliver &from_truck, Vehicle_pickDeliver &to_truck)
moves an order to an non empty vehicle
Definition: optimize.cpp:393
pgrouting::vrp::Optimize::move_reduce_cost
bool move_reduce_cost(Vehicle_pickDeliver &from, Vehicle_pickDeliver &to)
Definition: optimize.cpp:311
pgrouting::vrp::Vehicle_pickDeliver
Definition: vehicle_pickDeliver.h:47
pgrouting::vrp::Optimize::best_solution
Solution best_solution
Definition: optimize.h:52
pgrouting::vrp::Optimize::sort_by_size
void sort_by_size()
Definition: optimize.cpp:268
optimize.h
pgrouting::vrp::Swap_bk
Definition: book_keeping.h:83
pgrouting::vrp::Order
Definition: order.h:42
pgrouting::vrp::Optimize::save_if_best
void save_if_best()
Definition: optimize.cpp:491
pgrouting::vrp::Optimize
Definition: optimize.h:41
pgrouting::vrp::Solution::Optimize
friend class Optimize
Definition: solution.h:45
pgrouting
Book keeping class for swapping orders between vehicles.
Definition: pgr_alphaShape.cpp:56
pgrouting::vrp::Optimize::inter_swap
bool inter_swap()
Definition: optimize.cpp:94