18#ifndef OR_TOOLS_ROUTING_PARSERS_PDTSP_PARSER_H_
19#define OR_TOOLS_ROUTING_PARSERS_PDTSP_PARSER_H_
25#include "absl/strings/string_view.h"
35 bool LoadFile(absl::string_view file_name);
37 int depot()
const {
return depot_; }
39 int Size()
const {
return x_.size(); }
41 bool IsPickup(
int index)
const {
return deliveries_[index] >= 0; }
45 std::function<int64_t(
int,
int)>
Distances()
const;
48 enum Sections { SIZE_SECTION, DEPOT_SECTION, NODE_SECTION, EOF_SECTION };
49 void ProcessNewLine(
const std::string& line);
53 std::vector<double> x_;
54 std::vector<double> y_;
55 std::vector<int> deliveries_;
int depot() const
Returns the index of the depot.
std::function< int64_t(int, int)> Distances() const
Returns a function returning distances between nodes.
int DeliveryFromPickup(int index) const
Returns the delivery corresponding to a pickup.
bool IsPickup(int index) const
Returns true if the index corresponding to a node is a pickup.
int Size() const
Returns the number of nodes in the PDTSP.
bool LoadFile(absl::string_view file_name)
Loads and parse a PDTSP from a given file.
Common utilities for parsing routing instances.