PGROUTING  3.2
pgr_tsp.cpp File Reference
#include "tsp/pgr_tsp.hpp"
#include <time.h>
#include <utility>
#include <iomanip>
#include <limits>
#include <vector>
#include <set>
#include <algorithm>
#include <cmath>
#include "cpp_common/pgr_assert.h"
Include dependency graph for pgr_tsp.cpp:

Go to the source code of this file.

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

◆ rand()

static size_t rand ( size_t  n)
static

Definition at line 49 of file pgr_tsp.cpp.

49  {
50  pgassert(n > 0);
51  return static_cast< size_t >(std::rand() % n);
52 }

References pgassert.

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

◆ succ()

static size_t succ ( size_t  i,
size_t  n 
)
static

Definition at line 57 of file pgr_tsp.cpp.

57  {
58  pgassert(n > 0);
59  return static_cast<size_t>((i + 1) % n);
60 }

References pgassert.

Referenced by pgrouting::tsp::TSP< MATRIX >::annealing(), pgrouting::tsp::TSP< MATRIX >::getDeltaReverse(), pgrouting::tsp::TSP< MATRIX >::getDeltaSlide(), and pgrouting::tsp::TSP< MATRIX >::getDeltaSwap().

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