[gecode-users] Return value of Branching::commit
Chris Mears
chris at cmears.id.au
Sat Jun 21 06:19:57 CEST 2008
Hello,
How should the return value of commit be constructed in a custom
Branching class? In the QueenArmies example (copied below), a single
constraint is posted whose ModEvent value is converted into an
ExecStatus value by me_failed, and that ExecStatus is returned.
virtual ExecStatus commit(Space* home, const BranchingDesc* d,
unsigned int a) {
QueenArmies *q = static_cast<QueenArmies*>(home);
const PosValDesc<bool,2> *pvd = static_cast<const PosValDesc<bool,2>*>(d);
bool val = a == 0 ? pvd->val() : !pvd->val();
return me_failed(Int::BoolView(q->w[pvd->pos()]).eq(q, val))
? ES_FAILED
: ES_OK;
}
However, what if a commit posts many constraints? Is it necessary to
observe the ModEvent returned by every posted constraint, and return
ES_FAILED if any of them returns ME_INT_FAILED?
(My overall aim is to implement some kind of dynamic symmetry breaking.
If a search node branches left with (X = v) and right with (X /= v), I'd
like to post additional constraints on the right branch -- for example,
if X and Y are symmetric, I'd also post (Y /= v). )
More information about the gecode-users
mailing list