[gecode-users] obtaining IntVar's domain as IntSet?

Christian Schulte cschulte at kth.se
Tue Jul 27 21:02:04 CEST 2010


Hi Kish,

Be warned! That's inefficient (well, the int sets are okay efficiencywise).
The very point in Gecode is to not use explicit data structures for sets but
iterators that iterate over them. For pretty much everything that works just
fine and is very very fast!

Chapter 24 in MPG goes crazy about why that's cool!

Christian

--
Christian Schulte, web.ict.kth.se/~cschulte/


-----Original Message-----
From: users-bounces at gecode.org [mailto:users-bounces at gecode.org] On Behalf
Of Guido Tack
Sent: Tuesday, July 27, 2010 7:16 PM
To: Kish Shen
Cc: users at gecode.org
Subject: Re: [gecode-users] obtaining IntVar's domain as IntSet?

Kish Shen wrote:

> Hi,
> 
> Is there anyway to obtain the domain of an IntVar as an independent
object, preferably an IntSet? I looked at the documentation, and can't
figure out how to do this.

Yes, using an IntVarRanges iterator.  If you have an IntVar x, use the
following:

IntSet s(IntVarRanges(x));

Cheers,
	Guido

-- 
Guido Tack, http://people.cs.kuleuven.be/~guido.tack/




_______________________________________________
Gecode users mailing list
users at gecode.org
https://www.gecode.org/mailman/listinfo/gecode-users




More information about the users mailing list