Scippy

SCIP

Solving Constraint Integer Programs

scip_message.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2020 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_message.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for message handling
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Leona Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_MESSAGE_H__
32 #define __SCIP_SCIP_MESSAGE_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_message.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**@addtogroup MessageOutputMethods
45  *
46  * @{
47  */
48 
49 /* if we have a C99 compiler */
50 #ifdef SCIP_HAVE_VARIADIC_MACROS
51 
52 /** prints a debugging message if SCIP_DEBUG flag is set */
53 #ifdef SCIP_DEBUG
54 #define SCIPdebugMsg(scip, ...) SCIPprintDebugMessage(scip, __FILE__, __LINE__, __VA_ARGS__)
55 #define SCIPdebugMsgPrint(scip, ...) SCIPdebugMessagePrint(scip, __VA_ARGS__)
56 #else
57 #define SCIPdebugMsg(scip, ...) while ( FALSE ) SCIPprintDebugMessage(scip, __FILE__, __LINE__, __VA_ARGS__)
58 #define SCIPdebugMsgPrint(scip, ...) while ( FALSE ) SCIPdebugMessagePrint(scip, __VA_ARGS__)
59 #endif
60 
61 #else
62 /* if we do not have a C99 compiler, use a workaround that prints a message, but not the file and linenumber */
63 
64 /** prints a debugging message if SCIP_DEBUG flag is set */
65 #ifdef SCIP_DEBUG
66 #define SCIPdebugMsg printf("debug: "), SCIPdebugMessagePrint
67 #define SCIPdebugMsgPrint SCIPdebugMessagePrint
68 #else
69 #define SCIPdebugMsg while ( FALSE ) SCIPdebugMessagePrint
70 #define SCIPdebugMsgPrint while ( FALSE ) SCIPdebugMessagePrint
71 #endif
72 
73 #endif
74 
75 
76 /** installs the given message handler, such that all messages are passed to this handler. A messages handler can be
77  * created via SCIPmessagehdlrCreate().
78  *
79  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
80  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
81  *
82  * @pre this method can be called in one of the following stages of the SCIP solving process:
83  * - \ref SCIP_STAGE_INIT
84  * - \ref SCIP_STAGE_PROBLEM
85  *
86  * @note The currently installed messages handler gets freed if this SCIP instance is its last user (w.r.t. capture/release).
87  */
90  SCIP* scip, /**< SCIP data structure */
91  SCIP_MESSAGEHDLR* messagehdlr /**< message handler to install, or NULL to suppress all output */
92  );
93 
94 /** returns the currently installed message handler
95  *
96  * @return the currently installed message handler, or NULL if messages are currently suppressed
97  */
100  SCIP* scip /**< SCIP data structure */
101  );
102 
103 /** sets the log file name for the currently installed message handler */
106  SCIP* scip, /**< SCIP data structure */
107  const char* filename /**< name of log file, or NULL (no log) */
108  );
109 
110 /** sets the currently installed message handler to be quiet (or not) */
113  SCIP* scip, /**< SCIP data structure */
114  SCIP_Bool quiet /**< should screen messages be suppressed? */
115  );
116 
117 /** prints a warning message via the message handler */
119 void SCIPwarningMessage(
120  SCIP* scip, /**< SCIP data structure */
121  const char* formatstr, /**< format string like in printf() function */
122  ... /**< format arguments line in printf() function */
123  );
124 
125 /** prints a debug message */
128  SCIP* scip, /**< SCIP data structure */
129  const char* sourcefile, /**< name of the source file that called the function */
130  int sourceline, /**< line in the source file where the function was called */
131  const char* formatstr, /**< format string like in printf() function */
132  ... /**< format arguments line in printf() function */
133  );
134 
135 /** prints a debug message without precode */
138  SCIP* scip, /**< SCIP data structure */
139  const char* formatstr, /**< format string like in printf() function */
140  ... /**< format arguments line in printf() function */
141  );
142 
143 /** prints a dialog message that requests user interaction or is a direct response to a user interactive command */
145 void SCIPdialogMessage(
146  SCIP* scip, /**< SCIP data structure */
147  FILE* file, /**< file stream to print into, or NULL for stdout */
148  const char* formatstr, /**< format string like in printf() function */
149  ... /**< format arguments line in printf() function */
150  );
151 
152 /** prints a message */
154 void SCIPinfoMessage(
155  SCIP* scip, /**< SCIP data structure */
156  FILE* file, /**< file stream to print into, or NULL for stdout */
157  const char* formatstr, /**< format string like in printf() function */
158  ... /**< format arguments line in printf() function */
159  );
160 
161 /** prints a message depending on the verbosity level */
163 void SCIPverbMessage(
164  SCIP* scip, /**< SCIP data structure */
165  SCIP_VERBLEVEL msgverblevel, /**< verbosity level of this message */
166  FILE* file, /**< file stream to print into, or NULL for stdout */
167  const char* formatstr, /**< format string like in printf() function */
168  ... /**< format arguments line in printf() function */
169  );
170 
171 /** returns the current message verbosity level
172  *
173  * @return message verbosity level of SCIP
174  *
175  * @see \ref SCIP_VerbLevel "SCIP_VERBLEVEL" for a list of all verbosity levels
176  */
179  SCIP* scip /**< SCIP data structure */
180  );
181 
182 
183 /**@} */
184 
185 #ifdef __cplusplus
186 }
187 #endif
188 
189 #endif
SCIP_EXPORT SCIP_RETCODE SCIPsetMessagehdlr(SCIP *scip, SCIP_MESSAGEHDLR *messagehdlr)
Definition: scip_message.c:56
SCIP_EXPORT void SCIPsetMessagehdlrQuiet(SCIP *scip, SCIP_Bool quiet)
Definition: scip_message.c:111
SCIP_EXPORT void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:182
SCIP_EXPORT void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:123
#define SCIP_EXPORT
Definition: def.h:100
SCIP_EXPORT void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
enum SCIP_VerbLevel SCIP_VERBLEVEL
Definition: type_message.h:48
type definitions for return codes for SCIP methods
SCIP_EXPORT void SCIPsetMessagehdlrLogfile(SCIP *scip, const char *filename)
Definition: scip_message.c:99
type definitions for SCIP&#39;s main datastructure
SCIP_EXPORT void SCIPprintDebugMessage(SCIP *scip, const char *sourcefile, int sourceline, const char *formatstr,...)
Definition: scip_message.c:139
#define SCIP_Bool
Definition: def.h:70
SCIP_EXPORT SCIP_VERBLEVEL SCIPgetVerbLevel(SCIP *scip)
Definition: scip_message.c:240
SCIP_EXPORT SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Definition: scip_message.c:91
SCIP_EXPORT void SCIPdebugMessagePrint(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:166
type definitions for message output methods
common defines and data types used in all packages of SCIP
SCIP_EXPORT void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:199