[gecode-users] IntSet question
Gustavo Gutierrez
gutierrez.gustavo at uclouvain.be
Mon Aug 2 17:21:11 CEST 2010
Hello,
Probably what I am going to ask is not useful or is just to much particular
to my case that does not worth have it, however, I wouldn't hesitate to ask
:).
While writing a propagator I realized that keeping some state in it will
lower the complexity. This propagator is on a finite set variable and what I
does is to track "the new elements in the glb" and propagate according with
its semantics. At the beginning to I was using an std::set to keep the "old
values" and using it to compute the new elements:
new elements = current glb \ old values
The propagator was performing well but the memory consumption and the time
to compute the intersection was quite high. After realizing that I start
using an IntSet instead of a std::set to keep the data. The advantage is
that the IntSet stores ranges and then is *hopefully* less memory hungry.
There is also something nice, you can use all the iterators with them (range
iterators). The only problem is that they are intended to be used only to
represent variable domains in initializations or when posting constraints
and this is reflected in the fact that they lack of "modification
operations" in the API.
In my case I have to copy construct all the time and this is of course time
consuming but far better than my previous implementation. Now my question,
sounds it very crazy or stupid to use the IntSet in this way?, if it does
not, then it would be nice to provide an specialization (via inheritance,
for instance) that allows this kind of use. What do you think?
Best regards,
--
Gustavo Gutierrez
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.gecode.org/pipermail/users/attachments/20100802/7284b112/attachment.htm>
More information about the users
mailing list