1 |
|
/****************************************************************************** |
2 |
|
* Top contributors (to current version): |
3 |
|
* Mathias Preiner, Aina Niemetz |
4 |
|
* |
5 |
|
* This file is part of the cvc5 project. |
6 |
|
* |
7 |
|
* Copyright (c) 2009-2021 by the authors listed in the file AUTHORS |
8 |
|
* in the top-level source directory and their institutional affiliations. |
9 |
|
* All rights reserved. See the file COPYING in the top-level source |
10 |
|
* directory for licensing information. |
11 |
|
* **************************************************************************** |
12 |
|
* |
13 |
|
* Option template for option modules. |
14 |
|
* |
15 |
|
* For each <module>_options.toml configuration file, mkoptions.py |
16 |
|
* expands this template and generates a <module>_options.cpp file. |
17 |
|
*/ |
18 |
|
#include "options/arith_options.h" |
19 |
|
|
20 |
|
#include <iostream> |
21 |
|
|
22 |
|
#include "base/check.h" |
23 |
|
#include "options/option_exception.h" |
24 |
|
|
25 |
|
namespace cvc5::options { |
26 |
|
|
27 |
|
// clang-format off |
28 |
|
std::ostream& operator<<(std::ostream& os, ArithPropagationMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case ArithPropagationMode::UNATE_PROP: return os << "unate"; |
33 |
|
case ArithPropagationMode::BOTH_PROP: return os << "both"; |
34 |
|
case ArithPropagationMode::BOUND_INFERENCE_PROP: return os << "bi"; |
35 |
|
case ArithPropagationMode::NO_PROP: return os << "none"; |
36 |
|
default: Unreachable(); |
37 |
|
} |
38 |
|
return os; |
39 |
|
} |
40 |
|
ArithPropagationMode stringToArithPropagationMode(const std::string& optarg) |
41 |
|
{ |
42 |
|
if (optarg == "unate") return ArithPropagationMode::UNATE_PROP; |
43 |
|
else if (optarg == "both") return ArithPropagationMode::BOTH_PROP; |
44 |
|
else if (optarg == "bi") return ArithPropagationMode::BOUND_INFERENCE_PROP; |
45 |
|
else if (optarg == "none") return ArithPropagationMode::NO_PROP; |
46 |
|
else if (optarg == "help") |
47 |
|
{ |
48 |
|
std::cerr << R"FOOBAR( |
49 |
|
This decides on kind of propagation arithmetic attempts to do during the |
50 |
|
search. |
51 |
|
Available modes for --arith-prop are: |
52 |
|
+ unate |
53 |
|
Use constraints to do unate propagation. |
54 |
|
+ both (default) |
55 |
|
Use bounds inference and unate. |
56 |
|
+ bi |
57 |
|
(Bounds Inference) infers bounds on basic variables using the upper and lower |
58 |
|
bounds of the non-basic variables in the tableau. |
59 |
|
)FOOBAR"; |
60 |
|
std::exit(1); |
61 |
|
} |
62 |
|
throw OptionException(std::string("unknown option for --arith-prop: `") + |
63 |
|
optarg + "'. Try --arith-prop=help."); |
64 |
|
} |
65 |
|
std::ostream& operator<<(std::ostream& os, ErrorSelectionRule mode) |
66 |
|
{ |
67 |
|
switch(mode) |
68 |
|
{ |
69 |
|
case ErrorSelectionRule::MINIMUM_AMOUNT: return os << "min"; |
70 |
|
case ErrorSelectionRule::MAXIMUM_AMOUNT: return os << "max"; |
71 |
|
case ErrorSelectionRule::VAR_ORDER: return os << "varord"; |
72 |
|
case ErrorSelectionRule::SUM_METRIC: return os << "sum"; |
73 |
|
default: Unreachable(); |
74 |
|
} |
75 |
|
return os; |
76 |
|
} |
77 |
|
ErrorSelectionRule stringToErrorSelectionRule(const std::string& optarg) |
78 |
|
{ |
79 |
|
if (optarg == "min") return ErrorSelectionRule::MINIMUM_AMOUNT; |
80 |
|
else if (optarg == "max") return ErrorSelectionRule::MAXIMUM_AMOUNT; |
81 |
|
else if (optarg == "varord") return ErrorSelectionRule::VAR_ORDER; |
82 |
|
else if (optarg == "sum") return ErrorSelectionRule::SUM_METRIC; |
83 |
|
else if (optarg == "help") |
84 |
|
{ |
85 |
|
std::cerr << R"FOOBAR( |
86 |
|
This decides on the rule used by simplex during heuristic rounds for deciding |
87 |
|
the next basic variable to select. |
88 |
|
Available rules for --error-selection-rule are: |
89 |
|
+ min (default) |
90 |
|
The minimum abs() value of the variable's violation of its bound. |
91 |
|
+ max |
92 |
|
The maximum violation the bound. |
93 |
|
+ varord |
94 |
|
The variable order. |
95 |
|
)FOOBAR"; |
96 |
|
std::exit(1); |
97 |
|
} |
98 |
|
throw OptionException(std::string("unknown option for --error-selection-rule: `") + |
99 |
|
optarg + "'. Try --error-selection-rule=help."); |
100 |
|
} |
101 |
|
std::ostream& operator<<(std::ostream& os, NlCadLiftingMode mode) |
102 |
|
{ |
103 |
|
switch(mode) |
104 |
|
{ |
105 |
|
case NlCadLiftingMode::REGULAR: return os << "regular"; |
106 |
|
case NlCadLiftingMode::LAZARD: return os << "lazard"; |
107 |
|
default: Unreachable(); |
108 |
|
} |
109 |
|
return os; |
110 |
|
} |
111 |
|
NlCadLiftingMode stringToNlCadLiftingMode(const std::string& optarg) |
112 |
|
{ |
113 |
|
if (optarg == "regular") return NlCadLiftingMode::REGULAR; |
114 |
|
else if (optarg == "lazard") return NlCadLiftingMode::LAZARD; |
115 |
|
else if (optarg == "help") |
116 |
|
{ |
117 |
|
std::cerr << R"FOOBAR( |
118 |
|
Modes for the CAD lifting in non-linear arithmetic. |
119 |
|
Available modes for --nl-cad-lift are: |
120 |
|
+ regular (default) |
121 |
|
Regular lifting. |
122 |
|
+ lazard |
123 |
|
Lazard's lifting scheme. |
124 |
|
)FOOBAR"; |
125 |
|
std::exit(1); |
126 |
|
} |
127 |
|
throw OptionException(std::string("unknown option for --nl-cad-lift: `") + |
128 |
|
optarg + "'. Try --nl-cad-lift=help."); |
129 |
|
} |
130 |
|
std::ostream& operator<<(std::ostream& os, NlCadProjectionMode mode) |
131 |
|
{ |
132 |
|
switch(mode) |
133 |
|
{ |
134 |
|
case NlCadProjectionMode::LAZARD: return os << "lazard"; |
135 |
|
case NlCadProjectionMode::MCCALLUM: return os << "mccallum"; |
136 |
|
case NlCadProjectionMode::LAZARDMOD: return os << "lazard-mod"; |
137 |
|
default: Unreachable(); |
138 |
|
} |
139 |
|
return os; |
140 |
|
} |
141 |
|
NlCadProjectionMode stringToNlCadProjectionMode(const std::string& optarg) |
142 |
|
{ |
143 |
|
if (optarg == "lazard") return NlCadProjectionMode::LAZARD; |
144 |
|
else if (optarg == "mccallum") return NlCadProjectionMode::MCCALLUM; |
145 |
|
else if (optarg == "lazard-mod") return NlCadProjectionMode::LAZARDMOD; |
146 |
|
else if (optarg == "help") |
147 |
|
{ |
148 |
|
std::cerr << R"FOOBAR( |
149 |
|
Modes for the CAD projection operator in non-linear arithmetic. |
150 |
|
Available modes for --nl-cad-proj are: |
151 |
|
+ lazard |
152 |
|
Lazard's projection operator. |
153 |
|
+ mccallum (default) |
154 |
|
McCallum's projection operator. |
155 |
|
+ lazard-mod |
156 |
|
A modification of Lazard's projection operator. |
157 |
|
)FOOBAR"; |
158 |
|
std::exit(1); |
159 |
|
} |
160 |
|
throw OptionException(std::string("unknown option for --nl-cad-proj: `") + |
161 |
|
optarg + "'. Try --nl-cad-proj=help."); |
162 |
|
} |
163 |
|
std::ostream& operator<<(std::ostream& os, NlExtMode mode) |
164 |
|
{ |
165 |
|
switch(mode) |
166 |
|
{ |
167 |
|
case NlExtMode::NONE: return os << "none"; |
168 |
|
case NlExtMode::LIGHT: return os << "light"; |
169 |
|
case NlExtMode::FULL: return os << "full"; |
170 |
|
default: Unreachable(); |
171 |
|
} |
172 |
|
return os; |
173 |
|
} |
174 |
126 |
NlExtMode stringToNlExtMode(const std::string& optarg) |
175 |
|
{ |
176 |
126 |
if (optarg == "none") return NlExtMode::NONE; |
177 |
120 |
else if (optarg == "light") return NlExtMode::LIGHT; |
178 |
120 |
else if (optarg == "full") return NlExtMode::FULL; |
179 |
|
else if (optarg == "help") |
180 |
|
{ |
181 |
|
std::cerr << R"FOOBAR( |
182 |
|
Modes for the non-linear linearization |
183 |
|
Available modes for --nl-ext are: |
184 |
|
+ none |
185 |
|
Disable linearization approach |
186 |
|
+ light |
187 |
|
Only use a few light-weight lemma schemes |
188 |
|
+ full (default) |
189 |
|
Use all lemma schemes |
190 |
|
)FOOBAR"; |
191 |
|
std::exit(1); |
192 |
|
} |
193 |
|
throw OptionException(std::string("unknown option for --nl-ext: `") + |
194 |
|
optarg + "'. Try --nl-ext=help."); |
195 |
|
} |
196 |
|
std::ostream& operator<<(std::ostream& os, NlRlvMode mode) |
197 |
|
{ |
198 |
|
switch(mode) |
199 |
|
{ |
200 |
|
case NlRlvMode::INTERLEAVE: return os << "interleave"; |
201 |
|
case NlRlvMode::NONE: return os << "none"; |
202 |
|
case NlRlvMode::ALWAYS: return os << "always"; |
203 |
|
default: Unreachable(); |
204 |
|
} |
205 |
|
return os; |
206 |
|
} |
207 |
6 |
NlRlvMode stringToNlRlvMode(const std::string& optarg) |
208 |
|
{ |
209 |
6 |
if (optarg == "interleave") return NlRlvMode::INTERLEAVE; |
210 |
6 |
else if (optarg == "none") return NlRlvMode::NONE; |
211 |
3 |
else if (optarg == "always") return NlRlvMode::ALWAYS; |
212 |
|
else if (optarg == "help") |
213 |
|
{ |
214 |
|
std::cerr << R"FOOBAR( |
215 |
|
Modes for using relevance of assertions in non-linear arithmetic. |
216 |
|
Available modes for --nl-rlv are: |
217 |
|
+ interleave |
218 |
|
Alternate rounds using relevance. |
219 |
|
+ none (default) |
220 |
|
Do not use relevance. |
221 |
|
+ always |
222 |
|
Always use relevance. |
223 |
|
)FOOBAR"; |
224 |
|
std::exit(1); |
225 |
|
} |
226 |
|
throw OptionException(std::string("unknown option for --nl-rlv: `") + |
227 |
|
optarg + "'. Try --nl-rlv=help."); |
228 |
|
} |
229 |
|
std::ostream& operator<<(std::ostream& os, ArithUnateLemmaMode mode) |
230 |
|
{ |
231 |
|
switch(mode) |
232 |
|
{ |
233 |
|
case ArithUnateLemmaMode::NO: return os << "none"; |
234 |
|
case ArithUnateLemmaMode::EQUALITY: return os << "eqs"; |
235 |
|
case ArithUnateLemmaMode::INEQUALITY: return os << "ineqs"; |
236 |
|
case ArithUnateLemmaMode::ALL: return os << "all"; |
237 |
|
default: Unreachable(); |
238 |
|
} |
239 |
|
return os; |
240 |
|
} |
241 |
|
ArithUnateLemmaMode stringToArithUnateLemmaMode(const std::string& optarg) |
242 |
|
{ |
243 |
|
if (optarg == "none") return ArithUnateLemmaMode::NO; |
244 |
|
else if (optarg == "eqs") return ArithUnateLemmaMode::EQUALITY; |
245 |
|
else if (optarg == "ineqs") return ArithUnateLemmaMode::INEQUALITY; |
246 |
|
else if (optarg == "all") return ArithUnateLemmaMode::ALL; |
247 |
|
else if (optarg == "help") |
248 |
|
{ |
249 |
|
std::cerr << R"FOOBAR( |
250 |
|
Unate lemmas are generated before SAT search begins using the relationship of |
251 |
|
constant terms and polynomials. |
252 |
|
Available modes for --unate-lemmas are: |
253 |
|
+ eqs |
254 |
|
Outputs lemmas of the general forms (= p c) implies (<= p d) for c < d, or (= |
255 |
|
p c) implies (not (= p d)) for c != d. |
256 |
|
+ ineqs |
257 |
|
Outputs lemmas of the general form (<= p c) implies (<= p d) for c < d. |
258 |
|
+ all (default) |
259 |
|
A combination of inequalities and equalities. |
260 |
|
)FOOBAR"; |
261 |
|
std::exit(1); |
262 |
|
} |
263 |
|
throw OptionException(std::string("unknown option for --unate-lemmas: `") + |
264 |
|
optarg + "'. Try --unate-lemmas=help."); |
265 |
|
} |
266 |
|
// clang-format on |
267 |
|
|
268 |
31137 |
} // namespace cvc5::options |