void IntervalVariable::projectSupCost(Cost cost)
{
    supCost += cost;
    assert(supCost >= MIN_COST);
    if (getSup() == maxCostValue || supCost > maxCost) queueNC();
    if (CUT(supCost + wcsp->getLb(), wcsp->getUb())) decreaseFast(getSup() - 1);
}
void IntervalVariable::propagateNC()
{
    if (ToulBar2::verbose >= 3) cout << "propagateNC for " << getName() << endl;
    if (CUT(getInfCost() + wcsp->getLb(), wcsp->getUb())) increaseFast(getInf() + 1);
    if (CUT(getSupCost() + wcsp->getLb(), wcsp->getUb())) decreaseFast(getSup() - 1);
    if (getInfCost() > getSupCost()) {
        setMaxUnaryCost(getInf(), getInfCost());
    } else {
        setMaxUnaryCost(getSup(), getSupCost());
    }
}
Ejemplo n.º 3
0
 //Finds the first available element whose value is lower or equal to v
 iterator upper_bound(Value v) {
     if (v >= inf) return iterator(this, min(getSup(), v));
     else return end();
 }