[gecode-users] Questions about the range iterators

Jean-Noël Monette jean-noel.monette at it.uu.se
Fri Mar 23 18:04:31 CET 2012


Hello,

I have a few questions about range iterators. Those questions are maybe 
more reflexions that I hope you will confirm or correct if I 
misunderstood something. Thank you in advance.

* Some iterators (those that are not templated), like NaryUnion or 
Minus, maintain their own data structure for the ranges, while the other 
ones (most of them) rely on the information provided by other iterators.

* A very few iterators (based on RangeListIter) have a reset() method 
allowing one to restart the iteration from scratch. The other ones do 
not have this functionality. What is the rational behind this choice? I 
was thinking about the way/cost of adding a reset method to all 
iterators and it looks to me that it might be easy enough. But maybe you 
have no interest in doing this (as it typically requires some more 
pointers (e.g. in classes such as IntVarImpFwd) for only an occasional 
use), or there are some hidden difficulties (I'm certainly not expert in 
the implementation of Gecode).

* From the previous point, most iterators are "one-use" only and are 
unusable once consumed. If one wants to use twice the same iterator for 
some reason, he has to recreate it from scratch. Is it right? Or is 
there some other way to do it (e.g. with a copy constructor)?

Thank you for your help,

Jean-Noël Monette



More information about the users mailing list