Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
Expand all | Collapse all

A problem in defining constraint - Urgent help needed please?????

  • 1.  A problem in defining constraint - Urgent help needed please?????

    Posted 11/14/13 03:07 PM

    Originally posted by: ikucukkoc


     

    Hello

    I have defined required data, decision variables, and objective function. However, I have a problem to code the constraint attached to this post.

    DemandProportions=  {<1 "A" 0.16667> <1 "B" 0.66667> <1 "C" 0.16667> <2 "D" 0.66667>  <2 "E" 0.33333>} //initialized externally 

    {int} ProdCycles = {1, 2, 3, 4, 5, 6};

    {int} Queues = {1, 2, 3, 4};

    int TotalPhi = 6;

    tuple linemodel{
      int h;
      string j;
    }

    {linemodel} LineModels = {<h, j> | <h, j, i> in LineModelTasks}; //LineModelTasks has defined in the code

    tuple propdemand{
      key string j;
      float d;
    };

    {propdemand} PropDemands= {<j, d>|<h, j, d> in DemandProportions};

    propdemand PropDemandsArray[i in 1..card(PropDemands)] = item(PropDemands, i-1);

     

      forall( <h, j> in LineModels )
        ct314: 
          sum( phi in ProdCycles, h in Lines, q in Queues )
            T[ phi, <h, j>, q ] == TotalPhi * PropDemandsArray[<j,i>];

     

    My question is: I defined "<h, j> in LineModels" for forall section but I also need to sum all "h in Lines". Is that a proper representation for the attached constraint? Or should I delete "h in Lines"?

    The next question is the program does not accept "PropDemandsArray[<j,i>". How should I modify it?

    Many thanks in advance.

    Best Regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/14/13 04:12 PM

    Hi,

     

    since you have 3 sigmas in your formula, you should keep 3 elements in the sum.

    PropDemandsArray is an array and its index should be an int : i in 1..card(PropDemands);

    but in

    T[ phi, <h, j>, q ] == TotalPhi * PropDemandsArray[<j,i>];

    you use a tuple as index, which is not good.

    Plus PropDemandsArray[<j,i>] is type tuple and cannot be multiplied.

    Can you attach your .mod and .dat so someone can have a look ?

     

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/14/13 04:37 PM

    Originally posted by: ikucukkoc


     

    Hi Alex

     

    Many thanks for your reply.

     

    I am attaching whole .mod and .dat files. The files may seem a bit complex but I need your help to make sure that whether my code is correct to define the Objective Function (3.9) and Constraints (3.13, 3.14, and 3.15) in the attached ikkoc2.png file.

     

    Your help is much appreciated.

     

    Many thanks in advance.

     

    Best Regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/14/13 05:00 PM

    Hi,

    turning

    forall( <h, j> in LineModels )
        ct314: //Model Demand Satisfaction Constraint
          sum( phi in ProdCycles, /*h in Lines,*/ q in Queues )
            T[ phi, <h, j>, q ] == TotalPhi * PropDemandsArray[<j,i>];

     

    into
            
            
     forall( <h, j> in LineModels )
        ct314: //Model Demand Satisfaction Constraint
          sum( phi in ProdCycles, /*h in Lines,*/ q in Queues )
            T[ phi, <h, j>, q ] == TotalPhi * PropDemandsArray[ord(PropDemands,<j,h>)].d;

     

    helps.

    I let you go on like this and fix your model

     

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/14/13 05:30 PM

    Originally posted by: ikucukkoc


     

    Many thanks for the reply. Sorry, there should not be comments before and after h in lines. So the sum section would be "sum( phi in ProdCycles, h in Lines, q in Queues )".   So, should i keep "h in lines" in sum? is it correct in this format?

     

    forall( <h, j> in LineModels )

        ct314: //Model Demand Satisfaction Constraint

          sum( phi in ProdCycles, h in Lines, q in Queues )

            T[ phi, <h, j>, q ] == TotalPhi * PropDemandsArray[ord(PropDemands,<j,h>)].d

     

    Is that correct now without comments? I am asking because I also have "h" as "<h, j> in LineModels". So,does "h in Lines" duplicate "h"?

    Really appreciate for your help. I solved examples but cannot find solutions for such specific problems. And your replies really helped me a lot. And I am sure that these conversations will also be helpful for other forum followers.

     

    Best Regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/15/13 01:48 AM

    forall( <h, j> in LineModels )
        ct314: //Model Demand Satisfaction Constraint
          sum( phi in ProdCycles, /*h in Lines,*/ q in Queues )
            T[ phi, <h, j>, q ] == TotalPhi  ; //* PropDemandsArray[<j,i>];

      forall( <h, j, i> in LineModelTasks, phi in ProdCycles)
        ct315: //Task Occurence Constraint
          sum( h2 in Lines, q in Queues, x in Sides, k in Workstations )
            T[ phi, <h,j>, q ] * Y[ phi, <h, j, i>, k, x ] <= 1;

     

    works and you can debug from that stage.

    Becareful : you used h in <h, j, i> in LineModelTasks and sum( h in Lines)

    is is really the same h ?

     

    Regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: A problem in defining constraint - Urgent help needed please?????

    Posted 11/15/13 02:26 AM

    Originally posted by: ikucukkoc


    Thanks for the reply. 

     

    1) So you do not define h second time in ct314 because you are keeping comment command /*h in Lines,*/ ??

     

    2) In ct315, you define a h2 but you do not use it, is that right?

     

    3) Actually I do not have to use it like  "<h, j, i> in LineModelTasks" but "i"s are defined for each j, and "j"s are defined for each "h". That is why i use "<h, j, i> in LineModelTasks" Is there another way for such expression please?

     

    Regards

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer