27a28,30 > /* FALESAT: The following line added to include certain #defines. */ > #include "../../satfront.h" > 127a131,139 > /* FALESAT: Global variable from dlm2k.c. */ > extern SATResults *globResults; > > /* FALESAT: Total unsat clauses for each flip. */ > #if USE_UNSAT_TRACKING > int flips = 0; > #endif > > 150a163,169 > if (fd == NULL) > { > int *x = NULL; > *x = 1; > printf("blah\n"); > } > 256a276,279 > /* FALESAT: Added because we don't really want the output and it sometimes > * crashes whilst reading the parameters. > */ > #if 0 319a343 > #endif 820c844,845 < int main(int argc, char *argv[]) --- > /* FALESAT: Renamed main() to old_main() for dlm2k. */ > int old_main(int argc, char *argv[]) 1092c1117,1127 < varBuffer=(int *) malloc( S_INT*(varNum+2)); --- > /* FALESAT: Fixes "bug" in original code. The routines that selects > * variables for this buffer may select the same variable multiple times > * if it occurs in multiple false clauses. This means that the buffer can > * overflow. It also means that the probability of selecting a variable > * is multiplied by the number of times it occurs within the current set > * of false clauses (arguably a good thing). This fix preserves the > * existing behaviour, which may be intentional, but increases the size of > * the buffer so it cannot overflow. The original buffer size was simply > * (varNum+2). We multiply by 5 to reduce the probability of overflow. > */ > varBuffer=(int *) malloc( S_INT*(varNum+2) * 5); 1097a1133,1134 > /* FALESAT: Disabled for dlm2k. */ > #if 0 1099a1137 > #endif 1107a1146,1149 > > /* FALESAT: Added to reset some counters. */ > roundNum = 0; > 1113c1155,1156 < INIT_RANDOM; --- > /* FALESAT: Disabled PRNG seeding because satfront handles it. */ > /* INIT_RANDOM; */ 1147a1191,1192 > /* FALESAT: Disable from dlm2k. */ > #if 0 1150a1196 > #endif 1213a1260,1267 > #include "../../dlmparams/unsat1-dlm.c" > #include "../../dlmparams/mobility2-dlm.c" > #include "../../dlmparams/assigndump-dlm.c" > > #ifdef ADD_NOISE > if(rand() % 100000 < ADDED_NOISE * 100000) > var = rand() % varNum + 1; > #endif 1531a1586,1587 > /* FALESAT: Disabled for dlm2k. */ > #if 0 1533a1590 > #endif 1535c1592 < totalFlipTime=0; --- > /* FALESAT: Moved totalFlipTime reset for dlm2k. */ 1536a1594,1595 > { > totalFlipTime=0; 1537a1597 > } 1540a1601,1603 > > /* FALESAT: Commented for dlk2k. */ > /* 1542a1606 > */ 1565c1629,1637 < roundNum=0; --- > /* FALESAT: Commented following line for dlm2k. */ > // roundNum=0; > > /* FALESAT: Free allocated memory for dlm2k. */ > > free(clauseBuffer); > free(varBuffer); > free(distance); > free(isVarInTabuQ); 1573a1646,1680 > > void freeProblem() > { > free(clauseLen); > free(absLiteralBuf); > free(signLiteralBuf); > free(absClause); > free(clauseSign); > } > > void freeStuff() > { > int i; > > free(x); > free(isFixed); > free(varDelta); > free(matchedVar); > free(clauseWeight); > free(lambda); > free(falseClauseQ); > free(posInFalseClauseQ); > > for (i=1;i<=varNum;i++) > { > free(varLink[i]); > free(varLinkSign[i]); > free(isVarMatched[i]); > } > > free(varLinkLen); > free(varLink); > free(varLinkSign); > free(isVarMatched); > }