Scippy

SCIP

Solving Constraint Integer Programs

scip_general.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-2019 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_general.h
17  * @ingroup PUBLICCOREAPI
18  * @brief general public methods
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_GENERAL_H__
32 #define __SCIP_SCIP_GENERAL_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_retcode.h"
37 #include "scip/type_scip.h"
38 #include "scip/type_set.h"
39 #include "scip/type_stat.h"
40 
41 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
42  * this structure except the interface methods in scip.c.
43  * In optimized mode, the structure is included in scip.h, because some of the methods
44  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
45  * Additionally, the internal "set.h" is included, such that the defines in set.h are
46  * available in optimized mode.
47  */
48 #ifdef NDEBUG
49 #include "scip/struct_scip.h"
50 #include "scip/struct_stat.h"
51 #include "scip/set.h"
52 #include "scip/tree.h"
53 #include "scip/misc.h"
54 #include "scip/var.h"
55 #include "scip/cons.h"
56 #include "scip/solve.h"
57 #include "scip/debug.h"
58 #endif
59 
60 #ifdef __cplusplus
61 extern "C" {
62 #endif
63 
64 /**@addtogroup MiscellaneousMethods
65  *
66  * @{
67  */
68 
69 /** returns complete SCIP version number in the format "major . minor tech"
70  *
71  * @return complete SCIP version
72  */
73 extern
75  void
76  );
77 
78 /** returns SCIP major version
79  *
80  * @return major SCIP version
81  */
82 extern
84  void
85  );
86 
87 /** returns SCIP minor version
88  *
89  * @return minor SCIP version
90  */
91 extern
93  void
94  );
95 
96 /** returns SCIP technical version
97  *
98  * @return technical SCIP version
99  */
100 extern
101 int SCIPtechVersion(
102  void
103  );
104 
105 /** returns SCIP sub version number
106  *
107  * @return subversion SCIP version
108  */
109 extern
110 int SCIPsubversion(
111  void
112  );
113 
114 /** prints a version information line to a file stream via the message handler system
115  *
116  * @note If the message handler is set to a NULL pointer nothing will be printed
117  */
118 extern
119 void SCIPprintVersion(
120  SCIP* scip, /**< SCIP data structure */
121  FILE* file /**< output file (or NULL for standard output) */
122  );
123 
124 /** prints detailed information on the compile-time flags
125  *
126  * @note If the message handler is set to a NULL pointer nothing will be printed
127  */
128 extern
130  SCIP* scip, /**< SCIP data structure */
131  FILE* file /**< output file (or NULL for standard output) */
132  );
133 
134 /** prints error message for the given SCIP_RETCODE via the error prints method */
135 extern
136 void SCIPprintError(
137  SCIP_RETCODE retcode /**< SCIP return code causing the error */
138  );
139 
140 /**@} */
141 
142 /**@addtogroup GeneralSCIPMethods
143  *
144  * @{
145  */
146 
147 /** creates and initializes SCIP data structures
148  *
149  * @note The SCIP default message handler is installed. Use the method SCIPsetMessagehdlr() to install your own
150  * message handler or SCIPsetMessagehdlrLogfile() and SCIPsetMessagehdlrQuiet() to write into a log
151  * file and turn off/on the display output, respectively.
152  *
153  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
154  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
155  *
156  * @post After calling this method @p scip reached the solving stage \ref SCIP_STAGE_INIT
157  *
158  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
159  */
160 extern
162  SCIP** scip /**< pointer to SCIP data structure */
163  );
164 
165 /** frees SCIP data structures
166  *
167  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
168  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
169  *
170  * @pre This method can be called if @p scip is in one of the following stages:
171  * - \ref SCIP_STAGE_INIT
172  * - \ref SCIP_STAGE_PROBLEM
173  * - \ref SCIP_STAGE_TRANSFORMED
174  * - \ref SCIP_STAGE_INITPRESOLVE
175  * - \ref SCIP_STAGE_PRESOLVING
176  * - \ref SCIP_STAGE_PRESOLVED
177  * - \ref SCIP_STAGE_EXITPRESOLVE
178  * - \ref SCIP_STAGE_SOLVING
179  * - \ref SCIP_STAGE_SOLVED
180  * - \ref SCIP_STAGE_FREE
181  *
182  * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_FREE
183  *
184  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
185  */
186 extern
188  SCIP** scip /**< pointer to SCIP data structure */
189  );
190 
191 /** returns current stage of SCIP
192  *
193  * @return the current SCIP stage
194  *
195  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
196  */
197 extern
199  SCIP* scip /**< SCIP data structure */
200  );
201 
202 /** outputs SCIP stage and solution status if applicable via the message handler
203  *
204  * @note If the message handler is set to a NULL pointer nothing will be printed
205  *
206  * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
207  * thus may to correspond to the original status.
208  *
209  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
210  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
211  *
212  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
213  */
214 extern
216  SCIP* scip, /**< SCIP data structure */
217  FILE* file /**< output file (or NULL for standard output) */
218  );
219 
220 /** gets solution status
221  *
222  * @return SCIP solution status
223  *
224  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
225  */
226 extern
228  SCIP* scip /**< SCIP data structure */
229  );
230 
231 /** outputs solution status
232  *
233  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
234  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
235  *
236  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
237  */
238 extern
240  SCIP* scip, /**< SCIP data structure */
241  FILE* file /**< output file (or NULL for standard output) */
242  );
243 
244 /** returns whether the current stage belongs to the transformed problem space
245  *
246  * @return Returns TRUE if the \SCIP instance is transformed, otherwise FALSE
247  */
248 extern
250  SCIP* scip /**< SCIP data structure */
251  );
252 
253 /** returns whether the solution process is arithmetically exact, i.e., not subject to roundoff errors
254  *
255  * @note This feature is not supported yet!
256  *
257  * @return Returns TRUE if \SCIP is exact solving mode, otherwise FALSE
258  */
259 extern
261  SCIP* scip /**< SCIP data structure */
262  );
263 
264 /** returns whether the presolving process would be finished given no more presolving reductions are found in this
265  * presolving round
266  *
267  * Checks whether the number of presolving rounds is not exceeded and the presolving reductions found in the current
268  * presolving round suffice to trigger another presolving round.
269  *
270  * @note if subsequent presolvers find more reductions, presolving might continue even if the method returns FALSE
271  * @note does not check whether infeasibility or unboundedness was already detected in presolving (which would result
272  * in presolving being stopped although the method returns TRUE)
273  *
274  * @return Returns TRUE if presolving is finished if no further reductions are detected
275  */
276 extern
278  SCIP* scip /**< SCIP data structure */
279  );
280 
281 /** returns whether SCIP has performed presolving during the last solve
282  *
283  * @return Returns TRUE if presolving was performed during the last solve
284  */
285 extern
287  SCIP* scip /**< SCIP data structure */
288  );
289 
290 /** returns whether the user pressed CTRL-C to interrupt the solving process
291  *
292  * @return Returns TRUE if Ctrl-C was pressed, otherwise FALSE.
293  */
294 extern
296  SCIP* scip /**< SCIP data structure */
297  );
298 
299 /** returns whether the solving process should be / was stopped before proving optimality;
300  * if the solving process should be / was stopped, the status returned by SCIPgetStatus() yields
301  * the reason for the premature abort
302  *
303  * @return Returns TRUE if solving process is stopped/interrupted, otherwise FALSE.
304  */
305 extern
307  SCIP* scip /**< SCIP data structure */
308  );
309 
310 /**@} */
311 
312 /**@addtogroup PublicExternalCodeMethods
313  *
314  * @{
315  */
316 
317 
318 
319 /** includes information about an external code linked into the SCIP library */
320 extern
322  SCIP* scip, /**< SCIP data structure */
323  const char* name, /**< name of external code */
324  const char* description /**< description of external code, or NULL */
325  );
326 
327 /** returns an array of names of currently included external codes */
328 extern
330  SCIP* scip /**< SCIP data structure */
331  );
332 
333 /** returns an array of the descriptions of currently included external codes
334  *
335  * @note some descriptions may be NULL
336  */
337 extern
339  SCIP* scip /**< SCIP data structure */
340  );
341 
342 /** returns the number of currently included information on external codes */
343 extern
345  SCIP* scip /**< SCIP data structure */
346  );
347 
348 /** prints information on external codes to a file stream via the message handler system
349  *
350  * @note If the message handler is set to a NULL pointer nothing will be printed
351  */
352 extern
354  SCIP* scip, /**< SCIP data structure */
355  FILE* file /**< output file (or NULL for standard output) */
356  );
357 
358 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
359  * speed up the algorithms.
360  */
361 #ifdef NDEBUG
362 
363 #define SCIPgetStage(scip) (((scip)->set)->stage)
364 #define SCIPhasPerformedPresolve(scip) ((scip)->stat->performpresol)
365 #define SCIPisStopped(scip) SCIPsolveIsStopped((scip)->set, (scip)->stat, 0)
366 
367 #endif
368 
369 /* @} */
370 
371 #ifdef __cplusplus
372 }
373 #endif
374 
375 #endif
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:411
internal methods for branch and bound tree
char ** SCIPgetExternalCodeDescriptions(SCIP *scip)
Definition: scip_general.c:779
int SCIPmajorVersion(void)
Definition: scip_general.c:157
void SCIPprintExternalCodes(SCIP *scip, FILE *file)
Definition: scip_general.c:804
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
char ** SCIPgetExternalCodeNames(SCIP *scip)
Definition: scip_general.c:765
type definitions for global SCIP settings
type definitions for return codes for SCIP methods
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:338
SCIP_Bool SCIPisTransformed(SCIP *scip)
Definition: scip_general.c:610
SCIP_Bool SCIPpressedCtrlC(SCIP *scip)
Definition: scip_general.c:725
type definitions for problem statistics
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
Definition: scip_general.c:647
type definitions for SCIP&#39;s main datastructure
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:518
SCIP_Real SCIPversion(void)
Definition: scip_general.c:146
SCIP_RETCODE SCIPprintStage(SCIP *scip, FILE *file)
Definition: scip_general.c:433
internal miscellaneous methods
internal methods for global SCIP settings
SCIP main data structure.
SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:541
internal methods for problem variables
int SCIPgetNExternalCodes(SCIP *scip)
Definition: scip_general.c:790
#define SCIP_Bool
Definition: def.h:69
void SCIPprintVersion(SCIP *scip, FILE *file)
Definition: scip_general.c:201
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:58
methods for debugging
int SCIPsubversion(void)
Definition: scip_general.c:190
int SCIPtechVersion(void)
Definition: scip_general.c:179
datastructures for problem statistics
internal methods for main solving loop and node processing
#define SCIP_Real
Definition: def.h:157
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:50
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:738
internal methods for constraints and constraint handlers
SCIP_RETCODE SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
Definition: scip_general.c:748
SCIP_Bool SCIPhasPerformedPresolve(SCIP *scip)
Definition: scip_general.c:709
common defines and data types used in all packages of SCIP
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:266
int SCIPminorVersion(void)
Definition: scip_general.c:168
void SCIPprintBuildOptions(SCIP *scip, FILE *file)
Definition: scip_general.c:236
SCIP_Bool SCIPisExactSolve(SCIP *scip)
Definition: scip_general.c:625
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:370