[gecode-users] How to iterate over a integer view's domain

Debdeep Banerjee banerjed at rsise.anu.edu.au
Fri Apr 4 13:13:45 CEST 2008


Guido Tack wrote:
> Debdeep Banerjee wrote:
>> I want to iterate over the current domain of a integer view
>> (Gecode::Int::IntView). How can I do that ? Is this domain current ?
>> I want to implement my own variable and value selection. That's why I
>> need to access the current domain of the variable. Is there any good way
>> to do it ?
>
> Yes, using ViewRanges<IntView>:
> http://www.gecode.org/gecode-doc-latest/classGecode_1_1Int_1_1ViewRanges.html 
>

Is this going to give me the ranges or it will iterate over all values 
in the domain ?
For example: if the domain of a variable X is Dom(X):{1,4,5,6,9,10,11,15}
Which output will be given by ViewRanges ?
Option 1: 4 ranges
                   R1: 1
                   R2: 4..6
                   R3: 9..11
                   R4: 15

Option 2: It will iterate through all the values of the domain.

May be it is a silly question, but I don't understand what is the 
advantage of the range.


With regards
Debdeep
>
> What do you mean by current?  The domain of a variable is always 
> current, in the sense that if it's modified, iteration over the domain 
> will reflect the modification.
>
> Cheers,
>     Guido


-- 
Debdeep Banerjee
PhD Candidate
CSL/RSISE/NICTA
Australian National University
Email: debdeep.banerjee at rsise.anu.edu.au
Web:http://rsise.anu.edu.au/~banerjed






More information about the gecode-users mailing list