Decision Optimization

Decision Optimization

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


#Analytics
#DecisionOptimization
#DecisionOptimization
 View Only
  • 1.  export file in docplex

    Posted 03/06/19 02:00 AM

    Originally posted by: ShaCplex


    Hi Daniel,

     

    I noticed that the export_as_lp() is not exporting the lp file.

     

    i wrote ;

    mdl = Model("LP")

    mdl.export_as_lp("C:\input files\sample data\rps.lp")

    its not generating the lp file in the path.

    I even tried with backslash like mdl.export_as_lp("C:/input files/sample data/rps.lp")

    am I misssing something here? 

     

     

    Regards,

    shahul


    #CPLEXOptimizers
    #DecisionOptimization


  • 2.  Re: export file in docplex

    Posted 03/06/19 03:05 AM

    All the arguments you passed to the function look like they do not represent the file names you have in mind.

    "C:\input files\sample data\rps.lp" will use the special characters '\i', '\s', and '\r', you will have to escape the backslashes in case you you have backslashes in string arguments.

    "C:/input files/sample data/rps.lp" does not look like a valid file system path.

    Can you try any of this:

    mdl.export_as_lp(r"C:\input files\sample data\rps.lp")
    mdl.export_as_lp("C:\\input files\\sample data\\rps.lp")

    Please also read the definition of string literals in Python.


    #CPLEXOptimizers
    #DecisionOptimization