Originally posted by: Janisch
Hello,
as the title suggests, I want to do several calculations of a model, and every calculation changes an input parameter (d[Variante]). This input parameter comes from an Excel file (see attached file). The 20 columns represent the various input parameters. In the end, therefore, 20 calculations should be performed. I once started to program a sequence control. My model file is a CP model.
{string} Variante;
int d[Variante];
main {
var source = new IloOplModelSource("Master_CP.mod");
var cplex = new IloCP();
var def = new IloOplModelDefinition(source);
var Data1 = new IloOplDataSource("Data1.dat");
var sumObj=0;
for(var k=1;k<=20;k++){
writeln(k+". Berechnung");
var opl = new IloOplModel(def,cplex);
opl.addDataSource(Data1);
var Data2= new IloOplDataElements();
Data2.d=thisOplModel.d; //must change for each calculation
opl.addDataSource(Data2);
opl.generate();
if (cplex.solve()) {
opl.postProcess();
writeln("Overload = " + cplex.getObjValue());
sumObj=sumObj+cplex.getObjValue();
writeln("Gesamt-Overload= "+sumObj);
writeln("________________________________");
} else {
writeln("No solution");
}
opl.end();
}
}
How can I add the input parameter d [Variante] over and over again and how can I program it with Excel?
Thanks in advance for your solution suggestions. I have attached all necessary files.
regards
#DecisionOptimization#OPLusingCPOptimizer