Search in sources :

Example 6 with Clause

use of kodkod.engine.satlab.Clause in project org.alloytools.alloy by AlloyTools.

the class CRRStrategy method next.

/**
 * Returns the next subset of clauses in the given trace to be analyzed.
 *
 * @requires {@inheritDoc}
 * @ensures {@inheritDoc}
 * @return last(this.nexts')
 */
@Override
public final IntSet next(final ResolutionTrace trace) {
    final IntSet core = trace.core();
    if (excluded == null) {
        // the first time this method is called
        excluded = new HashSet<Clause>((int) (StrictMath.round(core.size() * .75)));
    }
    for (IntIterator iter = core.iterator(Integer.MAX_VALUE, Integer.MIN_VALUE); iter.hasNext(); ) {
        int index = iter.next();
        if (excluded.add(trace.get(index))) {
            // haven't tried excluding
            // this one
            // get all clauses reachable from the conflict clause
            IntSet next = trace.reachable(Ints.singleton(trace.size() - 1));
            // remove all clauses backward reachable from the excluded
            // clause
            next.removeAll(trace.backwardReachable(Ints.singleton(index)));
            return next;
        }
    }
    return Ints.EMPTY_SET;
}
Also used : IntIterator(kodkod.util.ints.IntIterator) IntSet(kodkod.util.ints.IntSet) Clause(kodkod.engine.satlab.Clause)

Aggregations

Clause (kodkod.engine.satlab.Clause)6 IntSet (kodkod.util.ints.IntSet)6 IntIterator (kodkod.util.ints.IntIterator)5 IntBitSet (kodkod.util.ints.IntBitSet)4 IntTreeSet (kodkod.util.ints.IntTreeSet)1