示例#1
0
void BacktrackEnumerator::undoLevel(Solver& s) {
	while (!nogoods_.empty() && nogoods_.back().second >= s.decisionLevel()) {
		Clause* c = (Clause*)nogoods_.back().first;
		nogoods_.pop_back();
		*c->end() = posLit(0);
		c->removeWatches(s);
		c->destroy();
	}
}
示例#2
0
void RecordEnumerator::addSolution(Solver& s) {
	solution_.clear(); solution_.setSolver(s);
	if (minimize() && minimize()->mode() == MinimizeConstraint::compare_less) return;
	solution_.start(Constraint_t::learnt_conflict);
	for (uint32 x = s.decisionLevel(); x != 0; --x) {
		solution_.add(~s.decision(x));
	}
	if (minimize() && minimize()->models() == 1) {
		ConstraintDB::size_type i, end, j = 0;
		for (i = 0, end = nogoods_.size(); i != end; ++i) {
			Clause* c = (Clause*)nogoods_[i];
			if (c->locked(s)) {
				nogoods_[j++] = c;
			}
			else {
				c->removeWatches(s);
				c->destroy();
			}
		}
		nogoods_.erase(nogoods_.begin()+j, nogoods_.end());
	}
}