TSP.cpp File Reference
#include <shark/Algorithms/DirectSearch/Operators/Recombination/PartiallyMappedCrossover.h>
#include <shark/Algorithms/DirectSearch/Operators/Selection/RouletteWheelSelection.h>
#include <shark/Algorithms/DirectSearch/Individual.h>
#include <shark/ObjectiveFunctions/AbstractObjectiveFunction.h>
#include <shark/LinAlg/Base.h>
#include <boost/format.hpp>
#include <boost/graph/adjacency_matrix.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/graph/graphml.hpp>
#include <boost/graph/graphviz.hpp>
#include <boost/graph/metric_tsp_approx.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <numeric>

Go to the source code of this file.

Typedefs

typedef IntVector Tour
 
typedef boost::adjacency_matrix< boost::undirectedS, boost::property< boost::vertex_color_t, std::string >, boost::property< boost::edge_weight_t, double, boost::property< boost::edge_color_t, std::string > >, boost::no_property > Graph
 
typedef boost::graph_traits< Graph >::vertex_descriptor Vertex
 
typedef boost::graph_traits< Graph >::edge_descriptor Edge
 
typedef boost::property_map< Graph, boost::edge_weight_t >::type WeightMap
 
typedef boost::property_map< Graph, boost::edge_color_t >::type ColorMap
 
typedef Individual< Tour, double > IndividualType
 
typedef std::vector< IndividualTypePopulation
 

Functions

int main (int argc, char **argv)
 

Variables

const double cities [10][10]
 Defines the problem, i.e., its cost matrix. More...
 

Typedef Documentation

◆ ColorMap

typedef boost::property_map<Graph, boost::edge_color_t>::type ColorMap

Definition at line 93 of file TSP.cpp.

◆ Edge

typedef boost::graph_traits<Graph>::edge_descriptor Edge

Definition at line 91 of file TSP.cpp.

◆ Graph

typedef boost::adjacency_matrix< boost::undirectedS, boost::property< boost::vertex_color_t, std::string >, boost::property< boost::edge_weight_t, double, boost::property< boost::edge_color_t, std::string > >, boost::no_property > Graph

Definition at line 89 of file TSP.cpp.

◆ IndividualType

typedef Individual< Tour,double > IndividualType

Definition at line 95 of file TSP.cpp.

◆ Population

typedef std::vector< IndividualType > Population

Definition at line 96 of file TSP.cpp.

◆ Tour

typedef IntVector Tour

Definition at line 65 of file TSP.cpp.

◆ Vertex

typedef boost::graph_traits<Graph>::vertex_descriptor Vertex

Definition at line 90 of file TSP.cpp.

◆ WeightMap

typedef boost::property_map<Graph, boost::edge_weight_t>::type WeightMap

Definition at line 92 of file TSP.cpp.

Function Documentation

◆ main()

int main ( int  argc,
char **  argv 
)

Definition at line 128 of file TSP.cpp.

References cities, lambda, and shark::searchPoint().

Variable Documentation

◆ cities

const double cities[10][10]
Initial value:
= {
{ 0, 28, 57, 72, 81, 85, 80, 113, 89, 80 },
{ 28, 0, 28, 45, 54, 57, 63, 85, 63, 63 },
{ 57, 28, 0, 20, 30, 28, 57, 57, 40, 57 },
{ 72, 45, 20, 0, 10, 20, 72, 45, 20, 45 },
{ 81, 54, 30, 10, 0, 22, 81, 41, 10, 41 },
{ 85, 57, 28, 20, 22, 0, 63, 28, 28, 63 },
{ 80, 63, 57, 72, 81, 63, 0, 80, 89, 113 },
{ 113, 85, 57, 45, 41, 28, 80, 0, 40, 80 },
{ 89, 63, 40, 20, 10, 28, 89, 40, 0, 40 },
{ 80, 63, 57, 45, 41, 63, 113, 80, 40, 0 }
}

Defines the problem, i.e., its cost matrix.

Definition at line 70 of file TSP.cpp.

Referenced by main().