![]() |
Google OR-Tools v9.14
a fast and portable software suite for combinatorial optimization
|
Definition at line 41 of file tsplib_parser.h.
#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 (absl::string_view file_name) |
| Loads and parses a routing problem from a given file. | |
| int | SizeFromFile (absl::string_view 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 |
Routing model types (cf. the link above for a description).
| Enumerator | |
|---|---|
| TSP | |
| ATSP | |
| SOP | |
| HCP | |
| CVRP | |
| TOUR | |
| UNDEFINED_TYPE | |
Definition at line 44 of file tsplib_parser.h.
| operations_research::routing::TspLibParser::TspLibParser | ( | ) |
Definition at line 159 of file tsplib_parser.cc.
| std::string operations_research::routing::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 65 of file tsplib_parser.h.
|
inline |
Returns the comments attached to the data.
Definition at line 79 of file tsplib_parser.h.
|
inline |
Returns the coordinates of the nodes in the current routing problem (if they exist).
Definition at line 61 of file tsplib_parser.h.
|
inline |
Returns the demands (or quantities picked up) at each node.
Definition at line 69 of file tsplib_parser.h.
|
inline |
Returns the index of the depot.
Definition at line 54 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 75 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 72 of file tsplib_parser.h.
|
inline |
Returns a function returning edge weights between nodes.
Definition at line 52 of file tsplib_parser.h.
| bool operations_research::routing::TspLibParser::LoadFile | ( | absl::string_view | 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 67 of file tsplib_parser.h.
|
inline |
Returns the name of the current routing model.
Definition at line 77 of file tsplib_parser.h.
|
inline |
Returns the number of nodes in the current routing problem.
Definition at line 56 of file tsplib_parser.h.
| int operations_research::routing::TspLibParser::SizeFromFile | ( | absl::string_view | 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 58 of file tsplib_parser.h.