OutputHandler#

class amplpy.OutputHandler#

Interface to handle the outputs from the calls to any function that causes the underlying AMPL interpreter to display a message. If an application needs to implement customised output handling, it must implement this interface and then register an instance with the AMPL API using the set_output_handler() method.

Note that errors and warnings are not passed through this interface, see ErrorHandler for more information.

output(self, kind, msg)#

This method is called when AMPL sends some output derived from executing a statement.

Args:

kind: kind of the output of the AMPL interpreter.

msg: text of the output by the AMPL interpreter.

class amplpy.Kind#

Represents the type of the output coming from the interpreter.

BREAK = 1#
BREAKPOINT = 21#
CALL = 22#
CD = 2#
CHECK = 23#
CLOSE = 24#
COMMANDS = 25#
CONTINUE = 26#
DATA = 27#
DELETECMD = 28#
DISPLAY = 3#
DROP = 29#
DROP_OR_RESTORE_ALL = 30#
ELSE_CHECK = 32#
ENDIF = 33#
ENVIRON = 34#
EXIT = 4#
EXPAND = 5#
FIX = 35#
FOR = 36#
LET = 38#
LOAD = 6#
LOOPEND = 39#
MISC = 16#
OBJECTIVE = 40#
OPTION = 7#
OPTION_RESET = 41#
PRINT = 8#
PRINTF = 42#
PROBLEM = 43#
PROMPT = 9#
PURGE = 44#
RBRACE = 45#
READ = 46#
READ_TABLE = 18#
RELOAD = 47#
REMOVE = 48#
REPEAT = 49#
REPEAT_END = 50#
RESET = 51#
RESTORE = 52#
RUN_ARGS = 53#
SEMICOLON = 54#
SHELL_MESSAGE = 15#
SHELL_OUTPUT = 14#
SHOW = 12#
SOLUTION = 10#
SOLVE = 11#
SSTEP = 55#
THEN = 56#
UNFIX = 57#
UNLOAD = 58#
UPDATE = 59#
WAITING = 0#
WRITE = 60#
WRITE_TABLE = 17#
XREF = 13#