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-2025 Zuse Institute Berlin (ZIB) */
7/* */
8/* Licensed under the Apache License, Version 2.0 (the "License"); */
9/* you may not use this file except in compliance with the License. */
10/* You may obtain a copy of the License at */
11/* */
12/* http://www.apache.org/licenses/LICENSE-2.0 */
13/* */
14/* Unless required by applicable law or agreed to in writing, software */
15/* distributed under the License is distributed on an "AS IS" BASIS, */
16/* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17/* See the License for the specific language governing permissions and */
18/* limitations under the License. */
19/* */
20/* You should have received a copy of the Apache-2.0 license */
21/* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22/* */
23/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24
25/**@file scip_general.h
26 * @ingroup PUBLICCOREAPI
27 * @brief general public methods
28 * @author Tobias Achterberg
29 * @author Timo Berthold
30 * @author Thorsten Koch
31 * @author Alexander Martin
32 * @author Marc Pfetsch
33 * @author Kati Wolter
34 * @author Gregor Hendel
35 * @author Leona Gottwald
36 */
37
38/*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
39
40#ifndef __SCIP_SCIP_GENERAL_H__
41#define __SCIP_SCIP_GENERAL_H__
42
43
44#include "scip/def.h"
45#include "scip/type_retcode.h"
46#include "scip/type_scip.h"
47#include "scip/type_set.h"
48#include "scip/type_stat.h"
49
50/* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
51 * this structure except the interface methods in scip.c.
52 * In optimized mode, the structure is included in scip.h, because some of the methods
53 * are implemented as defines for performance reasons (e.g. the numerical comparisons).
54 * Additionally, the internal "set.h" is included, such that the defines in set.h are
55 * available in optimized mode.
56 */
57#ifdef NDEBUG
58#include "scip/struct_scip.h"
59#include "scip/struct_stat.h"
60#include "scip/struct_set.h"
61#include "scip/solve.h"
62#endif
63
64#ifdef __cplusplus
65extern "C" {
66#endif
67
68/**@addtogroup MiscellaneousMethods
69 *
70 * @{
71 */
72
73/** returns SCIP version number as major + minor / 100
74 *
75 * @return SCIP major and minor version number
76 */
77SCIP_EXPORT
79 void
80 );
81
82/** returns SCIP major version
83 *
84 * @return major SCIP version
85 */
86SCIP_EXPORT
88 void
89 );
90
91/** returns SCIP minor version
92 *
93 * @return minor SCIP version
94 */
95SCIP_EXPORT
97 void
98 );
99
100/** returns SCIP technical (or patch) version
101 *
102 * @return technical SCIP version
103 */
104SCIP_EXPORT
106 void
107 );
108
109/** returns SCIP sub version number
110 *
111 * @return subversion SCIP version
112 *
113 * @deprecated SCIPsubversion() always returns 0 and will be removed in a future release.
114 */
115SCIP_EXPORT
117 void
118 );
119
120/** prints a version information line to a file stream via the message handler system
121 *
122 * @note If the message handler is set to a NULL pointer nothing will be printed
123 */
124SCIP_EXPORT
126 SCIP* scip, /**< SCIP data structure */
127 FILE* file /**< output file (or NULL for standard output) */
128 );
129
130/** prints detailed information on the compile-time flags
131 *
132 * @note If the message handler is set to a NULL pointer nothing will be printed
133 */
134SCIP_EXPORT
136 SCIP* scip, /**< SCIP data structure */
137 FILE* file /**< output file (or NULL for standard output) */
138 );
139
140/** prints error message for the given SCIP_RETCODE via the error prints method */
141SCIP_EXPORT
142void SCIPprintError(
143 SCIP_RETCODE retcode /**< SCIP return code causing the error */
144 );
145
146/**@} */
147
148/**@addtogroup GeneralSCIPMethods
149 *
150 * @{
151 */
152
153/** creates and initializes SCIP data structures
154 *
155 * @note The SCIP default message handler is installed. Use the method SCIPsetMessagehdlr() to install your own
156 * message handler or SCIPsetMessagehdlrLogfile() and SCIPsetMessagehdlrQuiet() to write into a log
157 * file and turn off/on the display output, respectively.
158 *
159 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
160 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
161 *
162 * @post After calling this method @p scip reached the solving stage \ref SCIP_STAGE_INIT
163 *
164 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
165 */
166SCIP_EXPORT
168 SCIP** scip /**< pointer to SCIP data structure */
169 );
170
171/** frees SCIP data structures
172 *
173 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
174 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
175 *
176 * @pre This method can be called if @p scip is in one of the following stages:
177 * - \ref SCIP_STAGE_INIT
178 * - \ref SCIP_STAGE_PROBLEM
179 * - \ref SCIP_STAGE_TRANSFORMED
180 * - \ref SCIP_STAGE_INITPRESOLVE
181 * - \ref SCIP_STAGE_PRESOLVING
182 * - \ref SCIP_STAGE_PRESOLVED
183 * - \ref SCIP_STAGE_EXITPRESOLVE
184 * - \ref SCIP_STAGE_SOLVING
185 * - \ref SCIP_STAGE_SOLVED
186 * - \ref SCIP_STAGE_FREE
187 *
188 * @post After calling this method \SCIP reached the solving stage \ref SCIP_STAGE_FREE
189 *
190 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
191 */
192SCIP_EXPORT
194 SCIP** scip /**< pointer to SCIP data structure */
195 );
196
197/** returns current stage of SCIP
198 *
199 * @return the current SCIP stage
200 *
201 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
202 */
203SCIP_EXPORT
205 SCIP* scip /**< SCIP data structure */
206 );
207
208/** outputs SCIP stage and solution status if applicable via the message handler
209 *
210 * @note If the message handler is set to a NULL pointer nothing will be printed
211 *
212 * @note If limits have been changed between the solution and the call to this function, the status is recomputed and
213 * thus may to correspond to the original status.
214 *
215 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
216 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
217 *
218 * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
219 */
220SCIP_EXPORT
222 SCIP* scip, /**< SCIP data structure */
223 FILE* file /**< output file (or NULL for standard output) */
224 );
225
226/** gets solution status
227 *
228 * @return SCIP solution status
229 *
230 * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
231 */
232SCIP_EXPORT
234 SCIP* scip /**< SCIP data structure */
235 );
236
237/** gets name for a solution status */
238SCIP_EXPORT
239const char* SCIPstatusName(
240 SCIP_STATUS status /**< SCIP status code */
241 );
242
243/** outputs solution status
244 *
245 * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
246 * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
247 *
248 * See \ref SCIP_Status "SCIP_STATUS" for a complete list of all possible solving status.
249 */
250SCIP_EXPORT
252 SCIP* scip, /**< SCIP data structure */
253 FILE* file /**< output file (or NULL for standard output) */
254 );
255
256/** returns whether the current stage belongs to the transformed problem space
257 *
258 * @return Returns TRUE if the \SCIP instance is transformed, otherwise FALSE
259 */
260SCIP_EXPORT
262 SCIP* scip /**< SCIP data structure */
263 );
264
265/** returns whether the presolving process would be finished given no more presolving reductions are found in this
266 * presolving round
267 *
268 * Checks whether the number of presolving rounds is not exceeded and the presolving reductions found in the current
269 * presolving round suffice to trigger another presolving round.
270 *
271 * @note if subsequent presolvers find more reductions, presolving might continue even if the method returns FALSE
272 * @note does not check whether infeasibility or unboundedness was already detected in presolving (which would result
273 * in presolving being stopped although the method returns TRUE)
274 *
275 * @return Returns TRUE if presolving is finished if no further reductions are detected
276 */
277SCIP_EXPORT
279 SCIP* scip /**< SCIP data structure */
280 );
281
282/** returns whether SCIP has performed presolving during the last solve
283 *
284 * @return Returns TRUE if presolving was performed during the last solve
285 */
286SCIP_EXPORT
288 SCIP* scip /**< SCIP data structure */
289 );
290
291/** returns whether the user pressed CTRL-C to interrupt the solving process
292 *
293 * @return Returns TRUE if Ctrl-C was pressed, otherwise FALSE.
294 */
295SCIP_EXPORT
297 SCIP* scip /**< SCIP data structure */
298 );
299
300/** returns whether the solving process should be / was stopped before proving optimality;
301 * if the solving process should be / was stopped, the status returned by SCIPgetStatus() yields
302 * the reason for the premature abort
303 *
304 * @return Returns TRUE if solving process is stopped/interrupted, otherwise FALSE.
305 */
306SCIP_EXPORT
308 SCIP* scip /**< SCIP data structure */
309 );
310
311/**@} */
312
313/**@addtogroup PublicExternalCodeMethods
314 *
315 * @{
316 */
317
318
319
320/** includes information about an external code linked into the SCIP library */
321SCIP_EXPORT
323 SCIP* scip, /**< SCIP data structure */
324 const char* name, /**< name of external code */
325 const char* description /**< description of external code, or NULL */
326 );
327
328/** returns an array of names of currently included external codes */
329SCIP_EXPORT
331 SCIP* scip /**< SCIP data structure */
332 );
333
334/** returns an array of the descriptions of currently included external codes
335 *
336 * @note some descriptions may be NULL
337 */
338SCIP_EXPORT
340 SCIP* scip /**< SCIP data structure */
341 );
342
343/** returns the number of currently included information on external codes */
344SCIP_EXPORT
346 SCIP* scip /**< SCIP data structure */
347 );
348
349/** prints information on external codes to a file stream via the message handler system
350 *
351 * @note If the message handler is set to a NULL pointer nothing will be printed
352 */
353SCIP_EXPORT
355 SCIP* scip, /**< SCIP data structure */
356 FILE* file /**< output file (or NULL for standard output) */
357 );
358
359/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
360 * speed up the algorithms.
361 */
362#ifdef NDEBUG
363
364#define SCIPgetStage(scip) ((scip)->set->stage)
365#define SCIPgetStatus(scip) ((scip)->stat->status)
366#define SCIPhasPerformedPresolve(scip) ((scip)->stat->performpresol)
367#define SCIPisStopped(scip) SCIPsolveIsStopped((scip)->set, (scip)->stat, 0)
368
369#endif
370
371/** @} */
372
373#ifdef __cplusplus
374}
375#endif
376
377#endif
common defines and data types used in all packages of SCIP
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:156
SCIP_Bool SCIPisTransformed(SCIP *scip)
Definition: scip_general.c:647
SCIP_RETCODE SCIPprintStage(SCIP *scip, FILE *file)
Definition: scip_general.c:466
SCIP_Bool SCIPisPresolveFinished(SCIP *scip)
Definition: scip_general.c:668
SCIP_Bool SCIPhasPerformedPresolve(SCIP *scip)
Definition: scip_general.c:730
const char * SCIPstatusName(SCIP_STATUS status)
Definition: scip_general.c:576
SCIP_Bool SCIPpressedCtrlC(SCIP *scip)
Definition: scip_general.c:746
SCIP_RETCODE SCIPprintStatus(SCIP *scip, FILE *file)
Definition: scip_general.c:631
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:759
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:402
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:370
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:562
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip_general.c:444
void SCIPprintError(SCIP_RETCODE retcode)
Definition: scip_general.c:231
int SCIPsubversion(void)
Definition: scip_general.c:158
void SCIPprintBuildOptions(SCIP *scip, FILE *file)
Definition: scip_general.c:201
int SCIPminorVersion(void)
Definition: scip_general.c:134
SCIP_Real SCIPversion(void)
Definition: scip_general.c:112
int SCIPtechVersion(void)
Definition: scip_general.c:145
void SCIPprintVersion(SCIP *scip, FILE *file)
Definition: scip_general.c:169
int SCIPmajorVersion(void)
Definition: scip_general.c:123
char ** SCIPgetExternalCodeDescriptions(SCIP *scip)
Definition: scip_general.c:800
SCIP_RETCODE SCIPincludeExternalCodeInformation(SCIP *scip, const char *name, const char *description)
Definition: scip_general.c:769
int SCIPgetNExternalCodes(SCIP *scip)
Definition: scip_general.c:811
void SCIPprintExternalCodes(SCIP *scip, FILE *file)
Definition: scip_general.c:825
char ** SCIPgetExternalCodeNames(SCIP *scip)
Definition: scip_general.c:786
internal methods for main solving loop and node processing
SCIP main data structure.
datastructures for global SCIP settings
datastructures for problem statistics
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for SCIP's main datastructure
type definitions for global SCIP settings
enum SCIP_Stage SCIP_STAGE
Definition: type_set.h:59
type definitions for problem statistics
enum SCIP_Status SCIP_STATUS
Definition: type_stat.h:64