d_successAfterDiffSearch("theory::arith::successAfterDiffSearch",0),
d_attemptDuringVarOrderSearch("theory::arith::attemptDuringVarOrderSearch",0),
d_successDuringVarOrderSearch("theory::arith::successDuringVarOrderSearch",0),
+ d_delayedConflicts("theory::arith::delayedConflicts",0),
d_pivotTime("theory::arith::pivotTime"),
d_avgNumRowsNotContainingOnUpdate("theory::arith::avgNumRowsNotContainingOnUpdate"),
d_avgNumRowsNotContainingOnPivot("theory::arith::avgNumRowsNotContainingOnPivot")
StatisticsRegistry::registerStat(&d_attemptDuringVarOrderSearch);
StatisticsRegistry::registerStat(&d_successDuringVarOrderSearch);
+ StatisticsRegistry::registerStat(&d_delayedConflicts);
+
StatisticsRegistry::registerStat(&d_pivotTime);
StatisticsRegistry::registerStat(&d_avgNumRowsNotContainingOnUpdate);
StatisticsRegistry::unregisterStat(&d_attemptDuringVarOrderSearch);
StatisticsRegistry::unregisterStat(&d_successDuringVarOrderSearch);
+ StatisticsRegistry::unregisterStat(&d_delayedConflicts);
StatisticsRegistry::unregisterStat(&d_pivotTime);
StatisticsRegistry::unregisterStat(&d_avgNumRowsNotContainingOnUpdate);
case DuringVarOrderSearch: ++(d_statistics.d_attemptDuringVarOrderSearch); break;
}
- Node bestConflict = Node::null();
+ Node firstConflict = Node::null();
ArithPriorityQueue::const_iterator i = d_queue.begin();
ArithPriorityQueue::const_iterator end = d_queue.end();
for(; i != end; ++i){
if(d_tableau.isBasic(x_i)){
Node possibleConflict = checkBasicForConflict(x_i);
if(!possibleConflict.isNull()){
-
- bestConflict = betterConflict(bestConflict, possibleConflict);
+ if(firstConflict.isNull()){
+ firstConflict = possibleConflict;
+ }else{
+ delayConflictAsLemma(possibleConflict);
+ }
}
}
}
- if(!bestConflict.isNull()){
+ if(!firstConflict.isNull()){
switch(type){
case BeforeDiffSearch: ++(d_statistics.d_successBeforeDiffSearch); break;
case AfterDiffSearch: ++(d_statistics.d_successAfterDiffSearch); break;
case DuringVarOrderSearch: ++(d_statistics.d_successDuringVarOrderSearch); break;
}
}
- return bestConflict;
+ return firstConflict;
}
Node SimplexDecisionProcedure::updateInconsistentVars(){
#include "util/stats.h"
-#include <queue>
+#include <vector>
namespace CVC4 {
namespace theory {
ArithVar d_numVariables;
+ std::vector<Node> d_delayedLemmas;
+ uint32_t d_delayedLemmasPos;
+
public:
SimplexDecisionProcedure(const ArithConstants& constants,
ArithPartialModel& pm,
d_out(out),
d_tableau(tableau),
d_queue(pm, tableau),
- d_numVariables(0)
+ d_numVariables(0),
+ d_delayedLemmas(),
+ d_delayedLemmasPos(0)
{}
- void increaseMax() {d_numVariables++;}
+
+public:
/**
* Assert*(n, orig) takes an bound n that is implied by orig.
*/
DeltaRational computeRowValue(ArithVar x, bool useSafe);
+
+ void increaseMax() {d_numVariables++;}
+
+ /** Returns true if the simplex procedure has more delayed lemmas in its queue.*/
+ bool hasMoreLemmas() const {
+ return d_delayedLemmasPos < d_delayedLemmas.size();
+ }
+ /** Returns the next delayed lemmas on the queue.*/
+ Node popLemma(){
+ Assert(hasMoreLemmas());
+ Node lemma = d_delayedLemmas[d_delayedLemmasPos];
+ ++d_delayedLemmasPos;
+ return lemma;
+ }
+
private:
+ /** Adds a lemma to the queue. */
+ void pushLemma(Node lemma){
+ d_delayedLemmas.push_back(lemma);
+ ++(d_statistics.d_delayedConflicts);
+ }
+
+ /** Adds a conflict as a lemma to the queue. */
+ void delayConflictAsLemma(Node conflict){
+ Node negatedConflict = negateConjunctionAsClause(conflict);
+ pushLemma(negatedConflict);
+ }
/**
* Checks a basic variable, b, to see if it is in conflict.
IntStat d_attemptAfterDiffSearch, d_successAfterDiffSearch;
IntStat d_attemptDuringVarOrderSearch, d_successDuringVarOrderSearch;
+ IntStat d_delayedConflicts;
+
TimerStat d_pivotTime;
AverageStat d_avgNumRowsNotContainingOnUpdate;