Hi Kish, There is one more thing that might be valuable to you: we have changed the way how to post expressions and relations for the upcoming 3.4.0 (which should be available end of this month at the latest).
It is way more powerful (including arbitrary arithmetic expressions, set variables, and so on) and distinguishes between a function expr() that posts an expression (and hence returns a variable) and a function rel() that posts a relation (and hence does not return a variable). This removes the reification operator ~ and the confusion it caused. Cheers Christian -- Christian Schulte, web.ict.kth.se/~cschulte/ -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of Guido Tack Sent: Tuesday, July 13, 2010 5:02 PM To: Kish Shen Cc: [email protected] Subject: Re: [gecode-users] posting of expressions Kish Shen wrote: > As I have mentioned in my previous posts, I have been rewriting the code for handling expressions for the ECLiPSe interface to Gecode. I am wondering if there are any performance advantages in different ways of handling certain special cases of expressions, like sum. > > I had some special code that handled summation of variables using linear: > > linear(*solver, vars, rel, sum) > > where vars in IntVarArgs, sum is int (although I guess it could be generalised to IntVar as well), and rel is IntRelType. > > This code does not seem to be used at the moment, I assumed I had it to handle some specific ECLiPSe code that I wanted to run quickly with the interface. > > Instead, such summed expressions are now handled through the general expression handling code, and passed to Gecode as a LinRel through minimodel. The sum is passed as a series of +, e.g. A+B+C rather than using sum of a IntVarArg, because the code was written for Gecode 3.0.2, which I don't think supported sum. > > Is it more efficient to use the more specialised linear to post such expressions, and is it more efficient to use sum in LinExpr rahter than a series of +? The minimodel layer will combine such expressions automatically, and post the same propagators as when you call linear directly. Of course, there's a small overhead for the preprocessing of the LinExprs if you use a series of +, but that should be hardly noticeable in practice. Cheers, Guido -- Guido Tack, http://people.cs.kuleuven.be/~guido.tack/ _______________________________________________ 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
