48 bool LoadFile(absl::string_view file_name);
54 int depot()
const {
return depot_; }
56 int size()
const {
return size_; }
61 const std::vector<Coordinates3<double>>&
coordinates()
const {
69 const std::vector<int64_t>&
demands()
const {
return demands_; }
72 std::set<std::pair<int, int>>
fixed_edges()
const {
return fixed_edges_; }
75 const std::vector<std::vector<int>>&
edges()
const {
return edges_; }
77 const std::string&
name()
const {
return name_; }
79 const std::string&
comments()
const {
return comments_; }
83 absl::Span<
const std::vector<int>> routes)
const;
101 DISPLAY_DATA_SECTION,
108 enum EdgeDataFormat { EDGE_LIST, ADJ_LIST };
109 enum EdgeWeightTypes {
124 UNDEFINED_EDGE_WEIGHT_TYPE
126 enum EdgeWeightFormats {
137 UNDEFINED_EDGE_WEIGHT_FORMAT
145 void ParseExplicitFullMatrix(absl::Span<const std::string> words);
146 void ParseExplicitUpperRow(absl::Span<const std::string> words);
147 void ParseExplicitLowerRow(absl::Span<const std::string> words);
148 void ParseExplicitUpperDiagRow(absl::Span<const std::string> words);
149 void ParseExplicitLowerDiagRow(absl::Span<const std::string> words);
150 void ParseNodeCoord(absl::Span<const std::string> words);
151 void SetUpEdgeWeightSection();
152 void FinalizeEdgeWeights();
153 void ParseSections(absl::Span<const std::string> words);
154 void ProcessNewLine(
const std::string& line);
155 void SetExplicitCost(
int from,
int to, int64_t cost) {
156 if (explicit_costs_.size() != size_ * size_) {
157 explicit_costs_.resize(size_ * size_, 0);
159 explicit_costs_[from * size_ +
to] = cost;
165 int64_t max_distance_;
166 std::vector<int64_t> demands_;
168 std::vector<int64_t> explicit_costs_;
169 std::set<std::pair<int, int>> fixed_edges_;
171 std::vector<std::vector<int>> edges_;
174 static const absl::flat_hash_map<std::string, Sections>*
const kSections;
176 static const absl::flat_hash_map<std::string, Types>*
const kTypes;
178 static const absl::flat_hash_map<std::string, EdgeDataFormat>*
const
180 EdgeDataFormat edge_data_format_;
181 static const absl::flat_hash_map<std::string, EdgeWeightTypes>*
const
183 EdgeWeightTypes edge_weight_type_;
184 static const absl::flat_hash_map<std::string, EdgeWeightFormats>*
const
186 EdgeWeightFormats edge_weight_format_;
189 std::vector<Coordinates3<double>> coords_;
191 std::string comments_;