bool Distiller::distill_long_irred_cls() { assert(solver->ok); if (solver->conf.verbosity >= 6) { cout << "c Doing distillation branch for long irred clauses" << endl; } double myTime = cpuTime(); const size_t origTrailSize = solver->trail_size(); //Time-limiting uint64_t maxNumProps = solver->conf.distill_long_irred_cls_time_limitM*1000LL*1000ULL *solver->conf.global_timeout_multiplier; if (solver->litStats.irredLits + solver->litStats.redLits < 500000) maxNumProps *=2; extraTime = 0; uint64_t oldBogoProps = solver->propStats.bogoProps; bool time_out = false; runStats.potentialClauses = solver->longIrredCls.size(); runStats.numCalled = 1; std::sort(solver->longIrredCls.begin(), solver->longIrredCls.end(), ClauseSizeSorter(solver->cl_alloc)); uint64_t origLitRem = runStats.numLitsRem; uint64_t origClShorten = runStats.numClShorten; uint32_t queueByBy = 2; if (numCalls > 8 && (solver->litStats.irredLits + solver->litStats.redLits < 4000000) && (solver->longIrredCls.size() < 50000) ) { queueByBy = 1; } vector<ClOffset>::iterator i, j; i = j = solver->longIrredCls.begin(); for (vector<ClOffset>::iterator end = solver->longIrredCls.end() ; i != end ; i++ ) { //Check if we are in state where we only copy offsets around if (time_out || !solver->ok) { *j++ = *i; continue; } //if done enough, stop doing it if (solver->propStats.bogoProps-oldBogoProps + extraTime >= maxNumProps || solver->must_interrupt_asap() ) { if (solver->conf.verbosity >= 3) { cout << "c Need to finish distillation -- ran out of prop (=allocated time)" << endl; } runStats.timeOut++; time_out = true; } //Get pointer ClOffset offset = *i; Clause& cl = *solver->cl_alloc.ptr(offset); //Time to dereference extraTime += 5; //If we already tried this clause, then move to next if (cl.getdistilled()) { *j++ = *i; continue; } else { //Otherwise, this clause has been tried for sure cl.set_distilled(true); } extraTime += cl.size(); runStats.checkedClauses++; //Sanity check assert(cl.size() > 3); assert(!cl.red()); //Copy literals uselessLits.clear(); lits.resize(cl.size()); std::copy(cl.begin(), cl.end(), lits.begin()); //Try to distill clause ClOffset offset2 = try_distill_clause_and_return_new( offset , cl.red() , queueByBy ); if (offset2 != CL_OFFSET_MAX) { *j++ = offset2; } } solver->longIrredCls.resize(solver->longIrredCls.size()- (i-j)); //Didn't time out, so it went through the whole list. Reset distill for all. if (!time_out) { for (vector<ClOffset>::const_iterator it = solver->longIrredCls.begin(), end = solver->longIrredCls.end() ; it != end ; ++it ) { Clause* cl = solver->cl_alloc.ptr(*it); cl->set_distilled(false); } } const double time_used = cpuTime() - myTime; const double time_remain = float_div(solver->propStats.bogoProps-oldBogoProps + extraTime, maxNumProps); if (solver->conf.verbosity >= 2) { cout << "c [distill] longirred" << " tried: " << runStats.checkedClauses << "/" << solver->longIrredCls.size() << " cl-r:" << runStats.numClShorten- origClShorten << " lit-r:" << runStats.numLitsRem - origLitRem << solver->conf.print_times(time_used, time_out, time_remain) << endl; } if (solver->sqlStats) { solver->sqlStats->time_passed( solver , "distill long irred" , time_used , time_out , time_remain ); } //Update stats runStats.time_used = cpuTime() - myTime; runStats.zeroDepthAssigns = solver->trail_size() - origTrailSize; return solver->ok; }