Пример #1
0
	Potassco::Lit_t add(Literal lit) {
		uint32 word = lit.id() / 32;
		uint32 bit  = lit.id() & 31;
		if (word >= map.size()) { map.resize(word + 1, 0); }
		if (!test_bit(map[word], bit)) {
			vec.push_back(lit);
			set_bit(map[word], bit);
		}
		return encodeLit(lit);
	}
Пример #2
0
	void pushTrail(Literal p) {
		trail_.push_back(encodeLit(p));
	}
Пример #3
0
ClingoAssignment::Lit_t ClingoAssignment::decision(uint32_t dl) const {
	POTASSCO_REQUIRE(dl <= solver_->decisionLevel(), "Invalid decision level");
	return encodeLit(dl ? solver_->decision(dl) : lit_true());
}
Пример #4
0
void ClingoPropagatorInit::removeWatch(Literal lit) {
	changes_.push_back(Change(encodeLit(lit), RemoveWatch));
}
Пример #5
0
void ClingoPropagatorInit::removeWatch(uint32 sId, Literal lit) {
	POTASSCO_REQUIRE(sId < 64, "Invalid solver id");
	changes_.push_back(Change(encodeLit(lit), RemoveWatch, sId));
}
Пример #6
0
Potassco::Lit_t ClingoPropagatorInit::addWatch(uint32 sId, Literal lit) {
	POTASSCO_REQUIRE(sId < 64, "Invalid solver id");
	changes_.push_back(Change(encodeLit(lit), AddWatch, sId));
	return changes_.back().lit;
}
Пример #7
0
Potassco::Lit_t ClingoPropagatorInit::addWatch(Literal lit) {
	changes_.push_back(Change(encodeLit(lit), AddWatch));
	return changes_.back().lit;
}
Пример #8
0
Constraint::PropResult ClingoPropagator::propagate(Solver& s, Literal p, uint32&) {
	registerUndo(s);
	trail_.push_back(encodeLit(p));
	return PropResult(true, true);
}
Пример #9
0
bool ClingoPropagator::inTrail(Literal p) const {
	return std::find(trail_.begin(), trail_.end(), encodeLit(p)) != trail_.end();
}
Пример #10
0
Potassco::Lit_t ClingoPropagator::Control::addVariable() {
	POTASSCO_REQUIRE(!assignment_.hasConflict(), "Invalid addVariable() on conflicting assignment");
	ScopedUnlock unlocked(lock(), ctx_);
	return encodeLit(posLit(solver().pushAuxVar()));
}