Originally posted by: Robscher
Hi Everyone,
I am trying to create a model which has variables over 4 dimensions. For example: Demand[a][b][c][d].
Since I am planning on running this model with multiple instances, I decided to read the according data from an Excel sheet. It works for variables in a one-dimensional array.
My problem is that I dont know how to arrange these multiple dimensions within Excel so that I can simply access them through OPL.
This is what it could like:
MOD-File:
int nbPeriods = ...;
range Periods = 1..nbPeriods;
int VariableOCost
Periods=...;
int Demand
Periods=...;
dvar int Quantity
Periods;
minimize
(sum( t in Periods )
( VariableOCost[t] * Quantity[t] ));
subject to {
ctWhatEverConstraint:
forall( t in Periods)
Quantity[t] >= 1.5*Demand [t];
}
##############
DAT-File:
SheetConnection sheet("TestMitExcel.xls");
nbPeriods from SheetRead(sheet,"B2");
VariableOCost from SheetRead(sheet,"E2:E16");
Demand from SheetRead(sheet,"F2:F16");
##############
I am grateful for any comments and ideas,
Robert
#DecisionOptimization#OPLusingCPOptimizer