Decision Optimization

Decision Optimization

Delivers prescriptive analytics capabilities and decision intelligence to improve decision-making.


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  using IloOplCplexVectors obtained from one model and use in another model

    Posted 09/14/10 02:59 AM

    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


  • 2.  Re: using IloOplCplexVectors obtained from one model and use in another model

    Posted 09/21/10 04:58 AM

    Originally posted by: SystemAdmin


    I think your problem is probably discussed in this topic: http://www.ibm.com/developerworks/forums/thread.jspa?threadID=326310&tstart=0
    As said:
    <<Status -3 indicates misfit in number of rows.
    Try using the attach method for finer control on dvars and constraints.>>
    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: using IloOplCplexVectors obtained from one model and use in another model

    Posted 09/21/10 11:09 PM

    Originally posted by: AnthonyPANG


    Dear Vincent,

    Thanks for your reply. But I still don't know how to use the ilooplcplexvectors.attach function. Say, I have a 3D decision variable called Visit[v][i][j] in both model P1 and P2. How I can attach the solution obtained from P1 to the model P2?? I am using main() block to do the iteration between P1 and P2, any hint?? Thousands thx.

    Regards,
    Anthony
    #DecisionOptimization
    #OPLusingCPLEXOptimizer