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-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_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 Leona 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/struct_set.h"
52 #include "scip/solve.h"
53 #endif
54 
55 #ifdef __cplusplus
56 extern "C" {
57 #endif
58 
59 /**@addtogroup MiscellaneousMethods
60  *
61  * @{
62  */
63 
64 /** returns complete SCIP version number in the format "major . minor tech"
65  *
66  * @return complete SCIP version
67  */
70  void
71  );
72 
73 /** returns SCIP major version
74  *
75  * @return major SCIP version
76  */
79  void
80  );
81 
82 /** returns SCIP minor version
83  *
84  * @return minor SCIP version
85  */
88  void
89  );
90 
91 /** returns SCIP technical version
92  *
93  * @return technical SCIP version
94  */
96 int SCIPtechVersion(
97  void
98  );
99 
100 /** returns SCIP sub version number
101  *
102  * @return subversion SCIP version
103  */
105 int SCIPsubversion(
106  void
107  );
108 
109 /** prints a version information line to a file stream via the message handler system
110  *
111  * @note If the message handler is set to a NULL pointer nothing will be printed
112  */
114 void SCIPprintVersion(
115  SCIP* scip, /**< SCIP data structure */
116  FILE* file /**< output file (or NULL for standard output) */
117  );
118 
119 /** prints detailed information on the compile-time flags
120  *
121  * @note If the message handler is set to a NULL pointer nothing will be printed
122  */
125  SCIP* scip, /**< SCIP data structure */
126  FILE* file /**< output file (or NULL for standard output) */
127  );
128 
129 /** prints error message for the given SCIP_RETCODE via the error prints method */
131 void SCIPprintError(
132  SCIP_RETCODE retcode /**< SCIP return code causing the error */
133  );
134 
135 /**@} */
136 
137 /**@addtogroup GeneralSCIPMethods
138  *
139  * @{
140  */
141 
142 /** creates and initializes SCIP data structures
143  *
144  * @note The SCIP default message handler is installed. Use the method SCIPsetMessagehdlr() to install your own
145  * message handler or SCIPsetMessagehdlrLogfile() and SCIPsetMessagehdlrQuiet() to write into a log
146  * file and turn off/on the display output, respectively.
147  *
148  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
149  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
150  *
151  * @post After calling this method @p scip reached the solving stage \ref SCIP_STAGE_INIT
152  *
153  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
154  */
157  SCIP** scip /**< pointer to SCIP data structure */
158  );
159 
160 /** frees SCIP data structures
161  *
162  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
163  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
164  *
165  * @pre This method can be called if @p scip is in one of the following stages:
166  * - \ref SCIP_STAGE_INIT
167  * - \ref SCIP_STAGE_PROBLEM
168  * - \ref SCIP_STAGE_TRANSFORMED
169  * - \ref SCIP_STAGE_INITPRESOLVE
170  * - \ref SCIP_STAGE_PRESOLVING
171  * - \ref SCIP_STAGE_PRESOLVED
172  * - \ref SCIP_STAGE_EXITPRESOLVE
173  * - \ref SCIP_STAGE_SOLVING
174  * - \ref SCIP_STAGE_SOLVED
175  * - \ref SCIP_STAGE_FREE
176  *
177  * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_FREE
178  *
179  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
180  */
183  SCIP** scip /**< pointer to SCIP data structure */
184  );
185 
186 /** returns current stage of SCIP
187  *
188  * @return the current SCIP stage
189  *
190  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
191  */
194  SCIP* scip /**< SCIP data structure */
195  );
196 
197 /** outputs SCIP stage and solution status if applicable via the message handler
198  *
199  * @note If the message handler is set to a NULL pointer nothing will be printed
200  *
201  * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
202  * thus may to correspond to the original status.
203  *
204  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
205  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
206  *
207  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
208  */
211  SCIP* scip, /**< SCIP data structure */
212  FILE* file /**< output file (or NULL for standard output) */
213  );
214 
215 /** gets solution status
216  *
217  * @return SCIP solution status
218  *
219  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
220  */
223  SCIP* scip /**< SCIP data structure */
224  );
225 
226 /** outputs solution status
227  *
228  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
229  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
230  *
231  * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
232  */
235  SCIP* scip, /**< SCIP data structure */
236  FILE* file /**< output file (or NULL for standard output) */
237  );
238 
239 /** returns whether the current stage belongs to the transformed problem space
240  *
241  * @return Returns TRUE if the \SCIP instance is transformed, otherwise FALSE
242  */
245  SCIP* scip /**< SCIP data structure */
246  );
247 
248 /** returns whether the solution process is arithmetically exact, i.e., not subject to roundoff errors
249  *
250  * @note This feature is not supported yet!
251  *
252  * @return Returns TRUE if \SCIP is exact solving mode, otherwise FALSE
253  */
256  SCIP* scip /**< SCIP data structure */
257  );
258 
259 /** returns whether the presolving process would be finished given no more presolving reductions are found in this
260  * presolving round
261  *
262  * Checks whether the number of presolving rounds is not exceeded and the presolving reductions found in the current
263  * presolving round suffice to trigger another presolving round.
264  *
265  * @note if subsequent presolvers find more reductions, presolving might continue even if the method returns FALSE
266  * @note does not check whether infeasibility or unboundedness was already detected in presolving (which would result
267  * in presolving being stopped although the method returns TRUE)
268  *
269  * @return Returns TRUE if presolving is finished if no further reductions are detected
270  */
273  SCIP* scip /**< SCIP data structure */
274  );
275 
276 /** returns whether SCIP has performed presolving during the last solve
277  *
278  * @return Returns TRUE if presolving was performed during the last solve
279  */
282  SCIP* scip /**< SCIP data structure */
283  );
284 
285 /** returns whether the user pressed CTRL-C to interrupt the solving process
286  *
287  * @return Returns TRUE if Ctrl-C was pressed, otherwise FALSE.
288  */
291  SCIP* scip /**< SCIP data structure */
292  );
293 
294 /** returns whether the solving process should be / was stopped before proving optimality;
295  * if the solving process should be / was stopped, the status returned by SCIPgetStatus() yields
296  * the reason for the premature abort
297  *
298  * @return Returns TRUE if solving process is stopped/interrupted, otherwise FALSE.
299  */
302  SCIP* scip /**< SCIP data structure */
303  );
304 
305 /**@} */
306 
307 /**@addtogroup PublicExternalCodeMethods
308  *
309  * @{
310  */
311 
312 
313 
314 /** includes information about an external code linked into the SCIP library */
317  SCIP* scip, /**< SCIP data structure */
318  const char* name, /**< name of external code */
319  const char* description /**< description of external code, or NULL */
320  );
321 
322 /** returns an array of names of currently included external codes */
325  SCIP* scip /**< SCIP data structure */
326  );
327 
328 /** returns an array of the descriptions of currently included external codes
329  *
330  * @note some descriptions may be NULL
331  */
334  SCIP* scip /**< SCIP data structure */
335  );
336 
337 /** returns the number of currently included information on external codes */
340  SCIP* scip /**< SCIP data structure */
341  );
342 
343 /** prints information on external codes to a file stream via the message handler system
344  *
345  * @note If the message handler is set to a NULL pointer nothing will be printed
346  */
349  SCIP* scip, /**< SCIP data structure */
350  FILE* file /**< output file (or NULL for standard output) */
351  );
352 
353 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
354  * speed up the algorithms.
355  */
356 #ifdef NDEBUG
357 
358 #define SCIPgetStage(scip) (((scip)->set)->stage)
359 #define SCIPhasPerformedPresolve(scip) ((scip)->stat->performpresol)
360 #define SCIPisStopped(scip) SCIPsolveIsStopped((scip)->set, (scip)->stat, 0)
361 
362 #endif
363 
364 /** @} */
365 
366 #ifdef __cplusplus
367 }
368 #endif
369 
370 #endif
SCIP_EXPORT void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:211
SCIP_EXPORT SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:687
SCIP_EXPORT SCIP_RETCODE SCIPprintStage(SCIP *scip, FILE *file)
Definition: scip_general.c:378
SCIP_EXPORT SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:467
#define SCIP_EXPORT
Definition: def.h:100
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
type definitions for global SCIP settings
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_Bool SCIPisTransformed(SCIP *scip)
Definition: scip_general.c:559
type definitions for problem statistics
SCIP_EXPORT SCIP_Real SCIPversion(void)
Definition: scip_general.c:91
SCIP_EXPORT SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
SCIP_EXPORT int SCIPgetNExternalCodes(SCIP *scip)
Definition: scip_general.c:739
SCIP_EXPORT SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
Definition: scip_general.c:596
type definitions for SCIP&#39;s main datastructure
SCIP_EXPORT SCIP_RETCODE SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
Definition: scip_general.c:697
SCIP_EXPORT void SCIPprintVersion(SCIP *scip, FILE *file)
Definition: scip_general.c:146
SCIP_EXPORT SCIP_Bool SCIPpressedCtrlC(SCIP *scip)
Definition: scip_general.c:674
SCIP_EXPORT void SCIPprintExternalCodes(SCIP *scip, FILE *file)
Definition: scip_general.c:753
SCIP_EXPORT int SCIPmajorVersion(void)
Definition: scip_general.c:102
SCIP main data structure.
SCIP_EXPORT int SCIPminorVersion(void)
Definition: scip_general.c:113
#define SCIP_Bool
Definition: def.h:70
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:58
SCIP_EXPORT SCIP_Bool SCIPhasPerformedPresolve(SCIP *scip)
Definition: scip_general.c:658
datastructures for problem statistics
SCIP_EXPORT int SCIPsubversion(void)
Definition: scip_general.c:135
SCIP_EXPORT SCIP_Bool SCIPisExactSolve(SCIP *scip)
Definition: scip_general.c:574
SCIP_EXPORT void SCIPprintBuildOptions(SCIP *scip, FILE *file)
Definition: scip_general.c:181
internal methods for main solving loop and node processing
SCIP_EXPORT int SCIPtechVersion(void)
Definition: scip_general.c:124
SCIP_EXPORT SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:490
#define SCIP_Real
Definition: def.h:163
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:50
SCIP_EXPORT char ** SCIPgetExternalCodeNames(SCIP *scip)
Definition: scip_general.c:714
SCIP_EXPORT SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:356
SCIP_EXPORT char ** SCIPgetExternalCodeDescriptions(SCIP *scip)
Definition: scip_general.c:728
datastructures for global SCIP settings