[gecode-users] ask propagator

Guido Tack tack at ps.uni-sb.de
Mon Apr 21 11:40:01 CEST 2008


Mauricio Toro wrote:
> I have some questions about the concurrent constraint programming  
> ask propagator.
> I want to have this behavior:
> \textbf{blocking\_IF} $<boolean\_var>\ x0$ \textbf{then} $<ask\_body> 
> \ procedureBody$ \textbf{else} $<skip>$
>
> 1) In this propagator would it matter if I use domain
> consistency or bounds consistency? which one should I use?

I'm not sure which part you're referring to.  For the boolean control  
variable, there's no domain or bounds consistency really.  You wait  
until it gets assigned and then run the body.

> 2) I am passing this function void (* procedureBody) (Space*) as an  
> argument.
>     If I would like to pass a closure, like an object with an  
> executing method, instead of the function pointer.
>     What kind of additional information should I include in the  
> object?

Well, what do you plan to do in the object?  That pretty much  
determines whether you need additional information.  You'll have to  
have access to the variables, e.g., but you can of course get that by  
casting the Space* to its actual type.

> 3) What do you think about this header for the Ask Propagator:
>
>
>
>   /**
>    * \brief Concurrent Constraint Programming ASK propagator
>    *
>    * Requires \code #include "gecode/int/ask.hh" \endcode
>    * \ingroup FuncIntProp
>    */
>   template <class View>
>   class Ask : public UnaryPropagator<View,PC_INT_BND> {
>   protected:
>     using UnaryPropagator<View,PC_INT_BND>::x0;

Now you use an IntView for x0, but above you said x0 was a BoolVar.

>     /// Constructor for cloning \a p
>     Ask(Space* home, bool share, Ask& p);
>     /// Constructor for posting
>     Ask(Space* home, View x0, void (* procedureBody) (Space*));
>   public:
>     /// Copy propagator during cloning
>     virtual Actor*     copy(Space* home, bool share);
>     /// Perform propagation
>     virtual ExecStatus propagate(Space* home, ModEventDelta med);
>     /// Specification for this propagator
>     virtual Reflection::ActorSpec spec(const Space* home,
>                                         Reflection::VarMap& m) const;
>     /// Post propagator according to specification
>     static void post(Space* home, Reflection::VarMap& vars,
>                      const Reflection::ActorSpec& spec);
>     /// Mangled propagator name
>     static Support::Symbol ati(void);
>     /// Post bounds-consistent propagator
>     /// \textbf{blocking\_IF} $<boolean\_var>\ x0$ \textbf{then}  
> $<ask\_body>\ procedureBody$ \textbf{else} $<skip>$
>     static  ExecStatus post(Space* home, View x0, void (*  
> procedureBody) (Space*));
>   };

Yes, the rest looks ok.

Cheers,
	Guido

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 2436 bytes
Desc: not available
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20080421/ea5dc995/attachment.bin>


More information about the gecode-users mailing list