Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  triple index in IP

    Posted 04/23/13 01:28 PM

    Originally posted by: JasonHan@UT


    Hi,

    I am a beginner of Cplex OPL, recently I encounter a problem about unequal matrix , here is code

     

    rang hour=1..10;
    rang day=1..5;
    float data1[hour]=[3,2,5,7,2,6,1,4,5,6];
    float start[day]=[3,6,2,4,5];
    float end[day]=[9,10,6,8,9];
    range interval=start[day]..end[day];
    float data2[interval][hour]=?? /*how to use opl input dual index in this data*/
     
    dvar boolean y[day][hour]
     
    minimize sum(j in day, i in hour)(y[j][i]*data2[interval])
     
    Subject to {
     
    forall (j in day)
     
    ctyji: sum(i in hour)(y[j][i]==3);
     
    }

     

     

    I have solve this question by using the matrix below

     

     
    day1 <     5 7 2 6 1 4 5   >
    day2 <               6 1 4 5 6>
    day3 <  2 5 7 2 6             >
    day4 <        7 2 6 1 4       >
    day5 <            2 6 1 4 5   > 

    I used big number 99 fill the blank, but if I use the model to solve thousands data and this method is not working at all , how to solve this problem by using OPL. I think I should use loop function. Is there some way to resolve this, thanks a lot.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: triple index in IP

    Posted 04/24/13 03:08 AM

    Hi,

    if your matrix is sparse, instead of using an array you could use a tuple set with only the needed values.

    You would replace

    float data2[interval][hour]

    by

    a tuple set with a tuple with 3 fields: interval, hour, and value.

    Regards

     

     


    #DecisionOptimization
    #OPLusingCPLEXOptimizer