VIS

src/sat/satMain.c

Go to the documentation of this file.
00001 
00019 #include "satInt.h"
00020 
00021 static char rcsid[] UNUSED = "$Id: satMain.c,v 1.30 2009/04/11 18:26:37 fabio Exp $";
00022 
00023 /*---------------------------------------------------------------------------*/
00024 /* Constant declarations                                                     */
00025 /*---------------------------------------------------------------------------*/
00026 
00029 /*---------------------------------------------------------------------------*/
00030 /* Static function prototypes                                                */
00031 /*---------------------------------------------------------------------------*/
00032 
00033 
00037 /*---------------------------------------------------------------------------*/
00038 /* Definition of exported functions                                          */
00039 /*---------------------------------------------------------------------------*/
00040 
00041 
00053 void
00054 sat_PreProcessing(satManager_t *cm)
00055 {
00056 satLevel_t *d;
00057 
00058 
00060   cm->queue = sat_CreateQueue(1024);
00061   cm->BDDQueue = sat_CreateQueue(1024);
00062   cm->unusedAigQueue = sat_CreateQueue(1024);
00063 
00069   if(cm->variableArray == 0) {
00070     cm->variableArray = ALLOC(satVariable_t, cm->initNumVariables+1);
00071     memset(cm->variableArray, 0,
00072             sizeof(satVariable_t) * (cm->initNumVariables+1));
00073   }
00074 
00075   cm->auxArray = sat_ArrayAlloc(1024);
00076   cm->nonobjUnitLitArray = sat_ArrayAlloc(128);
00077   cm->objUnitLitArray = sat_ArrayAlloc(128);
00078 
00080   //sat_CompactFanout(cm);
00081 
00082   //Bing:
00083   if(cm->option->AbRf == 0)
00084     sat_CompactFanout(cm);
00085 
00087   sat_InitScore(cm);
00088 
00090   if(cm->decisionHeadSize == 0) {
00091     cm->decisionHeadSize = 32;
00092     cm->decisionHead = ALLOC(satLevel_t, cm->decisionHeadSize);
00093     memset(cm->decisionHead, 0, sizeof(satLevel_t) * cm->decisionHeadSize);
00094   }
00095   cm->currentDecision = -1;
00096 
00098   SATvalue(2) = 2;
00099   SATflags(0) = 0;
00100 
00101   cm->initNodesArraySize = cm->nodesArraySize;
00102   cm->beginConflict = cm->nodesArraySize;
00103 
00105   if(cm->option->incTraceObjective) {
00106     sat_RestoreForwardedClauses(cm, 0);
00107   }
00108   else if(cm->option->incAll) {
00109     sat_RestoreForwardedClauses(cm, 1);
00110   }
00111 
00112   if(cm->option->incTraceObjective) {
00113     sat_MarkObjectiveFlagToArray(cm, cm->obj);
00114     sat_MarkObjectiveFlagToArray(cm, cm->objCNF);
00115   }
00116 
00117 
00119   d = sat_AllocLevel(cm);
00120 
00121   sat_ApplyForcedAssignmentMain(cm, d);
00122 
00123   if(cm->status == SAT_UNSAT)
00124     return;
00125 
00126 
00127   //Bing:
00128   if(cm->option->coreGeneration && cm->option->IP){
00129     cm->rm = ALLOC(RTManager_t, 1);
00130     memset(cm->rm,0,sizeof(RTManager_t));
00131   }
00132   //Bing
00133   if(!(cm->option->SSS==1 && cm->option->coreGeneration==1))
00134     sat_ImplyArray(cm, d, cm->pureLits);
00135 
00136   sat_ImplyArray(cm,d,cm->assertArray);
00137   sat_ImplyArray(cm, d, cm->assertion);
00138   sat_ImplyArray(cm, d, cm->unitLits);
00139   sat_ImplyArray(cm, d, cm->auxObj);
00140   sat_ImplyArray(cm, d, cm->nonobjUnitLitArray);
00141   sat_ImplyArray(cm, d, cm->obj);
00142 
00143   sat_ImplicationMain(cm, d);
00144   if(d->conflict) {
00145     cm->status = SAT_UNSAT;
00146   }
00147 
00148   if(cm->status == 0) {
00149     if(cm->option->incDistill) {
00150       sat_IncrementalUsingDistill(cm);
00151     }
00152   }
00153 
00154 }
00155 
00167 void
00168 sat_PreProcessingForMixed(satManager_t *cm)
00169 {
00170 satLevel_t *d;
00171 
00172 
00174   cm->queue = sat_CreateQueue(1024);
00175   cm->BDDQueue = sat_CreateQueue(1024);
00176   cm->unusedAigQueue = sat_CreateQueue(1024);
00177 
00183   if(cm->variableArray == 0) {
00184     cm->variableArray = ALLOC(satVariable_t, cm->initNumVariables+1);
00185     memset(cm->variableArray, 0,
00186             sizeof(satVariable_t) * (cm->initNumVariables+1));
00187   }
00188 
00189   cm->auxArray = sat_ArrayAlloc(1024);
00190   cm->nonobjUnitLitArray = sat_ArrayAlloc(128);
00191   cm->objUnitLitArray = sat_ArrayAlloc(128);
00192 
00194   sat_CompactFanout(cm);
00195 
00196   cm->initNodesArraySize = cm->nodesArraySize;
00197   cm->beginConflict = cm->nodesArraySize;
00198 
00199   if(cm->option->allSatMode) {
00200     sat_RestoreFrontierClauses(cm);
00201     sat_RestoreBlockingClauses(cm);
00202   }
00203 
00205   sat_InitScoreForMixed(cm);
00206 
00208   if(cm->decisionHeadSize == 0) {
00209     cm->decisionHeadSize = 32;
00210     cm->decisionHead = ALLOC(satLevel_t, cm->decisionHeadSize);
00211     memset(cm->decisionHead, 0, sizeof(satLevel_t) * cm->decisionHeadSize);
00212   }
00213   cm->currentDecision = -1;
00214 
00216   SATvalue(2) = 2;
00217   SATflags(0) = 0;
00218 
00220   if(cm->option->incTraceObjective) {
00221     sat_RestoreForwardedClauses(cm, 0);
00222   }
00223   else if(cm->option->incAll) {
00224     sat_RestoreForwardedClauses(cm, 1);
00225   }
00226 
00227   if(cm->option->incTraceObjective) {
00228     sat_MarkObjectiveFlagToArray(cm, cm->obj);
00229     sat_MarkObjectiveFlagToArray(cm, cm->objCNF);
00230   }
00231 
00233   d = sat_AllocLevel(cm);
00234 
00235   sat_ApplyForcedAssignmentMain(cm, d);
00236 
00237   if(cm->status == SAT_UNSAT)
00238     return;
00239 
00240   sat_ImplyArray(cm, d, cm->assertion);
00241   sat_ImplyArray(cm, d, cm->unitLits);
00242   sat_ImplyArray(cm, d, cm->pureLits);
00243   sat_ImplyArray(cm, d, cm->auxObj);
00244   sat_ImplyArray(cm, d, cm->nonobjUnitLitArray);
00245   sat_ImplyArray(cm, d, cm->obj);
00246 
00247   sat_ImplicationMain(cm, d);
00248   if(d->conflict) {
00249     cm->status = SAT_UNSAT;
00250   }
00251 
00252   if(cm->status == 0) {
00253     if(cm->option->incDistill) {
00254       sat_IncrementalUsingDistill(cm);
00255     }
00256   }
00257 
00258 }
00259 
00271 void
00272 sat_PreProcessingForMixedNoCompact(satManager_t *cm)
00273 {
00274 satLevel_t *d;
00275 
00276 
00278   cm->queue = sat_CreateQueue(1024);
00279   cm->BDDQueue = sat_CreateQueue(1024);
00280   cm->unusedAigQueue = sat_CreateQueue(1024);
00281 
00287   if(cm->variableArray == 0) {
00288     cm->variableArray = ALLOC(satVariable_t, cm->initNumVariables+1);
00289     memset(cm->variableArray, 0,
00290             sizeof(satVariable_t) * (cm->initNumVariables+1));
00291   }
00292 
00293   if(cm->auxArray == 0)
00294     cm->auxArray = sat_ArrayAlloc(1024);
00295   if(cm->nonobjUnitLitArray == 0)
00296     cm->nonobjUnitLitArray = sat_ArrayAlloc(128);
00297   if(cm->objUnitLitArray == 0)
00298     cm->objUnitLitArray = sat_ArrayAlloc(128);
00299 
00304   cm->initNodesArraySize = cm->nodesArraySize;
00305   cm->beginConflict = cm->nodesArraySize;
00306 
00307   if(cm->option->allSatMode) {
00308     sat_RestoreFrontierClauses(cm);
00309     sat_RestoreBlockingClauses(cm);
00310   }
00311 
00313   sat_InitScoreForMixed(cm);
00314 
00316   if(cm->decisionHeadSize == 0) {
00317     cm->decisionHeadSize = 32;
00318     cm->decisionHead = ALLOC(satLevel_t, cm->decisionHeadSize);
00319     memset(cm->decisionHead, 0, sizeof(satLevel_t) * cm->decisionHeadSize);
00320   }
00321   cm->currentDecision = -1;
00322 
00324   SATvalue(2) = 2;
00325   SATflags(0) = 0;
00326 
00328   if(cm->option->incTraceObjective) {
00329     sat_RestoreForwardedClauses(cm, 0);
00330   }
00331   else if(cm->option->incAll) {
00332     sat_RestoreForwardedClauses(cm, 1);
00333   }
00334 
00335   if(cm->option->incTraceObjective) {
00336     sat_MarkObjectiveFlagToArray(cm, cm->obj);
00337     sat_MarkObjectiveFlagToArray(cm, cm->objCNF);
00338   }
00339 
00341   d = sat_AllocLevel(cm);
00342 
00343   sat_ApplyForcedAssignmentMain(cm, d);
00344 
00345   if(cm->status == SAT_UNSAT)
00346     return;
00347 
00348   sat_ImplyArray(cm, d, cm->assertion);
00349   sat_ImplyArray(cm, d, cm->unitLits);
00350   sat_ImplyArray(cm, d, cm->pureLits);
00351   sat_ImplyArray(cm, d, cm->auxObj);
00352   sat_ImplyArray(cm, d, cm->nonobjUnitLitArray);
00353   sat_ImplyArray(cm, d, cm->obj);
00354 
00355   sat_ImplicationMain(cm, d);
00356   if(d->conflict) {
00357     cm->status = SAT_UNSAT;
00358   }
00359 
00360   if(cm->status == 0) {
00361     if(cm->option->incDistill) {
00362       sat_IncrementalUsingDistill(cm);
00363     }
00364   }
00365 
00366 }
00367 
00381 void
00382 sat_MarkObjectiveFlagToArray(
00383         satManager_t *cm,
00384         satArray_t *objArr)
00385 {
00386 int i;
00387 long v;
00388 
00389   if(objArr == 0)       return;
00390 
00391   for(i=0; i<objArr->num; i++) {
00392     v = objArr->space[i];
00393     v = SATnormalNode(v);
00394     SATflags(v) |= ObjMask;
00395   }
00396 }
00397 
00409 void
00410 sat_PostProcessing(satManager_t *cm)
00411 {
00412 
00413   sat_Verify(cm);
00414 
00415   if(cm->option->incTraceObjective) {
00416     sat_SaveNonobjClauses(cm);
00417   }
00418 
00419   if(cm->option->incAll) {
00420     sat_SaveAllClauses(cm);
00421   }
00422 
00423   if(cm->option->allSatMode) {
00424     sat_CollectBlockingClause(cm);
00425   }
00426 
00427   //Bing:
00428   //sat_RestoreFanout(cm);
00429   if(cm->option->AbRf == 0)
00430     sat_RestoreFanout(cm);
00431 
00432   if(cm->mgr) {
00433 #ifdef BDDcu
00434     Cudd_Quit(cm->mgr);
00435 #endif
00436     cm->mgr = 0;
00437   }
00438 
00439 }
00440 
00452 void
00453 sat_Main(satManager_t *cm)
00454 {
00455 long btime, etime;
00456 
00457   btime = util_cpu_time();
00458   sat_PreProcessing(cm);
00459 
00460   if(cm->status == 0)
00461     sat_Solve(cm);
00462 
00464   if(cm->option->coreGeneration && cm->status == SAT_UNSAT){
00465     //Bing
00466     if(cm->option->RT)
00467       sat_GenerateCore_All(cm);
00468     else
00469       sat_GenerateCore(cm);
00470   }
00471 
00472   sat_PostProcessing(cm);
00473 
00474   etime = util_cpu_time();
00475   cm->each->satTime = (double)(etime - btime) / 1000.0 ;
00476 
00477 }
00478 
00491 void
00492 sat_Solve(satManager_t *cm)
00493 {
00494 satLevel_t *d;
00495 satOption_t *option;
00496 satVariable_t *var;
00497 int level;
00498 
00499   d = SATgetDecision(0);
00500   cm->implicatedSoFar = d->implied->num;
00501   cm->currentTopConflict = 0;
00502 
00503   option = cm->option;
00504   if(option->BDDMonolithic) {
00505     sat_TryToBuildMonolithicBDD(cm);
00506   }
00507 
00508   if(cm->status == SAT_UNSAT) {
00509     sat_Undo(cm, SATgetDecision(0));
00510     return;
00511   }
00512 
00513   while(1) {
00514     sat_PeriodicFunctions(cm);
00515 
00516     if(cm->currentDecision == 0)
00517       sat_BuildLevelZeroHyperImplicationGraph(cm);
00518 
00519     d = sat_MakeDecision(cm);
00520 
00521     if(d == 0)  {
00522       cm->status = SAT_SAT;
00523       return;
00524     }
00525 
00526     while(1) {
00527       sat_ImplicationMain(cm, d);
00528 
00529       if(d->conflict == 0)      {
00530         if(cm->option->verbose > 2) {
00531           var = SATgetVariable(d->decisionNode);
00532           fprintf(cm->stdOut, "decision at %3d on %6ld <- %ld score(%d %d) %d %ld implied %.3f %%\n",
00533             d->level, d->decisionNode, SATvalue(d->decisionNode),
00534             var->scores[0], var->scores[1],
00535             cm->each->nDecisions, d->implied->num,
00536             (double)cm->implicatedSoFar/(double)cm->initNumVariables * 100);
00537           fflush(cm->stdOut);
00538         }
00539 
00540         break;
00541       }
00542 
00543         if(cm->option->verbose > 2) {
00544           var = SATgetVariable(d->decisionNode);
00545           fprintf(cm->stdOut, "decision at %3d on %6ld <- %ld score(%d %d) %d %ld implied  %.3f %% Conflict\n",
00546             d->level, d->decisionNode, SATvalue(d->decisionNode),
00547             var->scores[0], var->scores[1],
00548             cm->each->nDecisions, d->implied->num,
00549             (double)cm->implicatedSoFar/(double)cm->initNumVariables * 100);
00550           fflush(cm->stdOut);
00551         }
00552 
00553       if(cm->option->useStrongConflictAnalysis)
00554         level = sat_StrongConflictAnalysis(cm, d);
00555       else
00556         level = sat_ConflictAnalysis(cm, d);
00557 
00558       if(cm->currentDecision == -1) {
00559         if(cm->option->incDistill) {
00560           sat_BuildTrieForDistill(cm);
00561         }
00562         sat_Undo(cm, SATgetDecision(0));
00563         cm->status = SAT_UNSAT;
00564         return;
00565       }
00566 
00567       d = SATgetDecision(cm->currentDecision);
00568     }
00569 
00570   }
00571 }
00572 
00585 void
00586 sat_PeriodicFunctions(satManager_t *cm)
00587 {
00588 satStatistics_t *stats;
00589 satOption_t *option;
00590 int nDecisions;
00591 int gap;
00592 
00594   stats = cm->each;
00595   option = cm->option;
00596   nDecisions = stats->nDecisions-stats->nShrinkDecisions;
00597   if(nDecisions && !(nDecisions % option->decisionAgeInterval)) {
00598     if(option->decisionAgeRestart) {
00599       gap = stats->nConflictCl-stats->nOldConflictCl;
00600       if(gap > option->decisionAgeInterval>>2)  {
00601         sat_UpdateScore(cm);
00602         sat_Backtrack(cm, cm->lowestBacktrackLevel);
00603         cm->currentTopConflict = cm->literals->last-1;
00604         cm->currentTopConflictCount = 0;
00605         cm->lowestBacktrackLevel = MAXINT;
00606       }
00607       stats->nOldConflictCl = stats->nConflictCl;
00608     }
00609     else {
00610       sat_UpdateScore(cm);
00611     }
00612 
00613   }
00614 
00615   if(option->clauseDeletionHeuristic & LATEST_ACTIVITY_DELETION &&
00616           stats->nBacktracks > option->nextClauseDeletion &&
00617      cm->implicatedSoFar > cm->initNumVariables/3) {
00618     option->nextClauseDeletion += option->clauseDeletionInterval;
00619     sat_ClauseDeletionLatestActivity(cm);
00620   }
00621   else if(option->clauseDeletionHeuristic & MAX_UNRELEVANCE_DELETION &&
00622           stats->nBacktracks > option->nextClauseDeletion) {
00623     option->nextClauseDeletion += option->clauseDeletionInterval;
00624     sat_ClauseDeletion(cm);
00625   }
00626 
00627 }
00628 
00640 void
00641 sat_CNFMain(satOption_t *option, char *filename)
00642 {
00643 satManager_t *cm;
00644 int maxSize;
00645 
00646   cm = sat_InitManager(0);
00647   cm->comment = ALLOC(char, 2);
00648   cm->comment[0] = ' ';
00649   cm->comment[1] = '\0';
00650   if(option->outFilename) {
00651     if(!(cm->stdOut = fopen(option->outFilename, "w"))) {
00652       fprintf(stdout, "ERROR : Can't open file %s\n", option->outFilename);
00653       cm->stdOut = stdout;
00654       cm->stdErr = stderr;
00655     }
00656     else {
00657       cm->stdErr = cm->stdOut;
00658     }
00659   }
00660   else {
00661     cm->stdOut = stdout;
00662     cm->stdErr = stderr;
00663   }
00664 
00665   cm->option = option;
00666   cm->each = sat_InitStatistics();
00667 
00668   cm->unitLits = sat_ArrayAlloc(16);
00669   cm->pureLits = sat_ArrayAlloc(16);
00670 
00671   maxSize = 1024 << 8;
00672   cm->nodesArray = ALLOC(long, maxSize);
00673   cm->maxNodesArraySize = maxSize;
00674   cm->nodesArraySize = satNodeSize;
00675 
00676   sat_AllocLiteralsDB(cm);
00677 
00678   if(!sat_ReadCNF(cm, filename)) {
00679     sat_FreeManager(cm);
00680     return;
00681   }
00682 
00684   if(cm->option->coreGeneration==0)
00685     cm->option->useStrongConflictAnalysis = 1;
00686 
00687   sat_Main(cm);
00688 
00689   //Bing:change
00690   //unsat core
00691   if(cm->option->coreGeneration)
00692     fclose(cm->fp);
00693 
00694   if(cm->status == SAT_UNSAT) {
00695     if(cm->option->forcedAssignArr)
00696       fprintf(cm->stdOut, "%s UNSAT under given assignment\n",
00697               cm->comment);
00698     fprintf(cm->stdOut, "%s UNSATISFIABLE\n", cm->comment);
00699     fflush(cm->stdOut);
00700     sat_ReportStatistics(cm, cm->each);
00701     sat_FreeManager(cm);
00702   }
00703   else if(cm->status == SAT_SAT) {
00704     fprintf(cm->stdOut, "%s SATISFIABLE\n", cm->comment);
00705     fflush(cm->stdOut);
00706     sat_PrintSatisfyingAssignment(cm);
00707     sat_ReportStatistics(cm, cm->each);
00708     sat_FreeManager(cm);
00709   }
00710   if(cm->stdOut != stdout)
00711     fclose(cm->stdOut);
00712   if(cm->stdErr != stderr && cm->stdErr != cm->stdOut)
00713     fclose(cm->stdErr);
00714 }
00715 
00727 int
00728 sat_CNFMainWithArray(
00729         satOption_t *option,
00730         satArray_t *cnfArray,
00731         int unsatCoreFlag,
00732         satArray_t *coreArray,
00733         st_table *mappedTable)
00734 {
00735 satManager_t *cm;
00736 int maxSize;
00737 int flag;
00738 int i;
00739 long v;
00740 
00741   cm = sat_InitManager(0);
00742   cm->comment = ALLOC(char, 2);
00743   cm->comment[0] = ' ';
00744   cm->comment[1] = '\0';
00745   if(option->outFilename) {
00746     if(!(cm->stdOut = fopen(option->outFilename, "w"))) {
00747       fprintf(stdout, "ERROR : Can't open file %s\n", option->outFilename);
00748       cm->stdOut = stdout;
00749       cm->stdErr = stderr;
00750     }
00751     else {
00752       cm->stdErr = cm->stdOut;
00753     }
00754   }
00755   else {
00756     cm->stdOut = stdout;
00757     cm->stdErr = stderr;
00758   }
00759 
00760   cm->option = option;
00761   cm->each = sat_InitStatistics();
00762 
00763   cm->unitLits = sat_ArrayAlloc(16);
00764   cm->pureLits = sat_ArrayAlloc(16);
00765 
00766   maxSize = 1024 << 8;
00767   cm->nodesArray = ALLOC(long, maxSize);
00768   cm->maxNodesArraySize = maxSize;
00769   cm->nodesArraySize = satNodeSize;
00770 
00771   sat_AllocLiteralsDB(cm);
00772 
00773   if(unsatCoreFlag) {
00774     cm->option->useStrongConflictAnalysis = 0;
00775     cm->option->coreGeneration = 1;
00776     cm->dependenceTable = st_init_table(st_ptrcmp, st_ptrhash);
00777     cm->anteTable = st_init_table(st_numcmp, st_numhash);
00778   }
00779 
00780   if(!sat_ReadCNFFromArray(cm, cnfArray, mappedTable)) {
00781     sat_FreeManager(cm);
00782     return(SAT_UNSAT);
00783   }
00784 
00785   sat_Main(cm);
00786 
00787   if(cm->status == SAT_UNSAT) {
00788     if(cm->option->forcedAssignArr)
00789       fprintf(cm->stdOut, "%s UNSAT under given assignment\n",
00790               cm->comment);
00791     fprintf(cm->stdOut, "%s UNSATISFIABLE\n", cm->comment);
00792     fflush(cm->stdOut);
00793     sat_ReportStatistics(cm, cm->each);
00794     flag = SAT_UNSAT;
00795 
00796     if(unsatCoreFlag) {
00797       for(i=0; i<cm->clauseIndexInCore->num; i++) {
00798         v = cm->clauseIndexInCore->space[i];
00799         sat_ArrayInsert(coreArray, v);
00800       }
00801     }
00802   }
00803   else if(cm->status == SAT_SAT) {
00804     fprintf(cm->stdOut, "%s SATISFIABLE\n", cm->comment);
00805     fflush(cm->stdOut);
00806     sat_PrintSatisfyingAssignment(cm);
00807     sat_ReportStatistics(cm, cm->each);
00808     flag = SAT_SAT;
00809   }
00810   if(cm->stdOut != stdout)
00811     fclose(cm->stdOut);
00812   if(cm->stdErr != stderr && cm->stdErr != cm->stdOut)
00813     fclose(cm->stdErr);
00814 
00815   sat_FreeManager(cm);
00816 
00817   return(flag);
00818 }
00819 
00831 int
00832 sat_PrintSatisfyingAssignment(satManager_t *cm)
00833 {
00834 int i, size, index, value;
00835 
00836   index = 0;
00837   size = cm->initNumVariables * satNodeSize;
00838   for(i=satNodeSize; i<=size; i+=satNodeSize) {
00839     if(!(SATflags(i) & CoiMask))        continue;
00840     index ++;
00841     value = SATvalue(i);
00842     if(value == 1) {
00843       fprintf(cm->stdOut, "%ld ", SATnodeID(i));
00844     }
00845     else if(value == 0) {
00846       fprintf(cm->stdOut, "%ld ", -(SATnodeID(i)));
00847     }
00848     else {
00849       fprintf(cm->stdOut, "\n%s ERROR : unassigned variable %d\n", cm->comment, i);
00850       fflush(cm->stdOut);
00851       return(0);
00852     }
00853 
00854     if(((index % 10) == 0) && (i+satNodeSize <= size))
00855       fprintf(cm->stdOut, "\n ");
00856   }
00857   fprintf(cm->stdOut, "\n");
00858   return(1);
00859 }
00860 
00872 void
00873 sat_Verify(satManager_t *cm)
00874 {
00875 int value, size, i;
00876 int v, flag;
00877 satArray_t *arr;
00878 satLevel_t *d;
00879 
00880   if(cm->status != SAT_SAT)     return;
00881 
00882   size = cm->initNumVariables * satNodeSize;
00883   arr = sat_ArrayAlloc(cm->initNumVariables);
00884   for(i=satNodeSize; i<=size; i+=satNodeSize) {
00885     if(!(SATflags(i) & CoiMask))
00886       continue;
00887     value = SATvalue(i);
00888     if(value > 1) {
00889       fprintf(cm->stdOut, "%s ERROR : unassigned variable %d\n", cm->comment, i);
00890       fflush(cm->stdOut);
00891     }
00892     else {
00893       v = value ? i : SATnot(i);
00894       sat_ArrayInsert(arr, v);
00895     }
00896   }
00897 
00898   sat_Backtrack(cm, -1);
00899 
00900   d = sat_AllocLevel(cm);
00901   flag = sat_ApplyForcedAssigment(cm, arr, d);
00902   sat_ArrayFree(arr);
00903   if(flag == 1) {
00904     fprintf(cm->stdOut,
00905            "%s ERROR : Wrong satisfying assignment\n", cm->comment);
00906     fflush(cm->stdOut);
00907     exit(0);
00908   }
00909 }