49 absl::Status
LoadFile(absl::string_view file_name);
51 absl::StatusOr<int>
SizeFromFile(absl::string_view file_name)
const;
55 int depot()
const {
return depot_; }
57 int size()
const {
return size_; }
62 const std::vector<Coordinates3<double>>&
coordinates()
const {
70 const std::vector<int64_t>&
demands()
const {
return demands_; }
73 std::set<std::pair<int, int>>
fixed_edges()
const {
return fixed_edges_; }
76 const std::vector<std::vector<int>>&
edges()
const {
return edges_; }
78 const std::string&
name()
const {
return name_; }
80 const std::string&
comments()
const {
return comments_; }
84 absl::Span<
const std::vector<int>> routes)
const;
102 DISPLAY_DATA_SECTION,
109 enum EdgeDataFormat { EDGE_LIST, ADJ_LIST };
110 enum EdgeWeightTypes {
125 UNDEFINED_EDGE_WEIGHT_TYPE
127 enum EdgeWeightFormats {
138 UNDEFINED_EDGE_WEIGHT_FORMAT
146 void ParseExplicitFullMatrix(absl::Span<const std::string> words);
147 void ParseExplicitUpperRow(absl::Span<const std::string> words);
148 void ParseExplicitLowerRow(absl::Span<const std::string> words);
149 void ParseExplicitUpperDiagRow(absl::Span<const std::string> words);
150 void ParseExplicitLowerDiagRow(absl::Span<const std::string> words);
151 void ParseNodeCoord(absl::Span<const std::string> words);
152 void SetUpEdgeWeightSection();
153 void FinalizeEdgeWeights();
154 bool ParseSections(absl::Span<const std::string> words);
155 void ProcessNewLine(
const std::string& line);
156 void SetExplicitCost(
int from,
int to, int64_t cost) {
157 if (explicit_costs_.size() != size_ * size_) {
158 explicit_costs_.resize(size_ * size_, 0);
160 explicit_costs_[from * size_ +
to] = cost;
166 int64_t max_distance_;
167 std::vector<int64_t> demands_;
169 std::vector<int64_t> explicit_costs_;
170 std::set<std::pair<int, int>> fixed_edges_;
172 std::vector<std::vector<int>> edges_;
175 static const absl::flat_hash_map<std::string, Sections>*
const kSections;
177 static const absl::flat_hash_map<std::string, Types>*
const kTypes;
179 static const absl::flat_hash_map<std::string, EdgeDataFormat>*
const
181 EdgeDataFormat edge_data_format_;
182 static const absl::flat_hash_map<std::string, EdgeWeightTypes>*
const
184 EdgeWeightTypes edge_weight_type_;
185 static const absl::flat_hash_map<std::string, EdgeWeightFormats>*
const
187 EdgeWeightFormats edge_weight_format_;
190 std::vector<Coordinates3<double>> coords_;
192 std::string comments_;
194 bool valid_section_found_ =
false;