[gecode-users] BoolVars, Intvars and Channeling

Mikael Zayenz Lagerkvist zayenz at gmail.com
Mon Oct 27 08:29:14 CET 2008


On Sun, Oct 26, 2008 at 5:22 AM, David Przybilla <paranoic.pum at gmail.com> wrote:
> In gecode 1 it was possible to use BoolVars and IntVars interchangeably,
> that means that a function which received a BoolVar could receive an Intvar
> and a function which received an IntVar could received a BoolVar as an
> argument.

This change was made so that BoolVar's could be implemented more
efficiently - the memory requirements went down with about 50% and the
efficiency went up. For constraints that make sense for Booelan
variables, there are now post-functions that take BoolVar's instead of
IntVar's.

> Im porting a library from gecode 1 to Gecode 2
> The solution I had found for these function callings is to create a new
> variable and post a channeling constraint
> I wonder if there is another way to achieve this, and if posting this new
> constraint would affect the performance.

The channeling constraints are very cheap to propagate. However, in
most cases they should not be needed, since there are dedicated
propagators for constraints over Booleans which are more efficient
than the ones for integer variables. If possible, make sure that you
use the appropriate propagator for the type of variable that you have.

Cheers,
Mikael

-- 
Mikael Zayenz Lagerkvist, http://www.ict.kth.se/~zayenz/




More information about the gecode-users mailing list