PGROUTING  3.2
pgr_tsp.hpp File Reference
#include <time.h>
#include <sstream>
#include <vector>
#include <set>
#include <string>
#include <utility>
#include <limits>
#include <cmath>
#include "cpp_common/pgr_assert.h"
#include "cpp_common/Dmatrix.h"
#include "tsp/euclideanDmatrix.h"
#include "tsp/tour.h"
Include dependency graph for pgr_tsp.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

class  pgrouting::tsp::TSP< MATRIX >
 

Namespaces

 pgrouting
 Book keeping class for swapping orders between vehicles.
 
 pgrouting::tsp
 

Functions

static size_t pred (size_t i, size_t n)
 
static size_t rand (size_t n)
 
static size_t succ (size_t i, size_t n)
 

Function Documentation

◆ pred()

static size_t pred ( size_t  i,
size_t  n 
)
static

Definition at line 68 of file pgr_tsp.hpp.

68  {
69  return i == 0? n - 1: i -1;
70 }

◆ rand()

static size_t rand ( size_t  n)
static

Definition at line 53 of file pgr_tsp.hpp.

53  {
54  pgassert(n > 0);
55  return static_cast< size_t >(std::rand())/((RAND_MAX + 1u)/n);
56 }

References pgassert.

◆ succ()

static size_t succ ( size_t  i,
size_t  n 
)
static

Definition at line 61 of file pgr_tsp.hpp.

61  {
62  pgassert(n > 0);
63  return static_cast<size_t>((i + 1) % n);
64 }

References pgassert.

rand
static size_t rand(size_t n)
Definition: pgr_tsp.hpp:53
pgassert
#define pgassert(expr)
Uses the standard assert syntax.
Definition: pgr_assert.h:94