[Gecode] Memory management, where to alloc?

Guido Tack tack at ps.uni-sb.de
Fri Jun 18 13:36:48 CEST 2004


On Friday 18 June 2004 13:22, Christian Schulte wrote:
> Well, let me elaborate a little bit on 1). This is just for caching and the
> reason why it works well is subtle and relies on interaction (well, a
> certain discipline) with search:
>
> A propagator can have a cache. The cache is created on demand from some
> other datastructure conatining the variables of interest (such as an
> VarArray<*>). Each time the propagator is invoked, it checks wether there
> is a cache. If not, it creates one. If there is already a cache, the cache
> is updated to properly represent the modified variables. Propagation then
> is performed on the cache.

Ok, that is exactly as I would have thought.

> So, please consider whether 1) does the job. It works well. The variable
> doubling is not an issue for two reasons:
>  1) A variable (you mean a view actually) takes 4 byte.
>  2) There is just one cache per search engine and per propagator created.

I will try. I guess with these explanations it should be easy, but I'm sure I 
would have screwed up things badly again if I hadn't known the details ;-)

It still feels a bit weird to use a VarArray only to store the variables that 
are needed to reconstruct the cache instead of storing them in a list in the 
first place, however...

> Otherwise, there is no need to use freelists. As you rightly say, the lists
> shrink. That's fine. Freelists are very special beasts (there are only size
> 8 and 16 freelists). Don't use them if you don't have to. I use them for
> rangelists as they have the property to grow and not to shrink.

I see. Good to know.

Guido

-- 
Guido Tack
Programming Systems Lab
http://www.ps.uni-sb.de/~tack



More information about the gecode-users mailing list