void AvgAggrLitPrinter::weight(const Val &v) { int num = v.number(); min_ = std::min(min_, num); max_ = std::max(max_, num); output_->addToList(symbol_, v); }
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_); } }
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; }
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; }
void ParityPrinter::weight(const Val &v) { weights_.push_back(v.number() % 2 != 0); };
void SumAggrLitPrinter::weight(const Val &v) { if(!count_) aggr_ << "=" << v.number(); }
void ParityAggrLitPrinter::weight(const Val &v) { if(set_) return; if(v.number() % 2 == 0) aggr_ << "=0"; else aggr_ << "=1"; }
void AvgAggrLitPrinter::weight(const Val &v) { aggr_ << "=" << v.number(); }
void ParityAggrLitPrinter::weight(const Val &v) { output_->addToList(symbol_, Val::create(Val::NUM, v.number() % 2)); }