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