vrpRouting  0.3
move.h
Go to the documentation of this file.
1 /*PGR-GNU*****************************************************************
2 
3 FILE: matrix.h
4 
5 Copyright (c) 2021 pgRouting developers
7 
8 Created by Joseph Percival on 2020/06/15.
9 Modified by Vicky
10 ------
11 
12 This program is free software; you can redistribute it and/or modify
13 it under the terms of the GNU General Public License as published by
14 the Free Software Foundation; either version 2 of the License, or
15 (at your option) any later version.
16 
17 This program is distributed in the hope that it will be useful,
18 but WITHOUT ANY WARRANTY; without even the implied warranty of
19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 GNU General Public License for more details.
21 
22 You should have received a copy of the GNU General Public License
23 along with this program; if not, write to the Free Software
24 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 
26  ********************************************************************PGR-GNU*/
27 
28 #ifndef INCLUDE_OPTIMIZERS_MOVE_H_
29 #define INCLUDE_OPTIMIZERS_MOVE_H_
30 #pragma once
31 
32 #include <cstdint>
33 #include <iosfwd>
34 
35 namespace vrprouting {
36 namespace problem {
37 class Order;
38 class Vehicle_pickDeliver;
39 }
40 
41 namespace optimizers {
42 namespace tabu {
43 
44 
46 class Move {
47  public:
49  Move() = delete;
50 
53  const problem::Order&, double, double);
54 
57  const problem::Order&, const problem::Order&, double, double);
58 
60  int64_t oid1() const {return m_oid1;}
61 
63  int64_t oid2() const {return m_oid2;}
64 
66  int64_t vid1() const {return m_vid1;}
67 
69  int64_t vid2() const {return m_vid2;}
70 
72  bool is_swap() const {return m_is_swap;}
73 
75  double to_objective() const {return m_obj1;}
76 
78  double from_objective() const {return m_obj2;}
79 
81  friend std::ostream& operator<<(std::ostream &, const Move &);
82 
84  friend bool operator==(const Move&, const Move&);
85 
86  private:
88  int64_t m_vid1;
89 
91  int64_t m_vid2;
92 
94  int64_t m_oid1;
95 
97  int64_t m_oid2;
98 
100  bool m_is_swap;
101 
103  double m_obj1;
104 
106  double m_obj2;
107 };
108 
109 } // namespace tabu
110 } // namespace optimizers
111 } // namespace vrprouting
112 
113 #endif // INCLUDE_OPTIMIZERS_MOVE_H_
114 
vrprouting::optimizers::tabu::Move::operator==
friend bool operator==(const Move &, const Move &)
equality operator
Definition: move.cpp:80
vrprouting::optimizers::tabu::Move::vid1
int64_t vid1() const
The identifier of the vehicle to move the order to.
Definition: move.h:66
vrprouting::optimizers::tabu::Move::vid2
int64_t vid2() const
The identifier of the vehicle to move the order to.
Definition: move.h:69
vrprouting::optimizers::tabu::Move::m_vid2
int64_t m_vid2
The identifier of the vehicle to move the order to.
Definition: move.h:91
vrprouting::optimizers::tabu::Move::m_obj1
double m_obj1
The objective value of the vehicle to move the order to.
Definition: move.h:103
vrprouting::optimizers::tabu::Move::m_obj2
double m_obj2
The objective value of the vehicle to move the order from.
Definition: move.h:106
vrprouting::optimizers::tabu::Move::oid1
int64_t oid1() const
The identifier of the order to move or swap.
Definition: move.h:60
vrprouting::optimizers::tabu::Move::oid2
int64_t oid2() const
The identifier of the order to swap.
Definition: move.h:63
vrprouting::optimizers::tabu::Move::Move
Move()=delete
empty move is not allowed
vrprouting::optimizers::tabu::Move
The Move class defines moves that are evaluated and set as tabu.
Definition: move.h:46
vrprouting::optimizers::tabu::Move::m_vid1
int64_t m_vid1
The identifier of the vehicle to move the order from.
Definition: move.h:88
vrprouting::optimizers::tabu::Move::is_swap
bool is_swap() const
is the move a swap move?
Definition: move.h:72
vrprouting::optimizers::tabu::Move::m_oid1
int64_t m_oid1
The identifier of the first moved order.
Definition: move.h:94
vrprouting::problem::Vehicle_pickDeliver
Definition: vehicle_pickDeliver.h:46
vrprouting::optimizers::tabu::Move::m_oid2
int64_t m_oid2
The identifier of the second moved order (valid only for swap moves)
Definition: move.h:97
vrprouting::optimizers::tabu::Move::to_objective
double to_objective() const
Objective value of the "to" vehicle.
Definition: move.h:75
vrprouting::optimizers::tabu::Move::operator<<
friend std::ostream & operator<<(std::ostream &, const Move &)
printing function
Definition: move.cpp:66
vrprouting::optimizers::tabu::Move::m_is_swap
bool m_is_swap
flag == true when belongs to swap
Definition: move.h:100
vrprouting::problem::Order
Definition: order.h:40
vrprouting::optimizers::tabu::Move::from_objective
double from_objective() const
Objective value of the "from" vehicle.
Definition: move.h:78
vrprouting
Definition: base_matrix.cpp:46