Hi Guido, Thank you for the reply.
*// That is what the element constraint is used for (you'll find it in the documentation). It works directly on variables, so you don't have to solve the sub-problem on x first.* I am not sure I follow your point. Let me clarify the question, there are two integer variable arrays Array1[] and Array2[]. Both the arrays are constrained in different ways individually. Then, as a last constraint Array1[] needs to be constrained using the values assigned to Array2[]. So, do u think the following constraint would work or not? rel(*this, Array2[Array1[some_index].val()] + (something) <= Array2[another_index]); It doesn't give any errors on compilation but I haven't finished the rest of the model yet to be 100% sure if it works correctly or not. Thank you in advance. Best regards, Wajid On Mon, Feb 20, 2012 at 11:04 PM, Guido Tack <[email protected]> wrote: > On 21 Feb 2012, at 08:33, Wajid Hassan wrote: > > Hi Christian, > > The problem in a nut shell is: > > I have two arrays of integer variables, Array1[x] and Array2[x]. I want to > use the value assigned to the variables in Array1[] as an index of > Array2[], something like this: > > rel(*this, Array2[Array1[x].val()] + (something) <= Array2[x+1]); > > Is there anything wrong with the above constraint or should this work? > > > That is what the element constraint is used for (you'll find it in the > documentation). It works directly on variables, so you don't have to solve > the sub-problem on x first. > > Cheers, > Guido > > -- > Guido Tack, > http://www.csse.monash.edu/~guidot/ > >
_______________________________________________ Gecode users mailing list [email protected] https://www.gecode.org/mailman/listinfo/gecode-users
