Google OR-Tools v9.11
a fast and portable software suite for combinatorial optimization
|
#include <tsplib_parser.h>
Public Types | |
enum | Types { TSP , ATSP , SOP , HCP , CVRP , TOUR , UNDEFINED_TYPE } |
Routing model types (cf. the link above for a description). More... | |
Public Member Functions | |
TspLibParser () | |
bool | LoadFile (const std::string &file_name) |
Loads and parses a routing problem from a given file. | |
int | SizeFromFile (const std::string &file_name) const |
Returns the number of nodes in the routing problem stored in a given file. | |
EdgeWeights | GetEdgeWeights () const |
Returns a function returning edge weights between nodes. | |
int | depot () const |
Returns the index of the depot. | |
int | size () const |
Returns the number of nodes in the current routing problem. | |
Types | type () const |
Returns the type of the current routing problem. | |
const std::vector< Coordinates3< double > > & | coordinates () const |
int64_t | capacity () const |
Returns the capacity of the vehicles in the current routing problem. | |
int64_t | max_distance () const |
Returns the maximal distance vehicles can travel. | |
const std::vector< int64_t > & | demands () const |
Returns the demands (or quantities picked up) at each node. | |
std::set< std::pair< int, int > > | fixed_edges () const |
const std::vector< std::vector< int > > & | edges () const |
const std::string & | name () const |
Returns the name of the current routing model. | |
const std::string & | comments () const |
Returns the comments attached to the data. | |
std::string | BuildTourFromRoutes (absl::Span< const std::vector< int > > routes) const |
Definition at line 40 of file tsplib_parser.h.
Routing model types (cf. the link above for a description).
Enumerator | |
---|---|
TSP | |
ATSP | |
SOP | |
HCP | |
CVRP | |
TOUR | |
UNDEFINED_TYPE |
Definition at line 43 of file tsplib_parser.h.
operations_research::TspLibParser::TspLibParser | ( | ) |
Definition at line 159 of file tsplib_parser.cc.
std::string operations_research::TspLibParser::BuildTourFromRoutes | ( | absl::Span< const std::vector< int > > | routes | ) | const |
Build a tour output in TSPLIB95 format from a vector of routes, a route being a sequence of node indices.
Definition at line 661 of file tsplib_parser.cc.
|
inline |
Returns the capacity of the vehicles in the current routing problem.
Definition at line 64 of file tsplib_parser.h.
|
inline |
Returns the comments attached to the data.
Definition at line 78 of file tsplib_parser.h.
|
inline |
Returns the coordinates of the nodes in the current routing problem (if they exist).
Definition at line 60 of file tsplib_parser.h.
|
inline |
Returns the demands (or quantities picked up) at each node.
Definition at line 68 of file tsplib_parser.h.
|
inline |
Returns the index of the depot.
Definition at line 53 of file tsplib_parser.h.
|
inline |
Returns edges of the graph on which Hamiltonian cycles need to be built. Edges are represented as adjacency lists for each node.
Definition at line 74 of file tsplib_parser.h.
|
inline |
Returns the pairs of nodes corresponding to forced edges (second node is directly after the first).
Definition at line 71 of file tsplib_parser.h.
|
inline |
Returns a function returning edge weights between nodes.
Definition at line 51 of file tsplib_parser.h.
bool operations_research::TspLibParser::LoadFile | ( | const std::string & | file_name | ) |
Loads and parses a routing problem from a given file.
Definition at line 174 of file tsplib_parser.cc.
|
inline |
Returns the maximal distance vehicles can travel.
Definition at line 66 of file tsplib_parser.h.
|
inline |
Returns the name of the current routing model.
Definition at line 76 of file tsplib_parser.h.
|
inline |
Returns the number of nodes in the current routing problem.
Definition at line 55 of file tsplib_parser.h.
int operations_research::TspLibParser::SizeFromFile | ( | const std::string & | file_name | ) | const |
Returns the number of nodes in the routing problem stored in a given file.
Definition at line 185 of file tsplib_parser.cc.
|
inline |
Returns the type of the current routing problem.
Definition at line 57 of file tsplib_parser.h.