Decision Optimization

 View Only
  • 1.  Suppress Markowitz tolerance messages

    IBM Champion
    Posted Tue January 12, 2021 06:15 PM
    I'm using the Java API to CPLEX 20.1, and I would like to get rid of the "Markowitz threshold set to 0.1" messages. (I'm solving LPs in a loop, and the messages get a bit tedious.) I tried invoking both setOut(null) and setWarning(null), but neither blocks the messages. For some reason, the IloCplex class in the Java API does not have a setError() method, even though there is one in the C++ API (in class IloAlgorithm, I think).

    Is there any way in Java to block the Markowitz messages?

    Thanks,
    Paul

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------

    #DecisionOptimization


  • 2.  RE: Suppress Markowitz tolerance messages

    Community Leadership
    Posted Mon March 08, 2021 04:11 AM
    Hi Paul!

    I checked the CPLEX code, and the warning that you refer is printed the same way (or so I think) as the warning that appears when importing this file:

    $ cat RemoveWarning.java
    import ilog.concert.*;
    import ilog.cplex.*;
    
    public class RemoveWarning {
       public static void main(String[] args) throws IloException {
          assert (args.length != 1);
          IloCplex cplex = new IloCplex();
          cplex.importModel(args[0]);
    
          System.out.println("After setWarning(null): (nothing should be printed)");
          cplex.setWarning(null);
          cplex.importModel(args[0]);
       }
    }
    $ cat foo.lp
    minimize
    x
    subject to
    x >= 0
    $ javac -classpath /Applications/CPLEX_Studio_Community201/cplex/lib/cplex.jar -O -d . RemoveWarning.java
    $ java  -Djava.library.path=/Applications/CPLEX_Studio_Community201/cplex/bin/x86-64_osx -classpath /Applications/CPLEX_Studio_Community201/cplex/lib/cplex.jar: RemoveWarning foo.lp
    Warning: 'End' missing.
    After setWarning(null): (nothing should be printed)
    $


    It seems that 'setWarning(null)' behaves as I would expect, and I can't reproduce the issue that you faced.



    ------------------------------
    Xavier
    ------------------------------



  • 3.  RE: Suppress Markowitz tolerance messages

    IBM Champion
    Posted Mon March 08, 2021 02:14 PM
    Thanks, Xavier. In fact, I got setWarning(null) to suppress the messages in a different program. I'm at a loss as to why it did not work back in January (side effect of the plague?), and I don't think I still have the program where it failed. Very curious.

    ------------------------------
    Paul Rubin
    Professor Emeritus
    Michigan State University
    ------------------------------