示例#1
0
bool CBConsequences::backtrack(Solver& s) {
	if (C_.empty()) {
		// no more consequences possible
		C_.push_back(negLit(0));
	}
	// C_ stores the violated nogood, ie. the new integrity constraint.
	// C_[0] is the literal assigned on the highest DL and hence the
	// decision level on which we must analyze the conflict.
	uint32 newDl = s.level(C_[0].var());
	if (getHighestActiveLevel() < newDl) {
		// C_ is not the most important nogood, ie. there is some other
		// nogood that is violated below C_. 
		newDl = getHighestActiveLevel() - 1;
	}
	s.undoUntil(newDl, true);
	addNewConstraint(s);
	return !s.hasConflict() || s.resolveConflict();
}
示例#2
0
bool ModelEnumerator::backtrack(Solver& s) {
	uint32 bl = getHighestActiveLevel();
	if (projectionEnabled()) {
		bl = std::min(bl, getProjectLevel(s));
	}
	if (bl <= s.rootLevel()) {
		return false;
	}
	return doBacktrack(s, bl-1);
}