Hi,
a list of attach should work as can be seen in the following code:
range r = 1..10;
dvar int+ x[r][r];
dvar int+ x2[r][r];
dvar int+ y[r][r];
// The following array of values (defined as data) will be used as
// a starting solution to warm-start the CPLEX search.
float values[i in r,j in r] = (i==5 && j==5)? 10 : 0;
float values2[i in r,j in r] = (i==3 && j==3)? 10 : 0;
minimize
sum( i in r,j in r) (x[i][j]+x2[i][j]) + sum( i,j in r ) y[i][j];
subject to{
ctSum:
sum( i,j in r ) x[i,j] >= 10;
ctSum2:
sum( i,j in r ) x2[i,j] >= 10;
forall( i,j in r )
ctEqual:
y[i][j] == j;
}
main{
thisOplModel.generate();
var def = thisOplModel.modelDefinition;
// Default behaviour
writeln("Default Behaviour");
var cplex1 = new IloCplex();
var opl1 = new IloOplModel(def, cplex1);
opl1.generate();
cplex1.solve();
writeln(opl1.printSolution());
// Setting initial solution
writeln("Setting initial solution");
var cplex2 = new IloCplex();
var opl2 = new IloOplModel(def, cplex2);
opl2.generate();
var vectors = new IloOplCplexVectors();
// We attach the values (defined as data) as starting solution
// for the variables x.
vectors.attach(opl2.x,opl2.values);
vectors.attach(opl2.x2,opl2.values2);
vectors.setVectors(cplex2);
cplex2.solve();
writeln(opl2.printSolution());
opl1.end();
cplex1.end();
opl2.end();
cplex2.end();
0;
}
In the engine log I got
1 of 1 MIP starts provided solutions.
regards
#DecisionOptimization#OPLusingCPLEXOptimizer