Hmmm, as you used the word already... "Absurd" is not that far away, maybe let's call it "daring": each element propagator destructively updates its IdxView data structure, so they just can't be shared.
Actually, the same is true for element with integers: the data structure on which propagation is performed cannot be shared, however the array of integers from which the datastructure is created can be shared. In principle it would be possible to design a propagator that shares the array but it would not buy you much in memory reduction. Cheers Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Rijsman Sent: Thursday, May 08, 2008 4:47 PM To: [EMAIL PROTECTED] Subject: [gecode-users] 'Shared' IdxView in an element constraint I have a use case where I have to post an element constraint several times on the same variable array but using different variables for the 'index' and rhs. For example A = {A1,A2,A3} A[Y1] = Z1 A[Y2] = Z2 ... What I would like todo is to share the variable array among the element constraints and I thought I could do that by posting the element constraint myself: Gecode::Int::Element::IdxView<Gecode::Int::IntView>* aview = Gecode::Int::Element::IdxView<Gecode::Int::IntView>::init(this,A); GECODE_ES_FAIL(this,(Gecode::Int::Element::ViewDom<Gecode::Int::IntView,Geco de::Int::IntView,Gecode::Int::IntView>::post(this,aview,A.size(),Y1,Z1))); GECODE_ES_FAIL(this,(Gecode::Int::Element::ViewDom<Gecode::Int::IntView,Geco de::Int::IntView,Gecode::Int::IntView>::post(this,aview,A.size(),Y2,Z2))); ... This will crash although by looking at the code I conclude this should work, am I missing something or doing something completely absurd? By the way it workd fine if I use a sharedarray of integers and post GECODE_ES_FAIL(this,(Gecode::Int::Element::Int<Gecode::Int::IntView,Gecode:: Int::IntView>::post(this,shared_integers,Y1,Z1))); GECODE_ES_FAIL(this,(Gecode::Int::Element::Int<Gecode::Int::IntView,Gecode:: Int::IntView>::post(this,shared_integers,Y2,Z2))); thanks, David _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users _______________________________________________ Gecode users mailing list [EMAIL PROTECTED] https://www.gecode.org/mailman/listinfo/gecode-users
