Topic
3 replies Latest Post - ‏2014-03-19T06:59:34Z by ol
davidoff
davidoff
51 Posts
ACCEPTED ANSWER

Pinned topic Variables based on interval characteristics

‏2014-03-11T18:19:53Z |

Hello

Given an optional interval Pile defined as an alternative between 2 dimensional set of intervals itv[i in 0..5][y in ypos={0,90,120}], I want to define integer variables pileInfo[1..2] defined as follow

pileInfo[1] == i iff the chosen itv first index is i, or a dummy index (6 for instance) if Pile is not present

pileInfo[2]==y iff the chosen itv second index is y

Note : This vector well help me later to break symetry between several Pile using a lex constraint between 2 different pileInfo vectors

I'm wondering what most efficient way would be to define pileInfo. Something like

PileInfo[1]==presenceOf(Pile)==0?6:sum(i in 0..5, y in ypos)  i*presenceOf(itv[i][y])

is correct but not fancy and probably I could do better with intervals?

thanks

david

 

  • ol
    ol
    19 Posts
    ACCEPTED ANSWER

    Re: Variables based on interval characteristics

    ‏2014-03-13T08:04:44Z  in response to davidoff

    Hello,

    if the number of intervals in the set is not too large, you could use an allowedAssignment constraint:

    The variables would be: pileInfo[1], pileInfo[2], ... all the presenceOf(itv(i,j))...

    the tuples would be:

    i, j, 0,0,...0, 1 (a the i,j place), 0 ... 0

    plus an additional tuple:

    6,6, 0,...0

    (6 being your escape value)

    Regards,

    Olivier 

    • davidoff
      davidoff
      51 Posts
      ACCEPTED ANSWER

      Re: Variables based on interval characteristics

      ‏2014-03-18T13:35:39Z  in response to ol

      Thanks

      I have around 60 intervals for a Pile

      That would lead to 60 tuples in the allowedassignments

      All in all, there will be around 20 "Pile"

      Sounds reasonable ? Better than the previous model ?

      David

      • ol
        ol
        19 Posts
        ACCEPTED ANSWER

        Re: Variables based on interval characteristics

        ‏2014-03-19T06:59:34Z  in response to davidoff

        It's a large arity, but still reasonable. I think this model can be better thant the previous one if some other constraints can benefit from the aditional propagation on i and j.  

        Regards

        Olivier