Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  CP Conflict Refine

    Posted 01/20/17 03:49 PM

    Originally posted by: AndyHam


    Dear IBM,

    I have a question about relaxation of CP problem. I found few postings, but I could not get what I am looking for.

    https://www.ibm.com/developerworks/community/forums/html/topic?id=1eba9283-a7fc-41e6-ab39-f41cbb818e68#94e9ddac-6618-4577-81d0-bae7b5e58b42

    The following code generates a conflict, because a worker is available only between 100 and 300, but there are 10 jobs with size of 10 for each and all jobs must complete by time 170. Is there any way to relax the calendar restriction (forbidExtent(itvAlt[j][i], sfCalendar);) of the jobs having the conflict? At the end, I would like to generate the schedule with a note indicating this interval has a conflict or not.

    j    start    end    Conflict
    1    100    110    N
    2    110    120    N
    3    120    130    N
    4    130    140    N
    5    140    150    N
    6    150    160    N
    7    160    170    N
    8    170    180    Y
    9    180    190    Y
    10  190    200    Y

     

    ShiftCalendar = {
    <100,300>
    };

    using CP;

    tuple Break {
      int s;
      int e;
    };
    {Break} ShiftCalendar = ...; 

    tuple Step {
      int v;
      key int x;
    };
    sorted {Step} Steps = 
       { <0, b.s> | b in ShiftCalendar } union 
       { <100, b.e>   | b in ShiftCalendar };
       
    stepFunction sfCalendar = 
      stepwise (s in Steps) { s.v -> s.x; 100 };

    range Jobs = 1..10; 
    range Workers = 1..1; 
    dvar interval itvJob[Jobs] in 1..170 size 10; 
    dvar interval itvAlt[Jobs][Workers] optional intensity sfCalendar; 
    dvar sequence seq in itvJob;

    minimize max(j in Jobs) endOf(itvJob[j]);
    subject to {
        noOverlap(seq);
          forall(j in Jobs) 
            alternative(itvJob[j], all(i in Workers) itvAlt[j][i]);
         forall(j in Jobs,i in Workers) 
               forbidExtent(itvAlt[j][i], sfCalendar);
    }   
    execute {
       writeln("j" + "\t" + "start" + "\t" + "end");
       for (var j in Jobs)
            writeln( j + "\t" + itvJob[j].start  + "\t" + itvJob[j].end );
       }   


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 2.  Re: CP Conflict Refine

    Posted 01/23/17 06:45 AM

    Originally posted by: rdu


    Dear AndyHam,

     

    One possibility to achieve what you want to do is to create, for each interval, an alternative of two intervals:

    - the first one will be constrained by your calendar

    - the second one will be unconstrained.

    Then your model's objective must try to maximize the sum of the presence of the intervals constrained by your calendar.

    I hope this helps.

     

                Cheers,

     


    #DecisionOptimization
    #OPLusingCPOptimizer


  • 3.  Re: CP Conflict Refine

    Posted 01/23/17 08:27 AM

    Originally posted by: AndyHam


    Dear Athena,
    Thanks for your advice.
    It is a nice technique and gave me a great idea ^^
    Following changes are made and the results look good.
    ===================================

    dvar interval itvJob[Jobs] optional in 1..170 size 10 ; 
    maximize sum(j in Jobs) presenceOf(itvJob[j]);

    ===================================

    Thanks,
    Andy

     


    #DecisionOptimization
    #OPLusingCPOptimizer