Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

  • 1.  readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Wed February 04, 2015 12:22 PM

    Originally posted by: saeedmarvi


    Hi,

    I have a MIP model in OPL and I can load it in java using OPL interface (using IloOplFactory, IloOplModel etc.) and running that OPL model from java works fine. I would like to be able to stop the run and resume it later using MIPstarts. I found this note http://www-01.ibm.com/support/docview.wss?uid=swg21400014 . Could any one help me finding a code EXAMPLE on this. I have read the documentation and know the statements, but I really need an EXAMPLE to see how to use these methods, readMIPStarts and writeMIPStarts in java.

    Thanks in advance for any EXAMPLE!!!!


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Thu February 05, 2015 03:47 AM

    Hi

    could the 2 links here help ?

    https://www.ibm.com/developerworks/community/forums/html/topic?id=77777777-0000-0000-0000-000014868304&ps=25

    https://www.ibm.com/developerworks/community/forums/html/topic?id=ea9dd71f-6c81-4daa-8bda-ed71cd29db29&ps=25

    Plus be aware that in

    IDE and OPL > Optimization Programming Language (OPL) > IBM ILOG Script Reference Manual > OPL Classes

    In IloCplex you have now

    writeMIPStarts(name, start, nb)

    Writes MIP start information to the file denoted by name.

    And

     


     
    Reads the MST file denoted by name and copies the MIP start information into the invoking IloCplex object.

     

     

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Thu October 08, 2015 08:31 AM

    Hi,

     

    I was asked recently offline whether this really works, so let me give an example:

    The write MIP start :

    range r = 1..10;
    dvar int+ x[r];
    dvar int+ y[r];


    minimize
      sum( i in r ) x[i] + sum( j in r ) y[j];
    subject to{
      ctSum:    
        sum( i in r ) x[i] >= 10;
      forall( j in r )
        ctEqual:
          y[j] == j;
          
          x[5]==1;
    }

    main{
      thisOplModel.generate();
      cplex.solve();
      cplex.writeMIPStarts("c:/tam/warmstart/ws.mst",0,1);
    writeln(thisOplModel.printSolution());
     
    }

    and the read part:

    range r = 1..10;
    dvar int+ x[r];
    dvar int+ y[r];


    minimize
      sum( i in r ) x[i] + sum( j in r ) y[j];
    subject to{
      ctSum:    
        sum( i in r ) x[i] >= 10;
      forall( j in r )
        ctEqual:
          y[j] == j;
    }

    main{
      thisOplModel.generate();  
      cplex.readMIPStarts("c:/tam/warmstart/ws.mst");
      cplex.solve();   
      writeln(thisOplModel.printSolution());

     
    }

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 4.  Re: readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Tue March 14, 2017 01:37 PM

    Originally posted by: Yasmina


    Hi,

    The answer of AlexFleischer is exactly what I am looking for. I am using OPL scripting, with Cplex version 12.6.0.0 , but the writeMIPStarts method is unknown : "unknown property WriteMIPStart". I tried with both small and capital w : WriteMIPStart and writeMIPStart. Do I need a more recent version of Cplex to have this method working ?

    Thanks for your help,

    Yasmina


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 5.  Re: readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Tue March 14, 2017 01:49 PM

    Hi,

    can t you move to CPLEX 12.7 ?

    regards


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 6.  Re: readMIPStarts and writeMIPStarts in OPL with java interface EXAMPLE

    Posted Thu March 23, 2017 06:55 AM

    Originally posted by: Yasmina


    Yes, I upgraded to 12.7 and it works.

    Thanks,

    Yasmina


    #DecisionOptimization
    #OPLusingCPLEXOptimizer