PGROUTING  2.4
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
pgrouting::tsp::TSP< MATRIX > Class Template Reference

#include "pgr_tsp.hpp"

Inheritance diagram for pgrouting::tsp::TSP< MATRIX >:

Public Member Functions

 TSP (const MATRIX &_costs)
 
void annealing (double initial_temperature, double final_temperature, double cooling_factor, int64_t tries_per_temperature, int64_t max_changes_per_temperature, int64_t max_consecutive_non_changes, bool randomize, double time_limit)
 
std::string get_log () const
 
std::string get_stats () const
 
Tour get_tour () const
 
void greedyInitial (size_t idx_start=0)
 

Private Member Functions

size_t find_closest_city (size_t current_city, const std::set< size_t > inserted) const
 
double getDeltaReverse (size_t posA, size_t posC) const
 
double getDeltaSlide (size_t posP, size_t posF, size_t posL) const
 
double getDeltaSwap (size_t posA, size_t posC) const
 
void invariant () const
 
void swapClimb ()
 
void update_if_best ()
 

Private Attributes

Tour best_tour
 
double bestCost
 
double current_cost
 
Tour current_tour
 
double epsilon
 
size_t improve_count
 
std::ostringstream log
 
size_t n
 
size_t reverse_count
 
size_t slide_count
 
size_t swap_count
 
int updatecalls
 

Detailed Description

template<typename MATRIX>
class pgrouting::tsp::TSP< MATRIX >

Definition at line 50 of file pgr_tsp.hpp.

Constructor & Destructor Documentation

Member Function Documentation

template<typename MATRIX >
void pgrouting::tsp::TSP< MATRIX >::annealing ( double  initial_temperature,
double  final_temperature,
double  cooling_factor,
int64_t  tries_per_temperature,
int64_t  max_changes_per_temperature,
int64_t  max_consecutive_non_changes,
bool  randomize,
double  time_limit 
)

Definition at line 430 of file pgr_tsp.cpp.

References pgassert, rand(), and succ().

Referenced by do_pgr_eucledianTSP(), and do_pgr_tsp().

template<typename MATRIX >
size_t pgrouting::tsp::TSP< MATRIX >::find_closest_city ( size_t  current_city,
const std::set< size_t >  inserted 
) const
private

Definition at line 102 of file pgr_tsp.cpp.

References pgassert, and pgassertwm.

template<typename MATRIX>
std::string pgrouting::tsp::TSP< MATRIX >::get_log ( ) const
inline

Definition at line 88 of file pgr_tsp.hpp.

References pgrouting::tsp::TSP< MATRIX >::log.

Referenced by do_pgr_eucledianTSP(), and do_pgr_tsp().

template<typename MATRIX>
Tour pgrouting::tsp::TSP< MATRIX >::get_tour ( ) const
inline

Definition at line 77 of file pgr_tsp.hpp.

References pgrouting::tsp::TSP< MATRIX >::best_tour.

Referenced by do_pgr_eucledianTSP(), and do_pgr_tsp().

template<typename MATRIX >
double pgrouting::tsp::TSP< MATRIX >::getDeltaReverse ( size_t  posA,
size_t  posC 
) const
private

Definition at line 370 of file pgr_tsp.cpp.

References pgassertwm, and succ().

template<typename MATRIX >
double pgrouting::tsp::TSP< MATRIX >::getDeltaSlide ( size_t  posP,
size_t  posF,
size_t  posL 
) const
private
template<typename MATRIX >
double pgrouting::tsp::TSP< MATRIX >::getDeltaSwap ( size_t  posA,
size_t  posC 
) const
private

Definition at line 317 of file pgr_tsp.cpp.

References pgassertwm, pred(), and succ().

template<typename MATRIX >
void pgrouting::tsp::TSP< MATRIX >::greedyInitial ( size_t  idx_start = 0)

Definition at line 144 of file pgr_tsp.cpp.

References pgassert, and pgassertwm.

Referenced by do_pgr_eucledianTSP(), and do_pgr_tsp().

template<typename MATRIX >
void pgrouting::tsp::TSP< MATRIX >::invariant ( ) const
private

Definition at line 74 of file pgr_tsp.cpp.

References pgassert.

template<typename MATRIX >
void pgrouting::tsp::TSP< MATRIX >::swapClimb ( )
private

Definition at line 405 of file pgr_tsp.cpp.

References pgassert.

template<typename MATRIX >
void pgrouting::tsp::TSP< MATRIX >::update_if_best ( )
private

Definition at line 85 of file pgr_tsp.cpp.

Member Data Documentation

template<typename MATRIX>
Tour pgrouting::tsp::TSP< MATRIX >::best_tour
private
template<typename MATRIX>
double pgrouting::tsp::TSP< MATRIX >::bestCost
private

Definition at line 106 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::TSP().

template<typename MATRIX>
double pgrouting::tsp::TSP< MATRIX >::current_cost
private

Definition at line 107 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::TSP().

template<typename MATRIX>
Tour pgrouting::tsp::TSP< MATRIX >::current_tour
private

Definition at line 104 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::TSP().

template<typename MATRIX>
double pgrouting::tsp::TSP< MATRIX >::epsilon
private

Definition at line 108 of file pgr_tsp.hpp.

template<typename MATRIX>
size_t pgrouting::tsp::TSP< MATRIX >::improve_count
private

Definition at line 117 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::get_stats().

template<typename MATRIX>
std::ostringstream pgrouting::tsp::TSP< MATRIX >::log
private

Definition at line 113 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::get_log().

template<typename MATRIX>
size_t pgrouting::tsp::TSP< MATRIX >::n
private

Definition at line 109 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::TSP().

template<typename MATRIX>
size_t pgrouting::tsp::TSP< MATRIX >::reverse_count
private

Definition at line 116 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::get_stats().

template<typename MATRIX>
size_t pgrouting::tsp::TSP< MATRIX >::slide_count
private

Definition at line 115 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::get_stats().

template<typename MATRIX>
size_t pgrouting::tsp::TSP< MATRIX >::swap_count
private

Definition at line 114 of file pgr_tsp.hpp.

Referenced by pgrouting::tsp::TSP< MATRIX >::get_stats().

template<typename MATRIX>
int pgrouting::tsp::TSP< MATRIX >::updatecalls
private

Definition at line 111 of file pgr_tsp.hpp.


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