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

Mathias Dalheimer dalheimer at itwm.fhg.de
Wed Oct 12 10:57:24 CEST 2011


Hi,

I'm having trouble expressing the following constraints: I have two
IntVarArrays which contain short timeseries (i.e. consumption values for
one hour, while the remaining hours of one day are empty/not
constrained). The *position* of the constraints of the consumption can
move within the day, this is governed by two IntVars (m, n) (which are
my optimization goal, so the cost function is calculated depending on
the position variables). The underlying question is where to place the
consumption in order to optimize some cost function.

Now I have some other constraints that depend on the position m and n of
the consumption. I need to sum the timeseries. So, as an example, I have
something like this (. denotes no constraint):


. . . 1 2 1 2 3 . . . . . . . . .   // m=3
. . . . . . . 2 4 5 6 5 . . . . .   // n=8

Now my question: How do I encode a constraint that depends on the sum of
these two IntVarArrays while m and n (the position) can change?

So, in the previous example, this would be:

. . . 1 2 1 2 3 . . . . . . . . .   // m=3
. . . . . . . 2 4 5 6 5 . . . . .   // n=8
. . . 1 2 1 2 5 4 5 6 5 . . . . .   // sum

In another example with different m and n:

1 2 1 2 3 . . . . . . . . . . . .  // m=0
. . . . . . . 2 4 5 6 5 . . . . .  // n=8
1 2 1 2 3 . . 2 4 5 6 5 . . . . .  // sum

Different m's and n's are being evaluated and an optimal set of m and n
is the result of the optimization.

Thanks for any pointers,
-Mathias



More information about the users mailing list