[gecode-users] Remapping of BoolVar propagation conditions
Christian Schulte
cschulte at kth.se
Sun Nov 29 17:34:31 CET 2009
Hi,
I am sorry but I do not understand Guido's answer. The reason why Boolean
propagation conditions are remapped is simple: we have many propagators that
are used both for Boolean as well integer views. Hence, both Boolean as well
as integer views need to have the same propagation conditions. As there is
no need to have anything but assigned as a condition for Boolean variables,
the integer conditions are mapped to assigned.
Changing this will break all propagators that are used for integer as well
as Boolean variables.
However, if you want to add a propagation condition to Boolean variables
that's fine. You only have to make sure that integer conditions are mapped
appropriately.
If you really want to know whether a Boolean variable is assigned 0/1 don't
use propagation conditions but use advisors. See the Boolean propagators
such as NaryOr or Clause for an example.
Christian
-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Guido Tack
Sent: Sunday, November 29, 2009 2:45 PM
To: Vincent Barichard
Cc: gecode list
Subject: Re: [gecode-users] Remapping of BoolVar propagation conditions
Hi Vincent,
for BoolVars, there are only two possible events, "assigned 0" and "assigned
1", so I assume you wanted to add those so that your propagator is only
scheduled for particular assignments, not for the general PC_BOOL_VAL.
The reason why we don't support these events is that we require propagators
to report when they are subsumed at the latest when all their variables are
assigned. If a propagator only subscribed to the hypothetical PC_BOOL_ONE,
but the variable was assigned 0, the propagator would not be able to report
subsumption, and would remain in the system although it could be removed.
Note that this is an optimization, so if you want to change the behavior,
the system would still work as expected, it would just need more memory in
certain situations. You should however check first if the additional calls
of the propagators are really a performance problem.
Cheers,
Guido
Vincent Barichard wrote:
> Hi,
>
> I would like to add a propagation condition to the BoolVar variables. I
succeeded
> to add this new propagation condition but when I tried to subscribe
variables to
> this new propagation condition, I discovered that all propagation
conditions
> for BoolVar are remapped to PC_BOOL_VAL.
>
> Why are they remapped ? Can I safely removed this mapping ?
>
> I found the remapping of the propagation condition in the file
gecode/int/var-imp/bool.hpp.
>
> forceinline void
> BoolVarImp::subscribe(Space& home, Propagator& p, PropCond,
> bool process) {
> // Subscription can be used with integer propagation conditions,
> // which must be remapped to the single Boolean propagation condition.
> BoolVarImpBase::subscribe(home,p,PC_BOOL_VAL,assigned(),process);
> }
> forceinline void
> BoolVarImp::cancel(Space& home, Propagator& p, PropCond) {
> BoolVarImpBase::cancel(home,p,PC_BOOL_VAL,assigned());
> }
>
> Thank you for your help.
>
> Cheers,
> Vincent
>
> Vincent Barichard Université d'Angers (LERIA)
> Tel: 02 41 73 52 06 Département Informatique
> Fax: 02 41 73 50 73 H203
>
>
> _______________________________________________
> Gecode users mailing list
> users at gecode.org
> https://www.gecode.org/mailman/listinfo/gecode-users
_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users
More information about the users
mailing list