47 bool LoadFile(
const std::string& file_name);
53 int depot()
const {
return depot_; }
55 int size()
const {
return size_; }
60 const std::vector<Coordinates3<double>>&
coordinates()
const {
68 const std::vector<int64_t>&
demands()
const {
return demands_; }
71 std::set<std::pair<int, int>>
fixed_edges()
const {
return fixed_edges_; }
74 const std::vector<std::vector<int>>&
edges()
const {
return edges_; }
76 const std::string&
name()
const {
return name_; }
78 const std::string&
comments()
const {
return comments_; }
82 absl::Span<
const std::vector<int>> routes)
const;
100 DISPLAY_DATA_SECTION,
107 enum EdgeDataFormat { EDGE_LIST, ADJ_LIST };
108 enum EdgeWeightTypes {
123 UNDEFINED_EDGE_WEIGHT_TYPE
125 enum EdgeWeightFormats {
136 UNDEFINED_EDGE_WEIGHT_FORMAT
144 void ParseExplicitFullMatrix(absl::Span<const std::string> words);
145 void ParseExplicitUpperRow(absl::Span<const std::string> words);
146 void ParseExplicitLowerRow(absl::Span<const std::string> words);
147 void ParseExplicitUpperDiagRow(absl::Span<const std::string> words);
148 void ParseExplicitLowerDiagRow(absl::Span<const std::string> words);
149 void ParseNodeCoord(absl::Span<const std::string> words);
150 void SetUpEdgeWeightSection();
151 void FinalizeEdgeWeights();
152 void ParseSections(absl::Span<const std::string> words);
153 void ProcessNewLine(
const std::string&
line);
154 void SetExplicitCost(
int from,
int to, int64_t cost) {
155 if (explicit_costs_.size() != size_ * size_) {
156 explicit_costs_.resize(size_ * size_, 0);
158 explicit_costs_[from * size_ +
to] = cost;
164 int64_t max_distance_;
165 std::vector<int64_t> demands_;
167 std::vector<int64_t> explicit_costs_;
168 std::set<std::pair<int, int>> fixed_edges_;
170 std::vector<std::vector<int>> edges_;
173 static const absl::flat_hash_map<std::string, Sections>*
const kSections;
175 static const absl::flat_hash_map<std::string, Types>*
const kTypes;
177 static const absl::flat_hash_map<std::string, EdgeDataFormat>*
const
179 EdgeDataFormat edge_data_format_;
180 static const absl::flat_hash_map<std::string, EdgeWeightTypes>*
const
182 EdgeWeightTypes edge_weight_type_;
183 static const absl::flat_hash_map<std::string, EdgeWeightFormats>*
const
185 EdgeWeightFormats edge_weight_format_;
188 std::vector<Coordinates3<double>> coords_;
190 std::string comments_;