42#ifndef OR_TOOLS_ROUTING_PARSERS_SOLOMON_PARSER_H_
43#define OR_TOOLS_ROUTING_PARSERS_SOLOMON_PARSER_H_
52#include "absl/strings/string_view.h"
73 bool LoadFile(
const std::string& file_name);
76 bool LoadFile(absl::string_view file_name,
const std::string& archive_name);
79 const std::string&
name()
const {
return name_; }
87 const std::vector<Coordinates2<int64_t>>&
coordinates()
const {
93 const std::vector<int64_t>&
demands()
const {
return demands_; }
95 const std::vector<SimpleTimeWindow<int64_t>>&
time_windows()
const {
99 const std::vector<int64_t>&
service_times()
const {
return service_times_; }
104 const double xd = from_coords.
x - to_coords.
x;
105 const double yd = from_coords.
y - to_coords.
y;
106 return sqrt(xd * xd + yd * yd);
114 enum Section { UNKNOWN, NAME, VEHICLE, CUSTOMER };
118 bool ParseFile(
const std::string& file_name);
121 const std::map<std::string, Section> sections_;
131 std::vector<Coordinates2<int64_t>> coordinates_;
133 std::vector<int64_t> demands_;
134 std::vector<SimpleTimeWindow<int64_t>> time_windows_;
135 std::vector<int64_t> service_times_;
double GetTravelTime(int from, int to) const
Returns the travel time between two nodes.
SolomonParser(const SolomonParser &)=delete
int NumberOfNodes() const
Returns the number of nodes in the current routing problem.
const std::vector< int64_t > & demands() const
Returns the demand of the nodes in the current routing problem.
int NumberOfVehicles() const
Returns the maximum number of vehicles to use.
const std::string & name() const
Returns the name of the instance being solved.
int64_t capacity() const
Returns the capacity of the vehicles.
const SolomonParser & operator=(const SolomonParser &)=delete
int Depot() const
Returns the index of the depot.
const std::vector< int64_t > & service_times() const
Returns the service times of the nodes in the current routing problem.
double GetDistance(int from, int to) const
Returns the distance between two nodes.
bool LoadFile(const std::string &file_name)
Loads instance from a file.
const std::vector< Coordinates2< int64_t > > & coordinates() const
Returns the coordinates of the nodes in the current routing problem.
const std::vector< SimpleTimeWindow< int64_t > > & time_windows() const
Returns the time windows of the nodes in the current routing problem.
In SWIG mode, we don't want anything besides these top-level includes.
trees with all degrees equal to