d_diseqQueue(c, false),
d_currentPropagationList(),
d_learnedBounds(c),
+ d_preregisteredNodes(u),
d_partialModel(c, DeltaComputeCallback(*this)),
d_errorSet(
d_partialModel, TableauSizes(&d_tableau), BoundCountingLookup(*this)),
void TheoryArithPrivate::preRegisterTerm(TNode n) {
Debug("arith::preregister") <<"begin arith::preRegisterTerm("<< n <<")"<< endl;
+ d_preregisteredNodes.insert(n);
+
try {
if(isRelationOperator(n.getKind())){
if(!isSetup(n)){
*
* If there is no such variable, returns ARITHVAR_SENTINEL;
*/
-ArithVar TheoryArithPrivate::nextIntegerViolatation(bool assumeBounds) const {
+ArithVar TheoryArithPrivate::nextIntegerViolation(bool assumeBounds) const
+{
ArithVar numVars = d_partialModel.getNumberOfVariables();
ArithVar v = d_nextIntegerCheckVar;
- if(numVars > 0){
+ if (numVars > 0)
+ {
const ArithVar rrEnd = d_nextIntegerCheckVar;
- do {
- if(isIntegerInput(v)){
- if(!d_partialModel.integralAssignment(v)){
- if( assumeBounds || d_partialModel.assignmentIsConsistent(v) ){
+ do
+ {
+ if (isIntegerInput(v))
+ {
+ if (!d_partialModel.integralAssignment(v))
+ {
+ if (assumeBounds || d_partialModel.assignmentIsConsistent(v))
+ {
return v;
}
}
}
- v= (1 + v == numVars) ? 0 : (1 + v);
- }while(v != rrEnd);
+ v = (1 + v == numVars) ? 0 : (1 + v);
+ } while (v != rrEnd);
}
return ARITHVAR_SENTINEL;
}
* Checks the set of integer variables I to see if each variable
* in I has an integer assignment.
*/
-bool TheoryArithPrivate::hasIntegerModel(){
- ArithVar next = nextIntegerViolatation(true);
- if(next != ARITHVAR_SENTINEL){
+bool TheoryArithPrivate::hasIntegerModel()
+{
+ ArithVar next = nextIntegerViolation(true);
+ if (next != ARITHVAR_SENTINEL)
+ {
d_nextIntegerCheckVar = next;
- if(Debug.isOn("arith::hasIntegerModel")){
+ if (Debug.isOn("arith::hasIntegerModel"))
+ {
Debug("arith::hasIntegerModel") << "has int model? " << next << endl;
d_partialModel.printModel(next, Debug("arith::hasIntegerModel"));
}
return false;
- }else{
+ }
+ else
+ {
return true;
}
}
-
Node flattenAndSort(Node n){
Kind k = n.getKind();
switch(k){
importSolution(mipSolution);
solveRelaxationOrPanic(effortLevel);
- if(d_qflraStatus == Result::SAT){
- if(!anyConflict()){
- if(ARITHVAR_SENTINEL == nextIntegerViolatation(false)){
+ if (d_qflraStatus == Result::SAT)
+ {
+ if (!anyConflict())
+ {
+ if (ARITHVAR_SENTINEL == nextIntegerViolation(false))
+ {
++(d_statistics.d_solveIntModelsSuccessful);
}
}
}
}
-bool TheoryArithPrivate::solveRelaxationOrPanic(Theory::Effort effortLevel){
+bool TheoryArithPrivate::solveRelaxationOrPanic(Theory::Effort effortLevel)
+{
// if at this point the linear relaxation is still unknown,
// attempt to branch an integer variable as a last ditch effort on full check
- if(d_qflraStatus == Result::SAT_UNKNOWN){
+ if (d_qflraStatus == Result::SAT_UNKNOWN)
+ {
d_qflraStatus = selectSimplex(true).findModel(false);
}
- if(Theory::fullEffort(effortLevel) && d_qflraStatus == Result::SAT_UNKNOWN){
- ArithVar canBranch = nextIntegerViolatation(false);
- if(canBranch != ARITHVAR_SENTINEL){
+ if (Theory::fullEffort(effortLevel) && d_qflraStatus == Result::SAT_UNKNOWN)
+ {
+ ArithVar canBranch = nextIntegerViolation(false);
+ if (canBranch != ARITHVAR_SENTINEL)
+ {
++d_statistics.d_panicBranches;
TrustNode branch = branchIntegerVariable(canBranch);
Assert(branch.getNode().getKind() == kind::OR);
Node rwbranch = Rewriter::rewrite(branch.getNode()[0]);
- if(!isSatLiteral(rwbranch)){
+ if (!isSatLiteral(rwbranch))
+ {
d_approxCuts.push_back(branch);
return true;
}
return d_partialModel.isAuxiliary(x);
}
- inline bool isIntegerInput(ArithVar x) const {
- return d_partialModel.isIntegerInput(x);
+ inline bool isIntegerInput(ArithVar x) const
+ {
+ return d_partialModel.isIntegerInput(x)
+ && d_preregisteredNodes.contains(d_partialModel.asNode(x));
}
/**
context::CDQueue<ConstraintP> d_learnedBounds;
+ /**
+ * Contains all nodes that have been preregistered
+ */
+ context::CDHashSet<Node, NodeHashFunction> d_preregisteredNodes;
+
/**
* Manages information about the assignment and upper and lower bounds on
*
* If there is no such variable, returns ARITHVAR_SENTINEL;
*/
- ArithVar nextIntegerViolatation(bool assumeBounds) const;
+ ArithVar nextIntegerViolation(bool assumeBounds) const;
/**
* Issues branches for non-auxiliary integer variables with non-integer assignments.