Decision Optimization

Decision Optimization

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

 View Only
  • 1.  how to model changeover minimization in CP

    Posted Mon July 13, 2020 09:49 AM
    Hi Everyone,
    I have a question about how to model the changeover minimization in CP (Constraint Programming)
    Problem statement:
    I have a number of jobs to be processed on a number of tools with templates. Each job requires a tool and a template to work together. A job may have multiple available tools and/or templates.The jobs have different priority and processing time.
    Objective:
    (1) minimize the total delay of all jobs with respect to the priority,
    (2) minimize the total number of template changeovers on all tools.

    I already have all the constraints and the total delay minimization, but I do not know how to model the template changeover on tools. Can you help? Please see my simple model and data files in the attachment. 

    Thank you very much.

    ------------------------------
    HUI ZHAO
    ------------------------------

    #DecisionOptimization


  • 2.  RE: how to model changeover minimization in CP

    Posted Tue July 14, 2020 04:41 AM
    Hello,

    changeovers could be modeled using functions typeOfNext (or symmetrically by typOfPrev).

    Here is the doc for OPL: https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.ide.help/OPL_Studio/opllang_quickref/topics/tlr_oplsch_typeOfNext.html
    And general documentation that describes the function mathematically (scroll down the page): https://www.ibm.com/support/knowledgecenter/SSSA5P_12.10.0/ilog.odms.cpo.help/refcppcpoptimizer/html/interval_sequence.html

    Sequence variable allows to define "types" for interval variables it consists of. In your case template is the type. Using typeOfNext(seq, itv) it is possible to test whether the interval scheduled right after itv on sequence var seq has the same type or not. If it is not the same then it is a changeover.

    There are two details that needs to be handled though. First, types must be integers and templates are strings. So we need to translate strings into integer ids, for example this way:

    int TemplateIds[Templates];
    
    execute {
      var id=0;
      for (t in Templates)
        TemplateIds[t] = id++;
    }

    Then we can extend usageTool by types:
    dvar sequence usageTool[t in Tools] in all (tm in Tool_Template_Map: t==tm.Tool)JobToolTemplate[tm] 
      types all(tm in Tool_Template_Map: t==tm.Tool) TemplateIds[tm.Templates];

    The second detail is that integer variables are optional. Naturally, absent interval doesn't have a "next" on the sequence. Similarly, an interval that is scheduled last on the sequence also doesn't have a next. Function typeOfNext has two additional arguments that specify what to return in those cases. We don't want to count those cases as changeovers so we want typeOfNext to return the current template id:
    dexpr int nbChangeovers = sum(tm in Tool_Template_Map) (typeOfNext(usageTool[tm.Tool], JobToolTemplate[tm], TemplateIds[tm.Templates], TemplateIds[tm.Templates]) != TemplateIds[tm.Templates]);

    Now you can use the nbChangeovers in your objective in any way you like. For example, you may use staticLex to minimize the delay first and then number of changeovers:
    minimize staticLex(Delay, nbChangeovers);

    Best regards, Petr

    ------------------------------
    Petr Vilím
    IBM
    ------------------------------



  • 3.  RE: how to model changeover minimization in CP

    Posted Tue July 14, 2020 06:18 AM
    Hi Vilim,
    Great thanks to your help and fast reply!
    It really resolves the pod changeover minimization in my scheduling problem. 
    Thank you very much!


    ------------------------------
    HUI ZHAO
    ------------------------------



  • 4.  RE: how to model changeover minimization in CP

    Posted Tue July 14, 2020 06:25 AM
    By the way, your explanation is very clear. With your explanations and example, I can understand the descriptions of typeOfNext more clearly. 
    Thank you.

    Best Regards,

    ------------------------------
    HUI ZHAO
    ------------------------------



  • 5.  RE: how to model changeover minimization in CP

    Posted Tue July 14, 2020 05:13 AM
    Hello Hui

    Using sequence variable of each tool, you have two alternatives (non exclusive) to model transition penalties:
    1. include a transition time between two consecutive jobs of the same tool, modeling a changeover of templates on the tool. This would result in a noOverlap(seq,TT) constraint where TT models this transition time between types of the intervals of the sequence
    2. include a transition cost

    The documentation explains very clearly the first concept and provides several examples. Therefore, in the attached model, I chose the second option. This uses a predefined transition cost arbitrarily set to a fixed cost for any change of Templates. You have to take into account a specific dummyIndex in this matrix. Indeed this matrix will be queried for each JobToolTemplate interval and its predecessor in the tool sequence. This is done through two constructs : 
    1. typeOfPrev that gives for a given interval the type of its predecessor in the tool sequence. This is where the dummy index helps since this interval may be absent or the first one in the sequence. In this case, typeOfPrev returns the dummyIndex
    2. element constraint that will query the static transition cost structure passing the index of the current interval and its typeOfPrev index
    I hope this is clear enough and models well what you were asking for ?

    Best regards
    David

    ------------------------------
    David Gravot
    ------------------------------



  • 6.  RE: how to model changeover minimization in CP

    Posted Tue July 14, 2020 06:22 AM
    Hi David,
    Thank you a lot as well.
    You are so nice to send me the entire revised model file. It provides me another way to model this pod changeover minimization and give me some insights to model the machine location as well.
    Thank you for your help!

    ------------------------------
    HUI ZHAO
    ------------------------------