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/decision_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, DecisionMode mode) |
29 |
|
{ |
30 |
|
switch(mode) |
31 |
|
{ |
32 |
|
case DecisionMode::INTERNAL: return os << "internal"; |
33 |
|
case DecisionMode::JUSTIFICATION_OLD: return os << "justification-old"; |
34 |
|
case DecisionMode::STOPONLY_OLD: return os << "stoponly-old"; |
35 |
|
case DecisionMode::JUSTIFICATION: return os << "justification"; |
36 |
|
case DecisionMode::STOPONLY: return os << "stoponly"; |
37 |
|
default: Unreachable(); |
38 |
|
} |
39 |
|
return os; |
40 |
|
} |
41 |
102 |
DecisionMode stringToDecisionMode(const std::string& optarg) |
42 |
|
{ |
43 |
102 |
if (optarg == "internal") return DecisionMode::INTERNAL; |
44 |
92 |
else if (optarg == "justification-old") return DecisionMode::JUSTIFICATION_OLD; |
45 |
89 |
else if (optarg == "stoponly-old") return DecisionMode::STOPONLY_OLD; |
46 |
89 |
else if (optarg == "justification") return DecisionMode::JUSTIFICATION; |
47 |
|
else if (optarg == "stoponly") return DecisionMode::STOPONLY; |
48 |
|
else if (optarg == "help") |
49 |
|
{ |
50 |
|
std::cerr << R"FOOBAR( |
51 |
|
Decision modes. |
52 |
|
Available modes for --decision are: |
53 |
|
+ internal (default) |
54 |
|
Use the internal decision heuristics of the SAT solver. |
55 |
|
+ justification-old |
56 |
|
Older implementation of an ATGP-inspired justification heuristic. |
57 |
|
+ stoponly-old |
58 |
|
Use the old implementation of justification heuristic only to stop early, not |
59 |
|
for decisions. |
60 |
|
+ justification |
61 |
|
An ATGP-inspired justification heuristic. |
62 |
|
+ stoponly |
63 |
|
Use the justification heuristic only to stop early, not for decisions. |
64 |
|
)FOOBAR"; |
65 |
|
std::exit(1); |
66 |
|
} |
67 |
|
throw OptionException(std::string("unknown option for --decision: `") + |
68 |
|
optarg + "'. Try --decision=help."); |
69 |
|
} |
70 |
|
std::ostream& operator<<(std::ostream& os, DecisionWeightInternal mode) |
71 |
|
{ |
72 |
|
switch(mode) |
73 |
|
{ |
74 |
|
case DecisionWeightInternal::SUM: return os << "sum"; |
75 |
|
case DecisionWeightInternal::MAX: return os << "max"; |
76 |
|
case DecisionWeightInternal::USR1: return os << "usr1"; |
77 |
|
case DecisionWeightInternal::OFF: return os << "off"; |
78 |
|
default: Unreachable(); |
79 |
|
} |
80 |
|
return os; |
81 |
|
} |
82 |
|
DecisionWeightInternal stringToDecisionWeightInternal(const std::string& optarg) |
83 |
|
{ |
84 |
|
if (optarg == "sum") return DecisionWeightInternal::SUM; |
85 |
|
else if (optarg == "max") return DecisionWeightInternal::MAX; |
86 |
|
else if (optarg == "usr1") return DecisionWeightInternal::USR1; |
87 |
|
else if (optarg == "off") return DecisionWeightInternal::OFF; |
88 |
|
else if (optarg == "help") |
89 |
|
{ |
90 |
|
std::cerr << R"FOOBAR( |
91 |
|
Decision weight internal mode. |
92 |
|
Available hows for --decision-weight-internal are: |
93 |
|
)FOOBAR"; |
94 |
|
std::exit(1); |
95 |
|
} |
96 |
|
throw OptionException(std::string("unknown option for --decision-weight-internal: `") + |
97 |
|
optarg + "'. Try --decision-weight-internal=help."); |
98 |
|
} |
99 |
|
std::ostream& operator<<(std::ostream& os, JutificationSkolemMode mode) |
100 |
|
{ |
101 |
|
switch(mode) |
102 |
|
{ |
103 |
|
case JutificationSkolemMode::LAST: return os << "last"; |
104 |
|
case JutificationSkolemMode::FIRST: return os << "first"; |
105 |
|
default: Unreachable(); |
106 |
|
} |
107 |
|
return os; |
108 |
|
} |
109 |
|
JutificationSkolemMode stringToJutificationSkolemMode(const std::string& optarg) |
110 |
|
{ |
111 |
|
if (optarg == "last") return JutificationSkolemMode::LAST; |
112 |
|
else if (optarg == "first") return JutificationSkolemMode::FIRST; |
113 |
|
else if (optarg == "help") |
114 |
|
{ |
115 |
|
std::cerr << R"FOOBAR( |
116 |
|
Policy for when to satisfy skolem definitions in justification heuristic |
117 |
|
Available modes for --jh-skolem are: |
118 |
|
+ last |
119 |
|
satisfy pending relevant skolem definitions after input assertions |
120 |
|
+ first (default) |
121 |
|
satisfy pending relevant skolem definitions before input assertions |
122 |
|
)FOOBAR"; |
123 |
|
std::exit(1); |
124 |
|
} |
125 |
|
throw OptionException(std::string("unknown option for --jh-skolem: `") + |
126 |
|
optarg + "'. Try --jh-skolem=help."); |
127 |
|
} |
128 |
|
std::ostream& operator<<(std::ostream& os, JutificationSkolemRlvMode mode) |
129 |
|
{ |
130 |
|
switch(mode) |
131 |
|
{ |
132 |
|
case JutificationSkolemRlvMode::ALWAYS: return os << "always"; |
133 |
|
case JutificationSkolemRlvMode::ASSERT: return os << "assert"; |
134 |
|
default: Unreachable(); |
135 |
|
} |
136 |
|
return os; |
137 |
|
} |
138 |
|
JutificationSkolemRlvMode stringToJutificationSkolemRlvMode(const std::string& optarg) |
139 |
|
{ |
140 |
|
if (optarg == "always") return JutificationSkolemRlvMode::ALWAYS; |
141 |
|
else if (optarg == "assert") return JutificationSkolemRlvMode::ASSERT; |
142 |
|
else if (optarg == "help") |
143 |
|
{ |
144 |
|
std::cerr << R"FOOBAR( |
145 |
|
Policy for when to consider skolem definitions relevant in justification |
146 |
|
heuristic |
147 |
|
Available modes for --jh-skolem-rlv are: |
148 |
|
+ always |
149 |
|
skolems are always relevant |
150 |
|
+ assert (default) |
151 |
|
skolems are relevant when they occur in an asserted literal |
152 |
|
)FOOBAR"; |
153 |
|
std::exit(1); |
154 |
|
} |
155 |
|
throw OptionException(std::string("unknown option for --jh-skolem-rlv: `") + |
156 |
|
optarg + "'. Try --jh-skolem-rlv=help."); |
157 |
|
} |
158 |
|
// clang-format on |
159 |
|
|
160 |
31137 |
} // namespace cvc5::options |