hi Thank You for your help but i really didn't get it well with the IntVarArgs : this what i did :
IntArgs res(n*m); IntVarArgs X1(n*m); for (int i=0; i<n; i++) { IntArgs res(g[i]);/// here i'm not sur if i will get the whole matrix g in the IntArgs res?????? } for (int i=0; i<n; i++) { IntVarArgs X1(X.row(i));//// but this is wrong how can i fix this ?? how can i put the matrix X which has Boolean variables in the IntVarArgs X1?????? } Could You please help me with that ???? Thank YOU very much Manel 2013/11/19 Guido Tack <t...@gecode.org> > Simply create a new IntArgs and IntVarArgs with the right size and put all > the coefficients and variables that you need to sum up into those arrays. > Then you only need to post one linear. > > Cheers, > Guido > > On 19 Nov 2013, at 8:26 am, manel askri <askri.man...@gmail.com> wrote: > > > hi everyone! > > I want to post a constraint that is the sum of a sum like this > *sum(sum (res [ i ] * X.row (i)))=Z, **with 0 < i <n* > > but in the documentation MPG I just found the linear constraint that are > used to constraint the sum not the sum of sum : > > let me explain: > > I have a matrix : vector < vector <int> > res , and a Boolean matrix X > defined as follows: Matrix <BoolVarArray> X (a, m, n); > > in the following code I had to do this sum : > > *sum (res [ i ] * X.row (i)) with 0 < i <n* / / here i can not pay this > sum for a table because the 2 matrix does not have the same type and i > didnt find any prototype of the linear constraint that can do this. > > Then I had to make this sum : > > *the sum of the previous sum= Z* > > so I used this constraint but it appeared that it is false because it does > not give me the desired solution : > *linear ( * this , res [ i ] X.row ( i ) IRT_EQ , Z) ;* > > I know that this constraint only to : *sum (res [ i ] * X.row (i)) = Z* , > where 0 < i < n; an dits wrong. > > you have an idea on correcting this error could you help me please > > thank you very much for your help > > Manel > > > > _______________________________________________ > Gecode users mailing list > users@gecode.org > https://www.gecode.org/mailman/listinfo/gecode-users > > >
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users