75#ifndef OR_TOOLS_ROUTING_PARSERS_NEARP_PARSER_H_
76#define OR_TOOLS_ROUTING_PARSERS_NEARP_PARSER_H_
83#include "absl/strings/string_view.h"
99 bool LoadFile(absl::string_view file_name);
102 const std::string&
name()
const {
return name_; }
104 const std::string&
comment()
const {
return comment_; }
106 int64_t
depot()
const {
return depot_; }
150 return arc_servicing_demands_;
154 return edge_servicing_demands_;
158 return node_servicing_demands_;
163 return arc_servicing_costs_;
167 return edge_servicing_costs_;
171 return node_servicing_costs_;
176 return arc_traversing_costs_;
180 return edge_traversing_costs_;
196 return absl::StrCat(
"N", node + 1);
204 ARCS_WITHOUT_SERVICING,
205 EDGES_WITH_SERVICING,
206 EDGES_WITHOUT_SERVICING,
207 NODES_WITH_SERVICING,
215 bool ParseFile(absl::string_view file_name);
216 bool ParseMetadataLine(
const std::vector<std::string>& words);
217 bool ParseArc(std::string_view line,
bool with_servicing);
218 bool ParseEdge(std::string_view line,
bool with_servicing);
219 bool ParseNode(std::string_view line);
227 std::string comment_;
231 int num_arcs_with_servicing_;
232 int num_edges_with_servicing_;
233 int num_nodes_with_servicing_;
int NumberOfArcsWithServicing() const
const gtl::linked_hash_map< Arc, int64_t > & arc_traversing_costs() const
Returns the traversing costs of the arcs in the current routing problem.
int64_t depot() const
Returns the index of the depot.
const gtl::linked_hash_map< int64_t, int64_t > & node_servicing_costs() const
Returns the servicing costs of the nodes in the current routing problem.
const gtl::linked_hash_map< Arc, int64_t > & arc_servicing_costs() const
Returns the servicing costs of the arcs in the current routing problem.
const gtl::linked_hash_map< Edge, int64_t > & edge_servicing_costs() const
Returns the servicing costs of the edges in the current routing problem.
std::string GetEdgeName(Edge edge) const
const std::string & name() const
Returns the name of the instance being solved.
const std::string & comment() const
Returns the comment of the instance being solved, typically an upper bound.
std::string GetArcName(int64_t tail, int64_t head) const
bool LoadFile(absl::string_view file_name)
Loads instance from a file into this parser object.
const gtl::linked_hash_map< Edge, int64_t > & edge_traversing_costs() const
Returns the traversing costs of the edges in the current routing problem.
int NumberOfEdgesWithServicing() const
const gtl::linked_hash_map< int64_t, int64_t > & node_servicing_demands() const
Returns the servicing demands of the nodes in the current routing problem.
std::string GetNodeName(int64_t node) const
const gtl::linked_hash_map< Edge, int64_t > & edge_servicing_demands() const
Returns the servicing demands of the edges in the current routing problem.
std::string GetEdgeName(int64_t tail, int64_t head) const
std::string GetArcName(Arc arc) const
int NumberOfNodesWithServicing() const
const gtl::linked_hash_map< Arc, int64_t > & arc_servicing_demands() const
Returns the servicing demands of the arcs in the current routing problem.
int64_t NumberOfNodesWithoutServicing() const
int NumberOfVehicles() const
Returns the maximum number of vehicles to use.
int NumberOfArcsWithoutServicing() const
int NumberOfNodes() const
Returns the number of nodes in the current routing problem.
int64_t capacity() const
Returns the capacity of the vehicles.
int NumberOfEdgesWithoutServicing() const
const NearpParser & operator=(const NearpParser &)=delete
int NumberOfEdges() const
NearpParser(const NearpParser &)=delete
Common utilities for parsing routing instances.