Originally posted by: MatthiasP.
Hi everyone, I'm relatively new to CPLEX for my thesis work.
I've written a model for a home health care problem, but because the original model was too large to solve instances of a realistic size, my promotor suggested I decompose it into an assignment and scheduling problem. Now, I wish to feed 2 decision variables of this assignment problem to the scheduling problem so I can solve it in one go instead of having to solve one, then add the solution to the .dat-file of the second.
The two decision variables are:
dvar boolean z[workers][patients];
dvar int r2[days][workers];
The latter has to be renamed to r[days][workers] when fed to the scheduling model.
I've been trying to puzzle together the necessary code looking at some of the examples but not to much success.
The 'Master model.mod' is the assignment problem, 'Subproblem.mod' is the scheduling problem which needs the solutions fed to. The code below is what I currently have in the 'Master model'-file. Running it returns a "scripting runtime error: cannot add properties to this value : [a IloOplMain.IloOplDataSource].".
main
{
var MASTERDef = thisOplModel.modelDefinition;
var MASTERCplex = cplex;
var MASTERData = thisOplModel.dataElements;
var MASTEROpl = new IloOplModel(MASTERDef, MASTERCplex);
MASTEROpl.addDataSource(MASTERData);
MASTEROpl.generate();
var SUBSource = new IloOplModelSource("Submodel.mod");
var SUBDef = new IloOplModelDefinition(SUBSource);
var SUBCplex = new IloCplex();
var SUBOpl = new IloOplModel(SUBDef, SUBCplex);
var SUBData = new IloOplDataSource("Submodel.dat");
SUBData.r = MASTEROpl.r2;
SUBData.z = MASTEROpl.z;
SUBOpl.addDataSource(SUBData);
SUBOpl.generate();
}
Does this have to do with how I define r[d][k] and z[k][p] in the Submodel's .mod and .dat files? I've tried various options, but nothing seems to work.
Any help is much appreciated. Thanks in advance.
#CPLEXOptimizers#DecisionOptimization