Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Get the interval from sequence

    Posted 10/27/18 04:21 AM

    Originally posted by: Guiheng


    Hi everyone,

    I have got a problem in my recent JSSP project. I want to calculate the buffer time between two intervals for a machine in a sequence and change this buffer time to get a robust scheduling plan.

    I am very thankful for all your help.


    #ConstraintProgramming-General
    #DecisionOptimization


  • 2.  Re: Get the interval from sequence

    Posted 10/29/18 06:58 AM

    Originally posted by: rdumeur


    Dear Guiheng,

     

    I suggest that you use the startOfNext expression:

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

    that you can use to compute the buffer time between one interval and the next.

    Now, if you want to enforce a time delay between two intervals, you can use a transition distance and a state function as done  in the <distdir>/cpoptimizer/examples/src/cpp/sched_state.cpp  C++ example (or sched_state.mod example if you are using OPL). 

    I hope this helps.

     

      Cheers,


    #ConstraintProgramming-General
    #DecisionOptimization


  • 3.  Re: Get the interval from sequence

    Posted 10/30/18 09:11 AM

    Originally posted by: Guiheng


    Dear rdumeur,

    thanks for your reply. I have another problem now, I tried to use startofNext in my model but I found I can not use it in the if-condition.

    for example, if(startOfPrev(...)==0    {....}.  Can you give me some advice, how I use this expression in the if-condition?

    I am very thankful for your help.

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 4.  Re: Get the interval from sequence

    Posted 10/30/18 10:54 AM

    Originally posted by: rdumeur


    Dear Guiheng,

    I am not sure to understand what you exactly want to do.

    Do you want to add a constraint only if a condition startOfPrev(...) == 0 is true?

    If so, I suggest you have a look at the logical constraints of OPL language, if you are using it:

    https://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.8.0/ilog.odms.ide.help/OPL_Studio/opllangref/topics/opl_langref_constraints_types_inCP.html#usropllangref.uss_langref_constraints.1073721__usropllangref.uss_langref_constraints.1075339

    where you'll find the implication constraint that you should be able to use with:

    startOfPrev(...) == 0 =>  {some other constraint}

     

    I hope this helps.

    Cheers,

     

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 5.  Re: Get the interval from sequence

    Posted 10/30/18 11:58 AM

    Originally posted by: Guiheng


    Dear rdumeur,

    thanks for your reply, I am working with a JSSP and I want to calculate the time gap between two consecutive operations for the same job and the time gap between two consecutive operations in the same machine.  I want to use the code below to make sure that every first operation in the machine, the horizontal delays should be equal to zero.

    forall(m in Mchs){
        forall(o in Ops,md1 in Modes : o.id==md1.opId && md1.mch==m ){
              if(startOfPrev(mchs[m],ops[o],-1,0)==-1);{
                     horizontaldelays[o] == 0;}
             }
    }

     

    tuple Operation
    {
      key int id;    // Operation id
      int jobId; // Job id
      int pos;    // Position in job 
    };
     
    //Maschinenfähigkeiten (Realisierung Redundanz)
    tuple Mode
    {
      int jobId; // Job id
      int opId; // Operation id
      int mch;  // Machine
      int pt;    // Processing time
      float mchavail; // Maschinenverfügbarkeit
      float delays; //Stoerung
    };
     
    {Operation} Ops   = ...;
    {Mode}      Modes = ...;

    I truly want to add a constraint only if a condition startofPrev(...)==0 is true.  how can I make it?


    #ConstraintProgramming-General
    #DecisionOptimization


  • 6.  Re: Get the interval from sequence

    Posted 10/31/18 04:44 AM

    Originally posted by: rdumeur


    Dear Guiheng,

    You cannot use the 'if' syntax for what you want to do. An 'if' predicate cannot test the state of variables in the model being built!

    What you describe requires using logical implication:

    A => B

    which is equivalent to !A || B

    So in your case:

    A  is your startOfPrev(...) == 0 expression

    B is the constraint on the horizontal delay

    So your model-building code should look like:

    startOfPrev(mchs[m],ops[o],-1,0)==-1) => (horizontaldelays[o] == 0)

    Cheers,


    #ConstraintProgramming-General
    #DecisionOptimization


  • 7.  Re: Get the interval from sequence

    Posted 11/01/18 07:17 AM

    Originally posted by: Guiheng


    Dear rdumeur,

    Thanks for the reply.

    I have written it in my code, for the function startOfPrev(mchs[m],ops[o],-1,0). think when the ops[o] is not in the sequence mchs[m], it will return 0. and when the ops[o] is the first one of the sequence, it will return -1. but now when I run this program,  I got this Errors(PNG).

    forall(m in Mchs){
                  forall(o in Ops,md1 in Modes : o.id==md1.opId && md1.mch==m ){
                            (startOfPrev(mchs[m],ops[o],-1,0)==-1) => (horizontaldelays[o] == 0);

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 8.  Re: Get the interval from sequence

    Posted 11/01/18 04:43 PM

    Originally posted by: rdumeur


    Dear Guiheng,

    Check that the mchs[m] sequence is declared so that intervals from ops[o] can potentially be contained by it.

    If you want to see how a sequence variable is declared, I suggest you read the documentation:

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

    or have a look at the sched_sequence.mod user example provided in the opl installation.

    I hope this helps,

     

            Renaud

     

    Cheers,

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 9.  Re: Get the interval from sequence

    Posted 11/11/18 03:54 AM

    Originally posted by: Guiheng


    Dear rdumeur,

    Thanks for your help. I have already solved the problem.

    but because the type of delay is the float and I can not definite a float variable in the model, is there any way that can help?

    Thank you in advance.

    when I use a float, there is a warning like this, how can I solve this problem?

    Warning: Comparison of floating point expressions may result in true or false for very small changes in expression values.
               "verticaldelays@35898" == "totaldelays@35900" + -1 * "verticalbuffertimes#1"

    Guiheng


    #ConstraintProgramming-General
    #DecisionOptimization


  • 10.  Re: Get the interval from sequence

    Posted 11/12/18 06:10 AM

    Originally posted by: rdumeur


    Dear Guiheng,

    You can convert a float expression to an integer in a constraint using the ftoi function:

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

     

    If your float expression value has decimal digits, you can scale it up by the appropriate power of 10 in order to preserve that information.

    So you can write something like:

    ftoi(verticaldelays * scale) == ftoi(scale*(totaldelays - verticalbuffertimes))

    I hope this helps.

     

    Cheers,

     


    #ConstraintProgramming-General
    #DecisionOptimization


  • 11.  Re: Get the interval from sequence

    Posted 12/10/18 01:37 PM

    Originally posted by: Guiheng


    Dear rdumeur,

    I work recently with this scheduling problem and I got a problem.

    The problem is when I use the model for 20 Jobs, this model work well and I can get a result. But when I increase the number of Jobs, Although there are no mistakes, I can not get a result.

    Thanks for your help.

    Guiheng


    #ConstraintProgramming-General
    #DecisionOptimization


  • 12.  Re: Get the interval from sequence

    Posted 12/11/18 12:32 PM

    Originally posted by: ol


    Hello,

    what do you mean by: " I increase the number of Jobs" ? 21 or 100000?

    what do you mean by: " I can not get a result"? The solver reports that there is no solution? the time to reach a solution is unexpectedly large?

    If you send a model, we may be able to help you further.

    Regards,

    ol


    #ConstraintProgramming-General
    #DecisionOptimization