* {@inheritDoc}
* @see kodkod.engine.satlab.ReductionStrategy#next(kodkod.engine.satlab.ResolutionTrace)
*/
public IntSet next(ResolutionTrace trace) {
if (topVars.isEmpty()) return Ints.EMPTY_SET; // tried everything
final IntSet core = trace.core();
for(Iterator<Clause> iter = trace.iterator(core); iter.hasNext();) {
Clause clause = iter.next();
int maxVar = clause.maxVariable();
if (topVars.remove(maxVar)) {
// get all core clauses with the given maximum variable
IntSet exclude = coreClausesWithMaxVar(trace, maxVar);
assert !exclude.isEmpty();
// get all clauses reachable from the conflict clause
IntSet next = trace.reachable(Ints.singleton(trace.size()-1));
// remove all clauses backward reachable from the clauses with the given maxVar
next.removeAll(trace.backwardReachable(exclude));
if (!next.isEmpty()) {
return next;
}
}
}