Skip to content

Commit c40b7fe

Browse files
committed
Lookahead: checking wheter a bound propagates
This commit introduces a simple check whether a given linear inequality would result in a propagation of another linear inequality.
1 parent b424d69 commit c40b7fe

File tree

2 files changed

+25
-5
lines changed

2 files changed

+25
-5
lines changed

src/tsolvers/lasolver/LASolver.cc

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -623,13 +623,32 @@ bool LASolver::setStatus( LASolverStatus s )
623623
return getStatus( );
624624
}
625625

626-
bool LASolver::wouldDeduce(LABoundRef br) const {
627-
LABound const & bound = boundStore[br];
626+
bool LASolver::wouldDeduce(PtAsgn asgn) const {
627+
assert(status != INIT);
628+
assert(logic.isLeq(asgn.tr));
629+
assert(not hasPolarity(asgn.tr));
630+
LVRef v = getVarForLeq(asgn.tr);
631+
LABoundRef boundRef = asgn.sgn == l_False ? getBoundRefPair(asgn.tr).neg : getBoundRefPair(asgn.tr).pos;
632+
LABound const & bound = boundStore[boundRef];
633+
634+
auto searchForUnassignedBound = [this, &bound, &v](BoundT type) {
635+
for (int it = bound.getIdx().x - 1; it >= 0; -- it) {
636+
LABoundRef candidateRef = boundStore.getBoundByIdx(v, it);
637+
LABound const & candidate = boundStore[candidateRef];
638+
if (candidate.getType() != type) {
639+
continue;
640+
} else if (not hasPolarity(getAsgnByBound(candidateRef).tr)) {
641+
return true;
642+
}
643+
}
644+
return false;
645+
};
646+
628647
if (bound.getType() == bound_l) {
629-
for (int it = bound.getIdx().x - 1; it >= 0; -- it) {
630-
LABoundRef propagatedBoundRef = boundStore.getBoundByIdx(v, it)
631-
}
648+
return searchForUnassignedBound(bound_u);
632649
}
650+
assert(bound.getType() == bound_u);
651+
return searchForUnassignedBound(bound_l);
633652
}
634653

635654
void LASolver::getSimpleDeductions(LVRef v, LABoundRef br)

src/tsolvers/lasolver/LASolver.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,7 @@ class LASolver: public TSolver
160160
bool shouldTryCutFromProof() const;
161161

162162
void getSuggestions( vec<PTRef>& dst, SolverId solver_id ); // find possible suggested atoms
163+
bool wouldDeduce(PtAsgn pta) const; // Would setting this assignment deduce more bounds
163164
void getSimpleDeductions(LVRef v, LABoundRef); // find deductions from actual bounds position
164165
unsigned getIteratorByPTRef( PTRef e, bool ); // find bound iterator by the PTRef
165166
inline bool getStatus( ); // Read the status of the solver in lbool

0 commit comments

Comments
 (0)