OR-Tools  9.6
glpk_formatters.h
Go to the documentation of this file.
1 // Copyright 2010-2022 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 // Formatting functions for GLPK constants.
15 #ifndef OR_TOOLS_GLPK_GLPK_FORMATTERS_H_
16 #define OR_TOOLS_GLPK_GLPK_FORMATTERS_H_
17 
18 #include <string>
19 #include <string_view>
20 
21 namespace operations_research {
22 
23 // Formats a solution status (GLP_OPT,...).
24 std::string SolutionStatusString(int status);
25 
26 // Formats a linear constraint or variable basis status (GLP_BS,...).
27 std::string BasisStatusString(int stat);
28 
29 // Formats the return code of glp_intopt(), glp_simplex(), glp_exact() and
30 // glp_interior() to a string.
31 std::string ReturnCodeString(int rc);
32 
33 // The maximum length of GLPK's names for the problem, the variables and the
34 // constraints.
35 inline constexpr std::size_t kMaxGLPKNameLen = 255;
36 
37 // Returns a name which size is < kMaxGLPKNameLen and that does not contain
38 // control characters (as define by iscntrl()) (escaped using \xHH sequences).
39 std::string TruncateAndQuoteGLPKName(std::string_view original_name);
40 
41 } // namespace operations_research
42 
43 #endif // OR_TOOLS_GLPK_GLPK_FORMATTERS_H_
absl::Status status
Definition: g_gurobi.cc:41
Collection of objects used to extend the Constraint Solver library.
std::string BasisStatusString(const int stat)
constexpr std::size_t kMaxGLPKNameLen
std::string ReturnCodeString(const int rc)
std::string SolutionStatusString(const int status)
std::string TruncateAndQuoteGLPKName(const std::string_view original_name)