Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  results different between using python and studio (Why??)

    Posted 07/26/16 11:42 PM

    Originally posted by: baohu


    Hi I created an optimization model with OPL in a MOD file, which can be directly solved by CPLEX studio.

    After that I converted this MOD file to LP file and solve it using Python

    I did not specify any parameter setting. Therefore, I assumed that in both of these methods I have used the default parameters setting.

    However, the results are different. The result obtained from CPLEX studio is better than the second method.

    Any clue in it and Do I need to do any improvement?


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: results different between using python and studio (Why??)

    Posted 07/27/16 03:24 AM

    First of all, you should use a SAV file, not an LP file. Can you try with this? I take it you are using the exact same machine for both solves?


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  回复:Re: results different between using python and studio (Why??)

    Posted 07/27/16 03:35 AM

    Originally posted by: baohu


    Thanks for reply. I would try the SAV format. Yes, the running environment was the same (same machine)


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: results different between using python and studio (Why??)

    Posted 08/02/16 09:21 PM

    Originally posted by: baohu


    It works while using a SAV file and the results are even better than directly using CPLEX studio. The following JAVA codings are also workable for conversion MOD to SAV

     {
            IloOplFactory.setDebugMode(true);
            IloOplFactory oplF = new IloOplFactory();
            IloOplErrorHandler errHandler = oplF.createOplErrorHandler(System.out);
            IloOplModelSource modelSource=oplF.createOplModelSource("./data/xxx.mod");
            IloOplSettings settings = oplF.createOplSettings(errHandler);
      settings.setWithNames(true);
            IloOplModelDefinition def=oplF.createOplModelDefinition(modelSource,settings);  
            IloCplex cplex = oplF.createCplex();
            IloOplModel opl=oplF.createOplModel(def,cplex);
            IloCplex  memset=new IloCplex();
            memset.setParam(IloCplex.BooleanParam.MemoryEmphasis,true);
          

            IloOplDataSource dataSource=oplF.createOplDataSource("./data/xxxx.dat");
            opl.addDataSource(dataSource);
            opl.generate();
      
            cplex.exportModel("./data/xx.sav");
            cplex.end();
            oplF.end();
            }

     


    #CPLEXOptimizers
    #DecisionOptimization