PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgrouting::tsp::eucledianDmatrix Class Reference

#include "eucledianDmatrix.h"

Public Member Functions

 eucledianDmatrix ()=default
 
 eucledianDmatrix (const std::vector< Coordinate_t > &data_coordinates)
 
double comparable_distance (size_t i, size_t j) const
 
double distance (size_t i, size_t j) const
 
int64_t get_id (size_t idx) const
 idx -> original id More...
 
size_t get_index (int64_t id) const
 original id -> idx More...
 
const std::vector< double > get_row (size_t idx) const
 returns a row of distances More...
 
bool has_id (int64_t id) const
 original id -> true More...
 
bool has_no_infinity () const
 
bool is_symmetric () const
 
bool obeys_triangle_inequality () const
 
void set (size_t i, size_t j, double dist)
 sets a special value for the distance(i,j) More...
 
size_t size () const
 |idx| More...
 
double tourCost (const Tour &tour) const
 tour evaluation More...
 

Protected Member Functions

void set_ids ()
 

Protected Attributes

std::vector< int64_t > ids
 

Private Attributes

size_t column
 
std::vector< Coordinate_tcoordinates
 
size_t row
 
double special_distance
 

Friends

std::ostream & operator<< (std::ostream &log, const eucledianDmatrix &matrix)
 

Detailed Description

Definition at line 40 of file eucledianDmatrix.h.

Constructor & Destructor Documentation

pgrouting::tsp::eucledianDmatrix::eucledianDmatrix ( )
default
pgrouting::tsp::eucledianDmatrix::eucledianDmatrix ( const std::vector< Coordinate_t > &  data_coordinates)
explicit

Definition at line 115 of file eucledianDmatrix.cpp.

References coordinates, Coordinate_t::id, and set_ids().

Member Function Documentation

double pgrouting::tsp::eucledianDmatrix::comparable_distance ( size_t  i,
size_t  j 
) const

Definition at line 55 of file eucledianDmatrix.cpp.

References column, coordinates, row, and special_distance.

Referenced by distance().

double pgrouting::tsp::eucledianDmatrix::distance ( size_t  i,
size_t  j 
) const

Definition at line 67 of file eucledianDmatrix.cpp.

References column, comparable_distance(), row, and special_distance.

Referenced by do_pgr_eucledianTSP(), get_row(), and tourCost().

int64_t pgrouting::tsp::eucledianDmatrix::get_id ( size_t  idx) const

idx -> original id

Parameters
[in]idx- index (i-th coordinate)
Returns
the original id corresponding to idx

Definition at line 108 of file eucledianDmatrix.cpp.

References ids.

Referenced by do_pgr_eucledianTSP().

size_t pgrouting::tsp::eucledianDmatrix::get_index ( int64_t  id) const

original id -> idx

Parameters
[in]id- original id
Returns
idx index of the id in the distance table

Definition at line 102 of file eucledianDmatrix.cpp.

References ids.

Referenced by do_pgr_eucledianTSP().

const std::vector< double > pgrouting::tsp::eucledianDmatrix::get_row ( size_t  idx) const

returns a row of distances

Parameters
[in]idxrow index
Returns
distances from idx to all other coordinates

Definition at line 42 of file eucledianDmatrix.cpp.

References distance(), ids, and pgassert.

bool pgrouting::tsp::eucledianDmatrix::has_id ( int64_t  id) const

original id -> true

Parameters
[in]idoriginal id
Returns
true if id is in the distance table

Definition at line 96 of file eucledianDmatrix.cpp.

References ids.

Referenced by do_pgr_eucledianTSP().

bool pgrouting::tsp::eucledianDmatrix::has_no_infinity ( ) const

Definition at line 139 of file eucledianDmatrix.cpp.

bool pgrouting::tsp::eucledianDmatrix::is_symmetric ( ) const

Definition at line 149 of file eucledianDmatrix.cpp.

bool pgrouting::tsp::eucledianDmatrix::obeys_triangle_inequality ( ) const

Definition at line 144 of file eucledianDmatrix.cpp.

void pgrouting::tsp::eucledianDmatrix::set ( size_t  i,
size_t  j,
double  dist 
)
inline

sets a special value for the distance(i,j)

Parameters
[in]i- index in matrix
[in]j- index in matrix
[in]dist- distance from i to j & from j to i

Definition at line 57 of file eucledianDmatrix.h.

References column, row, and special_distance.

Referenced by do_pgr_eucledianTSP().

void pgrouting::tsp::eucledianDmatrix::set_ids ( )
protected

Definition at line 125 of file eucledianDmatrix.cpp.

References coordinates, ids, and pgassertwm.

Referenced by eucledianDmatrix().

size_t pgrouting::tsp::eucledianDmatrix::size ( ) const
inline

|idx|

Returns
the total number of coordinates

Definition at line 86 of file eucledianDmatrix.h.

References ids.

Referenced by do_pgr_eucledianTSP().

double pgrouting::tsp::eucledianDmatrix::tourCost ( const Tour tour) const

tour evaluation

Parameters
[in]tour
Returns
total cost of traversing the tour

Definition at line 78 of file eucledianDmatrix.cpp.

References pgrouting::tsp::Tour::cities, and distance().

Referenced by do_pgr_eucledianTSP().

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  log,
const eucledianDmatrix matrix 
)
friend

Definition at line 153 of file eucledianDmatrix.cpp.

Member Data Documentation

size_t pgrouting::tsp::eucledianDmatrix::column
private

Definition at line 117 of file eucledianDmatrix.h.

Referenced by comparable_distance(), distance(), and set().

std::vector< Coordinate_t > pgrouting::tsp::eucledianDmatrix::coordinates
private
std::vector<int64_t> pgrouting::tsp::eucledianDmatrix::ids
protected
size_t pgrouting::tsp::eucledianDmatrix::row
private

Definition at line 116 of file eucledianDmatrix.h.

Referenced by comparable_distance(), distance(), and set().

double pgrouting::tsp::eucledianDmatrix::special_distance
private

Definition at line 118 of file eucledianDmatrix.h.

Referenced by comparable_distance(), distance(), and set().


The documentation for this class was generated from the following files: