OR-Tools  8.0
mps_reader.h
Go to the documentation of this file.
1 // Copyright 2010-2018 Google LLC
2 // Licensed under the Apache License, Version 2.0 (the "License");
3 // you may not use this file except in compliance with the License.
4 // You may obtain a copy of the License at
5 //
6 // http://www.apache.org/licenses/LICENSE-2.0
7 //
8 // Unless required by applicable law or agreed to in writing, software
9 // distributed under the License is distributed on an "AS IS" BASIS,
10 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11 // See the License for the specific language governing permissions and
12 // limitations under the License.
13 
14 // A reader for files in the MPS format.
15 // see http://lpsolve.sourceforge.net/5.5/mps-format.htm
16 // and http://www.ici.ro/camo/language/ml11.htm.
17 //
18 // MPS stands for Mathematical Programming System.
19 //
20 // The format was invented by IBM in the 60's, and has become the de facto
21 // standard. We developed this reader to be able to read benchmark data files.
22 // Using the MPS file format for new models is discouraged.
23 
24 #ifndef OR_TOOLS_LP_DATA_MPS_READER_H_
25 #define OR_TOOLS_LP_DATA_MPS_READER_H_
26 
27 #include <limits>
28 #include <memory>
29 #include <string>
30 #include <vector>
31 
32 #include "absl/container/flat_hash_map.h"
33 #include "absl/container/flat_hash_set.h"
34 #include "absl/status/status.h"
35 #include "absl/strings/numbers.h"
36 #include "absl/strings/str_cat.h"
37 #include "absl/strings/str_split.h"
41 #include "ortools/base/hash.h"
42 #include "ortools/base/int_type.h"
44 #include "ortools/base/logging.h"
45 #include "ortools/base/macros.h" // for DISALLOW_COPY_AND_ASSIGN, NULL
46 #include "ortools/base/map_util.h"
48 #include "ortools/base/statusor.h"
52 
53 namespace operations_research {
54 namespace glop {
55 
56 // Reads a linear program in the mps format.
57 //
58 // All Parse() methods clear the previously parsed instance and store the result
59 // in the given Data class.
60 
61 class MPSReader {
62  public:
63  enum Form { AUTO_DETECT, FREE, FIXED };
64 
65  // Parses instance from a file.
66  absl::Status ParseFile(const std::string& file_name, LinearProgram* data,
67  Form form = AUTO_DETECT);
68 
69  absl::Status ParseFile(const std::string& file_name, MPModelProto* data,
70  Form form = AUTO_DETECT);
71 };
72 
73 } // namespace glop
74 } // namespace operations_research
75 
76 #endif // OR_TOOLS_LP_DATA_MPS_READER_H_
map_util.h
lp_data.h
linear_solver.pb.h
logging.h
operations_research::glop::MPSReader::AUTO_DETECT
@ AUTO_DETECT
Definition: mps_reader.h:63
statusor.h
macros.h
operations_research
The vehicle routing library lets one model and solve generic vehicle routing problems ranging from th...
Definition: dense_doubly_linked_list.h:21
operations_research::glop::LinearProgram
Definition: lp_data.h:55
filelineiter.h
protobuf_util.h
operations_research::glop::MPSReader::Form
Form
Definition: mps_reader.h:63
operations_research::glop::MPSReader::ParseFile
absl::Status ParseFile(const std::string &file_name, LinearProgram *data, Form form=AUTO_DETECT)
Definition: mps_reader.cc:1037
int_type.h
int_type_indexed_vector.h
status_macros.h
operations_research::glop::MPSReader::FIXED
@ FIXED
Definition: mps_reader.h:63
operations_research::glop::MPSReader::FREE
@ FREE
Definition: mps_reader.h:63
hash.h
lp_types.h
commandlineflags.h
operations_research::glop::MPSReader
Definition: mps_reader.h:61