Originally posted by: pineapple365
Thanks very much! But there is a new problem, input data is in an Excel file, Excel can only storage a 2-Dimensional data, so I should create a middle parameter called nb2 to read data from excel and then convert nb2( 2-Dimensional ) to nbArray( 3-Dimensional ) . But my code seems not work. Could you please give me more suggestion?
Regards.
// test.mode
{string} Market={"M"};
{string} Product={"M"};
{string} Level={"M"};
//nb2 is reading 2-dimensional data from Excel
int nb2[Market][Product*Level]= ...;
//convert 2-dimensional array to 3-dimensional array
int nbArray2[Market][Product][Level]= nb2[Market][Product*Level];
int Demand[m in Market][p in Product][l in Level]=nbArray2[m][p][l];
execute
{
writeln(Demand);
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
// test.dat
Market = 2;
Product = 2;
Level = 3;
SheetConnection sheetInput("3DimArray.xls");
// If the data elements are in a 2 dimensional array
nb2 from SheetRead(sheetInput,"data!B17:G18");
#DecisionOptimization#OPLusingCPLEXOptimizer