CONOPT
Loading...
Searching...
No Matches
MessageHandler Class

Data Structures

class  pyconopt.MessageHandler
 The message handler class. More...
 

Functions

 pyconopt.MessageHandler.message (self, smsg, dmsg, nmsg, msgv)
 virtual method for handling the messages.
 
 pyconopt.MessageHandler.errorMessage (self, rowno, colno, posno, msg)
 virtual method for handling error messages.
 
 pyconopt.MessageHandler.sendMessage (self, msg)
 sends a message to the message handler
 
 pyconopt.MessageHandler.setVerbosityLevel (self, verblevel)
 sets the verbosity level for messaging.
 

Detailed Description

An optional class for providing a custom message handler.

Function Documentation

◆ message()

pyconopt.MessageHandler.message ( self,
smsg,
dmsg,
nmsg,
msgv )

virtual method for handling the messages.

This can be redefined by the user for alternative message handling

Attention
Mandatory callback routine. (Fortran and C API only. A default implementation is available in the other languages.)

General messages can be information for the iteration log, error messages, termination messages, and other generally useful information. The messages can be more than one line long and each line can be up to 132 characters long. There may be blank lines identified by LLEN(I) = 1 and MSGV(I)(1:1) = " " used to space the messages nicely, and some of the lines may be indented with leading blanks.

Messages are sent to three simultaneous streams or files and parts of the messages can be intended for one or more streams. These streams/files are:

  • The Screen file: These messages are intended for immediate display, showing the modeler the progress as it happens. The file has a small number of small messages plus an iteration log with lines for a subset of the iterations. The first SMSG lines are intended for this file.
  • The Status file: A summary file that after the model has been solved can be used to determine the status of the solution and whether there were any problems during the solution process. Error messages are more detailed than in the Screen file, but there is no iteration log. The file is intended to be saved with the solution. The first NMSG lines are intended for this file.
  • The Documentation file: A detailed description of the iteration process with one line per iteration plus detailed versions of all error and termination messages. The file is intended for experimentation and debugging. The first DMSG lines are intended for this file.

The modeler may implement all three streams or a subset of them. Note that SMSG, NMSG, or DMSG can be zero indicating that there are only messages for a subset for the files. Also note that the status file always will be a subset of the documentation file, i.e. NMSG will be less than or equal to DMSG. All messages start with the first line in MSGV.

Parameters
smsgThe number of lines in the message that should go to the Screen file. Between 0 and 30.
dmsgThe number of lines in the message that should go to the Status file. Between 0 and 30.
nmsgThe number of lines in the message that should go to the Documentation file. Between 0 and 30.
msgvVector with the actual message lines.

Definition at line 2290 of file pyconopt.py.

◆ errorMessage()

pyconopt.MessageHandler.errorMessage ( self,
rowno,
colno,
posno,
msg )

virtual method for handling error messages.

This can be redefined by the user for alternative message handling

Messages about particular parts of a model are all one line long. The messages can be related to an error or it can be a general informative message related to a row or column or Jacobian element. The modeler is responsible for combining the row and column identification and the message text and for displaying the overall message.

There are some special cases for the three first arguments and the message should be interpreted accordingly. The special cases are:

  • COLNO = -1: The message is about a row and ROWNO will be between 0 and NumCon-1.
  • ROWNO = -1: The message is about a column and COLNO will be between 0 and NumVar-1.
  • ROWNO and COLNO both non-negative: The message is about a position in the Jacobian if POSNO is non-negative and about a (row,column)-pair if POSNO is -1.

Examples of message texts are "Inconsistent lower and upper bounds." and "The variable has reached 'infinity.'" for a column, "The slack has reached 'infinity.'" for a row and "Initial Jacobian element was not defined." for a Jacobian element.

Parameters
rownoThe number of a row in the matrix.
colnoThe number of a column in the matrix.
posnoThe number of a Jacobian element in the matrix.
msgThe actual message.

Definition at line 2308 of file pyconopt.py.

◆ sendMessage()

pyconopt.MessageHandler.sendMessage ( self,
msg )

sends a message to the message handler

Definition at line 2359 of file pyconopt.py.

◆ setVerbosityLevel()

pyconopt.MessageHandler.setVerbosityLevel ( self,
verblevel )

sets the verbosity level for messaging.

The effect of this will depend on how the user implements the custom message handler

Definition at line 2368 of file pyconopt.py.