Decision Optimization

Decision Optimization

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

 View Only
  • 1.  modification of a constraint

    Posted Wed July 11, 2018 11:54 AM

    Originally posted by: Janisch


    Hello,

    I have incorporated the following constraint into my model:
    forall (i in 1..N, s in 1..S, g in 1..G) {
       ((s == 1)? 60: 60 - MaxDrift [s-1] [g]) <= (60 + startOf (station [i] [s] [g]))% 120 <= ((s == 1)? (60 + MaxDrift [s] [g]): (60 + MaxDrift [s-1] [g]));
    }

    This allows the start time of the station a maximum of 60(seconds)(MaxDrift=60) earlier to a maximum of 60 (seconds) later by a multiple of 120 may start. I hope you understand what I mean ;)
    But now I want to modify the constraint so that the station can now start a maximum of 120 (seconds) earlier or later.

    Does anyone have an idea how to implement this?

     

    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: modification of a constraint

    Posted Fri July 13, 2018 05:14 AM

    Originally posted by: rdumeur


    Dear Janish,

    What I understand is that you want now to constrain an interval so that :

     

    startOf(interval) >= someDate - 120 && startOf(interval) <= someDate + 120

     

    right? When you say ealier or later, what is your reference time? Do you have some date to compare with?

     

    Cheers,

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: modification of a constraint

    Posted Fri July 13, 2018 06:06 AM

    Originally posted by: Janisch


    That's exactly what I want!
    My reference time is the tact time and that is 120 seconds.

    But if the MaxDrift array has a time over 60. Does not work this formula. I want to adapt it so that MaxDrift of up to 120 is allowed.

    In the attached example you can see that the first five stations "drift". They start depending on how it is most optimal earlier or later. From the sixth station no drift is allowed. I hope the example explains the context.

    regards


    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: modification of a constraint

    Posted Fri July 13, 2018 12:59 PM

    Originally posted by: GGR


    Hi Janish

     

    If I understand correctly your needs, the operation must start around a date +-120 for a certain number of tag dates

    The answer depends on the tags are known or must be fixed by the search.

     

    If the tag dates are known:

    The model tell the start dates of the interval are constrained to be in a set of time segment centered on the tag dates of of radius 120.

     

    You must have a look to the Forbidden start concept in

    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.cplex.help/refcppcplex/html/interval_variables.html#50

    and OPL reference of forbidStart function

    https://www.ibm.com/support/knowledgecenter/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_forbidStart.html

    Please refer to the OPL distributed example in sched_calendar.mod

     

    If the tag are not known

    The tags segment are interval variable the solver must fix: You must define a chain of  interval variable of maximum length twice the radius. These interval variables are optional because the tags segment may not content a start of an operation.

    int radius = ...;
    int center[nbtags] = ...;
    dvar interval tagit[i in 1..nbtags] optional in (center[i]-radius)...(center[i] + radius) size in 0..2*radius // the possible tags intervals
    

     

    Then the operation must start in one of these tag intervals. That is an interval variable that is the start of an operation is an alternative of start interval in the tags:

     

    dvar interval operations[nbopers] ...; // declaration of the operation
    dvar interval startOpers[nbopers];
    dvar interval tagsOpers[nbopers][nbtags] optional size 0;
    
    subject to {
     forall(o in 1..nbopers) {
       startsAtstart(operations[o], startOpers[o]); // synchronization of the start date
       alternative(startOpers[o], all (t in 1..nbtags) tagsOpers[o][t]); // choice of the tag time of an operation
     }
     forall(t in 1..nbtags)
       span(tagit[t] , all (o in 1..nbopers) tagsOpers[o][t]); // fix the tag interval variables
    }
    

     

    Hope that helps

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 5.  Re: modification of a constraint

    Posted Fri July 13, 2018 02:39 PM

    Originally posted by: Janisch


    Hello GGR,
    Thank you for your answer :)
    Unfortunately I'm not very good with OPL yet. So I do not know how to implement your answer in my model. The start times must calculate the model (ie the second option).
    I once attached a model and the associated .dat file.

    regards


    #ConstraintProgramming-General
    #DecisionOptimization


  • 6.  Re: modification of a constraint

    Posted Tue August 21, 2018 04:20 AM

    Originally posted by: Petr Vilím


    Hello,

    if I get it right then you want to implement the part "if the tag dates are not known" from the answer of GGR. But I don't see the OPL code GGR provided in your model so I'm not sure what to fix. If you really want to implement the part "tag dates are not known", try to include his code and then we can help you with problems that may arise.

    Thanks, Petr


    #ConstraintProgramming-General
    #DecisionOptimization


  • 7.  Re: modification of a constraint

    Posted Wed December 12, 2018 09:26 AM

    Originally posted by: GGR


    Hi Janish.

     

    Basically, there is one rule with CP Optimizer for scheduling: use the algebra of interval variables, apart very special cases, you have everything for your model expression needs.

     

    As for me your model is fine and tell what it seems to me you wanted to tell. I think you only need the station sequence noOverlap  and same sequence constraints. The sequence on work is useless as each workinterval  is completely covered by its station interval variable. What is Your issue?

     

    forall(s in 1..S, g in 1..G) {
        noOverlap(station[s][g]);                         //since it is a conveyor belt, the stations can not "overtake"
        if ((s > 1) || (g > 1) {  
          sameSequence(station[1][1],station[s][g]);    //every station has the same sequence
        }
     

     

     

     

     

     

    Anyway, it seems to me you want to model some conveyor belt with some minimum and some ideal maximum delay (?) between two entering items  in the conveyor belt. Am I right? In such a case we may be think to something simpler  by modeling some First In Last Out sequence. Can you write textually how you want the conveyor belt works and what is the overload definition?

     

    Hope that helps

     

     

     


    #ConstraintProgramming-General
    #DecisionOptimization