bool External::grounded(Grounder *g) { head_->grounded(g); if (head_->fact()) { return true; } addDomain(g); Printer *printer = g->output()->printer<Printer>(); printer->begin(); if(head_.get()) { head_->accept(printer); } printer->endHead(); foreach(Lit &lit, body_) { lit.grounded(g); if(!lit.fact()) { lit.accept(printer); } else if(lit.forcePrint()) { lit.accept(printer); } }
void GlobalConstraint::accept(::Printer *v, Grounder* ) { Printer *printer = v->output()->printer<Printer>(); printer->type(type_); for (size_t i = 0; i < heads_.size(); ++i) { if ((type_==COUNT || type_==COUNT_UNIQUE)&& i==1) printer->beginHead(cmp_); else printer->beginHead(); GlobalConstraintHeadLit& h = heads_[i]; GroundedConstraintVarLitVec vec; h.getVariables(vec, v->output()->storage()); printer->addHead(vec); printer->endHead(); } printer->end(); }