Will add it to the trunk after holidays. C -- Christian Schulte, www.ict.kth.se/~cschulte
-----Original Message----- From: users-boun...@gecode.org [mailto:users-boun...@gecode.org] On Behalf Of Philippe Sent: Monday, August 12, 2013 05:18 PM To: users@gecode.org Subject: [gecode-users] sum of IntArgs Hi to all Geocode authors, I needed to compute the sum of IntArgs the same way we compute the sum of IntVarArray. Tell me if i'm wrong, but it seems that this facility is not natively provided by Gecode. For now, i use my own implementation which do the job (i'm not sure of the code below but it seems to work). Don't you think this facility could be useful for other and thus natively provided by Gecode ? Anyway, congratulations for your work. I'm a new user of Gecode and I really like it ! Cheers, Philippe LinIntExpr sum(const Slice<IntArgs>& slice) { const Slice<IntArgs>::ArgsType & args = slice; return sum(args); } LinIntExpr sum(const Matrix<IntArgs>& matrix) { const Matrix<IntArgs>::ArgsType & args = matrix.get_array(); return sum(args); } LinIntExpr sum(const IntArgs& args) { int i, sum = 0; const int size = args.size(); for (i = 0 ; i < size ; ++i) { sum += args[i]; } return LinIntExpr(sum); } _______________________________________________ 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