Hi,Thank you both for your answers. As I don't want to break all propagators that are used for integer as well as boolean variables, I see no choice but to use PC_BOOL_VAL.
Maybe one of you may see another way ? I make new functions on Boolean variables (and associated views) which don't set domain to 1 or 0 (I copied "ModEvent BoolVarImp::one_none(Space& home)" and removed the unwanted instructions). These functions notify new events (called ME_BOOL_SAME in bool.vis file (see attached file)). I mapped this new event to the PC_BOOL_SAME propagation condition.
Now I change an existing propagator (like the "Or" propagator), and I want it to be awaken when ME_BOOL_SAME is emitted. As the variable is not yet assigned, I didn't want to emit the ME_BOOL_VAL event because I didn't want to
wake up propagators which only subscribed to the PC_BOOL_VAL condition.So during propagation, I call my new functions on Boolean variables, the ME_BOOL_SAME event is sent and propagators which subscribe to the PC_BOOL_SAME condition are wake up. Other propagators are not awaken (except if a ME_BOOL_VAL event has also been sent). Is it possible ? Should I use ME_BOOL_VAL ? If I use ME_BOOL_VAL other propagators will be awaken for nothing.
Thanks for your help. Cheers, Vincent
bool.vis
Description: Binary data
Le 29 nov. 09 à 17:34, Christian Schulte a écrit :
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 wellas 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 mappedappropriately.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 propagatorssuch as NaryOr or Clause for an example. Christian -----Original Message-----From: [email protected] [mailto:[email protected]] On BehalfOf Guido Tack Sent: Sunday, November 29, 2009 2:45 PM To: Vincent Barichard Cc: gecode listSubject: Re: [gecode-users] Remapping of BoolVar propagation conditionsHi 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 onlyscheduled 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 callsof 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. Isucceededto add this new propagation condition but when I tried to subscribevariables tothis new propagation condition, I discovered that all propagationconditionsfor 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 filegecode/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 [email protected] https://www.gecode.org/mailman/listinfo/gecode-users_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
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 [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
