Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Daily Production Target

    Posted 07/29/19 01:58 PM

    Originally posted by: AndyHam


    I am seeking advice here. Any help will be very appreciated^^

    This is a daily production planning problem. Due to sequence dependent setup and time-based pm, I am exploring CP approach.
    Suppose there is a set of jobs with different quantities and processing times. The goal is to achieve a daily output target.
    The following is a result. The time unit is hour so I converted the "End" hour into "Day".

    ID Qty Start End Day
    10 6 0 12 1
    2 10 12 22 1
    1 5 22 32 2
    8 1 32 33 2
    9 3 33 39 2
    3 7 39 53 3
    5 8 53 61 3
    13 6 61 73 4
    4 7 73 87 4
    12 5 87 97 5
    15 4 97 105 5
    11 9 105 114 5
    6 8 114 130 6
    7 9 130 148 6
    14 8 148 156 6

     

    Then, we can calculate the daily output.

    Day Output
    1 16
    2 9
    3 15
    4 13
    5 18
    6 25

    Now, I am trying to make the factory produce 16 units every day. Any shortage amount needs to be summed up and penalized accordingly. Here are my questions:
    (1) How to map interval variables value into integer variables in order to calculate the daily output.
    (2) When an interval of job spans two days, I need to credit the proportional amount of output to each day. For instance, job k starts at 17 and ends at 40 with 6 units. Then, Day1 should get 2 and Day2 get 4 units.

     

    using CP;
    tuple t_Plan {
        key int id;
        int group;
        int qty;
        int pt;    
    };
    {t_Plan} Plan={
    <1,    1,  5,  2>,
    <2, 2,  10, 1>,
    <3, 3,  7,  2>,
    <4,    1,  7,  2>,
    <5,    2,  8,  1>,
    <6,    3,  8,  2>,
    <7,    1,  9,  2>,
    <8,    2,  1,  1>,
    <9,    3,  3,  2>,
    <10,1,  6,  2>,
    <11,2,  9,  1>,
    <12,3,  5,  2>,
    <13,1,  6,  2>,
    <14,2,  8,  1>,
    <15,3,  4,  2>
    };

    dvar interval itvPlan[p in Plan] size p.qty*p.pt;
    dvar sequence seqMch in all(p in Plan) itvPlan[p];
    minimize max(p in Plan) endOf(itvPlan[p]);
    subject to {
        noOverlap (seqMch);
    }

    execute{
    for (var p in Plan)      
      writeln( p.id + "\t" + p.qty + "\t" + itvPlan[p].start + "\t" + itvPlan[p].end );
    }
     

    Thanks,
    Andy


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: Daily Production Target

    Posted 07/30/19 03:31 AM

    Originally posted by: PhilippeLaborie


    If the number of days is not too large compared to the time granularity, I would use 'overlapLength' expressions, like in this model:

    int outmin = 16;
    int nDays = 8;
    range Days = 1..nDays;
    
    int start[d in Days] = (d-1)*24;
    int end  [d in Days] = d*24;
    
    using CP;
    
    dvar interval itvPlan[j in Plan]  in 0..end[nDays] size j.qty*j.pt;
    dvar sequence seqMch in all(p in Plan) itvPlan[p];
    
    dexpr int shortage[d in Days] = maxl(0, outmin - sum(j in Plan) overlapLength(itvPlan[j],start[d],end[d]) div j.pt);
    
    minimize sum(d in Days) shortage[d];
    subject to {
      noOverlap(seqMch); // Assuming single machine
    }
    

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: Daily Production Target

    Posted 07/30/19 08:52 AM

    Originally posted by: AndyHam


    This is great! I tried 90 days planning with this suggestion, it worked well. 
    I few times used the overlapLength to calculate the overlap length of two interval variables, but I did not know the function can mix with integer variables.
    Another learning!


    #DecisionOptimization
    #OPLusingCPOptimizer