Nope, MwG is correct on that respect. "x && imp(y,z)" is a Boolean expression, whereas "a[j] == i+1" is a relation (constraint). Posting a Boolean expression yields a Boolean variable, posting a relation does not. Please check the definition of expressions and relations in MwG.
Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ From: Yong [mailto:[email protected]] Sent: Monday, October 19, 2009 4:56 PM To: Christian Schulte Cc: [email protected] Subject: Re: [gecode-users] About posting Boolean expression Hi Christian, Thanks for your prompt reply. The code I wrote was following the example from Section 6.2 Boolean expressions and relations of <<Modeling with Gecode>>(for Gecode3.1.0). The original example is: " For example, the Boolean expression x && imp(y,z) (to be read as x ? (y ? z)) for Boolean variables x, y, and z is posted by: BoolVar b=post(home, x && imp(y,z)); " So, is it my inaccurate understanding of this example or the example itself is not expressed in an accurate way? Yong Christian Schulte wrote: Write instead: BoolVar tmp =post(*this, ~(a[j]==(i+1)),ICL_DEF); What you did is posting the constraint that (a[j] == (i+1)) (and hence the return type of post is void as the compiler tells you). What you apparently wanted to do is to post a reified constraint which you get with ~ (and hence the return type is BoolVar). Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ From: [email protected] [mailto:[email protected]] On Behalf Of Yong Sent: Monday, October 19, 2009 3:26 PM To: [email protected] Subject: [gecode-users] About posting Boolean expression Hi group, A question about posting Boolean expression here. Any hint will be appreciated! My compiler will give "cannot convert from 'void' to 'Gecode::BoolVar'" error on below code: BoolVar tmp =post(*this,(a[j]==(i+1)),ICL_DEF); Yong ps: I'm using Gecode3.2.0 + VC++ 2008 Express Edition
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
