21#include "absl/strings/ascii.h"
22#include "absl/strings/str_cat.h"
34 return "undefined (UNDEF)";
36 return "feasible (FEAS)";
38 return "infeasible (INFEAS)";
40 return "no feasible solution (NOFEAS)";
42 return "optimal (OPT)";
44 return "unbounded (UNBND)";
46 return absl::StrCat(
"? (", status,
")");
55 return "lower bound (NL)";
57 return "upper bound (NU)";
59 return "unbounded (NF)";
63 return absl::StrCat(
"? (", stat,
")");
70 return "[GLP_EBADB] invalid basis";
72 return "[GLP_ESING] singular matrix";
74 return "[GLP_ECOND] ill-conditioned matrix";
76 return "[GLP_EBOUND] invalid bounds";
78 return "[GLP_EFAIL] solver failed";
80 return "[GLP_EOBJLL] objective lower limit reached";
82 return "[GLP_EOBJUL] objective upper limit reached";
84 return "[GLP_EITLIM] iteration limit exceeded";
86 return "[GLP_ETMLIM] time limit exceeded";
88 return "[GLP_ENOPFS] no primal feasible solution";
90 return "[GLP_ENODFS] no dual feasible solution";
92 return "[GLP_EROOT] root LP optimum not provided";
94 return "[GLP_ESTOP] search terminated by application";
96 return "[GLP_EMIPGAP] relative mip gap tolerance reached";
98 return "[GLP_ENOFEAS] no primal/dual feasible solution";
100 return "[GLP_ENOCVG] no convergence";
102 return "[GLP_EINSTAB] numerical instability";
104 return "[GLP_EDATA] invalid data";
106 return "[GLP_ERANGE] result out of range";
108 return absl::StrCat(
"[?] unknown return code ", rc);
113 std::ostringstream oss;
114 std::size_t current_size = 0;
115 for (
const char c : original_name) {
128 if (!absl::ascii_iscntrl(c)) {
138 const std::string escaped_c =
139 absl::StrCat(
"\\x", absl::Hex(c, absl::kZeroPad2));
144 current_size += escaped_c.size();
147 const std::string ret = oss.str();
148 DCHECK_EQ(ret.size(), current_size);
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,...).