18 #include <string_view>
20 #include "absl/strings/ascii.h"
21 #include "absl/strings/str_cat.h"
33 return "undefined (UNDEF)";
35 return "feasible (FEAS)";
37 return "infeasible (INFEAS)";
39 return "no feasible solution (NOFEAS)";
41 return "optimal (OPT)";
43 return "unbounded (UNBND)";
45 return absl::StrCat(
"? (",
status,
")");
54 return "lower bound (NL)";
56 return "upper bound (NU)";
58 return "unbounded (NF)";
62 return absl::StrCat(
"? (", stat,
")");
69 return "[GLP_EBADB] invalid basis";
71 return "[GLP_ESING] singular matrix";
73 return "[GLP_ECOND] ill-conditioned matrix";
75 return "[GLP_EBOUND] invalid bounds";
77 return "[GLP_EFAIL] solver failed";
79 return "[GLP_EOBJLL] objective lower limit reached";
81 return "[GLP_EOBJUL] objective upper limit reached";
83 return "[GLP_EITLIM] iteration limit exceeded";
85 return "[GLP_ETMLIM] time limit exceeded";
87 return "[GLP_ENOPFS] no primal feasible solution";
89 return "[GLP_ENODFS] no dual feasible solution";
91 return "[GLP_EROOT] root LP optimum not provided";
93 return "[GLP_ESTOP] search terminated by application";
95 return "[GLP_EMIPGAP] relative mip gap tolerance reached";
97 return "[GLP_ENOFEAS] no primal/dual feasible solution";
99 return "[GLP_ENOCVG] no convergence";
101 return "[GLP_EINSTAB] numerical instability";
103 return "[GLP_EDATA] invalid data";
105 return "[GLP_ERANGE] result out of range";
107 return absl::StrCat(
"[?] unknown return code ", rc);
112 std::ostringstream oss;
113 std::size_t current_size = 0;
114 for (
const char c : original_name) {
127 if (!absl::ascii_iscntrl(c)) {
137 const std::string escaped_c =
138 absl::StrCat(
"\\x", absl::Hex(c, absl::kZeroPad2));
143 current_size += escaped_c.size();
146 const std::string ret = oss.str();
147 DCHECK_EQ(ret.size(), current_size);
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)