Example #1
0
	//! Returns the truth value that is currently assigned to lit or Value_t::Free if lit is unassigned.
	virtual Value_t  value(Lit_t lit) const {
		CLASP_FAIL_IF(!this->TheoryPropagator::PP::hasLit(lit), "invalid variable");
		switch (solver_->value(decodeVar(lit))) {
			default: return Value_t::Free;
			case value_true:  return lit >= 0 ? Value_t::True  : Value_t::False;
			case value_false: return lit >= 0 ? Value_t::False : Value_t::True;
		}
	}
Example #2
0
ClingoAssignment::Value_t ClingoAssignment::value(Lit_t lit)  const {
	POTASSCO_REQUIRE(ClingoAssignment::hasLit(lit), "Invalid literal");
	switch (solver_->value(decodeVar(lit))) {
		default: return Value_t::Free;
		case value_true:  return lit >= 0 ? Value_t::True  : Value_t::False;
		case value_false: return lit >= 0 ? Value_t::False : Value_t::True;
	}
}
Example #3
0
	virtual uint32_t level(Lit_t lit) const {
		return value(lit) != Potassco::Value_t::Free ? solver_->level(decodeVar(lit)) : uint32_t(-1);
	}
Example #4
0
	virtual bool     hasLit(Lit_t lit) const { return solver_->validVar(decodeVar(lit)); }
Example #5
0
bool     ClingoAssignment::hasLit(Lit_t lit) const { return solver_->validVar(decodeVar(lit)); }
Example #6
0
uint32_t ClingoAssignment::level(Lit_t lit)  const {
	return ClingoAssignment::value(lit) != Potassco::Value_t::Free
		? solver_->level(decodeVar(lit))
		: UINT32_MAX;
}