Camargue
Public Member Functions | Private Attributes | List of all members
CMR::Data::Instance Class Reference

Storing TSP instance data. More...

#include <datagroups.hpp>

Collaboration diagram for CMR::Data::Instance:
Collaboration graph
[legend]

Public Member Functions

 Instance () noexcept
 Default construct an empty instance.
 
 Instance (const std::string &fname, int seed)
 Construct an Instance from a TSPLIB file with a random seed.
 
 Instance (int seed, int ncount, int gridsize)
 Construct a geometric random Instance. More...
 
 Instance (const std::string &probname, int seed, int ncount, std::vector< int > &elist, std::vector< int > &elen, int default_len)
 Construct a sparse Instance with fixed edge set.
 
 Instance (const std::string &probname, int seed, int ncount, std::vector< int > &elist, std::vector< int > &elen)
 
 Instance (Instance &&I) noexcept
 
Instanceoperator= (Instance &&I) noexcept
 
CCdatagroup * ptr () const
 Access the raw pointer to the data, for use by Concorde routines.
 
double edgelen (int end0, int end1) const
 Edge length between two nodes in an Instance.
 
const std::function< double(int, int)> edgelen_func () const
 A function object for the edge length.
 
int node_count () const
 Number of nodes.
 
int seed () const
 Random seed used.
 
double tour_length (const std::vector< int > &tour_nodes) const
 Get the length of the tour in tour_nodes.
 
const std::string & problem_name () const
 The TSPLIB instance name or the random problem dimensions.
 

Private Attributes

CCdatagroup dat
 The Concorde data structure being managed.
 
int nodecount
 
int random_seed
 
std::string pname
 

Detailed Description

Storing TSP instance data.

This is a handle to CCdatagroup, providing unique ownership.

Constructor & Destructor Documentation

CMR::Data::Instance::Instance ( int  seed,
int  ncount,
int  gridsize 
)

Construct a geometric random Instance.

Parameters
[in]seedthe random seed used to generate the problem, and for all other later random computations.
[in]ncountthe number of nodes in the problem
[in]gridsizethe nodes will be generated from a square grid with this side length.

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