[gecode-users] Parallel conditional combinator
Guido Tack
tack at ps.uni-sb.de
Thu Apr 24 11:41:04 CEST 2008
Mauricio Toro wrote:
> I am thinking about implementing the
> parallel conditional combinator as a
> Gecode propagator. Any ideas about
> how to do this efficiently?
I guess by parallel conditional you mean something like (if b1 then a1
|| if b2 then a2 || ...), where || means parallel composition, and
with a short-circuit semantics that the first b that is determined to
be true "wins" and all other branches are discarded?
I think you could just extend the conditional that you already have.
As soon as one guard is determined, you execute that branch and remove
the conditional propagator (by returning ES_SUBSUMED). You have to be
very careful, though: you can easily program non-monotonic propagators
this way, which are not allowed in Gecode! E.g., if you wait for two
conditions, it may depend on the order of propagation which condition
is satisfied first, so the constraints added by the parallel
conditional can be different, depending on the order of propagator
execution. Don't do this unless you know exactly what you're doing (I
cannot see how to use this in a reasonable way).
Remember that Gecode is meant for solving constraint problems, not for
executing cc programs!
> By the way, where can I find examples
> about using the reflection post and spec
> propagator methods?
Here:
http://www.gecode.org/gecode-doc-latest/PageReflection.html
Cheers,
Guido
More information about the gecode-users
mailing list