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-2018 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 scip.zib.de. */
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 Robert Lion 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 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
41  * this structure except the interface methods in scip.c.
42  * In optimized mode, the structure is included in scip.h, because some of the methods
43  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
44  * Additionally, the internal "set.h" is included, such that the defines in set.h are
45  * available in optimized mode.
46  */
47 #ifdef NDEBUG
48 #include "scip/struct_scip.h"
49 #include "scip/struct_stat.h"
50 #include "scip/set.h"
51 #include "scip/tree.h"
52 #include "scip/misc.h"
53 #include "scip/var.h"
54 #include "scip/cons.h"
55 #include "scip/solve.h"
56 #include "scip/debug.h"
57 #endif
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 /**@addtogroup MessageOutputMethods
64  *
65  * @{
66  */
67 
68 /* if we have a C99 compiler */
69 #ifdef SCIP_HAVE_VARIADIC_MACROS
70 
71 /** prints a debugging message if SCIP_DEBUG flag is set */
72 #ifdef SCIP_DEBUG
73 #define SCIPdebugMsg(scip, ...) SCIPprintDebugMessage(scip, __FILE__, __LINE__, __VA_ARGS__)
74 #define SCIPdebugMsgPrint(scip, ...) SCIPdebugMessagePrint(scip, __VA_ARGS__)
75 #else
76 #define SCIPdebugMsg(scip, ...) while ( FALSE ) SCIPprintDebugMessage(scip, __FILE__, __LINE__, __VA_ARGS__)
77 #define SCIPdebugMsgPrint(scip, ...) while ( FALSE ) SCIPdebugMessagePrint(scip, __VA_ARGS__)
78 #endif
79 
80 #else
81 /* if we do not have a C99 compiler, use a workaround that prints a message, but not the file and linenumber */
82 
83 /** prints a debugging message if SCIP_DEBUG flag is set */
84 #ifdef SCIP_DEBUG
85 #define SCIPdebugMsg printf("debug: "), SCIPdebugMessagePrint
86 #define SCIPdebugMsgPrint SCIPdebugMessagePrint
87 #else
88 #define SCIPdebugMsg while ( FALSE ) SCIPdebugMessagePrint
89 #define SCIPdebugMsgPrint while ( FALSE ) SCIPdebugMessagePrint
90 #endif
91 
92 #endif
93 
94 
95 /** installs the given message handler, such that all messages are passed to this handler. A messages handler can be
96  * created via SCIPmessagehdlrCreate().
97  *
98  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
99  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
100  *
101  * @pre this method can be called in one of the following stages of the SCIP solving process:
102  * - \ref SCIP_STAGE_INIT
103  * - \ref SCIP_STAGE_PROBLEM
104  *
105  * @note The currently installed messages handler gets freed if this SCIP instance is its last user (w.r.t. capture/release).
106  */
107 extern
109  SCIP* scip, /**< SCIP data structure */
110  SCIP_MESSAGEHDLR* messagehdlr /**< message handler to install, or NULL to suppress all output */
111  );
112 
113 /** returns the currently installed message handler
114  *
115  * @return the currently installed message handler, or NULL if messages are currently suppressed
116  */
117 extern
119  SCIP* scip /**< SCIP data structure */
120  );
121 
122 /** sets the log file name for the currently installed message handler */
123 extern
125  SCIP* scip, /**< SCIP data structure */
126  const char* filename /**< name of log file, or NULL (no log) */
127  );
128 
129 /** sets the currently installed message handler to be quiet (or not) */
130 extern
132  SCIP* scip, /**< SCIP data structure */
133  SCIP_Bool quiet /**< should screen messages be suppressed? */
134  );
135 
136 /** prints a warning message via the message handler */
137 extern
138 void SCIPwarningMessage(
139  SCIP* scip, /**< SCIP data structure */
140  const char* formatstr, /**< format string like in printf() function */
141  ... /**< format arguments line in printf() function */
142  );
143 
144 /** prints a debug message */
145 extern
147  SCIP* scip, /**< SCIP data structure */
148  const char* sourcefile, /**< name of the source file that called the function */
149  int sourceline, /**< line in the source file where the function was called */
150  const char* formatstr, /**< format string like in printf() function */
151  ... /**< format arguments line in printf() function */
152  );
153 
154 /** prints a debug message without precode */
155 extern
157  SCIP* scip, /**< SCIP data structure */
158  const char* formatstr, /**< format string like in printf() function */
159  ... /**< format arguments line in printf() function */
160  );
161 
162 /** prints a dialog message that requests user interaction or is a direct response to a user interactive command */
163 extern
164 void SCIPdialogMessage(
165  SCIP* scip, /**< SCIP data structure */
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 /** prints a message */
172 extern
173 void SCIPinfoMessage(
174  SCIP* scip, /**< SCIP data structure */
175  FILE* file, /**< file stream to print into, or NULL for stdout */
176  const char* formatstr, /**< format string like in printf() function */
177  ... /**< format arguments line in printf() function */
178  );
179 
180 /** prints a message depending on the verbosity level */
181 extern
182 void SCIPverbMessage(
183  SCIP* scip, /**< SCIP data structure */
184  SCIP_VERBLEVEL msgverblevel, /**< verbosity level of this message */
185  FILE* file, /**< file stream to print into, or NULL for stdout */
186  const char* formatstr, /**< format string like in printf() function */
187  ... /**< format arguments line in printf() function */
188  );
189 
190 /** returns the current message verbosity level
191  *
192  * @return message verbosity level of SCIP
193  *
194  * @see \ref SCIP_VerbLevel "SCIP_VERBLEVEL" for a list of all verbosity levels
195  */
196 extern
198  SCIP* scip /**< SCIP data structure */
199  );
200 
201 
202 /**@} */
203 
204 #ifdef __cplusplus
205 }
206 #endif
207 
208 #endif
internal methods for branch and bound tree
void SCIPdialogMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:262
SCIP_RETCODE SCIPsetMessagehdlr(SCIP *scip, SCIP_MESSAGEHDLR *messagehdlr)
Definition: scip_message.c:136
SCIP_VERBLEVEL SCIPgetVerbLevel(SCIP *scip)
Definition: scip_message.c:320
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
enum SCIP_VerbLevel SCIP_VERBLEVEL
Definition: type_message.h:48
void SCIPdebugMessagePrint(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:246
type definitions for return codes for SCIP methods
SCIP_MESSAGEHDLR * SCIPgetMessagehdlr(SCIP *scip)
Definition: scip_message.c:171
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:203
void SCIPinfoMessage(SCIP *scip, FILE *file, const char *formatstr,...)
Definition: scip_message.c:279
type definitions for SCIP&#39;s main datastructure
void SCIPprintDebugMessage(SCIP *scip, const char *sourcefile, int sourceline, const char *formatstr,...)
Definition: scip_message.c:219
internal miscellaneous methods
internal methods for global SCIP settings
SCIP main data structure.
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:296
internal methods for problem variables
#define SCIP_Bool
Definition: def.h:62
void SCIPsetMessagehdlrQuiet(SCIP *scip, SCIP_Bool quiet)
Definition: scip_message.c:191
methods for debugging
datastructures for problem statistics
internal methods for main solving loop and node processing
void SCIPsetMessagehdlrLogfile(SCIP *scip, const char *filename)
Definition: scip_message.c:179
internal methods for constraints and constraint handlers
type definitions for message output methods
common defines and data types used in all packages of SCIP