Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.

 View Only
  • 1.  Shift Assigment

    Posted Fri May 31, 2019 01:58 PM

    Originally posted by: trxw


    Hello,

    I am trying to figure out how to use interval variables to define this (just an example):

    - Equally (the more the better) distribute the time of 5 workers over an 8 hours shift (48 slots of 10 minutes)

    - I need two workers always simultaneously (or more, but thas a known data)

    - A worker could work between 30 minutes and 1.5 hours (9 slots). Then he needs to rest at least 30 minutes before starting to work again.

     

    I have done this with integer constrains but I am trying to see if doing it with interval / sequence variable I get better performance... Any help?

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Shift Assigment

    Posted Sun June 02, 2019 03:38 AM

    Originally posted by: trxw


    I have done some progress on this. However, I have a doubt:

     

    - If I have an undefined number of intervals in a sequence, is there any way to do it? What I have done as a workaround is to defined a maximum number of intervals with an array. It works fine because with the use of precenceOf I am able to have all the intervals created consecutive and at the hightest positions in the array. So if the arra max is 10, the intervales created occupies 8, 9 and 10 positions for example. My problem now is that I don´t know how to access the first interval in the sequence (the last is always the max of the array). I need to know the lengthOf the first interval. With this

     

    dvar interval RosterPeople[People][1..MaxNumbArray ] optional in 1..ShiftDuration+1 size 5..15;

    FirstInterval[i in People] = MaxNumbArray +1-max(r in 1..MaxNumbArray ) (presenceOf(RosterPeople[i][r]) * (MaxNumbArray +1-r)))

     

    I am able to know the interval number of the first one. Howeven if I tried to use this inside lengthOf(RosterPeople[i][FirstInterval[i]]), i get an error...

     

    Any idea how to solve this?

     

    Thanks

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer