Originally posted by: ZeBo
@AlexFleischer a1d4492b-6cf8-402d-ae3c-dd656c427dc7 Thank you very much for this detailled answer, it helped a lot!
Every line in my .txt file is looking like this and i want to have one line for one optimization iteration so that the output below is always the newest solution added to the "solution.txt":
{<1,10.636, 8.087>,<2, 4.799, 8.960>,<3, 7.466, 8.589>,<4, 5.135, 0.150>,<5, 3.645, 1.659 >,<6,4.457 ,0.047 >,<7,3.779, 5.712>,<8, 6.072 ,1.933 >,<9,5.850, 3.503 >,<10,8.228, 1.741 >,<11,7.105, 3.040 >,<12,0.914 ,1.473>,<13, 9.885 ,1.191 >,<14,0.089 ,5.317 >,<15,6.018, 1.662>};
When i run the optimization it says: "Cannot set Arcs property".
What is my fault?
tuple Arc{
int id;
float xKoord;
float yKoord;
}
{Arc} Arcs = {};
tuple ArcNew{
int id;
float xKoord;
float yKoord;
}
{ArcNew} ArcsNew = {};
//HERE IS MY MAXIMIZE FUNCTION AND RESTRICTIONS
main
{
var f = new IloOplInputFile("netzwerke.txt");
var s;
for(var k=1;k<=6;k++)
{
s=f.readline();
var source = new IloOplModelSource("KP.mod");
var cplex = new IloCplex();
var def = new IloOplModelDefinition(source);
var opl = new IloOplModel(def,cplex);
var data2= new IloOplDataElements();
data2.Arcs=thisOplModel.ArcsNew;
data2.Arcs=s;
opl.addDataSource(data2);
opl.generate();
f.close();
data2.end();
opl.end();
}
}
execute{
var ofile = new IloOplOutputFile("modelRun.txt", true);
for(var j = 1; j <= 5; j++ ){
for(var i = 1; i <= 15; i++ ){
ofile.write(x[i][j]);
}
writeln();
}
ofile.close();
}
#CPLEXOptimizers#DecisionOptimization