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

#include "Dmatrix.h"

Public Member Functions

 Dmatrix ()=default
 
 Dmatrix (const std::vector< Matrix_cell_t > &data_costs)
 
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 (const std::vector< matrix_cell > &data_costs)
 

Protected Attributes

std::vector< int64_t > ids
 

Private Types

typedef std::vector
< std::vector< double > > 
Costs
 

Private Member Functions

std::vector< double > & operator[] (size_t i)
 
const std::vector< double > & operator[] (size_t i) const
 

Private Attributes

Costs costs
 

Friends

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

Detailed Description

Definition at line 40 of file Dmatrix.h.

Member Typedef Documentation

typedef std::vector< std::vector < double > > pgrouting::tsp::Dmatrix::Costs
private

Definition at line 116 of file Dmatrix.h.

Constructor & Destructor Documentation

pgrouting::tsp::Dmatrix::Dmatrix ( )
default
pgrouting::tsp::Dmatrix::Dmatrix ( const std::vector< Matrix_cell_t > &  data_costs)
explicit

Definition at line 98 of file Dmatrix.cpp.

References costs, get_index(), ids, and set_ids().

Member Function Documentation

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

Definition at line 101 of file Dmatrix.h.

References distance().

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

Definition at line 104 of file Dmatrix.h.

References costs.

Referenced by comparable_distance(), do_pgr_tsp(), and tourCost().

int64_t pgrouting::tsp::Dmatrix::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 91 of file Dmatrix.cpp.

References ids.

Referenced by do_pgr_tsp().

size_t pgrouting::tsp::Dmatrix::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 85 of file Dmatrix.cpp.

References ids.

Referenced by Dmatrix(), do_pgr_tsp(), and pgrouting::tsp::operator<<().

const std::vector<double>& pgrouting::tsp::Dmatrix::get_row ( size_t  idx) const
inline

returns a row of distances

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

Definition at line 98 of file Dmatrix.h.

References costs.

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

original id -> true

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

Definition at line 78 of file Dmatrix.cpp.

References ids.

Referenced by do_pgr_tsp().

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

Definition at line 116 of file Dmatrix.cpp.

References costs.

Referenced by do_pgr_tsp().

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

Definition at line 147 of file Dmatrix.cpp.

References costs, and pgassertwm.

Referenced by do_pgr_tsp().

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

Definition at line 128 of file Dmatrix.cpp.

References costs.

std::vector< double >& pgrouting::tsp::Dmatrix::operator[] ( size_t  i)
inlineprivate

Definition at line 118 of file Dmatrix.h.

References costs.

const std::vector< double >& pgrouting::tsp::Dmatrix::operator[] ( size_t  i) const
inlineprivate

Definition at line 119 of file Dmatrix.h.

References costs.

void pgrouting::tsp::Dmatrix::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 56 of file Dmatrix.h.

References costs.

Referenced by do_pgr_tsp().

void pgrouting::tsp::Dmatrix::set_ids ( const std::vector< matrix_cell > &  data_costs)
protected

Definition at line 63 of file Dmatrix.cpp.

References ids.

Referenced by Dmatrix().

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

|idx|

Returns
the total number of coordinates

Definition at line 84 of file Dmatrix.h.

References ids.

Referenced by do_pgr_tsp().

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

tour evaluation

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

Definition at line 43 of file Dmatrix.cpp.

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

Referenced by do_pgr_tsp().

Friends And Related Function Documentation

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

Definition at line 167 of file Dmatrix.cpp.

Member Data Documentation

Costs pgrouting::tsp::Dmatrix::costs
private
std::vector<int64_t> pgrouting::tsp::Dmatrix::ids
protected

Definition at line 113 of file Dmatrix.h.

Referenced by Dmatrix(), get_id(), get_index(), has_id(), pgrouting::tsp::operator<<(), set_ids(), and size().


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