ABC: A System for Sequential Synthesis and Verification
 
Loading...
Searching...
No Matches
options.hpp
Go to the documentation of this file.
1#ifndef _options_hpp_INCLUDED
2#define _options_hpp_INCLUDED
3
4#include "global.h"
5
7
8/*------------------------------------------------------------------------*/
9
10// In order to add a new option, simply add a new line below. Make sure that
11// options are sorted correctly (with '!}sort -k 2' in 'vi'). Otherwise
12// initializing the options will trigger an internal error. For the model
13// based tester 'mobical' the policy is that options which become redundant
14// because another one is disabled (set to zero) should have the name of the
15// latter as prefix. The 'O' column determines the options which are
16// target to 'optimize' them ('-O[1-3]'). A zero value in the 'O' column
17// means that this option is not optimized. A value of '1' results in
18// optimizing its value exponentially with exponent base '2', and a value
19// of '2' uses base '10'. The 'P' column determines simplification
20// options (disabled with '--plain') and 'R' which values can be reset.
21
22// clang-format off
23
24#define OPTIONS \
25\
26/* NAME DEFAULT, LO, HI,O,P,R, USAGE */ \
27\
28OPTION( arena, 1, 0, 1,0,0,1, "allocate clauses in arena") \
29OPTION( arenacompact, 1, 0, 1,0,0,1, "keep clauses compact") \
30OPTION( arenasort, 1, 0, 1,0,0,1, "sort clauses in arena") \
31OPTION( arenatype, 3, 1, 3,0,0,1, "1=clause, 2=var, 3=queue") \
32OPTION( binary, 1, 0, 1,0,0,1, "use binary proof format") \
33OPTION( block, 0, 0, 1,0,1,1, "blocked clause elimination") \
34OPTION( blockmaxclslim, 1e5, 1,2e9,2,0,1, "maximum clause size") \
35OPTION( blockminclslim, 2, 2,2e9,0,0,1, "minimum clause size") \
36OPTION( blockocclim, 1e2, 1,2e9,2,0,1, "occurrence limit") \
37OPTION( bump, 1, 0, 1,0,0,1, "bump variables") \
38OPTION( bumpreason, 1, 0, 1,0,0,1, "bump reason literals too") \
39OPTION( bumpreasondepth, 1, 1, 3,0,0,1, "bump reason depth") \
40OPTION( bumpreasonlimit, 10, 1,2e9,0,0,1, "bump reason limit") \
41OPTION( bumpreasonrate, 100, 1,2e9,0,0,1, "bump reason decision rate") \
42OPTION( check, 0, 0, 1,0,0,0, "enable internal checking") \
43OPTION( checkassumptions, 1, 0, 1,0,0,0, "check assumptions satisfied") \
44OPTION( checkconstraint, 1, 0, 1,0,0,0, "check constraint satisfied") \
45OPTION( checkfailed, 1, 0, 1,0,0,0, "check failed literals form core") \
46OPTION( checkfrozen, 0, 0, 1,0,0,0, "check all frozen semantics") \
47OPTION( checkproof, 3, 0, 3,0,0,0, "1=drat, 2=lrat, 3=both") \
48OPTION( checkwitness, 1, 0, 1,0,0,0, "check witness internally") \
49OPTION( chrono, 1, 0, 2,0,0,1, "chronological backtracking") \
50OPTION( chronoalways, 0, 0, 1,0,0,1, "force always chronological") \
51OPTION( chronolevelim, 1e2, 0,2e9,0,0,1, "chronological level limit") \
52OPTION( chronoreusetrail, 1, 0, 1,0,0,1, "reuse trail chronologically") \
53OPTION( compact, 1, 0, 1,0,1,1, "compact internal variables") \
54OPTION( compactint, 2e3, 1,2e9,0,0,1, "compacting interval") \
55OPTION( compactlim, 1e2, 0,1e3,0,0,1, "inactive limit per mille") \
56OPTION( compactmin, 1e2, 1,2e9,0,0,1, "minimum inactive limit") \
57OPTION( condition, 0, 0, 1,0,1,1, "globally blocked clause elim") \
58OPTION( conditioneffort, 100, 1,1e5,0,0,1, "relative efficiency per mille") \
59OPTION( conditionint, 1e4, 1,2e9,0,0,1, "initial conflict interval") \
60OPTION( conditionmaxeff, 1e7, 0,2e9,1,0,1, "maximum condition efficiency") \
61OPTION( conditionmaxrat, 100, 1,2e9,1,0,1, "maximum clause variable ratio") \
62OPTION( conditionmineff, 0, 0,2e9,1,0,1, "minimum condition efficiency") \
63OPTION( congruence, 1, 0, 1,0,0,1, "congruence closure") \
64OPTION( congruenceand, 1, 0, 1,0,0,1, "extract AND gates") \
65OPTION( congruenceandarity,1e6,2,5e7,0,0,1, "AND gate arity limit") \
66OPTION( congruencebinaries,1, 0, 1,0,0,1, "extract binary and strengthen ternary clauses") \
67OPTION( congruenceite, 1, 0, 1,0,0,1, "extract ITE gates") \
68OPTION( congruencexor, 1, 0, 1,0,0,1, "extract XOR gates") \
69OPTION( congruencexorarity,4, 2, 31,0,0,1, "XOR gate arity limit") \
70OPTION( congruencexorcounts,1, 1,5e6,0,0,1, "XOR gate round") \
71OPTION( cover, 0, 0, 1,0,1,1, "covered clause elimination") \
72OPTION( covereffort, 4, 1,1e5,1,0,1, "relative efficiency per mille") \
73OPTION( covermaxclslim, 1e5, 1,2e9,2,0,1, "maximum clause size") \
74OPTION( covermaxeff, 1e8, 0,2e9,1,0,1, "maximum cover efficiency") \
75OPTION( coverminclslim, 2, 2,2e9,0,0,1, "minimum clause size") \
76OPTION( covermineff, 0, 0,2e9,1,0,1, "minimum cover efficiency") \
77OPTION( decompose, 1, 0, 1,0,1,1, "decompose BIG in SCCs and ELS") \
78OPTION( decomposerounds, 2, 1, 16,1,0,1, "number of decompose rounds") \
79OPTION( deduplicate, 1, 0, 1,0,1,1, "remove duplicated binaries") \
80OPTION( eagersubsume, 1, 0, 1,0,1,1, "subsume recently learned") \
81OPTION( eagersubsumelim, 20, 1,1e3,0,0,1, "limit on subsumed candidates") \
82OPTION( elim, 1, 0, 1,0,1,1, "bounded variable elimination") \
83OPTION( elimands, 1, 0, 1,0,0,1, "find AND gates") \
84OPTION( elimbackward, 1, 0, 1,0,0,1, "eager backward subsumption") \
85OPTION( elimboundmax, 16, -1,2e6,1,0,1, "maximum elimination bound") \
86OPTION( elimboundmin, 0, -1,2e6,0,0,1, "minimum elimination bound") \
87OPTION( elimclslim, 1e2, 2,2e9,2,0,1, "resolvent size limit") \
88OPTION( elimdef, 0, 0, 1,0,0,1, "mine definitions with cadical_kitten") \
89OPTION( elimdefcores, 1, 1,100,0,0,1, "number of unsat cores") \
90OPTION( elimdefticks, 2e5, 0,2e9,1,0,1, "cadical_kitten ticks limit") \
91OPTION( elimeffort, 1e3, 1,1e5,1,0,1, "relative efficiency per mille") \
92OPTION( elimequivs, 1, 0, 1,0,0,1, "find equivalence gates") \
93OPTION( elimint, 2e3, 1,2e9,0,0,1, "elimination interval") \
94OPTION( elimites, 1, 0, 1,0,0,1, "find if-then-else gates") \
95OPTION( elimlimited, 1, 0, 1,0,0,1, "limit resolutions") \
96OPTION( elimmaxeff, 2e9, 0,2e9,1,0,1, "maximum elimination efficiency") \
97OPTION( elimmineff, 1e7, 0,2e9,1,0,1, "minimum elimination efficiency") \
98OPTION( elimocclim, 1e2, 0,2e9,2,0,1, "occurrence limit") \
99OPTION( elimprod, 1, 0,1e4,0,0,1, "elim score product weight") \
100OPTION( elimrounds, 2, 1,512,1,0,1, "usual number of rounds") \
101OPTION( elimsubst, 1, 0, 1,0,0,1, "elimination by substitution") \
102OPTION( elimsum, 1, 0,1e4,0,0,1, "elimination score sum weight") \
103OPTION( elimxorlim, 5, 2, 27,1,0,1, "maximum XOR size") \
104OPTION( elimxors, 1, 0, 1,0,0,1, "find XOR gates") \
105OPTION( emadecisions, 1e5, 1,2e9,0,0,1, "window decision rate") \
106OPTION( emagluefast, 33, 1,2e9,0,0,1, "window fast glue") \
107OPTION( emaglueslow, 1e5, 1,2e9,0,0,1, "window slow glue") \
108OPTION( emajump, 1e5, 1,2e9,0,0,1, "window back-jump level") \
109OPTION( emalevel, 1e5, 1,2e9,0,0,1, "window back-track level") \
110OPTION( emasize, 1e5, 1,2e9,0,0,1, "window learned clause size") \
111OPTION( ematrailfast, 1e2, 1,2e9,0,0,1, "window fast trail") \
112OPTION( ematrailslow, 1e5, 1,2e9,0,0,1, "window slow trail") \
113OPTION( exteagerreasons, 1, 0, 1,0,0,1, "eagerly ask for all reasons (0: only when needed)") \
114OPTION( exteagerrecalc, 1, 0, 1,0,0,1, "after eagerly asking for reasons recalculate all levels (0: trust the external tool)") \
115OPTION( externallrat, 0, 0, 1,0,0,1, "external lrat") \
116OPTION( factor, 1, 0, 1,0,1,1, "bounded variable addition") \
117OPTION( factorcandrounds, 2, 0,2e9,0,0,1, "candidates reduction rounds") \
118OPTION( factoreffort, 50, 0,1e6,0,0,1, "relative effort per mille") \
119OPTION( factoriniticks, 300, 1,1e6,0,0,1, "initial effort in millions") \
120OPTION( factorsize, 5, 2,2e9,0,0,1, "clause size limit") \
121OPTION( factorthresh, 7, 0,100,1,0,1, "delay if ticks smaller thresh*clauses") \
122OPTION( fastelim, 1, 0, 1,0,1,1, "fast BVE during preprocessing") \
123OPTION( fastelimbound, 8, 1,1e3,1,0,1, "fast BVE bound during preprocessing") \
124OPTION( fastelimclslim, 1e2, 2,2e9,2,0,1, "fast BVE resolvent size limit") \
125OPTION( fastelimocclim, 100, 1,2e9,2,0,1, "fast BVE occurence limit during preprocessing") \
126OPTION( fastelimrounds, 4, 1,512,1,0,1, "number of fastelim rounds") \
127OPTION( flush, 0, 0, 1,0,1,1, "flush redundant clauses") \
128OPTION( flushfactor, 3, 1,1e3,0,0,1, "interval increase") \
129OPTION( flushint, 1e5, 1,2e9,0,0,1, "initial limit") \
130OPTION( forcephase, 0, 0, 1,0,0,1, "always use initial phase") \
131OPTION( frat, 0, 0, 2,0,0,1, "1=frat(lrat), 2=frat(drat)") \
132OPTION( idrup, 0, 0, 1,0,0,1, "incremental proof format") \
133OPTION( ilb, 0, 0, 1,0,0,1, "ILB (incremental lazy backtrack)") \
134OPTION( ilbassumptions, 0, 0, 1,0,0,1, "trail reuse for assumptions (ILB-like)") \
135OPTION( inprobeint, 100, 1,2e9,0,0,1, "inprobing interval" ) \
136OPTION( inprobing, 1, 0, 1,0,1,1, "enable probe inprocessing") \
137OPTION( inprocessing, 1, 0, 1,0,1,1, "enable general inprocessing") \
138OPTION( instantiate, 0, 0, 1,0,1,1, "variable instantiation") \
139OPTION( instantiateclslim, 3, 2,2e9,0,0,1, "minimum clause size") \
140OPTION( instantiateocclim, 1, 1,2e9,2,0,1, "maximum occurrence limit") \
141OPTION( instantiateonce, 1, 0, 1,0,0,1, "instantiate each clause once") \
142OPTION( lidrup, 0, 0, 1,0,0,1, "linear incremental proof format") \
143LOGOPT( log, 0, 0, 1,0,0,0, "enable logging") \
144LOGOPT( logsort, 0, 0, 1,0,0,0, "sort logged clauses") \
145OPTION( lrat, 0, 0, 1,0,0,1, "use LRAT proof format") \
146OPTION( lucky, 1, 0, 1,0,0,1, "search for lucky phases") \
147OPTION( minimize, 1, 0, 1,0,0,1, "minimize learned clauses") \
148OPTION( minimizedepth, 1e3, 0,1e3,0,0,1, "minimization depth") \
149OPTION( minimizeticks, 1, 0, 1,0,0,1, "increment ticks in minimization") \
150OPTION( otfs, 1, 0, 1,0,0,1, "on-the-fly self subsumption") \
151OPTION( phase, 1, 0, 1,0,0,1, "initial phase") \
152OPTION( preprocessinit, 2e6, 0,2e9,2,0,1, "initial preprocessing base limit" ) \
153OPTION( preprocesslight, 1, 0, 1,0,1,1, "lightweight preprocessing" ) \
154OPTION( probe, 1, 0, 1,0,1,1, "failed literal probing" ) \
155OPTION( probeeffort, 8, 1,1e5,1,0,1, "relative efficiency per mille") \
156OPTION( probehbr, 1, 0, 1,0,0,1, "learn hyper binary clauses") \
157OPTION( probethresh, 0, 0,100,1,0,1, "delay if ticks smaller thresh*clauses") \
158OPTION( profile, 2, 0, 4,0,0,0, "profiling level") \
159QUTOPT( quiet, 0, 0, 1,0,0,0, "disable all messages") \
160OPTION( radixsortlim, 32, 0,2e9,0,0,1, "radix sort limit") \
161OPTION( realtime, 0, 0, 1,0,0,0, "real instead of process time") \
162OPTION( recomputetier, 1, 0, 1,0,0,1, "recompute tiers") \
163OPTION( reduce, 1, 0, 1,0,0,1, "reduce useless clauses") \
164OPTION( reduceinit, 300, 1,1e6,0,0,1, "initial interval") \
165OPTION( reduceint, 25, 2,1e6,0,0,1, "reduce interval") \
166OPTION( reduceopt, 1, 0, 2,0,0,1, "0=prct,1=sqrt,2=max") \
167OPTION( reducetarget, 75, 10,1e2,0,0,1, "reduce fraction in percent") \
168OPTION( reducetier1glue, 2, 1,2e9,0,0,1, "glue of kept learned clauses") \
169OPTION( reducetier2glue, 6, 1,2e9,0,0,1, "glue of tier two clauses") \
170OPTION( reluctant, 1024, 0,2e9,0,0,1, "reluctant doubling period") \
171OPTION( reluctantmax,1048576, 0,2e9,0,0,1, "reluctant doubling period") \
172OPTION( rephase, 1, 0, 1,0,0,1, "enable resetting phase") \
173OPTION( rephaseint, 1e3, 1,2e9,0,0,1, "rephase interval") \
174OPTION( report,reportdefault, 0, 1,0,0,1, "enable reporting") \
175OPTION( reportall, 0, 0, 1,0,0,1, "report even if not successful") \
176OPTION( reportsolve, 0, 0, 1,0,0,1, "use solving not process time") \
177OPTION( restart, 1, 0, 1,0,0,1, "enable restarts") \
178OPTION( restartint, 2, 1,2e9,0,0,1, "restart interval") \
179OPTION( restartmargin, 10, 0,1e2,0,0,1, "slow fast margin in percent") \
180OPTION( restartreusetrail, 1, 0, 1,0,0,1, "enable trail reuse") \
181OPTION( restoreall, 0, 0, 2,0,0,1, "restore all clauses (2=really)") \
182OPTION( restoreflush, 0, 0, 1,0,0,1, "remove satisfied clauses") \
183OPTION( reverse, 0, 0, 1,0,0,1, "reverse variable ordering") \
184OPTION( score, 1, 0, 1,0,0,1, "use EVSIDS scores") \
185OPTION( scorefactor, 950,500,1e3,0,0,1, "score factor per mille") \
186OPTION( seed, 0, 0,2e9,0,0,1, "random seed") \
187OPTION( shrink, 3, 0, 3,0,0,1, "shrink conflict clause (1=only with binary, 2=minimize when pulling, 3=full)") \
188OPTION( shrinkreap, 1, 0, 1,0,0,1, "use a reap for shrinking") \
189OPTION( shuffle, 0, 0, 1,0,0,1, "shuffle variables") \
190OPTION( shufflequeue, 1, 0, 1,0,0,1, "shuffle variable queue") \
191OPTION( shufflerandom, 0, 0, 1,0,0,1, "not reverse but random") \
192OPTION( shufflescores, 1, 0, 1,0,0,1, "shuffle variable scores") \
193OPTION( stabilize, 1, 0, 1,0,0,1, "enable stabilizing phases") \
194OPTION( stabilizeinit, 1e3, 1,2e9,0,0,1, "stabilizing interval") \
195OPTION( stabilizeonly, 0, 0, 1,0,0,1, "only stabilizing phases") \
196OPTION( stats, 0, 0, 1,0,0,1, "print all statistics at the end of the run") \
197OPTION( subsume, 1, 0, 1,0,1,1, "enable clause subsumption") \
198OPTION( subsumebinlim, 1e4, 0,2e9,1,0,1, "watch list length limit") \
199OPTION( subsumeclslim, 1e2, 0,2e9,2,0,1, "clause length limit") \
200OPTION( subsumeeffort, 1e3, 1,1e5,1,0,1, "relative efficiency per mille") \
201OPTION( subsumelimited, 1, 0, 1,0,0,1, "limit subsumption checks") \
202OPTION( subsumemaxeff, 1e8, 0,2e9,1,0,1, "maximum subsuming efficiency") \
203OPTION( subsumemineff, 0, 0,2e9,1,0,1, "minimum subsuming efficiency") \
204OPTION( subsumeocclim, 1e2, 0,2e9,1,0,1, "watch list length limit") \
205OPTION( subsumestr, 1, 0, 1,0,0,1, "subsume strenghten") \
206OPTION( sweep, 1, 0, 1,0,1,1, "enable SAT sweeping") \
207OPTION( sweepclauses, 1024, 0,2e9,1,0,1, "environment clauses") \
208OPTION( sweepcomplete, 0, 0, 1,0,0,1, "run SAT sweeping to completion") \
209OPTION( sweepcountbinary, 1, 0, 1,0,0,1, "count binaries to environment") \
210OPTION( sweepdepth, 2, 0,2e9,1,0,1, "environment depth") \
211OPTION( sweepeffort, 1e2, 0,1e4,0,0,1, "relative effort in ticks per mille") \
212OPTION( sweepfliprounds, 1, 0,2e9,1,0,1, "flipping rounds") \
213OPTION( sweepmaxclauses, 3e5, 2,2e9,1,0,1, "maximum environment clauses") \
214OPTION( sweepmaxdepth, 3, 1,2e9,1,0,1, "maximum environment depth") \
215OPTION( sweepmaxvars, 8192, 2,2e9,1,0,1, "maximum environment variables") \
216OPTION( sweeprand, 0, 0, 1,0,0,1, "randomize sweeping environment") \
217OPTION( sweepthresh, 5, 0,100,1,0,1, "delay if ticks smaller thresh*clauses") \
218OPTION( sweepvars, 256, 0,2e9,1,0,1, "environment variables") \
219OPTION( target, 1, 0, 2,0,0,1, "target phases (1=stable only)") \
220OPTION( terminateint, 10, 0,1e4,0,0,1, "termination check interval") \
221OPTION( ternary, 1, 0, 1,0,1,1, "hyper ternary resolution") \
222OPTION( ternaryeffort, 8, 1,1e5,1,0,1, "relative efficiency per mille") \
223OPTION( ternarymaxadd, 1e3, 0,1e4,1,0,1, "max clauses added in percent") \
224OPTION( ternaryocclim, 1e2, 1,2e9,2,0,1, "ternary occurrence limit") \
225OPTION( ternaryrounds, 2, 1, 16,1,0,1, "maximum ternary rounds") \
226OPTION( ternarythresh, 6, 0,100,1,0,1, "delay if ticks smaller thresh*clauses") \
227OPTION( tier1limit, 50, 0,100,0,0,1, "limit of tier1 usage in percentage") \
228OPTION( tier2limit, 90, 0,100,0,0,1, "limit of tier2 usage in percentage") \
229OPTION( transred, 1, 0, 1,0,1,1, "transitive reduction of BIG") \
230OPTION( transredeffort, 1e2, 1,1e5,1,0,1, "relative efficiency per mille") \
231OPTION( transredmaxeff, 1e8, 0,2e9,1,0,1, "maximum efficiency") \
232OPTION( transredmineff, 0, 0,2e9,1,0,1, "minimum efficiency") \
233QUTOPT( verbose, 0, 0, 3,0,0,0, "more verbose messages") \
234OPTION( veripb, 0, 0, 4,0,0,1, "odd=checkdeletions, > 2=drat") \
235OPTION( vivify, 1, 0, 1,0,1,1, "vivification") \
236OPTION( vivifycalctier, 0, 0, 1,0,0,1, "recalculate tier limits") \
237OPTION( vivifydemote, 0, 0, 1,0,1,1, "demote irredundant or delete directly") \
238OPTION( vivifyeffort, 50, 0,1e5,1,0,1, "overall efficiency per mille") \
239OPTION( vivifyflush, 1, 0, 1,1,0,1, "flush subsumed before vivification rounds") \
240OPTION( vivifyinst, 1, 0, 1,0,0,1, "instantiate last literal when vivify") \
241OPTION( vivifyirred, 1, 0, 1,0,1,1, "vivification irred") \
242OPTION( vivifyirredeff, 3, 1,100,1,0,1, "irredundant efficiency per mille") \
243OPTION( vivifyonce, 0, 0, 2,0,0,1, "vivify once: 1=red, 2=red+irr") \
244OPTION( vivifyretry, 0, 0, 5,0,0,1, "re-vivify clause if vivify was successful") \
245OPTION( vivifyschedmax, 5e3, 10,2e9,0,0,1, "maximum schedule size") \
246OPTION( vivifythresh, 20, 0,100,1,0,1, "delay if ticks smaller thresh*clauses") \
247OPTION( vivifytier1, 1, 0, 1,0,1,1, "vivification tier1") \
248OPTION( vivifytier1eff, 4, 0,100,1,0,1, "relative tier1 effort") \
249OPTION( vivifytier2, 1, 0, 1,0,1,1, "vivification tier2") \
250OPTION( vivifytier2eff, 2, 1,100,1,0,1, "relative tier2 effort") \
251OPTION( vivifytier3, 1, 0, 1,0,1,1, "vivification tier3") \
252OPTION( vivifytier3eff, 1, 1,100,1,0,1, "relative tier3 effort") \
253OPTION( walk, 1, 0, 1,0,0,1, "enable random walks") \
254OPTION( walkeffort, 20, 1,1e5,1,0,1, "relative efficiency per mille") \
255OPTION( walkmaxeff, 1e7, 0,2e9,1,0,1, "maximum efficiency") \
256OPTION( walkmineff, 0, 0,1e7,1,0,1, "minimum efficiency") \
257OPTION( walknonstable, 1, 0, 1,0,0,1, "walk in non-stabilizing phase") \
258OPTION( walkredundant, 0, 0, 1,0,0,1, "walk redundant clauses too") \
259
260// Note, keep an empty line right before this line because of the last '\'!
261// Also keep those single spaces after 'OPTION(' for proper sorting.
262
263// clang-format on
264
265/*------------------------------------------------------------------------*/
266
267// Some of the 'OPTION' macros above should only be included if certain
268// compile time options are enabled. This has the effect, that for instance
269// if 'LOGGING' is defined, and thus logging code is included, then also the
270// 'log' option is defined. Otherwise the 'log' option is not included.
271
272#ifdef LOGGING
273#define LOGOPT OPTION
274#else
275#define LOGOPT(...) /**/
276#endif
277
278#ifdef CADICAL_QUIET
279#define QUTOPT(...) /**/
280#else
281#define QUTOPT OPTION
282#endif
283
284/*------------------------------------------------------------------------*/
285
286namespace CaDiCaL {
287
288struct Internal;
289
290/*------------------------------------------------------------------------*/
291
292class Options;
293
294struct Option {
295 const char *name;
296 int def, lo, hi;
299 const char *description;
300 int &val (Options *);
301};
302
303/*------------------------------------------------------------------------*/
304
305// Produce a compile time constant for the number of options.
306
307static const size_t number_of_options =
308#define OPTION(N, V, L, H, O, P, R, D) 1 +
309 OPTIONS
310#undef OPTION
311 + 0;
312
313/*------------------------------------------------------------------------*/
314
315class Options {
316
317 Internal *internal;
318
319 void set (Option *, int val); // Force to [lo,hi] interval.
320
321 friend struct Option;
322 static Option table[];
323
324 static void initialize_from_environment (int &val, const char *name,
325 const int L, const int H);
326
327 friend Config;
328
329 void reset_default_values ();
330 void disable_preprocessing ();
331
332public:
333 // For library usage we disable reporting by default while for the stand
334 // alone SAT solver we enable it by default. This default value has to
335 // be set before the constructor of 'Options' is called (which in turn is
336 // called from the constructor of 'Solver'). If we would simply overwrite
337 // its initial value while initializing the stand alone solver, we will
338 // get that change of the default value (from 'false' to 'true') shown
339 // during calls to 'print ()', which is confusing to the user.
340 //
341 static int reportdefault;
342
343 Options (Internal *);
344
345 // Makes options directly accessible, e.g., for instance declares the
346 // member 'int restart' here. This will give fast access to option values
347 // internally in the solver and thus can also be used in tight loops.
348 //
349private:
350 int __start_of_options__; // Used by 'val' below.
351public:
352#define OPTION(N, V, L, H, O, P, R, D) \
353 int N; // Access option values by name.
354 OPTIONS
355#undef OPTION
356
357 // It would be more elegant to use an anonymous 'struct' of the actual
358 // option values overlayed with an 'int values[number_of_options]' array
359 // but that is not proper ISO C++ and produces a warning. Instead we use
360 // the following construction which relies on '__start_of_options__' and
361 // that the following options are really allocated directly after it.
362 //
363 inline int &val (size_t idx) {
364 CADICAL_assert (idx < number_of_options);
365 return (&__start_of_options__ + 1)[idx];
366 }
367
368 // With the following function we can get rather fast access to the option
369 // limits, the default value and the description. The code uses binary
370 // search over the sorted option 'table'. This static data is shared
371 // among different instances of the solver. The actual current option
372 // values are here in the 'Options' class. They can be accessed by the
373 // offset of the static options using 'Option::val' if you have an
374 // 'Option' or to have even faster access directly by the member function
375 // (the 'N' above, e.g., 'restart').
376 //
377 static Option *has (const char *name);
378
379 bool set (const char *name, int); // Explicit version.
380 int get (const char *name); // Get current value.
381
382 void print (); // Print current values in command line form
383 static void usage (); // Print usage message for all options.
384
385 void optimize (int val); // increase some limits (val=0..31)
386
387 static bool is_preprocessing_option (const char *name);
388
389 // Parse long option argument
390 //
391 // --<name>
392 // --<name>=<val>
393 // --no-<name>
394 //
395 // where '<val>' is as in 'parse_option_value'. If parsing succeeds,
396 // 'true' is returned and the string will be set to the name of the
397 // option. Additionally the parsed value is set (last argument).
398 //
399 static bool parse_long_option (const char *, string &, int &);
400
401 // Iterating options.
402
403 typedef Option *iterator;
404 typedef const Option *const_iterator;
405
406 static iterator begin () { return table; }
407 static iterator end () { return table + number_of_options; }
408
409 void copy (Options &other) const; // Copy 'this' into 'other'.
410};
411
412inline int &Option::val (Options *opts) {
413 CADICAL_assert (Options::table <= this &&
414 this < Options::table + number_of_options);
415 return opts->val (this - Options::table);
416}
417
418} // namespace CaDiCaL
419
421
422#endif
#define ABC_NAMESPACE_CXX_HEADER_START
#define ABC_NAMESPACE_CXX_HEADER_END
#define CADICAL_assert(ignore)
Definition global.h:14
static iterator end()
Definition options.hpp:407
friend struct Option
Definition options.hpp:321
void copy(Options &other) const
void optimize(int val)
const Option * const_iterator
Definition options.hpp:404
static int reportdefault
Definition options.hpp:341
int get(const char *name)
static Option * has(const char *name)
OPTIONS int & val(size_t idx)
Definition options.hpp:363
static bool is_preprocessing_option(const char *name)
static bool parse_long_option(const char *, string &, int &)
Option * iterator
Definition options.hpp:403
static iterator begin()
Definition options.hpp:406
char * name
Definition main.h:24
#define OPTIONS
Definition options.hpp:24
const char * name
Definition options.hpp:295
int & val(Options *)
Definition options.hpp:412
const char * description
Definition options.hpp:299