-
Notifications
You must be signed in to change notification settings - Fork 11
/
ubcsat-globals.h
310 lines (234 loc) · 9.56 KB
/
ubcsat-globals.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
/*
## ## ##### ##### $$$$$ $$$$ $$$$$$
## ## ## ## ## $$ $$ $$ $$
## ## ##### ## $$$$ $$$$$$ $$
## ## ## ## ## $$ $$ $$ $$
#### ##### ##### $$$$$ $$ $$ $$
======================================================
SLS SAT Solver from The University of British Columbia
======================================================
...Developed by Dave Tompkins (davet [@] cs.ubc.ca)...
------------------------------------------------------
.......consult legal.txt for legal information........
......consult revisions.txt for revision history......
------------------------------------------------------
... project website: http://www.satlib.org/ubcsat ....
------------------------------------------------------
.....e-mail ubcsat-help [@] cs.ubc.ca for support.....
------------------------------------------------------
*/
/***** UBCSAT GLOBAL VARIABLES *****/
/*
sAlgName name of current algorithm
sVarName variant name of current algorithm
bWeighted does the current algorithm use weighted clauses?
pActiveAlgorithm the active algorithm for this session of UBCSAT
iNumRuns total number of runs
iCutoff step cutoff for each run
fTimeOut timeout per runs in seconds
fGlobalTimeOut timeout for all runs in seconds
iSeed initial seed for the system
iTarget target solution quality (# of false clauses)
fTargetW weighted target solution quality (sum of false clause weights)
iFlipCandidate current variable to flip
iFind total number of solutions to find
iNumSolutionsFound number of solutions found so far
iFindUnique # of unique solutions to find
iPeriodicRestart restart each run every iPeriodicRestart steps
iProbRestart restart with a probability
iStagnateRestart restart if no improvement in iStagnateRestart steps
bRestart flag to restart the current run
iRun current run number
iStep current step number
bTerminateAllRuns flag to terminate all runs
bSolutionFound flag to indicate target solution quality found this run
bTerminateRun flag to terminate this run
bSolveMode flag to indicate "solve mode"
sFilenameIn file name of instance
sFilenameParms file name of current parameter file (note, can be multiple files)
sFilenameVarInit file name of variable initialization file
bReportEcho flag to set all file output to screen
bReportFlush flush all reports before each run
bReportClean flag to remove headers from output
iBestScore value of best score improvement this step
fBestScore value of best weighted score improvement this step
*/
extern const char sNull;
extern char *sAlgName;
extern char *sVarName;
extern BOOL bWeighted;
extern ALGORITHM *pActiveAlgorithm;
extern UINT32 iNumRuns;
extern UINT32 iCutoff;
extern FLOAT fTimeOut;
extern FLOAT fGlobalTimeOut;
extern UINT32 iSeed;
extern UINT32 iTarget;
extern FLOAT fTargetW;
extern UINT32 iFlipCandidate;
extern UINT32 iFind;
extern UINT32 iNumSolutionsFound;
extern UINT32 iFindUnique;
extern UINT32 iPeriodicRestart;
extern PROBABILITY iProbRestart;
extern UINT32 iStagnateRestart;
extern BOOL bRestart;
extern UINT32 iRun;
extern UINT32 iStep;
extern BOOL bTerminateAllRuns;
extern BOOL bSolutionFound;
extern BOOL bTerminateRun;
extern BOOL bSolveMode;
extern char *sFilenameIn;
extern char *sFilenameParms;
extern char *sFilenameVarInit;
extern BOOL bReportEcho;
extern BOOL bReportClean;
extern BOOL bReportFlush;
extern SINT32 iBestScore;
extern FLOAT fBestScore;
/***** UBCSAT GLOBAL ROUTINES *****/
/*
CreateAlgorithm() add a new algorithm to the UBCSAT system
*/
ALGORITHM *CreateAlgorithm (const char *sName, const char *sVariant, BOOL bWeighted,
const char *sDescription,
const char *sAuthors,
const char *sHeuristicTriggers,
const char *sDataTriggers,
const char *sDefaultOutput,
const char *sDefaultStats);
/*
CopyParameters() copy the parameters from one algorithm to another
*/
void CopyParameters(ALGORITHM *pDest, const char *sName, const char *sVar, BOOL bWeighted);
/*
InheritDataTriggers() copy the data triggers from one algorithm to another
*/
void InheritDataTriggers(ALGORITHM *pDest, const char *sName, const char *sVar, BOOL bWeighted);
/*
CreateTrigger() add a new trigger to the UBCSAT system
*/
void CreateTrigger(const char *sID,
enum EVENTPOINT eEventPoint,
FXNPTR pProcedure,
char *sDependencyList,
char *sDeactivateList);
/*
CreateContainerTrigger() add a new container trigger to the UBCSAT system
*/
void CreateContainerTrigger(const char *sID, const char *sList);
/*
ActivateTriggers() Explicitly Activate specific trigger(s) [not normally necessary]
*/
void ActivateTriggers(char *sTriggers);
/*
DeActivateTriggers() Explicitly DeActivate specific trigger(s) [not normally necessary]
*/
void DeActivateTriggers(char *sTriggers);
/*
AddParm????() adds a parameter to an algorithm (many different types)
*/
void AddParmProbability(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
PROBABILITY *pProb,
FLOAT fProb);
void AddParmUInt(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
UINT32 *pInt,
UINT32 iDefInt);
void AddParmSInt(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
SINT32 *pSInt,
SINT32 iDefSInt);
void AddParmBool(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
UINT32 *pBool,
BOOL bDefBool);
void AddParmFloat(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
FLOAT *pFloat,
FLOAT fDefFloat);
void AddParmString(ALGPARMLIST *pParmList,
const char *sSwitch,
const char *sName,
const char *sDescription,
const char *sTriggers,
char **pString,
char *sDefString);
/*
CreateReport() add a new report to the system
*/
REPORT *CreateReport(const char *sID,
const char *sDescription,
const char *sVerboseDescription,
const char *sOutputFile,
const char *sTriggers);
/*
AddReportParm???() add a parameter to a report
*/
void AddReportParmUInt(REPORT *pRep, const char *sParmName, UINT32 *pParmValUInt, UINT32 iDefault);
void AddReportParmFloat(REPORT *pRep, const char *sParmName, FLOAT *pParmValFloat, FLOAT fDefault);
void AddReportParmString(REPORT *pRep, const char *sParmName, const char *pDefault);
/*
AddColumn????() add a column of data for output & rtd reports
*/
void AddColumnUInt(const char *sID,
const char *sDescription,
char *sHeader1,
char *sHeader2,
char *sHeader3,
char *sPrintFormat,
UINT32 *pCurValue,
char *sTriggers,
enum COLTYPE eColType);
void AddColumnFloat(const char *sID,
const char *sDescription,
char *sHeader1,
char *sHeader2,
char *sHeader3,
char *sPrintFormat,
FLOAT *pCurValue,
char *sTriggers,
enum COLTYPE eColType);
void AddColumnComposite(const char *sID,
const char *sList);
/*
AddStatCol() add a column statistic, providing stats on columns of data
*/
void AddStatCol(const char *sID,
const char *sBaseDescription,
const char *sDefParm,
BOOL bSortByStep);
void AddContainerStat(const char *sID,
const char *sList);
/*
AddStatCustom() add a custom statistic, which can be calculated via triggers
*/
void AddStatCustom(const char *sID,
const char *sCustomDescription,
const char *sBaseDescription,
const char *sPrintCustomFormat,
void *pCurValue,
enum CDATATYPE eCustomType,
const char *sDataColumn,
const char *sTriggers);
/*
IsLocalMinimum() returns TRUE if currently in a local minimum
*/
BOOL IsLocalMinimum(BOOL bUseWeighted);