Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  Using Tuple Data and Sequencing

    Posted 07/12/16 05:05 AM

    Originally posted by: Morkes.L


    Hi,

    I am modelling a CLSP - Extension that considers start and ending times of production run, including setup times.
     

    I have assigned products to an individual machine through a tuple. Now, when I try to model start and ending times of a production run on one machine I am not able to "access" the full pool of variable assigned to the machines. This is necessary as I try to set all those in order. In the following an extract of the mod file.

    Mod:

    // Tuple Definition
        tuple Machine_Product_Relationship {
        string M; // Start point Resource
        string K; // End point Product

        }
    //(Tuple)Sets
        {Machine_Product_Relationship} Km = ...; // Set of products k produced on resource m

        dvar boolean ga[K, M, T]; // Binary setup operation variable
        dvar boolean w[K, M, T0]; // Binary linking variable
        dvar int+ q[K, M, T]; // Production quantity
        dvar float+ O[M, T]; // Overtime capacity used in t
        dvar float+ et[K, M, T]; // End time of setup and production process  
        dvar float+ st[K, M, T]; // Start time of setup and productio process

     

    // Part to coordinate the start and ending times of the production
     
        // Defines starting point of production for k on the possible machine m in t (16)
        forall(k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m)
        st[k, m, t] <= 1 - (tb[k] * q[k, m, t] + tr[k] * ga[k, m, t]) /(b[m, t]);
        
        // Defines the end point of the setup and production process of product k (21)
        forall (k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m)
        et[k, m, t] == st[k, m, t] + ((tr[k] * ga[k, m, t] + tb[k] * q[k, m, t])/ (b[m, t]));

     

    Until here it works just fine as it assigns an inidividual start and end time to every product to machine relation.



    The trouble starts with equation 17 and 18 as I try to model a sequence. The logic behind it is that every machine is blocked until the production process of the predecessor product has been finished. So far, the model does not allow multiple setups per product and OPL creates a relaxed solution.

     

        // Defines the order of two products or more products(17)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
       st[j, m, t] <= (st[k, m, t]) - ((tb[j] * q[j, m, t] + tr[j] * ga[j, m, t])/ (b[m, t]+ CO[m, t])) + (1-ga[k, m, t]);
        
        // Ensures that start points with setup carry-over are set (18)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
       (st[k, m, t]) >= (((tb[j] * q[j, m, t])/ (b[m, t]+ CO[m, t])) - (1-w[j, m, t-1]));

     

    As I am relatively new to modelling with OPL any hint would be helpful.

    If the provided code is not sufficient I will provide the whole model.


    Thank you

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: Using Tuple Data and Sequencing

    Posted 07/12/16 06:06 AM

    Hi,

    what you could do is label your constraints so that you get relaxations that will help you for debugging.

    You could turn for example

    // Defines the order of two products or more products(17)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
       st[j, m, t] <= (st[k, m, t]) - ((tb[j] * q[j, m, t] + tr[j] * ga[j, m, t])/ (b[m, t]+ CO[m, t])) + (1-ga[k, m, t]);
        
        // Ensures that start points with setup carry-over are set (18)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
       (st[k, m, t]) >= (((tb[j] * q[j, m, t])/ (b[m, t]+ CO[m, t])) - (1-w[j, m, t-1]));

    into

    // Defines the order of two products or more products(17)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
       ct17:st[j, m, t] <= (st[k, m, t]) - ((tb[j] * q[j, m, t] + tr[j] * ga[j, m, t])/ (b[m, t]+ CO[m, t])) + (1-ga[k, m, t]);
        
        // Ensures that start points with setup carry-over are set (18)
       forall (j, k in K, m in M, t in T, km in Km: km.K ==k && km.M ==m && j!=k)
      ct18: (st[k, m, t]) >= (((tb[j] * q[j, m, t])/ (b[m, t]+ CO[m, t])) - (1-w[j, m, t-1]));

    See http://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.3/ilog.odms.ide.help/OPL_Studio/usroplide/topics/opl_ide_relax.html

     

    Plus maybe you could have a look at scheduling if you want to use sequences : see https://www.linkedin.com/hp/update/6151699552895324161

    regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: Using Tuple Data and Sequencing

    Posted 07/12/16 08:15 AM

    Originally posted by: Morkes.L


    Hi,

    thanks for the suggestions. I tried your tip with the naming of the constraints.

    Still there is a relaxation / conflict that reads:

    line    Original    Relaxed   Element (1)
    126    [-Infinity,1]    [-Infinity,1.3067]    ct17#2#0#0#0

     

    Which I don't understand.


    Furthermore I adapted the coding a little bit to make it more straight forward - even though it creates the same results:

     

    // Defines starting point of production for k on the possible machine m in t (16)
        forall(m in M, t in T, <m,k> in Km)//, km in Km: km.K ==k && km.M ==m)
        st[<m,k>, t] <= 1 - (tb[k] * q[k, m, t] + tr[k] * ga[k, m, t]) /(b[m, t]);
        
        // Defines the end point of the setup and production process of product k (21)
        forall(m in M, t in T, <m,k> in Km)
        et[<m,k>, t] == st[<m,k>, t] + ((tr[k] * ga[k, m, t] + tb[k] * q[k, m, t])/ (b[m, t]));
        
        // Defines the order of two products or more products(17)
        forall(j, k in K, m in M, t in T, <m,k> in Km: j!=k)
        ct17:st[<m, j>, t] <= (st[<m, k>, t]) - ((tb[j] * q[j, m, t] + tr[j] * ga[j, m, t])/ (b[m, t])) + (1-ga[k, m, t]);
        
        // Ensures that start points with setup carry-over are set (18)
        forall(j, k in K, m in M, t in T, <m,k> in Km: j!=k)
        ct18:(st[<m, k>, t]) >= (((tb[j] * q[j, m, t])/ (b[m, t]+ CO[m, t])) - (1-w[j, m, t-1]));

     

    How do I have to interpret the relaxed nofication?


    Also, as I don't want to have a fixed sequence as in the nursing model but rather try to make it flexible. I have been thinking about introducing a third variable "i" that is part of K in order to sequence 2 or more products. Could that be an approach to solve it?

    Also does OPL recognize values across lines, i.e. X[K] e.g. if I write in line 1: i, j, k E K: j!=k  && i !=k && i !=j for future references or is it necessary to include such in the a variable (e.g. in form X[K, K]?

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: Using Tuple Data and Sequencing

    Posted 07/12/16 09:29 AM

    Hi

    more about relaxation at http://www.ibm.com/support/knowledgecenter/en/SSSA5P_12.6.3/ilog.odms.ide.help/OPL_Studio/usroplide/topics/opl_ide_relax_how_relaxations.html

    if you want a relaxation that is easier to read than

    126    [-Infinity,1]    [-Infinity,1.3067]    ct17#2#0#0#0

    then you should increase the threshold for names. See http://www-01.ibm.com/support/docview.wss?uid=swg21584507

    An OPL constraint may be in 2 lines but if you do forall(i in set) then you override other i in this context.

    Regards

    PS:

    You have many nice presentations at http://www-01.ibm.com/support/docview.wss?uid=swg21647915

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: Using Tuple Data and Sequencing

    Posted 07/17/16 12:39 PM

    Originally posted by: Morkes.L


    Hi,

    thank you very much. The posted articles have helped a lot. Continuing to work on this question I came up with the following, which is part of the sequencing.

    If I have a two dimensional boolean decision variable, e.g. x[j, k] and I use it in a modelling sequencing formulation (with K being a {string} of products that will later on be replaced by a {tuple} set , is there a difference between the following:

     

    // variable definition

    dvar boolean ga[K, K, T]; // Binary setup operation variable

    dvar int+ q[K, T]; // Production quantity 

    float Z = ...; // Large Number

     

    // first approach

        forall (j, k in K:j!=k, t in T)
        Setup_State:
        q[k, t] - Z * (ga[j, k, t] + w[k, t-1]) <=0;      

     

    // second approach

    forall (k in K, t in T)

    Setup_State:

    q[k, t] - Z * sum(j in K: j!=k) (ga[j, k, t]) <=0;

     

    This should be the last step to solve the problem.

    Thank you in advance for your help.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: Using Tuple Data and Sequencing

    Posted 07/18/16 07:08 AM

    Hi,

    in the first approach you use w, in the second one you do not.

    The first one can be written without Z using logical constraint:

    forall (j, k in K:j!=k, t in T)
        Setup_State:
         (ga[j, k, t] + w[k, t-1]==0)  => (q[k,t]==0) ;

    The second one:

    forall (k in K, t in T)

    Setup_State:

    (sum(j in K: j!=k) (ga[j, k, t])==0) => (q[k,t]==0) ;

    Comparing gets easier.

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer