Sleipnir C++ API
Loading...
Searching...
No Matches
SolverExitCondition.hpp
Go to the documentation of this file.
1// Copyright (c) Sleipnir contributors
2
3#pragma once
4
5#include <stdint.h>
6
7#include <string_view>
8
10
11namespace sleipnir {
12
41
47SLEIPNIR_DLLEXPORT constexpr std::string_view ToMessage(
48 const SolverExitCondition& exitCondition) {
50
51 switch (exitCondition) {
52 case kSuccess:
53 return "solved to desired tolerance";
55 return "solved to acceptable tolerance";
57 return "callback requested stop";
58 case kTooFewDOFs:
59 return "problem has too few degrees of freedom";
61 return "problem is locally infeasible";
63 return "solver failed to reach the desired tolerance, and feasibility "
64 "restoration failed to converge";
66 return "solver encountered nonfinite initial cost or constraints and "
67 "gave up";
69 return "solver encountered diverging primal iterates xₖ and/or sₖ and "
70 "gave up";
72 return "solution returned after maximum iterations exceeded";
73 case kTimeout:
74 return "solution returned after maximum wall clock time exceeded";
75 default:
76 return "unknown";
77 }
78}
79
80} // namespace sleipnir
#define SLEIPNIR_DLLEXPORT
Definition SymbolExports.hpp:34
Definition Expression.hpp:18
IntrusiveSharedPtr< T > AllocateIntrusiveShared(Alloc alloc, Args &&... args)
Definition IntrusiveSharedPtr.hpp:275
SLEIPNIR_DLLEXPORT constexpr std::string_view ToMessage(const SolverExitCondition &exitCondition)
Definition SolverExitCondition.hpp:47
SolverExitCondition
Definition SolverExitCondition.hpp:16
@ kNonfiniteInitialCostOrConstraints
The solver encountered nonfinite initial cost or constraints and gave up.
@ kLocallyInfeasible
The solver determined the problem to be locally infeasible and gave up.
@ kSuccess
Solved the problem to the desired tolerance.
@ kSolvedToAcceptableTolerance
Solved the problem to an acceptable tolerance, but not the desired one.
@ kTooFewDOFs
The solver determined the problem to be overconstrained and gave up.
@ kDivergingIterates
The solver encountered diverging primal iterates xₖ and/or sₖ and gave up.
@ kCallbackRequestedStop
The solver returned its solution so far after the user requested a stop.