Skip to content

Commit cbde920

Browse files
committed
LASolver: Skip redundant check
LASolver::updateBound was always called only on new inequalities, never on already seen ones.
1 parent 2c1c249 commit cbde920

File tree

2 files changed

+4
-17
lines changed

2 files changed

+4
-17
lines changed

src/tsolvers/lasolver/LASolver.cc

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ void LASolver::addBound(PTRef leq_tr) {
3838
}();
3939

4040
int const tid = Idx(logic.getPterm(leq_tr).getId());
41+
// Must be a new inequality
42+
assert(tid >= LeqToLABoundRefPair.size() or (LeqToLABoundRefPair[tid] == LABoundRefPair{LABoundRef_Undef, LABoundRef_Undef}));
4143
if (LeqToLABoundRefPair.size() <= tid) {
4244
LeqToLABoundRefPair.growTo(tid + 1);
4345
}
@@ -52,18 +54,6 @@ void LASolver::addBound(PTRef leq_tr) {
5254
LABoundRefToLeqAsgn[br_neg_idx] = PtAsgn(leq_tr, l_False);
5355
}
5456

55-
void LASolver::updateBound(PTRef tr)
56-
{
57-
// If the bound already exists, do nothing.
58-
int id = Idx(logic.getPterm(tr).getId());
59-
60-
if ((LeqToLABoundRefPair.size() > id) &&
61-
!(LeqToLABoundRefPair[id] == LABoundRefPair{LABoundRef_Undef, LABoundRef_Undef})) {
62-
return;
63-
}
64-
addBound(tr);
65-
}
66-
6757
bool LASolver::isValid(PTRef tr)
6858
{
6959
return logic.isLeq(tr); // MB: LA solver expects only inequalities in LEQ form!
@@ -278,12 +268,10 @@ void LASolver::declareAtom(PTRef leq_tr)
278268

279269
if (status != INIT)
280270
{
281-
// Treat the PTRef as it is pushed on-the-fly
282-
// status = INCREMENT;
283-
assert( status == SAT );
271+
assert(status == SAT);
284272
PTRef term = logic.getPterm(leq_tr)[1];
285273
registerArithmeticTerm(term);
286-
updateBound(leq_tr);
274+
addBound(leq_tr);
287275
}
288276
// DEBUG check
289277
isProperLeq(leq_tr);

src/tsolvers/lasolver/LASolver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,6 @@ class LASolver : public TSolver {
9393
PTRef getVarPTRef(LVRef v) const { return laVarMapper.getVarPTRef(v); }
9494

9595
void addBound(PTRef leq_tr);
96-
void updateBound(PTRef leq_tr);
9796
LVRef registerArithmeticTerm(PTRef expr); // Ensures this term and all variables in it has corresponding LVAR.
9897
// Returns the LAVar for the term.
9998
void storeExplanation(Simplex::Explanation && explanationBounds);

0 commit comments

Comments
 (0)