delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
LpResult.cpp
1
6#include "delpi/solver/LpResult.h"
7
8#include <ostream>
9
10#include "delpi/util/error.h"
11
12namespace delpi {
13
14std::ostream &operator<<(std::ostream &os, const LpResult result) {
15 switch (result) {
17 return os << "unsolved";
19 return os << "optimal";
21 return os << "delta-optimal";
23 return os << "unbounded";
25 return os << "infeasible";
26 case LpResult::ERROR:
27 return os << "error";
28 default:
29 DELPI_UNREACHABLE();
30 }
31}
32
34 switch (result) {
38 default:
39 return result;
40 }
41}
42
43bool IsFeasible(const LpResult result) {
44 switch (result) {
48 return true;
49 default:
50 return false;
51 }
52}
53int ExitCode(const LpResult result) {
54 switch (result) {
59 return 0;
60 case LpResult::ERROR:
61 return 1;
62 default:
63 return 2;
64 }
65}
66
67} // namespace delpi
Global namespace for the delpi library.
LpResult
Possible outcomes of the LP solver.
Definition LpResult.h:14
@ INFEASIBLE
The problem is infeasible.
Definition LpResult.h:19
@ DELTA_OPTIMAL
The delta-relaxation of the problem is optimal.
Definition LpResult.h:17
@ UNBOUNDED
The problem is unbounded.
Definition LpResult.h:18
@ ERROR
An error occurred.
Definition LpResult.h:20
@ OPTIMAL
The problem is optimal.
Definition LpResult.h:16
@ UNSOLVED
The solver has not yet been run.
Definition LpResult.h:15
bool IsFeasible(const LpResult result)
Check if the result obtained by the LpSolver implies that the problem is feasible.
Definition LpResult.cpp:43
LpResult operator~(const LpResult result)
Relax the result of the theory solver (i.e.
Definition LpResult.cpp:33
int ExitCode(const LpResult result)
Convert the result in.
Definition LpResult.cpp:53