Originally posted by: Thaher
Hi All, I really appreciate your help and assistance on below.
I am inputting some initial values for a binary variable y to warmstart my OPL model, y was declared as : dvar boolean y[Plants][PlantCapacity];
In order to load initial values of y I did the following :
1. I declared a new variable as :
int valY[Plants][PlantCapacity];
int sizeY = r*k;
int flatValY[1..sizeY]=...;
2. to attach subject data I coded as follows :
execute {
var i = 1;
for(var n in Plants)
{
for(var m in PlantCapacity)
{
valY[n][m] = flatValY[i];
i++;
}
}
}
3. and I inserted these values at data file as follows :
flatValY = [
0
0
1
0
1
0
0
0
1
0
0
0
];
4. Finally I have added the following code after the constraint block :
main
{
var src = new IloOplModelSource("Class 1.2.mod");
var def = new IloOplModelDefinition(src);
cplex = new IloCplex();
writeln("Solving the problem with initial solution");
var opl = new IloOplModel(def, cplex);
var data = new IloOplDataSource("Class 1.2.dat");
opl.addDataSource(data);
opl.generate();
var vectors = new IloOplCplexVectors();
vectors.attach(opl.y, opl.valY);
vectors.setVectors(cplex);
cplex.solve();
}
When I run the model, I observe the impact of loading those values on the search expressed in the gap values at engine log, However, though engine log showed 3 solutions were found I get no solution in the problem browser.
I am not really sure weather my code is really correct, and if so why I am not getting solution at the end. Knowing that initial values were obtained from an optimal solution.
Regards,
#DecisionOptimization#OPLusingCPLEXOptimizer