Hi Stanimir, 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...
Sorry about the inconvenience. As had become clear recently with the embarrassing number of bugs found, we have been looking again to which test coverage we have. For the kernel and integer propagators we have almost 100%. For search prior to 2.0.1 we only had around 75% with restart and LDS missing, that has been corrected. For the next release we will try to be close to 100% everywhere. Sorry again Christian -- Christian Schulte, www.ict.kth.se/~cschulte/ -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Stanimir Dragiev Sent: Thursday, February 14, 2008 10:00 PM To: [EMAIL PROTECTED] Subject: [gecode-users] posting LinExpr Hello, I have some irritating experience with posting a LinExpr === Short: The returned by LinExpr::post variable has different bounds than expected. === Long: 1. Background I have a functon like this: =-=-=-=-=-=Begin IntVar Constraints::get_variable_difference(Solver *space, IntVar& var1, int var2 ){ return abs(space, post(space, var1 - var2, ICL_DOM), ICL_DOM); } =-=-=-=-=-=End The variables returned by it are intended to be stored in an IntVarArray and then I can obtain a variable holding the total difference like this: =-=-=-=-=-=Begin linear(space, all_diffs, IRT_EQ, total_diff) ) =-=-=-=-=-=End And I can *after that* constrain the total_diff in the constrain() function (for BAB search). So I consider this whole process to be kind of query, not modifying the meaningful vars in the space, i.e. I do not expect the added variables to impact solvability of the space. (total_diff has initially the domain [0, int_max] and the sum over all_diffs is not more than 1000) The problem is that while filling the all_diffs array, after some iterations, the space is reported to have status SS_FAILED. Precisely, it gets failed, after the first invocation of get_variable_difference() with var2!=0. 2. Problem In a debugger session I found out, that the invocation: =-=-=-=-=-=Begin get_variable_difference(space, var1, 64 ); =-=-=-=-=-=End where the domain of var1 is {0, 64}, the posting post(space, var1 - var2, ICL_DOM) returns an IntVar with domain [64, 128], while I expect [-64, 0]. (Other invocation with var1={64} and var2=64 resulted in {128}, while expecting {0} ) I took a look at the definition of LinExpr::post in http://www.gecode.org/gecode-doc-search-1.3.1/lin-expr_8cc-source.html#l0007 4 and I noticed, that the doubles min and max are both initialized to sign*-c, which in my case means min=max=-(-64)=64 . Adding the bounds of my var1 to this really results in the returned variables. Is this correct? The following Int::Linear::post in line 94 could explain the failing of the space, since it is in my opinion really not satisfiable. Do you see some problem with the code? There might be some issue with domain consistency and posting linear expressions? Thanks a lot for your suggestions. cheers stanio _______________________________________________ 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