[gecode-users] Symbolic Constraints - fd_relation contraint in Gecode?

Pedro Salgueiro pds at di.uevora.pt
Tue May 26 11:36:53 CEST 2009


Hi!

On Mon, 2009-05-25 at 16:30 +0200, Mikael Zayenz Lagerkvist wrote:
> Hi,
> 
> On Wed, May 20, 2009 at 8:36 PM, Denys Duchier
> <denys.duchier at univ-orleans.fr> wrote:
> > I could be wrong about this, but I just had a quick glance at the
> > implementation and its seems to allocate datastructures of a size
> > proportial to the width of the domain.  So if you have small values and
> > very large values, the width is going to be very large.
> >
> > If I am right, then you might be better off encoding your N values into
> > the interval [0,N-1] and then possibly using an element constraint to
> > decode them where necessary.
> >
> > Then again, I could be completely off base :-/
> 
> Actually, you are completely right, and it also says so in the
> documentation [1]:
>     Warning:
>         If the domains for the $x_i$ are not dense and have similar
>         bounds, lots of memory will be wasted (memory consumption
>         is in $
> O\left(|x|\cdot|\min_i(\underline{x_i})-\max_i(\overline{x_i})|\right)$
>         for the basic algorithm (epk = EPK_MEMORY) and additionally
>         $ O\left(|x|^2\cdot|\min_i(\underline{x_i})|\max_i(\overline{x_i})|\right)$
>         for the incremental algorithm (epk = EPK_SPEED).
> 
> The memory-consumption in the size of the domain is inevitable for
> reasonably efficient extensional propagators. The translation into a
> dense domain from a sparse domain needs to happen at one point or
> another anyway for efficient data-structure management, and I choose
> not to do it automagically.

Sorry, my bad, didn't noticed that on the documentation... Now I
understand why it gets really slow, as the domain gets really big. 

So, there is no easy way of preventing the translation of this sparse
domain to a dense domain, even if it is just to make some tests and see
the behavior of Gecode under those circumstances?

Thank you,
Pedro Salgueiro
> 
> Cheers,
> Mikael
> 
> [1] https://www.gecode.org/doc-latest/reference/group__TaskModelIntExt.html#gf885611633b7b2bfb4d9512071dee9a3
> 





More information about the gecode-users mailing list