parse_tsplib_file

parse_tsplib_file(path)[source]

Parse a TSPLIB/CVRPLIB format .vrp or .tsp file.

Supports: - TYPE: CVRP and TYPE: TSP - EDGE_WEIGHT_TYPE: EUC_2D, GEO, EXPLICIT - EDGE_WEIGHT_FORMAT (for EXPLICIT): LOWER_DIAG_ROW, UPPER_ROW, FULL_MATRIX - NODE_COORD_SECTION, EDGE_WEIGHT_SECTION, DEMAND_SECTION, DEPOT_SECTION

Parameters:

path (str | Path) – Path to the .vrp or .tsp file.

Return type:

RoutingInstance

Returns:

Parsed RoutingInstance.

Raises:

ValueError – If the file format is unsupported or malformed.