From c9eecce14921a315d7c617c3179d5245d029f72e Mon Sep 17 00:00:00 2001 From: Martin Suda Date: Mon, 13 Oct 2014 18:47:31 +0100 Subject: [PATCH] fixing the ommisions in implemting model minimization option for avatar --- SAT/MinimizingSolver.cpp | 2 +- Saturation/SSplitter.cpp | 24 ++++++++++++++++-------- Saturation/SSplitter.hpp | 6 ++++-- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/SAT/MinimizingSolver.cpp b/SAT/MinimizingSolver.cpp index 205852332c..942f46f877 100644 --- a/SAT/MinimizingSolver.cpp +++ b/SAT/MinimizingSolver.cpp @@ -51,7 +51,7 @@ void MinimizingSolver::addClauses(SATClauseIterator cit, bool onlyPropagate,bool // and not adding clauses to _unprocessed should only result in more variables being marked // as DONT_CARE (if they only appear in clauses not to be used in the partial model) // - Giles - if(useInPartialModel){ + if(useInPartialModel || ! _splitclausesonly ) { //we need to filter out the empty clause -- it won't have any influence on our algorithm //(as it will make the problem unsat and we process only satisfiale assignment), but it //is a corner case that needs to be handled diff --git a/Saturation/SSplitter.cpp b/Saturation/SSplitter.cpp index fead3fc7f3..242fdaf1ac 100644 --- a/Saturation/SSplitter.cpp +++ b/Saturation/SSplitter.cpp @@ -230,7 +230,9 @@ void SSplittingBranchSelector::updateSelection(unsigned satVar, SATSolver::VarAs } -void SSplittingBranchSelector::addSatClauses(const SATClauseStack& clauses, +void SSplittingBranchSelector::addSatClauses( + const SATClauseStack& regularClauses, + const SATClauseStack& conflictClauses, SplitLevelStack& addedComps, SplitLevelStack& removedComps) { CALL("SSplittingBranchSelector::addSatClauses"); @@ -242,12 +244,13 @@ void SSplittingBranchSelector::addSatClauses(const SATClauseStack& clauses, // _unprocessed.loadFromIterator( // getFilteredIterator(SATClauseStack::ConstIterator(clauses), hasPositiveLiteral) ); - RSTAT_CTR_INC_MANY("ssat_sat_clauses",clauses.size()); + RSTAT_CTR_INC_MANY("ssat_sat_clauses",regularClauses.size()+conflictClauses.size()); // RSTAT_CTR_INC_MANY("ssat_sat_clauses_with_positive",_unprocessed.size()); { TimeCounter tc1(TC_SAT_SOLVER); // We do use split clauses in the partial model - _solver->addClauses(pvi( SATClauseStack::ConstIterator(clauses) ), false,true); + _solver->addClauses(pvi( SATClauseStack::ConstIterator(regularClauses) ), false,true); + _solver->addClauses(pvi( SATClauseStack::ConstIterator(conflictClauses) ), false,false); processDPConflicts(); } @@ -426,8 +429,11 @@ void SSplitter::addSATClause(SATClause* cl, bool branchRefutation) } if(branchRefutation) { _haveBranchRefutation = true; + _conflictClausesToBeAdded.push(cl); + } else { + _regularClausesToBeAdded.push(cl); } - _clausesToBeAdded.push(cl); + } void SSplitter::onAllProcessed() @@ -439,7 +445,8 @@ void SSplitter::onAllProcessed() if(_haveBranchRefutation) { _flushThreshold = _sa->getGeneratedClauseCount()+_flushPeriod; } - if(_sa->getGeneratedClauseCount()>=_flushThreshold && _clausesToBeAdded.isEmpty()) { + if(_sa->getGeneratedClauseCount()>=_flushThreshold && + _regularClausesToBeAdded.isEmpty() && _conflictClausesToBeAdded.isEmpty()) { flushing = true; _flushThreshold = _sa->getGeneratedClauseCount()+_flushPeriod; _flushPeriod = static_cast(_flushPeriod*_flushQuotient); @@ -448,7 +455,7 @@ void SSplitter::onAllProcessed() _haveBranchRefutation = false; - if(_clausesToBeAdded.isEmpty() && !flushing) { + if(_regularClausesToBeAdded.isEmpty() && _conflictClausesToBeAdded.isEmpty() && !flushing) { return; } static SplitLevelStack toAdd; @@ -459,8 +466,9 @@ void SSplitter::onAllProcessed() _branchSelector.flush(toAdd, toRemove); } else { - _branchSelector.addSatClauses(_clausesToBeAdded, toAdd, toRemove); - _clausesToBeAdded.reset(); + _branchSelector.addSatClauses(_regularClausesToBeAdded,_conflictClausesToBeAdded, toAdd, toRemove); + _regularClausesToBeAdded.reset(); + _conflictClausesToBeAdded.reset(); } if(toRemove.isNonEmpty()) { diff --git a/Saturation/SSplitter.hpp b/Saturation/SSplitter.hpp index 9840295447..cd87f41587 100644 --- a/Saturation/SSplitter.hpp +++ b/Saturation/SSplitter.hpp @@ -49,7 +49,8 @@ class SSplittingBranchSelector { void init(); void updateVarCnt(); - void addSatClauses(const SATClauseStack& clauses, SplitLevelStack& addedComps, SplitLevelStack& removedComps); + void addSatClauses(const SATClauseStack& regularClauses, const SATClauseStack& conflictClauses, + SplitLevelStack& addedComps, SplitLevelStack& removedComps); void flush(SplitLevelStack& addedComps, SplitLevelStack& removedComps); void clearZeroImpliedSplits(Clause* cl); @@ -233,7 +234,8 @@ class SSplitter : public Splitter { * in the saturation algorithm (and so we'll be able to maintain the * correspondence between the SAT model and the clauses in the saturation). */ - SATClauseStack _clausesToBeAdded; + SATClauseStack _regularClausesToBeAdded; + SATClauseStack _conflictClausesToBeAdded; }; }