55#ifndef OR_TOOLS_ROUTING_PARSERS_CARP_PARSER_H_
56#define OR_TOOLS_ROUTING_PARSERS_CARP_PARSER_H_
63#include "absl/types/span.h"
79 bool LoadFile(
const std::string& file_name);
82 const std::string&
name()
const {
return name_; }
84 const std::string&
comment()
const {
return comment_; }
86 int64_t
depot()
const {
return depot_; }
97 return number_of_edges_with_servicing_;
102 return number_of_edges_without_servicing_;
108 return servicing_demands_;
112 return traversing_costs_;
122 CHECK(traversing_costs_.contains(
edge))
123 <<
"Unknown edge: " <<
edge.tail() <<
" - " <<
edge.head();
124 return traversing_costs_.at(
edge);
132 return servicing_demands_.contains(
edge);
142 <<
"Unknown edge: " <<
edge.tail() <<
" - " <<
edge.head();
143 return servicing_demands_.at(
edge);
154 ARCS_WITHOUT_SERVICING,
159 bool ParseFile(
const std::string& file_name);
160 bool ParseMetadataLine(absl::Span<const std::string> words);
161 bool ParseEdge(std::string_view
line,
bool with_servicing);
169 std::string comment_;
170 int64_t number_of_nodes_;
171 int64_t number_of_edges_with_servicing_;
172 int64_t number_of_edges_without_servicing_;
173 int64_t total_servicing_cost_;
bool LoadFile(const std::string &file_name)
Loads instance from a file into this parser object.
int64_t GetServicing(Edge edge) const
int64_t NumberOfVehicles() const
Returns the maximum number of vehicles to use.
int64_t GetTraversingCost(Edge edge) const
int64_t NumberOfEdgesWithServicing() const
int64_t capacity() const
Returns the capacity of the vehicles.
const CarpParser & operator=(const CarpParser &)=delete
const std::string & name() const
Returns the name of the instance being solved.
int64_t GetServicing(int64_t tail, int64_t head) const
int64_t depot() const
Returns the index of the depot.
int64_t TotalServicingCost() const
Returns the total servicing cost for all arcs.
const std::string & comment() const
Returns the comment of the instance being solved, typically an upper bound.
const gtl::linked_hash_map< Edge, int64_t > & traversing_costs() const
Returns the traversing costs of the edges in the current routing problem.
int64_t NumberOfEdges() const
int64_t NumberOfNodes() const
Returns the number of nodes in the current routing problem.
int64_t HasServicingNeed(Edge edge) const
Checks whether this edge requires servicing.
int64_t GetTraversingCost(int64_t tail, int64_t head) const
int64_t HasServicingNeed(int64_t tail, int64_t head) const
CarpParser(const CarpParser &)=delete
int64_t NumberOfEdgesWithoutServicing() const
const gtl::linked_hash_map< Edge, int64_t > & servicing_demands() const
Returns the servicing of the edges in the current routing problem.
In SWIG mode, we don't want anything besides these top-level includes.