75#ifndef OR_TOOLS_ROUTING_PARSERS_NEARP_PARSER_H_
76#define OR_TOOLS_ROUTING_PARSERS_NEARP_PARSER_H_
98 bool LoadFile(
const std::string& file_name);
101 const std::string&
name()
const {
return name_; }
103 const std::string&
comment()
const {
return comment_; }
105 int64_t
depot()
const {
return depot_; }
149 return arc_servicing_demands_;
153 return edge_servicing_demands_;
157 return node_servicing_demands_;
162 return arc_servicing_costs_;
166 return edge_servicing_costs_;
170 return node_servicing_costs_;
175 return arc_traversing_costs_;
179 return edge_traversing_costs_;
195 return absl::StrCat(
"N", node + 1);
203 ARCS_WITHOUT_SERVICING,
204 EDGES_WITH_SERVICING,
205 EDGES_WITHOUT_SERVICING,
206 NODES_WITH_SERVICING,
214 bool ParseFile(
const std::string& file_name);
215 bool ParseMetadataLine(
const std::vector<std::string>& words);
216 bool ParseArc(std::string_view
line,
bool with_servicing);
217 bool ParseEdge(std::string_view
line,
bool with_servicing);
218 bool ParseNode(std::string_view
line);
226 std::string comment_;
230 int num_arcs_with_servicing_;
231 int num_edges_with_servicing_;
232 int num_nodes_with_servicing_;
bool LoadFile(const std::string &file_name)
Loads instance from a file into this parser object.
int NumberOfNodesWithServicing() const
int NumberOfVehicles() const
Returns the maximum number of vehicles to use.
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 GetEdgeName(Edge edge) const
std::string GetEdgeName(int64_t tail, int64_t head) const
int NumberOfEdgesWithoutServicing() const
int NumberOfNodes() const
Returns the number of nodes in the current routing problem.
std::string GetArcName(Arc arc) const
int64_t depot() const
Returns the index of the depot.
int NumberOfArcsWithoutServicing() const
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 > & edge_servicing_costs() const
Returns the servicing costs of the edges in the current routing problem.
std::string GetNodeName(int64_t node) 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.
int NumberOfEdgesWithServicing() const
const NearpParser & operator=(const NearpParser &)=delete
int64_t NumberOfNodesWithoutServicing() const
int NumberOfArcsWithServicing() const
int NumberOfEdges() const
NearpParser(const NearpParser &)=delete
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< Edge, int64_t > & edge_servicing_demands() const
Returns the servicing demands of the edges in the current routing problem.
int64_t capacity() const
Returns the capacity of the vehicles.
const gtl::linked_hash_map< Edge, int64_t > & edge_traversing_costs() const
Returns the traversing costs of the edges in the current routing problem.
const std::string & name() const
Returns the name of the instance being solved.
const gtl::linked_hash_map< Arc, int64_t > & arc_traversing_costs() const
Returns the traversing costs of the arcs 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.
std::string GetArcName(int64_t tail, int64_t head) const
In SWIG mode, we don't want anything besides these top-level includes.