Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  How to reduce the model size?

    Posted 01/25/18 09:48 AM

    Originally posted by: lxysjtu


    Dear all,

     

    I am writing a linear programming model in LP format. I found for small-sized instances, the LP file is more than 1.9GB. Thus it is impractical to write large instances in LP format.

    Is there any other way to reduce the model size? Or other file format is useful?

     

    Thanks,

     

    Shaon


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: How to reduce the model size?

    Posted 01/25/18 12:39 PM

    If the file name ends with one of the following extensions, a compressed file is written.

    • .bz2 for files compressed with BZip2.
    • .gz for files compressed with GNU Zip.

    This is from the documentation for CPXwriteprob here. If it suits your needs (it is not human readable, but has other advantages), you could use the SAV format which is described here.

    For example:

    status = CPXwriteprob (env, lp, "myprob.lp.gz", NULL);
    

    or

    status = CPXwriteprob (env, lp, "myprob.sav.gz", NULL);
    

     


    #CPLEXOptimizers
    #DecisionOptimization


  • 3.  Re: How to reduce the model size?

    Posted 01/25/18 08:34 PM

    Originally posted by: lxysjtu


    Thanks. I mean that I have created a "large" LP file and gave it to CPLEX for solving. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 4.  Re: How to reduce the model size?

    Posted 01/26/18 06:11 AM

    OK, then what is your question? In order to export the model to the smallest possible file use the sav.gz format. Depending on the length of your variable/constraint names you can sometimes significantly reduce file size but shortening those names or not using names at all.


    #CPLEXOptimizers
    #DecisionOptimization


  • 5.  Re: How to reduce the model size?

    Posted 01/27/18 06:34 AM

    Originally posted by: lxysjtu


    I created the MIP model in lp format. But for large instances, the lp file is too large, e.g., more than 5Gb. It is difficult for CPLEX to read this lp file. I want to reduce the size of this lp file. 

    Is there any way to reduce the model size, e.g., not in lp format?


    #CPLEXOptimizers
    #DecisionOptimization


  • 6.  Re: How to reduce the model size?

    Posted 01/27/18 10:24 AM

    Yes, like we said, compress the LP file with gzip or bzip2 or use the (compressed) SAV format.

    However, reading a compressed LP file will not be faster than reading an uncompressed file since the data read is basically the same. Reading a SAV file is faster though.

    I am not exactly sure this answers your question. When you say "model size" do you mean the size of file (in bytes) or do you mean the number of variables, constraints, non-zeros ... ?


    #CPLEXOptimizers
    #DecisionOptimization


  • 7.  Re: How to reduce the model size?

    Posted 01/29/18 11:36 PM

    Originally posted by: lxysjtu


    Model size means the size of file. 


    #CPLEXOptimizers
    #DecisionOptimization


  • 8.  Re: How to reduce the model size?

    Posted 01/30/18 02:21 AM

    OK, for minimal file size use the .sav.bz2 format and (if possible) remove any names from your model.


    #CPLEXOptimizers
    #DecisionOptimization