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(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.
- WAITING = 0#
Output
prompt2
, returned when incomplete statements are interpreted.
- BREAK = 1#
Output
break
, displayed when an operation is interrupted with SIGINT.
- CD = 2#
Output
cd
, returned by thecd
function.
- DISPLAY = 3#
Output
display
, returned by thedisplay
function.
- EXIT = 4#
Output
exit
, returned as last message from AMPL before exiting the interpreter.
- EXPAND = 5#
Output
expand
, returned by theexpand
function.
- LOAD = 6#
Output
load
, returned by theload
function when loading a library.
- OPTION = 7#
Output
option
, returned by theoption
function when getting the value of an option.
- PRINT = 8#
Output
print
, returned by theprint
function when printing values from AMPL command line.
- PROMPT = 9#
Output
prompt1
, normal AMPL prompt.
- SOLUTION = 10#
Output
solution
, returned when loading a solution with the commandsolution
, contains the solver message.
- SOLVE = 11#
Output
solve
, returned by thesolve
function, contains the solver message.
- SHOW = 12#
Output
show
, returned by theshow
function.
- XREF = 13#
Output
xref
, returned by thexref
function.
- SHELL_OUTPUT = 14#
Output of the AMPL command
shell
.
- SHELL_MESSAGE = 15#
Messages from the command
shell
.
- MISC = 16#
Output
misc
.
- WRITE_TABLE = 17#
Messages from the command
write table
.
- READ_TABLE = 18#
Messages from the command
read table
.
- BREAKPOINT = 21#
Breakpoint hit.
- CALL = 22#
Output of a script
call
.
- CHECK = 23#
Output of a
check
operation.
- CLOSE = 24#
Output of a
close
command for output redirection.
- COMMANDS = 25#
Output of a
commands
call into another file.
- CONTINUE = 26#
Issued when
continue
is encountered.
- DATA = 27#
Output of a
data
command.
- DELETECMD = 28#
Output of a
delete
command.
- DROP = 29#
Output of a
drop
command.
- DROP_OR_RESTORE_ALL = 30#
Internal.
- ELSE = 31#
Else block.
- ELSE_CHECK = 32#
Internal.
- ENDIF = 33#
End of if block.
- ENVIRON = 34#
Output of a
environ
command.
- FIX = 35#
Output of a
fix
command.
- FOR = 36#
Output of a
for
command.
- IF = 37#
Output of an
if
command.
- LET = 38#
Output of a
let
command.
- LOOPEND = 39#
End of loop.
- OBJECTIVE = 40#
Output of an
objective
command.
- OPTION_RESET = 41#
Occurs when resetting option values.
- PRINTF = 42#
Output of a
printf
command.
- PROBLEM = 43#
Output of a
problem
command.
- PURGE = 44#
Output of a
purge
command.
- RBRACE = 45#
Occurs when a right brace is encountered.
- READ = 46#
Output of a
read
command.
- RELOAD = 47#
Output of a
reload
command.
- REMOVE = 48#
Output of a
remove
command.
- REPEAT = 49#
Beginning of a repeat loop.
- REPEAT_END = 50#
End of a repeat loop.
- RESET = 51#
Output of a
reset
command.
- RESTORE = 52#
Output of a
restore
command.
- RUN_ARGS = 53#
Internal.
- SEMICOLON = 54#
Internal.
- SSTEP = 55#
Internal.
- THEN = 56#
Beginning of the
then
part of an if statement.
- UNFIX = 57#
Output of an
unfix
command.
- UNLOAD = 58#
Output of an
unload
command.
- UPDATE = 59#
Output of an
update
command.
- WRITE = 60#
Output of a
write
command.