PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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 
26 #pragma once
27 
28 #include "./optimize.h"
29 
30 namespace pgrouting {
31 namespace vrp {
32 
33 class Solution;
34 class Pgr_pickDeliver;
35 
36 
37 class Optimize : public Solution {
38  public:
39  Optimize(int kind,
40  const Solution &solution);
41 
42  /* @brief decrease_truck
43  *
44  * Optimization by decreasing trucks
45  */
46  void decrease_truck();
47  bool move_reduce_cost();
48  void move_wait_time_based();
49  void move_duration_based();
50  void inter_swap();
52  private:
53  void decrease_truck(size_t, bool&);
54  bool move_reduce_cost(size_t, size_t);
55  void sort_for_move();
56  void sort_by_duration();
57  void delete_empty_truck();
58 
59  bool swap_worse(size_t from_pos, size_t to_pos);
60  bool inter_swap(bool reversed);
61 
62  void move_order(
63  Order order,
64  Vehicle_pickDeliver &from_truck,
65  Vehicle_pickDeliver &to_truck);
66  void swap_order(
67  Order from_order,
68  Vehicle_pickDeliver &from_truck,
69  Order to_order,
70  Vehicle_pickDeliver &to_truck);
71  void save_if_best();
72 
73 };
74 
75 } // namespace vrp
76 } // namespace pgrouting
void move_order(Order order, Vehicle_pickDeliver &from_truck, Vehicle_pickDeliver &to_truck)
Definition: optimize.cpp:368
bool swap_worse(size_t from_pos, size_t to_pos)
Definition: optimize.cpp:107
PGDLLEXPORT Datum vrp(PG_FUNCTION_ARGS)
Definition: VRP.c:732
void swap_order(Order from_order, Vehicle_pickDeliver &from_truck, Order to_order, Vehicle_pickDeliver &to_truck)
Definition: optimize.cpp:186
Optimize(int kind, const Solution &solution)
Definition: optimize.cpp:41