[gecode-users] posting LinExpr

Christian Schulte cschulte at kth.se
Sun Feb 17 23:27:55 CET 2008


Hi,

no the variable will be eliminated immediately when the propagator runs. So
after the first propagation everything is as it should be.

Christian

--
Christian Schulte, www.ict.kth.se/~cschulte/


-----Original Message-----
From: 'Stanimir Dragiev' [mailto:stanio at cs.tu-berlin.de] 
Sent: Friday, February 15, 2008 10:51 PM
To: Christian Schulte
Cc: users at gecode.org
Subject: Re: [gecode-users] posting LinExpr

Hello Christian,

* Christian Schulte <cschulte at kth.se> [2008-02-15 01:13]:
> not so shy ;-) That was a bug, apparently there were no tests for posting

Well, after couple of hours in front of an old CRT I haven't
considered my perceptions reliable.
:o)

> not so shy ;-) That was a bug, apparently there were no tests for posting
> linear expressions but only linear relations! I'll fixed it in the trunk
and
> it should be soon in 2.0.2. For the time being, just replace sign*-c with
> sign*c and recompile...

I prefer messing around with my code, than with gecode's, so
I use a workaround for now (the constants are 0 and this
avoids the impact of sign*-c):

=-=-=-=-=-=Begin
   IntVar
   get_variable_difference(Solver *space, IntVar& var1, int var2){
-          return abs(space, post(space, var1 - var2, ICL_DOM), ICL_DOM);
+          IntVar tmp(space, var2, var2);
+          return  abs(space, post(space, var1 - tmp, ICL_DOM), ICL_DOM);
   }
=-=-=-=-=-=End

Could using a temp IntVar (and as consequence one Term more
inside the LinExpr, I guess) be a considerable performance
issue?

cheers
stanio_






More information about the gecode-users mailing list