From 356a8b6e5ea2622d0fef5cf209159caf08ba5297 Mon Sep 17 00:00:00 2001 From: Tim King Date: Wed, 5 Dec 2012 19:47:31 +0000 Subject: Cleanup of arithmetic, and some new utility functions for the coming fcsimplex code. --- src/theory/arith/arith_utilities.h | 53 -------------------------------------- src/theory/arith/arithvar.h | 10 +++++++ src/theory/arith/partial_model.cpp | 23 ++++++++++++++++- src/theory/arith/partial_model.h | 25 +++++++++++++++++- 4 files changed, 56 insertions(+), 55 deletions(-) (limited to 'src/theory/arith') diff --git a/src/theory/arith/arith_utilities.h b/src/theory/arith/arith_utilities.h index c7f511a98..76210fc7c 100644 --- a/src/theory/arith/arith_utilities.h +++ b/src/theory/arith/arith_utilities.h @@ -168,59 +168,6 @@ inline int deltaCoeff(Kind k){ } } - -// template -// inline TNode getSide(TNode assertion, Kind simpleKind){ -// switch(simpleKind){ -// case kind::LT: -// case kind::GT: -// case kind::DISTINCT: -// return selectLeft ? (assertion[0])[0] : (assertion[0])[1]; -// case kind::LEQ: -// case kind::GEQ: -// case kind::EQUAL: -// return selectLeft ? assertion[0] : assertion[1]; -// default: -// Unreachable(); -// return TNode::null(); -// } -// } - -// inline DeltaRational determineRightConstant(TNode assertion, Kind simpleKind){ -// TNode right = getSide(assertion, simpleKind); - -// Assert(right.getKind() == kind::CONST_RATIONAL); -// const Rational& noninf = right.getConst(); - -// Rational inf = Rational(Integer(deltaCoeff(simpleKind))); -// return DeltaRational(noninf, inf); -// } - -// inline DeltaRational asDeltaRational(TNode n){ -// Kind simp = simplifiedKind(n); -// return determineRightConstant(n, simp); -// } - -// /** -// * Takes two nodes with exactly 2 children, -// * the second child of both are of kind CONST_RATIONAL, -// * and compares value of the two children. -// * This is for comparing inequality nodes. -// * RightHandRationalLT((<= x 50), (< x 75)) == true -// */ -// struct RightHandRationalLT -// { -// bool operator()(TNode s1, TNode s2) const -// { -// TNode rh1 = s1[1]; -// TNode rh2 = s2[1]; -// const Rational& c1 = rh1.getConst(); -// const Rational& c2 = rh2.getConst(); -// int cmpRes = c1.cmp(c2); -// return cmpRes < 0; -// } -// }; - inline Node negateConjunctionAsClause(TNode conjunction){ Assert(conjunction.getKind() == kind::AND); NodeBuilder<> orBuilder(kind::OR); diff --git a/src/theory/arith/arithvar.h b/src/theory/arith/arithvar.h index 7cb6c6e99..eac238cba 100644 --- a/src/theory/arith/arithvar.h +++ b/src/theory/arith/arithvar.h @@ -50,6 +50,16 @@ public: virtual void operator()(ArithVar x) = 0; }; +/** + * Requests arithmetic variables for internal use, + * and releases arithmetic variables that are no longer being used. + */ +class ArithVarMalloc { +public: + virtual ArithVar request() = 0; + virtual void release(ArithVar v) = 0; +}; + class TNodeCallBack { public: virtual void operator()(TNode n) = 0; diff --git a/src/theory/arith/partial_model.cpp b/src/theory/arith/partial_model.cpp index 0ffe67763..5dccd8747 100644 --- a/src/theory/arith/partial_model.cpp +++ b/src/theory/arith/partial_model.cpp @@ -72,7 +72,9 @@ void ArithPartialModel::setAssignment(ArithVar x, const DeltaRational& safe, con Debug("partial_model") << "pm: updating the assignment to" << x << " now " << r <