Originally posted by: AnthonyPANG
Dear all,
Is it possible for me to use IloOplCplexVectors obtained from 1 model, and apply these vectors in another model, assuming I have the same set of decision variables in these two models. The code is extracted below. Thanks.
L1: var m2Source = new IloOplModelSource("Heuristic-2.mod");
L2: var m2Cplex = new IloCplex();
L3: var m2Def = new IloOplModelDefinition(m2Source);
L4: var m2_init = new IloOplModel(m2Def,m2Cplex);
L5: m2_init.addDataSource(Sourcedata);
L6: var h2data = new IloOplDataSource("H2 Data.dat");
L7: m2_init.addDataSource(h2data);
L8: m2_init.generate();
L9: if (m2Cplex.solve()) {
L10: if ( !m2vectors.getVectors(m2Cplex) ) {
L11: writeln("H2 solution warm start preparation failed: ",m2vectors.status);
L12: } else {
L13: writeln("H2 solution warm start preparation successful ");
L14: }
L15:}
L16: var m3Source = new IloOplModelSource("Heuristic-3.mod");
L17: var m3Cplex = new IloCplex();
L18: var m3Def = new IloOplModelDefinition(m3Source);
L19: var m3_init = new IloOplModel(m3Def,m3Cplex);
L20: m3_init.addDataSource(Sourcedata);
L21: var h3data = new IloOplDataSource("H3 Data.dat");
L22: m3_init.addDataSource(h3data);
L23: m3_init.generate();
L24:
L25: if ( !m2vectors.setVectors(m3Cplex) ) {
L26: writeln("warm start ",m2vectors.Nrows,"x",m2vectors.Ncols," failed: ",m2vectors.status);
L27: } else {
L28: writeln("warm start ",m2vectors.Nrows,"x",m2vectors.Ncols," succeeded ");
L29: }
L30:
L31: if (m3Cplex.solve()) {
L32: LB = m3Cplex.getObjValue();
L33: writeln("H3 Solution = ", LB);
L34:}
After execute m2Cplex.solve in L9, I can obtain the vectors "m2vectors" with number of columns and rows correct, with status = 0. However, when I execute L25, the m2vectors.status changed to -3, I don't know what's the problem. Any one can help?? Thanks.
Anthony
#DecisionOptimization#OPLusingCPLEXOptimizer