[gecode-users] CSPs with bulky static data
Guido Tack
tack at ps.uni-sb.de
Fri Jul 28 13:47:38 CEST 2006
Hi Torsten
> I am an Oz programmer with no experience in Gecode yet, please
> forgive my newbie question.
All questions welcome on this list ;-)
> Many of my Oz CSPs eat *very* much memory because I am using large
> data structures. Still, most data does not change at all during the
> search process, but is still copied because it is part of the
> script. I do understand that the Oz constraint store _implicitly_
> incorporates whatever value is part of the script (computational
> spaces in Oz encapsulate speculative computations on any Oz data
> and each variable can cause a fail).
>
> I saw that in Gecode, on the other hand, variables are _explicitly_
> handed to the computational space. Does this mean that the Gecode
> user has explicit control what variable is incorporated in the
> constraint store (and is copied during the search process)? In
> other words, can a Gecode CSP involve large (mainly static) data
> structures without copying all the static data?
You could make use of two mechanisms: either you have the data as
static members of your space, or you encapsulate the data in some
other object and store a pointer to that object in your space. When
copying a space, you merely copy the pointer. If you allocate the
object outside the search engine, you do not even need to use
reference counting for the data object, just delete it when you're
done with search.
> PS: I figure I could at least reduce my problem also within Oz by
> putting my data structure outside the script and communicating
> between my script and this data only via a port. Yet, that
> complicates the definition of the CSP. Moreover, I need potentially
> all information contained in the data structure, e.g., to decide to
> which variables I what to apply constraints. I do not know whether
> this communication via a port also affects what is stored in the
> constraint store.
You won't need any communication infrastructure (like ports) in
Gecode, as a space is nothing but a plain C++ object. Just keep your
data somewhere and access it "from within the space".
Cheers,
Guido
--
Guido Tack
Programming Systems Lab, Saarland University, Germany
http://www.ps.uni-sb.de
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ps.uni-sb.de/pipermail/users/attachments/20060728/136b01f5/attachment.htm>
More information about the gecode-users
mailing list