示例#1
0
	void AvgAggrLitPrinter::weight(const Val &v)
	{
		int num = v.number();
		min_ = std::min(min_, num);
		max_ = std::max(max_, num);
		output_->addToList(symbol_, v);
	}
示例#2
0
	void SumAggrLitPrinter::weight(const Val &v)
	{
		int num = v.number();
		min_ += std::min(0, num);
		max_ += std::max(0, num);
		output_->addToList(symbol_, v);
		if(num < 0) { hasNeg_ = true; }
		if(pos_ && (num != 0 || head_)) { output_->addDep(symbol_); }
	}
示例#3
0
tribool ParityAggrLit::accumulate(Grounder *g, const Val &weight, Lit &lit) throw(const Val*)
{
	(void)g;
	int32_t num = weight.number();
	if(num % 2 == 0 && !head()) return true;
	if(set_ && !lit.testUnique(uniques_)) return true;
	if(!lit.fact()) factOnly_ = false;
	else if (num % 2 != 0) fixed_ = !fixed_;
	return lit.fact() ? tribool(true) : unknown;
}
示例#4
0
tribool SumAggrLit::accumulate(Grounder *g, const Val &weight, Lit &lit) throw(const Val*)
{
	(void)g;
	int32_t num = weight.number();
	if(num == 0 && !head()) return true;
	if(set() && !lit.testUnique(uniques_))	return true;
	if(lit.fact())
	{
		fixed_ += num;
		if(checkUpperBound_ && fixed_ > upperBound_) return false;
	}
	else
	{
		factOnly_ = false;
		if(num < 0) valLower_ += num;
		if(num > 0)	valUpper_ += num;
	}
	return lit.fact() ? tribool(true) : unknown;
}
示例#5
0
void ParityPrinter::weight(const Val &v) {
	weights_.push_back(v.number() % 2 != 0);
};
示例#6
0
	void SumAggrLitPrinter::weight(const Val &v)
	{
		if(!count_) aggr_ << "=" << v.number();
	}
示例#7
0
	void ParityAggrLitPrinter::weight(const Val &v)
	{
		if(set_) return;
		if(v.number() % 2 == 0) aggr_ << "=0";
		else aggr_ << "=1";
	}
示例#8
0
	void AvgAggrLitPrinter::weight(const Val &v)
	{
		aggr_ << "=" << v.number();
	}
示例#9
0
	void ParityAggrLitPrinter::weight(const Val &v)
	{
		output_->addToList(symbol_, Val::create(Val::NUM, v.number() % 2));
	}