forked from RobotLocomotion/drake
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsolution_result.cc
35 lines (32 loc) · 1.07 KB
/
solution_result.cc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "drake/solvers/solution_result.h"
namespace drake {
namespace solvers {
std::string to_string(SolutionResult solution_result) {
switch (solution_result) {
case SolutionResult::kSolutionFound:
return "SolutionFound";
case SolutionResult::kInvalidInput:
return "InvalidInput";
case SolutionResult::kInfeasibleConstraints:
return "InfeasibleConstraints";
case SolutionResult::kUnbounded:
return "Unbounded";
case SolutionResult::kInfeasibleOrUnbounded:
return "InfeasibleOrUnbounded";
case SolutionResult::kIterationLimit:
return "IterationLimit";
case SolutionResult::kUnknownError:
return "UnknownError";
case SolutionResult::kDualInfeasible:
return "DualInfeasible";
}
// The following lines should not be reached, we add this line due to a defect
// in the compiler.
throw std::runtime_error("Should not reach here");
}
std::ostream& operator<<(std::ostream& os, SolutionResult solution_result) {
os << to_string(solution_result);
return os;
}
} // namespace solvers
} // namespace drake