dlinear  0.0.1
Delta-complete SMT solver for linear programming
Loading...
Searching...
No Matches
LpColBound.cpp
1
6#include "LpColBound.h"
7
8#include "dlinear/util/exception.h"
9
10namespace dlinear {
11
12LpColBound parseLpbound(char bound) {
13 switch (bound) {
14 case 'u':
15 return LpColBound::SU;
16 case 'U':
17 return LpColBound::U;
18 case 'B':
19 return LpColBound::B;
20 case 'D':
21 return LpColBound::D;
22 case 'l':
23 return LpColBound::SL;
24 case 'L':
25 return LpColBound::L;
26 case 'F':
27 return LpColBound::F;
28 default:
29 DLINEAR_UNREACHABLE();
30 }
31}
32
33char toChar(LpColBound bound) {
34 switch (bound) {
35 case LpColBound::SU:
36 return 'u';
37 case LpColBound::U:
38 return 'U';
39 case LpColBound::B:
40 return 'B';
41 case LpColBound::D:
42 return 'D';
43 case LpColBound::SL:
44 return 'l';
45 case LpColBound::L:
46 return 'L';
47 case LpColBound::F:
48 return 'F';
49 default:
50 DLINEAR_UNREACHABLE();
51 }
52}
53
55 switch (bound) {
56 case LpColBound::SU:
57 return LpColBound::L;
58 case LpColBound::U:
59 return LpColBound::SL;
60 case LpColBound::B:
61 return LpColBound::D;
62 case LpColBound::D:
63 return LpColBound::B;
64 case LpColBound::SL:
65 return LpColBound::U;
66 case LpColBound::L:
67 return LpColBound::SU;
68 default:
69 DLINEAR_UNREACHABLE();
70 }
71}
72
74 switch (bound) {
75 case LpColBound::U:
76 return LpColBound::L;
77 case LpColBound::L:
78 return LpColBound::U;
79 case LpColBound::B:
80 return LpColBound::F;
81 case LpColBound::F:
82 return LpColBound::B;
83 default:
84 DLINEAR_UNREACHABLE();
85 }
86}
87
89 switch (bound) {
90 case LpColBound::SL:
91 return LpColBound::L;
92 case LpColBound::SU:
93 return LpColBound::U;
94 case LpColBound::D:
95 return LpColBound::F;
96 default:
97 return bound;
98 }
99}
100
101std::ostream &operator<<(std::ostream &os, const LpColBound &bound) { return os << toChar(bound); }
102
103} // namespace dlinear
Global namespace for the dlinear library.
LpColBound operator~(LpColBound bound)
Relax the bound.
char toChar(LpColBound bound)
Convert the bound to a character.
LpColBound operator!(LpColBound bound)
Invert the bound with delta == 0.
LpColBound
Describe the bound of a linear program variable.
Definition LpColBound.h:21
@ U
Upper bound.
@ SL
Strict lower bound.
@ F
Free variable.
@ B
Both upper and lower bound are equal (fixed)
@ L
Lower bound.
@ D
Variable must be different from the bound.
@ SU
Strict upper bound.
LpColBound operator-(LpColBound bound)
Invert the bound with delta > 0.