13enum class ExitStatus : int8_t {
17 CALLBACK_REQUESTED_STOP = 1,
21 LOCALLY_INFEASIBLE = -2,
24 GLOBALLY_INFEASIBLE = -3,
26 FACTORIZATION_FAILED = -4,
29 LINE_SEARCH_FAILED = -5,
31 NONFINITE_INITIAL_COST_OR_CONSTRAINTS = -6,
33 DIVERGING_ITERATES = -7,
36 MAX_ITERATIONS_EXCEEDED = -8,
46struct std::formatter<slp::ExitStatus> {
51 constexpr auto parse(std::format_parse_context& ctx) {
52 return m_underlying.parse(ctx);
61 template <
typename FmtContext>
62 auto format(
const slp::ExitStatus& exit_status, FmtContext& ctx)
const {
63 using enum slp::ExitStatus;
65 switch (exit_status) {
67 return m_underlying.format(
"success", ctx);
68 case CALLBACK_REQUESTED_STOP:
69 return m_underlying.format(
"callback requested stop", ctx);
71 return m_underlying.format(
"too few degrees of freedom", ctx);
72 case LOCALLY_INFEASIBLE:
73 return m_underlying.format(
"locally infeasible", ctx);
74 case GLOBALLY_INFEASIBLE:
75 return m_underlying.format(
"globally infeasible", ctx);
76 case FACTORIZATION_FAILED:
77 return m_underlying.format(
"factorization failed", ctx);
78 case LINE_SEARCH_FAILED:
79 return m_underlying.format(
"line search failed", ctx);
80 case NONFINITE_INITIAL_COST_OR_CONSTRAINTS:
81 return m_underlying.format(
"nonfinite initial cost or constraints",
83 case DIVERGING_ITERATES:
84 return m_underlying.format(
"diverging iterates", ctx);
85 case MAX_ITERATIONS_EXCEEDED:
86 return m_underlying.format(
"max iterations exceeded", ctx);
88 return m_underlying.format(
"timeout", ctx);
95 std::formatter<const char*> m_underlying;