PGROUTING  2.6-dev
pgrouting::tsp Namespace Reference

Classes

class  Dmatrix
 
class  eucledianDmatrix
 
class  Tour
 
class  TSP
 

Functions

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

Function Documentation

std::ostream& pgrouting::tsp::operator<< ( std::ostream &  log,
const Tour tour 
)

Definition at line 36 of file tour.cpp.

References pgrouting::tsp::Tour::cities.

38  {
39  for (const auto &city : tour.cities) {
40  log << city << ", ";
41  }
42  return log;
43 }
std::ostream& pgrouting::tsp::operator<< ( std::ostream &  log,
const eucledianDmatrix matrix 
)

Definition at line 153 of file eucledianDmatrix.cpp.

References pgrouting::tsp::eucledianDmatrix::coordinates, pgrouting::tsp::eucledianDmatrix::ids, and pgrouting::tsp::eucledianDmatrix::row.

153  {
154  for (const auto id : matrix.ids) {
155  log << "\t" << id;
156  }
157  log << "\n";
158  for (const auto row : matrix.coordinates) {
159  log << row.id << "(" << row.x << "," << row.y << ")\n";
160  }
161  return log;
162 }
std::ostream& pgrouting::tsp::operator<< ( std::ostream &  log,
const Dmatrix matrix 
)

Definition at line 175 of file Dmatrix.cpp.

References pgrouting::tsp::Dmatrix::costs, pgrouting::tsp::Dmatrix::get_index(), and pgrouting::tsp::Dmatrix::ids.

175  {
176  for (const auto id : matrix.ids) {
177  log << "\t" << id;
178  }
179  log << "\n";
180  size_t i = 0;
181  for (const auto row : matrix.costs) {
182  size_t j = 0;
183  for (const auto cost : row) {
184  log << "Internal(" << i << "," << j << ")"
185  << "\tUsers(" << matrix.ids[i] << "," << matrix.ids[j] << ")"
186  << "\t = " << cost
187 #if 0
188  << "\t(" << matrix.get_index(matrix.ids[i])
189  << "," << matrix.get_index(matrix.ids[j]) << ")"
190  << "\t = " << matrix.costs[i][j]
191  << "\t = " << matrix.costs[j][i]
192  << "=inf:"
193  << (matrix.costs[i][j] ==
194  (std::numeric_limits<double>::infinity)())
195  << "=inf:"
196  << (matrix.costs[j][i] ==
197  (std::numeric_limits<double>::infinity)())
198 #endif
199  << "\n";
200  ++j;
201  }
202  ++i;
203  }
204 #if 0
205  for (size_t i = 0; i < matrix.costs.size(); ++i) {
206  for (size_t j = 0; j < matrix.costs.size(); ++j) {
207  for (size_t k = 0; k < matrix.costs.size(); ++k) {
208  log << matrix.costs[i][k] << " <= ("
209  << matrix.costs[i][j] << " + " << matrix.costs[j][k] << ")"
210  << (matrix.costs[i][k]
211  <= (matrix.costs[i][j] + matrix.costs[j][k]))
212  << "\n";
213  }
214  }
215  }
216 #endif
217  return log;
218 }

Here is the call graph for this function: