Google OR-Tools v9.12
a fast and portable software suite for combinatorial optimization
Loading...
Searching...
No Matches
glpk_formatters.h
Go to the documentation of this file.
1// Copyright 2010-2025 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 <cstddef>
19#include <string>
20#include <string_view>
21
22namespace operations_research {
23
24// Formats a solution status (GLP_OPT,...).
25std::string SolutionStatusString(int status);
26
27// Formats a linear constraint or variable basis status (GLP_BS,...).
28std::string BasisStatusString(int stat);
29
30// Formats the return code of glp_intopt(), glp_simplex(), glp_exact() and
31// glp_interior() to a string.
32std::string ReturnCodeString(int rc);
33
34// The maximum length of GLPK's names for the problem, the variables and the
35// constraints.
36inline constexpr std::size_t kMaxGLPKNameLen = 255;
37
38// Returns a name which size is < kMaxGLPKNameLen and that does not contain
39// control characters (as define by iscntrl()) (escaped using \xHH sequences).
40std::string TruncateAndQuoteGLPKName(std::string_view original_name);
41
42} // namespace operations_research
43
44#endif // OR_TOOLS_GLPK_GLPK_FORMATTERS_H_
In SWIG mode, we don't want anything besides these top-level includes.
std::string BasisStatusString(const int stat)
Formats a linear constraint or variable basis status (GLP_BS,...).
std::string TruncateAndQuoteGLPKName(const std::string_view original_name)
constexpr std::size_t kMaxGLPKNameLen
std::string ReturnCodeString(const int rc)
std::string SolutionStatusString(const int status)
Formats a solution status (GLP_OPT,...).