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

Reply via email to