d_updatedBounds.softAdd(x_i);
+ if(Debug.isOn("model")) {
+ Debug("model") << "before" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
+
if(!d_tableau.isBasic(x_i)){
if(d_partialModel.getAssignment(x_i) < c_i){
d_linEq.update(x_i, c_i);
d_simplex.updateBasic(x_i);
}
- if(Debug.isOn("model")) { d_partialModel.printModel(x_i); }
+ if(Debug.isOn("model")) {
+ Debug("model") << "after" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
return false; //sat
}
d_updatedBounds.softAdd(x_i);
+ if(Debug.isOn("model")) {
+ Debug("model") << "before" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
+
if(!d_tableau.isBasic(x_i)){
if(d_partialModel.getAssignment(x_i) > c_i){
d_linEq.update(x_i, c_i);
d_simplex.updateBasic(x_i);
}
- if(Debug.isOn("model")) { d_partialModel.printModel(x_i); }
+ if(Debug.isOn("model")) {
+ Debug("model") << "after" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
return false; //sat
}
d_updatedBounds.softAdd(x_i);
+ if(Debug.isOn("model")) {
+ Debug("model") << "before" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
+
if(!d_tableau.isBasic(x_i)){
if(!(d_partialModel.getAssignment(x_i) == c_i)){
d_linEq.update(x_i, c_i);
}else{
d_simplex.updateBasic(x_i);
}
+
+ if(Debug.isOn("model")) {
+ Debug("model") << "after" << endl;
+ d_partialModel.printModel(x_i);
+ d_tableau.debugPrintIsBasic(x_i);
+ }
+
return false;
}
d_qflraStatus = Result::UNSAT;
if(previous == Result::SAT){
++d_statistics.d_revertsOnConflicts;
+ Debug("arith::bt") << "clearing here " << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
revertOutOfConflict();
d_simplex.clearQueue();
}else{
++d_statistics.d_commitsOnConflicts;
-
+ Debug("arith::bt") << "committing here " << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
d_partialModel.commitAssignmentChanges();
revertOutOfConflict();
}
if(newFacts){
++d_statistics.d_nontrivialSatChecks;
}
+
+ Debug("arith::bt") << "committing sap inConflit" << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
d_partialModel.commitAssignmentChanges();
d_unknownsInARow = 0;
if(Debug.isOn("arith::consistency")){
- Assert(entireStateIsConsistent());
+ Assert(entireStateIsConsistent("sat comit"));
}
break;
case Result::SAT_UNKNOWN:
++d_unknownsInARow;
++(d_statistics.d_unknownChecks);
Assert(!fullEffort(effortLevel));
+ Debug("arith::bt") << "committing unknown" << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
d_partialModel.commitAssignmentChanges();
d_statistics.d_maxUnknownsInARow.maxAssign(d_unknownsInARow);
break;
d_unknownsInARow = 0;
if(previous == Result::SAT){
++d_statistics.d_revertsOnConflicts;
+ Debug("arith::bt") << "clearing on conflict" << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
revertOutOfConflict();
d_simplex.clearQueue();
}else{
++d_statistics.d_commitsOnConflicts;
+ Debug("arith::bt") << "committing on conflict" << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
d_partialModel.commitAssignmentChanges();
revertOutOfConflict();
+
+ if(Debug.isOn("arith::consistency")){
+ entireStateIsConsistent("commit on conflict");
+ }
}
outputConflicts();
emmittedConflictOrSplit = true;
d_qflraStatus = Result::UNSAT;
outputConflicts();
emmittedConflictOrSplit = true;
+ Debug("arith::bt") << "committing on unate conflict" << " " << newFacts << " " << previous << " " << d_qflraStatus << endl;
+
}
}else{
TimerStat::CodeTimer codeTimer(d_statistics.d_newPropTime);
}
}
+bool TheoryArith::safeToReset() const {
+ Assert(!d_tableauSizeHasBeenModified);
+
+ ArithPriorityQueue::const_iterator conf_iter = d_simplex.queueBegin();
+ ArithPriorityQueue::const_iterator conf_end = d_simplex.queueEnd();
+ for(; conf_iter != conf_end; ++conf_iter){
+ ArithVar basic = *conf_iter;
+ if(!d_smallTableauCopy.isBasic(basic)){
+ return false;
+ }
+ }
+
+ return true;
+}
+
void TheoryArith::notifyRestart(){
TimerStat::CodeTimer codeTimer(d_statistics.d_restartTimer);
uint32_t currSize = d_tableau.size();
uint32_t copySize = d_smallTableauCopy.size();
+ Debug("arith::reset") << "resetting" << d_restartsCounter << endl;
Debug("arith::reset") << "curr " << currSize << " copy " << copySize << endl;
Debug("arith::reset") << "tableauSizeHasBeenModified " << d_tableauSizeHasBeenModified << endl;
d_tableauSizeHasBeenModified = false;
}else if( d_restartsCounter >= RESET_START){
if(copySize >= currSize * 1.1 ){
+ Debug("arith::reset") << "size has shrunk " << d_restartsCounter << endl;
++d_statistics.d_smallerSetToCurr;
d_smallTableauCopy = d_tableau;
}else if(d_tableauResetDensity * copySize <= currSize){
- ++d_statistics.d_currSetToSmaller;
- d_tableau = d_smallTableauCopy;
+ d_simplex.reduceQueue();
+ if(safeToReset()){
+ Debug("arith::reset") << "resetting " << d_restartsCounter << endl;
+ ++d_statistics.d_currSetToSmaller;
+ d_tableau = d_smallTableauCopy;
+ }else{
+ Debug("arith::reset") << "not safe to reset at the moment " << d_restartsCounter << endl;
+ }
}
}
+ Assert(unenqueuedVariablesAreConsistent());
}
-bool TheoryArith::entireStateIsConsistent(){
+bool TheoryArith::entireStateIsConsistent(const string& s){
typedef std::vector<Node>::const_iterator VarIter;
bool result = true;
for(VarIter i = d_variables.begin(), end = d_variables.end(); i != end; ++i){
ArithVar var = d_arithvarNodeMap.asArithVar(*i);
if(!d_partialModel.assignmentIsConsistent(var)){
d_partialModel.printModel(var);
- Warning() << "Assignment is not consistent for " << var << *i;
+ Warning() << s << ":" << "Assignment is not consistent for " << var << *i;
if(d_tableau.isBasic(var)){
Warning() << " (basic)";
}
bool result = true;
for(VarIter i = d_variables.begin(), end = d_variables.end(); i != end; ++i){
ArithVar var = d_arithvarNodeMap.asArithVar(*i);
- if(!d_partialModel.assignmentIsConsistent(var) &&
- !d_simplex.debugIsInCollectionQueue(var)){
+ if(!d_partialModel.assignmentIsConsistent(var)){
+ if(!d_simplex.debugIsInCollectionQueue(var)){
- d_partialModel.printModel(var);
- Warning() << "Unenqueued var is not consistent for " << var << *i;
- if(d_tableau.isBasic(var)){
- Warning() << " (basic)";
+ d_partialModel.printModel(var);
+ Warning() << "Unenqueued var is not consistent for " << var << *i;
+ if(d_tableau.isBasic(var)){
+ Warning() << " (basic)";
+ }
+ Warning() << endl;
+ result = false;
+ } else {
+ d_partialModel.printModel(var);
+ Warning() << "Initial var is not consistent for " << var << *i;
+ if(d_tableau.isBasic(var)){
+ Warning() << " (basic)";
+ }
+ Warning() << endl;
}
- Warning() << endl;
- result = false;
- }
+ }
}
return result;
}