[gecode-users] Sum of IntVarArrays with changing array positions

Mathias Dalheimer dalheimer at itwm.fhg.de
Thu Oct 13 14:42:16 CEST 2011


Hi,

Guido Tack wrote:
> On 12 Oct 2011, at 16:27, Mathias Dalheimer wrote:

>> Then, I use Guido's recommendation:
>> 
>> for (int j=0; j < _dev0.size(); ++j) { rel(*this, _dev0_load[j] ==
>> element(_dev0, _start_times[0] + j)); }
> 
> Shouldn't this be the other way around:
> 
> for (int j=0; j < _dev0.size(); ++j) { rel(*this, _dev0[j] ==
> element(_dev0_load, _start_times[0] + j)); }

OK, this did the trick. My model is working, although pretty slow, but
this should be a matter of tweaking the domain sizes and so on.

If you don't mind, I have another question: Why does the oder matter? My
interpretation of MPG p.87, "Figure 6.1: Integer expressions and
relations" is that the order is not relevant. What am I missing?

>> Please note that I was not able to use the post function - the
>> compiler complains that the function is not defined, although
>> minimodel.hh is included.
> 
> Right, sorry, rel was called post in an earlier version of Gecode and
> I still get that mixed up sometimes.

No problem - thanks for your help!

Cheers,
-Mathias



More information about the users mailing list