[gecode-users] Correct ExecStatus to return from propagate?
Guido Tack
tack at ps.uni-sb.de
Sat Apr 7 17:26:47 CEST 2007
Hi!
> Im a bit confused as to when exactly i should return the various
> ExecStatus from my (n-ary) propagator.
>
> I understand that ES_FAILED means that the propagation failed, ie it
> signals a dead-end, so i return that whenever i completely empty a
> domain.
Exactly.
> I also understand ES_SUBSUMED which i return when my constraint is
> entailed by the domains.
Yes.
> However, ES_OK, ES_FIX and ES_NOFIX im not sure if i understand
> correctly. If i have pruned all i can unless another propagator
> removes more values (without reducing all domains to size 1 or
> failing), what should i return? Also, should i return something
> specific if i didnt prune any values?
You never return ES_OK, it is only used for the propagator post
functions, not for the propagate function itself. Your intuition
about FIX and NOFIX is basically correct: If you can guarantee that
after propagation, your propagator is at a fixpoint, i.e. running it
immediately again will not result in any pruning, you may return
ES_FIX. In all other cases, return ES_NOFIX. So it is always safe to
return NOFIX, but potentially less efficient than possible.
Not pruning anything is not a special case: if you know the
propagator is at a fixpoint, return ES_FIX, otherwise ES_NOFIX.
Christian has some slides dealing with fixpoints of propagators
(slide 40):
http://www.ict.kth.se/courses/2G1515/notes/2G1515-L05-1.pdf
> Finally if all domains are reduced to size 1, should i return
> ES_SUBSUMED, or something else?
You should return ES_SUBSUMED. This will guarantee that the
propagator is removed and its memory reclaimed. Our test suite, e.g.,
checks for all propagators that they are subsumed when all variables
are assigned.
> On a related note, does a variable automatically switch to being
> assigned when its domain is reduced to a single value?
Yes, you don't have to do anything about that. Actually, a variable
doesn't have a flag or anything that says that its assigned - it just
checks (in the case of integer variables) whether min=max.
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de/~tack
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20070407/8acd85c5/attachment.htm>
More information about the gecode-users
mailing list