Sorry it's RIchard again, you meant : y[i] = (x[i] < y[i])
or y[i] = (x[i] < x[i-1]) 2014-06-12 12:48 GMT+02:00 Richard Portelli <richard.port...@gmail.com>: > Sorry it's RIchard again, > you meant : > > > 2014-06-12 11:50 GMT+02:00 Mikael Zayenz Lagerkvist <zay...@gmail.com>: > >> Richard Portelli skrev 12/06/14 10:32: >> >> Hello Christian, >>> I would like to know if there is an easy way to implement a special >>> constraint. >>> I have an array with 10 numbers. >>> My constraint would be : if you plot the array values in function of the >>> index, you should have a wave aspect /\. >>> For example with 10 numbers >>> >>> 1 3 5 9 11 7 6 5 4 2 0 (increasing then decreasing) There is no >>> importance at witch index there is the inflexion point. >>> >>> Would you have an idea how to implement that in a clean way? >>> >>> >> For reference, this is similar to the inflexion constraint ( >> http://www.emn.fr/z-info/sdemasse/gccat/Cinflexion.html) with the number >> of inflexions set to 1 (assuming that valleys are also ok). >> >> The simplest way in my opinion to model this constraint would be the >> following. >> >> Assume the sequence of numbers is called x and has n entries. >> Define a new boolean array of variables y with n-1 values. >> For each place i in y, add the constraint >> y[i] = (x[i] < y[i]) >> (that is, reified ordering). >> On the y variables, add the constraint regular(y, 1*0*) >> >> The ordering constraint and the regular expression can be modified to >> suit your particular needs. >> >> Cheers, >> Mikael >> >> _______________________________________________ >> Gecode users mailing list >> users@gecode.org >> https://www.gecode.org/mailman/listinfo/gecode-users >> > >
_______________________________________________ Gecode users mailing list users@gecode.org https://www.gecode.org/mailman/listinfo/gecode-users