Forum Discussion

FICO's avatar
FICO
Community Manager
2 years ago

XNLP_VERBOSE turn off WARNING column/row has been ignored....

Hi!

When using XNLP_VERBOSE Is there any way to turn off the warning messages that a row has been ignored when constructing a model? 

I am finding that the model spends more on time printing out warnings than it does on solving the actual problem. I would like to have access to the verbose output, but without the clutter of all the warnings.

Cheers.

image

1 Reply

  • FICO's avatar
    FICO
    Community Manager

    The warning messages you are observing are produced by the solver Knitro. There is no direct way of disabling just such warnings. However, what you might want to do is to redirect the full solver output into a file (physical or in memory) and apply some filtering when displaying the output that has been stored, for example as in the following code snippet:

    fopen("mylog",F_OUTPUT)
    maximise(MyObjective)
    fclose(F_OUTPUT)
    fopen("mylog",F_INPUT)
    while(readtextline(l)>0) do
      if not startswith(l,"WARNING:"): write(l)
    end-do
    fclose(F_INPUT)

    The in-memory version just requires adding a driver prefix to the filename:

    fopen("mem:mylog",F_OUTPUT)
    maximise(MyObjective)
    fclose(F_OUTPUT)
    fopen("mem:mylog",F_INPUT)
    while(readtextline(l)>0) do
     if not startswith(l,"WARNING:"): write(l)
    end-do
    fclose(F_INPUT)