vrpRouting  0.3
vrprouting::optimizers::tabu::Move Class Reference

The Move class defines moves that are evaluated and set as tabu. More...

#include "move.h"

Public Member Functions

 Move ()=delete
 empty move is not allowed More...
 
 Move (const problem::Vehicle_pickDeliver &, const problem::Vehicle_pickDeliver &, const problem::Order &, const problem::Order &, double, double)
 The Move constructor for a "swap" move. More...
 
 Move (const problem::Vehicle_pickDeliver &, const problem::Vehicle_pickDeliver &, const problem::Order &, double, double)
 The Move constructor for a "move" move. More...
 
double from_objective () const
 Objective value of the "from" vehicle. More...
 
bool is_swap () const
 is the move a swap move? More...
 
int64_t oid1 () const
 The identifier of the order to move or swap. More...
 
int64_t oid2 () const
 The identifier of the order to swap. More...
 
double to_objective () const
 Objective value of the "to" vehicle. More...
 
int64_t vid1 () const
 The identifier of the vehicle to move the order to. More...
 
int64_t vid2 () const
 The identifier of the vehicle to move the order to. More...
 

Private Attributes

bool m_is_swap
 flag == true when belongs to swap More...
 
double m_obj1
 The objective value of the vehicle to move the order to. More...
 
double m_obj2
 The objective value of the vehicle to move the order from. More...
 
int64_t m_oid1
 The identifier of the first moved order. More...
 
int64_t m_oid2
 The identifier of the second moved order (valid only for swap moves) More...
 
int64_t m_vid1
 The identifier of the vehicle to move the order from. More...
 
int64_t m_vid2
 The identifier of the vehicle to move the order to. More...
 

Friends

std::ostream & operator<< (std::ostream &, const Move &)
 printing function More...
 
bool operator== (const Move &, const Move &)
 equality operator More...
 

Detailed Description

The Move class defines moves that are evaluated and set as tabu.

Definition at line 46 of file move.h.

Constructor & Destructor Documentation

◆ Move() [1/3]

vrprouting::optimizers::tabu::Move::Move ( )
delete

empty move is not allowed

◆ Move() [2/3]

vrprouting::optimizers::tabu::Move::Move ( const problem::Vehicle_pickDeliver from_v,
const problem::Vehicle_pickDeliver to_v,
const problem::Order order,
double  to_obj,
double  from_obj 
)

The Move constructor for a "move" move.

Definition at line 39 of file move.cpp.

40  :
41  m_vid1(from_v.id()),
42  m_vid2(to_v.id()),
43  m_oid1(order.id()),
44  m_oid2(0),
45  m_is_swap(false),
46  m_obj1(to_obj),
47  m_obj2(from_obj) { }

◆ Move() [3/3]

vrprouting::optimizers::tabu::Move::Move ( const problem::Vehicle_pickDeliver from_v,
const problem::Vehicle_pickDeliver to_v,
const problem::Order from_order,
const problem::Order to_order,
double  to_obj,
double  from_obj 
)

The Move constructor for a "swap" move.

Definition at line 49 of file move.cpp.

50  :
51  m_vid1(from_v.id()),
52  m_vid2(to_v.id()),
53  m_oid1(from_order.id()),
54  m_oid2(to_order.id()),
55  m_is_swap(true),
56  m_obj1(to_obj),
57  m_obj2(from_obj) { }

Member Function Documentation

◆ from_objective()

double vrprouting::optimizers::tabu::Move::from_objective ( ) const
inline

Objective value of the "from" vehicle.

Currently unused.

Definition at line 78 of file move.h.

78 {return m_obj2;}

References m_obj2.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ is_swap()

bool vrprouting::optimizers::tabu::Move::is_swap ( ) const
inline

is the move a swap move?

Definition at line 72 of file move.h.

72 {return m_is_swap;}

References m_is_swap.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ oid1()

int64_t vrprouting::optimizers::tabu::Move::oid1 ( ) const
inline

The identifier of the order to move or swap.

Definition at line 60 of file move.h.

60 {return m_oid1;}

References m_oid1.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ oid2()

int64_t vrprouting::optimizers::tabu::Move::oid2 ( ) const
inline

The identifier of the order to swap.

Definition at line 63 of file move.h.

63 {return m_oid2;}

References m_oid2.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ to_objective()

double vrprouting::optimizers::tabu::Move::to_objective ( ) const
inline

Objective value of the "to" vehicle.

Currently unused.

Definition at line 75 of file move.h.

75 {return m_obj1;}

References m_obj1.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ vid1()

int64_t vrprouting::optimizers::tabu::Move::vid1 ( ) const
inline

The identifier of the vehicle to move the order to.

Definition at line 66 of file move.h.

66 {return m_vid1;}

References m_vid1.

Referenced by vrprouting::optimizers::tabu::operator==().

◆ vid2()

int64_t vrprouting::optimizers::tabu::Move::vid2 ( ) const
inline

The identifier of the vehicle to move the order to.

Definition at line 69 of file move.h.

69 {return m_vid2;}

References m_vid2.

Referenced by vrprouting::optimizers::tabu::operator==().

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  log,
const Move m 
)
friend

printing function

Parameters
[in,out]log- where to write
[in]m- move to write
Returns
log with move information

Definition at line 66 of file move.cpp.

66  {
67  log << m.m_oid1 << ":" << m.m_oid2 << ":"
68  << m.m_vid1 << ":" << m.m_vid2 << ":"
69  << m.m_is_swap;
70  return log;
71  }

◆ operator==

bool operator== ( const Move a,
const Move b 
)
friend

equality operator

Parameters
[in]a- left hand side move
[in]b- right hand side move
Returns
true when the left hand side move move is the same as the right hand side move

Definition at line 80 of file move.cpp.

80  {
81  /*
82  * possible cases are captured in TabuList::has_move and TabuList::has_swap:
83  */
84  return (
85  a.oid1() == b.oid1()
86  && a.oid2() == b.oid2()
87  && a.vid1() == b.vid1()
88  && a.vid2() == b.vid2()
89 #if 0
90  && a.to_objective() == b.to_objective()
91  && a.from_objective() == b.from_objective()
92 #endif
93  && a.is_swap() == b.is_swap());
94  }

Member Data Documentation

◆ m_is_swap

bool vrprouting::optimizers::tabu::Move::m_is_swap
private

flag == true when belongs to swap

Definition at line 100 of file move.h.

Referenced by is_swap(), and vrprouting::optimizers::tabu::operator<<().

◆ m_obj1

double vrprouting::optimizers::tabu::Move::m_obj1
private

The objective value of the vehicle to move the order to.

Definition at line 103 of file move.h.

Referenced by to_objective().

◆ m_obj2

double vrprouting::optimizers::tabu::Move::m_obj2
private

The objective value of the vehicle to move the order from.

Definition at line 106 of file move.h.

Referenced by from_objective().

◆ m_oid1

int64_t vrprouting::optimizers::tabu::Move::m_oid1
private

The identifier of the first moved order.

Definition at line 94 of file move.h.

Referenced by oid1(), and vrprouting::optimizers::tabu::operator<<().

◆ m_oid2

int64_t vrprouting::optimizers::tabu::Move::m_oid2
private

The identifier of the second moved order (valid only for swap moves)

Definition at line 97 of file move.h.

Referenced by oid2(), and vrprouting::optimizers::tabu::operator<<().

◆ m_vid1

int64_t vrprouting::optimizers::tabu::Move::m_vid1
private

The identifier of the vehicle to move the order from.

Definition at line 88 of file move.h.

Referenced by vrprouting::optimizers::tabu::operator<<(), and vid1().

◆ m_vid2

int64_t vrprouting::optimizers::tabu::Move::m_vid2
private

The identifier of the vehicle to move the order to.

Definition at line 91 of file move.h.

Referenced by vrprouting::optimizers::tabu::operator<<(), and vid2().


The documentation for this class was generated from the following files:
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::m_vid1
int64_t m_vid1
The identifier of the vehicle to move the order from.
Definition: move.h:88
vrprouting::optimizers::tabu::Move::m_oid1
int64_t m_oid1
The identifier of the first moved order.
Definition: move.h:94
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::m_is_swap
bool m_is_swap
flag == true when belongs to swap
Definition: move.h:100