Decision Optimization

Decision Optimization

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

 View Only
Expand all | Collapse all

doopl - Unable to redirect log

  • 1.  doopl - Unable to redirect log

    Posted Tue February 05, 2019 11:26 AM

    Originally posted by: abalkum


    Hi,

    I've been working with the new python doopl library for running opl models.  I'm trying to redirect the engine log to a file but the method doesn't seem seem to do anything.  After I run the following code:

    from doopl.factory import *
    with create_opl_model("C:\\Program Files\\IBM\\ILOG\\CPLEX_Studio128\\opl\\examples\\opl\\euler\\euler.mod") as opl:
            opl.redirect_engine_log("D:\\test.txt")
            opl.run()
    

    I get the output (expected from euler.mod):

    [[64 13 60 11 58 9 30 27]
             [61 6 63 8 29 26 57 38]
             [14 1 12 59 10 39 28 31]
             [5 62 7 40 25 56 37 46]
             [2 15 4 51 36 47 32 55]
             [19 22 17 24 41 52 45 48]
             [16 3 20 35 50 43 54 33]
             [21 18 23 42 53 34 49 44]]

     

    but "text.txt" is just an empty file.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 2.  Re: doopl - Unable to redirect log

    Posted Wed February 06, 2019 04:13 AM

    Originally posted by: Viu-Long Kong


    Hi,

    As it is implemented in current version of doopl, redirect_engine_log(filename) will flush and close the file only when the program exits.

    I will work on a fix for the next version. Thanks for the report.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer


  • 3.  Re: doopl - Unable to redirect log

    Posted Wed February 06, 2019 10:37 AM

    Originally posted by: abalkum


    Thanks for the response.  I was hoping that it would flush after the "with" statement.  Unfortunately, doopl will be hard for me to utilize without output logging to a file during execution.  I look forward to the fix.


    #DecisionOptimization
    #OPLusingCPLEXOptimizer