Decision Optimization

Decision Optimization

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

 View Only
  • 1.  print output to terminal in OPL

    Posted Thu April 11, 2024 04:35 AM

    Hello, 

    I have defined and initialize a matrix in my .mod as

    float tOldIt[j in J, i in I] = -1.0; 

    and I have been trying to print it on my terminal (Ubuntu) using the execute block as

    execute DISPLAY
    {
      writeln(tOldIt);
      writeln(' HELLO ');
    };

    ...but it does not print anything, not even the 'HELLO'... Is there a way to do it?

    Thanks

    Sam



    ------------------------------
    Samuele Viaro
    ------------------------------


  • 2.  RE: print output to terminal in OPL

    Posted Sat April 13, 2024 02:47 AM

    Hi

    have you used oplrun to run your .mod file ?

    regards



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 3.  RE: print output to terminal in OPL

    Posted Mon April 15, 2024 04:58 AM

    Hi Alex, 

    I am using the makefile provided in opl/examples/opl_interfaces/cpp/x86-64_linux/static_pic, modified to include my additional .cpp files.

    Then in my main .cpp I load the .mod and .dat files:

      IloEnv env; 
      IloOplRunConfiguration rc(env, "./dynamic.mod",  "./dynamic.dat");

    and solve with

    rc.getCplex().solve()

    isn't oplrun called automatically if I use the makefile provided by IBM?

    Thanks

    Sam



    ------------------------------
    Samuele Viaro
    ------------------------------



  • 4.  RE: print output to terminal in OPL

    Posted Mon April 15, 2024 07:44 AM

    in CPLEX_Studio2211\opl\examples\opl_interfaces\cpp\src oplrunsample.cpp

    you should not forget

    opl.postProcess();
    

    which handles the display of a solution



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------



  • 5.  RE: print output to terminal in OPL

    Posted Mon April 15, 2024 07:59 AM

    That worked beautifully!!

    There are so many functions that sometimes, even if I seek for a solution, it is hard to gather all the pieces together to make it work!! ;)

    Thanks



    ------------------------------
    Samuele Viaro
    ------------------------------



  • 6.  RE: print output to terminal in OPL

    Posted Mon April 15, 2024 08:07 AM

    Many links in https://www.linkedin.com/pulse/low-barrier-entry-optimization-through-cplex-alex-fleischer



    ------------------------------
    [Alex] [Fleischer]
    [Data and AI Technical Sales]
    [IBM]
    ------------------------------