Originally posted by: Striker121
Hi there,
I would greatly appreciate any help on the following issue I am encountering. I am running IBM ILOG CPLEX Optimization Studio Version: 12.7.0.0 Build id: 0.
My MILP requires the following expression as part of a constraint (see sheet 3 of the attached Excel spreadsheet for the mathematical expression):
subject to{
forall (i in BatchI, s in S[i])
sum (j in J[i][s]) Y[i][j] == 1 ;
}
I have attached an Excel file, ExampleData.xls, which contains some dummy data for the arrays J[i][s] (in Sheet1) and S[i] (in Sheet2). Each element in the array J[i][s] is to be a set of numbers. For example, from the Excel file, J[1][2] should equal the set [1, 2, 9] and J[3][3] should equal the set [2]. Similarly, each element in the S[i] array is to be a set of numbers. From the Excel data file, S[2] should equal the set [2,3,4] and S[3] should equal the set [1,2,3].
I am having difficulty in creating the J[i][s] and S[i] arrays and having them read their data from the Excel file. Is there any way this can be achieved?
When I run the configuration, I get an error when reading the ExampleData.xls "Data element "J" of type {int}[BatchI][StagesS] not supported for sheets.".
Below is my code from the .mod file I have written:
intnbBatchesI = ...;
intnbStagesS = ...;
rangeBatchI= 1..nbBatchesI;
rangeStagesS= 1..nbStagesS;
dvar booleanY[BatchI][StagesS];
{int}J[BatchI][StagesS] = ...;
{int} S[BatchI] = ...;
subject to{
forall (i in BatchI, s in S[i])
sum (j in J[i][s]) Y[i][j] == 1 ;
}
Below is my code from the .dat file I have written:
nbBatchesI= 3;
nbStagesS= 3;
SheetConnection Example_Data("ExampleData.xls");
J from SheetRead(Example_Data, "'Sheet1'!A1:C3");
S from SheetRead(Example_Data, "'Sheet2'!A1:C1");
I have attached all files below.
Again, I would be very grateful for any help you may offer.
Thank you.
#DecisionOptimization#OPLusingCPLEXOptimizer