Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

using tuple data in decision varibale in opl

  • 1.  using tuple data in decision varibale in opl

    Posted Tue April 07, 2015 09:17 AM

    Originally posted by: bilgesu


    Hi everybody;

    My problem is :

    I have a subscript denoted with 's', used in decision variable Xijs. I defined this s as:

    tuple schedule_S{

    int station;

    int sequence;

    };

    {schedule_S} positionS=...;

     

    s is referred 'sequence' in the positionS tuple.

    in my data file s is given as:

    positionS={ <1,3>,

    <2,7>,

    <3,9>,

    <4,9>,

    <5,9>,

    <6,8>,

    <7,3>,

    };

     

    now I need to write the decision varible Xijs (i denotes task and j denotes workstation defined in the sets). I don't know how should I write its 's' part from positionS tuple. I wrote as shown  below but it is not true...

    dvar boolean x[task][workstation][positions].sequence

     

    Thanks in advance;

    Regards.

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: using tuple data in decision varibale in opl

    Posted Wed April 08, 2015 01:50 AM

    Hi,

    you could compute sequences as an integer set with values 7,9,3,8 and then you would write

    x[task][workstation][sequences];

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: using tuple data in decision varibale in opl

    Posted Thu April 09, 2015 07:14 AM

    Originally posted by: bilgesu


    thank you very much for your quick answer. but I have another tuple parameters that I should use in constraints. How tuple structure is being used in constraints I need to know.. For example Tj is the parameter that shows the set of tasks that assigned to workstations. I defined the Tj as:

    Mod file:

    tuple station_assignment{

    int sttn;

    {int} tsks;

    };

    {station_assignment}Tj=...;

     

    data file:

    Tj={<1, {1,2,5}>,

    <2, {1, 2, 3, 4, 5, 6, 8}>,

    <3, {2, 3, 4, 5, 6, 7, 8, 9, 10}>,

    <4, {2, 3, 4, 5, 6, 7, 8, 9, 10}>,

    <5, {2, 3, 4, 5, 6, 7, 8, 9, 10}>,

    <6, {3, 5, 6, 7, 8, 9, 10, 11}>,

    <7, {9, 10, 11}>,

    };

    It shows that 1, 2., and 5. tasks assigned to 1. station.  1, 2, 3, 4, 5, 6, and 8. tasks assigned to 2. station and so on...

     

    In my constraint , below the sum expression  every i is element of Tj is written. I wrote its code as below. I need the tsks data from the station_assignment tuple. Is this expression of tuples in constraint is true?

    forall(jin workstation, d in positiond, r in machine)

      sum (i in task: i==Tj.tsks[i]) x[i][j][d][r]<=1;

     

    thanks in advance;

    Regards...


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: using tuple data in decision varibale in opl

    Posted Thu April 09, 2015 07:51 AM

    Hi,

    for each element in

    tuple station_assignment{

    int sttn;

    {int} tsks;

    };

    you can do a forall or a sum on all tsks

    forall(i in stations) forall(t in i.tsks)

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: using tuple data in decision varibale in opl

    Posted Thu April 09, 2015 08:04 AM

    Originally posted by: bilgesu


    Hi again;

    I am asking to be sure that should I write my constraint as:

    sum ( i in station_assignment) forall(t in i.tsks) x[i][j][d][r]<=1;

     

    you wrote as forall(i in stations) forall(t in i.tsks) but i denotes tasks not stations in my model.

     

    Thank you very much for your answers.

    Regards...

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: using tuple data in decision varibale in opl

    Posted Thu April 09, 2015 08:34 AM

    Hi

    with your data,

    tuple station_assignment{

    int sttn;

    {int} tsks;

    };

    {station_assignment}Tj=...;

    dvar int x[Tj][1..10];
    subject to
    {
    sum ( i in Tj) sum(t in 1..10 : t in i.tsks) x[i][t]<=1;
    }
     

    works

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 7.  Re: using tuple data in decision varibale in opl

    Posted Fri April 10, 2015 05:00 AM

    Originally posted by: bilgesu


    Thanks for your answer. I will try it in my code.

    Regards.... 


    #DecisionOptimization
    #OPLusingCPLEXOptimizer