Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

multidimensional tuple

  • 1.  multidimensional tuple

    Posted Fri July 11, 2014 09:45 AM

    Originally posted by: MMM12


    Bonjour,

    I have read toturial and manual of OPL CPLEX to find how I can write a model using tuple but I was confused because of several ways of using tuples.

    I copy paste a part of my model to help how I can write a tuple function and how I can rewrite the constraint below.

    inta=...;

    intb=...;

    intc=...;

    intd=...;

    inte=...;

    bigM=10000

    //sets:

    rangeA = 1.. a;

    rangeB = 1.. b;

    rangeC = 1.. c;

    rangeD = 0.. d;

    rangeE = 1.. e;

    //parameters:

    intdemand[C][D][E]=...;

    //desicion variable:

    dvar booleanV[B][C][D][E];

    dvar float+F[B][C][D][E];

    dvar float+R [C][D][E];

    //a constarint of model;

    forall(jin B) forall(k in C) forall (t in t:t>=1) forall(s in E

    F[j][k][t][s]<=-R[k][t][s]+R[k][t-1][s]+demand[k][t][s]+bigM*(1-V[j][k][t][s]);

     

    thank you in advance.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: multidimensional tuple

    Posted Wed July 23, 2014 07:43 AM

    Originally posted by: StephenHall


    you can do it with

    tuple demand ={  // create the type of tuple needed
        int c;
        int d;
        int e;
        float demand;
        };
        
    {demand} Demands = ...;  //create the set of tuple demand'¨
    //that allow to load it from an excel file or database
    subject to{
    // here is your constraint
    forall(j in B, d in Demands, t in Periods: t>1)
         F[j][t][d.e] <= -R[d.c][t][d.e] + R[d.c][t-1][d.e] + d.demand +
                                bigM * (1 - v[j][d.c][t][d.e]);
        };

     

    I hope that help


    #DecisionOptimization
    #OPLusingCPLEXOptimizer