Scippy

SCIP

Solving Constraint Integer Programs

scip_solve.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_solve.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public solving 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_SOLVE_H__
32 #define __SCIP_SCIP_SOLVE_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_retcode.h"
37 #include "scip/type_scip.h"
38 #include "scip/type_sol.h"
39 #include "scip/type_tree.h"
40 #include "scip/type_var.h"
41 
42 #ifdef __cplusplus
43 extern "C" {
44 #endif
45 
46 /**@addtogroup PublicSolveMethods
47  *
48  * @{
49  */
50 
51 /** initializes solving data structures and transforms problem
52  *
53  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
54  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
55  *
56  * @pre This method can be called if @p scip is in one of the following stages:
57  * - \ref SCIP_STAGE_PROBLEM
58  * - \ref SCIP_STAGE_TRANSFORMED
59  * - \ref SCIP_STAGE_INITPRESOLVE
60  * - \ref SCIP_STAGE_PRESOLVING
61  * - \ref SCIP_STAGE_EXITPRESOLVE
62  * - \ref SCIP_STAGE_PRESOLVED
63  * - \ref SCIP_STAGE_INITSOLVE
64  * - \ref SCIP_STAGE_SOLVING
65  * - \ref SCIP_STAGE_SOLVED
66  * - \ref SCIP_STAGE_EXITSOLVE
67  * - \ref SCIP_STAGE_FREETRANS
68  * - \ref SCIP_STAGE_FREE
69  *
70  * @post When calling this method in the \ref SCIP_STAGE_PROBLEM stage, the \SCIP stage is changed to \ref
71  * SCIP_STAGE_TRANSFORMED; otherwise, the stage is not changed
72  *
73  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
74  */
77  SCIP* scip /**< SCIP data structure */
78  );
79 
80 /** transforms and presolves problem
81  *
82  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
83  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
84  *
85  * @pre This method can be called if @p scip is in one of the following stages:
86  * - \ref SCIP_STAGE_PROBLEM
87  * - \ref SCIP_STAGE_TRANSFORMED
88  * - \ref SCIP_STAGE_PRESOLVING
89  * - \ref SCIP_STAGE_PRESOLVED
90  *
91  * @post After calling this method \SCIP reaches one of the following stages:
92  * - \ref SCIP_STAGE_PRESOLVING if the presolving process was interrupted
93  * - \ref SCIP_STAGE_PRESOLVED if the presolving process was finished and did not solve the problem
94  * - \ref SCIP_STAGE_SOLVED if the problem was solved during presolving
95  *
96  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
97  */
100  SCIP* scip /**< SCIP data structure */
101  );
102 
103 /** transforms, presolves, and solves problem
104  *
105  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
106  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
107  *
108  * @pre This method can be called if @p scip is in one of the following stages:
109  * - \ref SCIP_STAGE_PROBLEM
110  * - \ref SCIP_STAGE_TRANSFORMED
111  * - \ref SCIP_STAGE_PRESOLVING
112  * - \ref SCIP_STAGE_PRESOLVED
113  * - \ref SCIP_STAGE_SOLVING
114  * - \ref SCIP_STAGE_SOLVED
115  *
116  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
117  * process was interrupted:
118 
119  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
120  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
121  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
122  *
123  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
124  */
127  SCIP* scip /**< SCIP data structure */
128  );
129 
130 /** transforms, presolves, and solves problem using additional solvers which emphasize on
131  * finding solutions.
132  *
133  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
134  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
135  *
136  * @pre This method can be called if @p scip is in one of the following stages:
137  * - \ref SCIP_STAGE_PROBLEM
138  * - \ref SCIP_STAGE_TRANSFORMED
139  * - \ref SCIP_STAGE_PRESOLVING
140  * - \ref SCIP_STAGE_PRESOLVED
141  * - \ref SCIP_STAGE_SOLVING
142  * - \ref SCIP_STAGE_SOLVED
143  *
144  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
145  * process was interrupted:
146  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
147  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
148  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
149  *
150  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
151  *
152  * @deprecated Please use SCIPsolveConcurrent() instead.
153  */
156  SCIP* scip /**< SCIP data structure */
157  );
158 
159 /** transforms, presolves, and solves problem using additional solvers which emphasize on
160  * finding solutions.
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_PROBLEM
167  * - \ref SCIP_STAGE_TRANSFORMED
168  * - \ref SCIP_STAGE_PRESOLVING
169  * - \ref SCIP_STAGE_PRESOLVED
170  * - \ref SCIP_STAGE_SOLVING
171  * - \ref SCIP_STAGE_SOLVED
172  *
173  * @post After calling this method \SCIP reaches one of the following stages depending on if and when the solution
174  * process was interrupted:
175  * - \ref SCIP_STAGE_PRESOLVING if the solution process was interrupted during presolving
176  * - \ref SCIP_STAGE_SOLVING if the solution process was interrupted during the tree search
177  * - \ref SCIP_STAGE_SOLVED if the solving process was not interrupted
178  *
179  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
180  */
183  SCIP* scip /**< SCIP data structure */
184  );
185 
186 /** frees branch and bound tree and all solution process data; statistics, presolving data and transformed problem is
187  * preserved
188  *
189  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
190  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
191  *
192  * @pre This method can be called if @p scip is in one of the following stages:
193  * - \ref SCIP_STAGE_INIT
194  * - \ref SCIP_STAGE_PROBLEM
195  * - \ref SCIP_STAGE_TRANSFORMED
196  * - \ref SCIP_STAGE_PRESOLVING
197  * - \ref SCIP_STAGE_PRESOLVED
198  * - \ref SCIP_STAGE_SOLVING
199  * - \ref SCIP_STAGE_SOLVED
200  *
201  * @post If this method is called in \SCIP stage \ref SCIP_STAGE_INIT or \ref SCIP_STAGE_PROBLEM, the stage of
202  * \SCIP is not changed; otherwise, the \SCIP stage is changed to \ref SCIP_STAGE_TRANSFORMED
203  *
204  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
205  */
208  SCIP* scip, /**< SCIP data structure */
209  SCIP_Bool restart /**< should certain data be preserved for improved restarting? */
210  );
211 
212 /** frees branch and bound tree and all solution process data; statistics, presolving data and transformed problem is
213  * preserved
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  * @pre This method can be called if @p scip is in one of the following stages:
219  * - \ref SCIP_STAGE_INIT
220  * - \ref SCIP_STAGE_PROBLEM
221  * - \ref SCIP_STAGE_TRANSFORMED
222  * - \ref SCIP_STAGE_PRESOLVING
223  * - \ref SCIP_STAGE_PRESOLVED
224  * - \ref SCIP_STAGE_SOLVING
225  * - \ref SCIP_STAGE_SOLVED
226  *
227  * @post If this method is called in \SCIP stage \ref SCIP_STAGE_INIT or \ref SCIP_STAGE_PROBLEM, the stage of
228  * \SCIP is not changed; otherwise, the \SCIP stage is changed to \ref SCIP_STAGE_PRESOLVED.
229  *
230  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
231  */
234  SCIP* scip /**< SCIP data structure */
235  );
236 
237 /** frees all solution process data including presolving and transformed problem, only original problem is kept
238  *
239  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
240  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
241  *
242  * @pre This method can be called if @p scip is in one of the following stages:
243  * - \ref SCIP_STAGE_INIT
244  * - \ref SCIP_STAGE_PROBLEM
245  * - \ref SCIP_STAGE_TRANSFORMED
246  * - \ref SCIP_STAGE_PRESOLVING
247  * - \ref SCIP_STAGE_PRESOLVED
248  * - \ref SCIP_STAGE_SOLVING
249  * - \ref SCIP_STAGE_SOLVED
250  *
251  * @post After calling this method \SCIP reaches one of the following stages:
252  * - \ref SCIP_STAGE_INIT if the method was called from \SCIP stage \ref SCIP_STAGE_INIT
253  * - \ref SCIP_STAGE_PROBLEM if the method was called from any other of the allowed stages
254  *
255  * See \ref SCIP_Stage "SCIP_STAGE" for a complete list of all possible solving stages.
256  */
259  SCIP* scip /**< SCIP data structure */
260  );
261 
262 /** informs \SCIP that the solving process should be interrupted as soon as possible (e.g., after the current node has
263  * been solved)
264  *
265  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
266  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
267  *
268  * @pre This method can be called if @p scip is in one of the following stages:
269  * - \ref SCIP_STAGE_PROBLEM
270  * - \ref SCIP_STAGE_TRANSFORMING
271  * - \ref SCIP_STAGE_TRANSFORMED
272  * - \ref SCIP_STAGE_INITPRESOLVE
273  * - \ref SCIP_STAGE_PRESOLVING
274  * - \ref SCIP_STAGE_EXITPRESOLVE
275  * - \ref SCIP_STAGE_PRESOLVED
276  * - \ref SCIP_STAGE_SOLVING
277  * - \ref SCIP_STAGE_SOLVED
278  * - \ref SCIP_STAGE_EXITSOLVE
279  * - \ref SCIP_STAGE_FREETRANS
280  *
281  * @note the \SCIP stage does not get changed
282  */
285  SCIP* scip /**< SCIP data structure */
286  );
287 
288 /** informs SCIP that the solving process should be restarted as soon as possible (e.g., after the current node has
289  * been solved)
290  *
291  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
292  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
293  *
294  * @pre This method can be called if @p scip is in one of the following stages:
295  * - \ref SCIP_STAGE_INITPRESOLVE
296  * - \ref SCIP_STAGE_PRESOLVING
297  * - \ref SCIP_STAGE_EXITPRESOLVE
298  * - \ref SCIP_STAGE_SOLVING
299  *
300  * @note the \SCIP stage does not get changed
301  */
304  SCIP* scip /**< SCIP data structure */
305  );
306 
307 /** include specific heuristics and branching rules for reoptimization
308  *
309  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
310  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
311  *
312  * @pre This method can be called if @p scip is in one of the following stages:
313  * - \ref SCIP_STAGE_PROBLEM
314  */
317  SCIP* scip, /**< SCIP data structure */
318  SCIP_Bool enable /**< enable reoptimization (TRUE) or disable it (FALSE) */
319  );
320 
321 /** returns whether reoptimization is enabled or not */
324  SCIP* scip /**< SCIP data structure */
325  );
326 
327 /** returns the stored solutions corresponding to a given run */
330  SCIP* scip, /**< SCIP data structue */
331  int run, /**< number of the run */
332  SCIP_SOL** sols, /**< array to store solutions */
333  int allocmem, /**< allocated size of the array */
334  int* nsols /**< number of solutions */
335  );
336 
337 /** mark all stored solutions as not updated */
340  SCIP* scip /**< SCIP data structure */
341  );
342 
343 /** check if the reoptimization process should be restarted
344  *
345  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
346  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
347  *
348  * @pre This method can be called if @p scip is in one of the following stages:
349  * - \ref SCIP_STAGE_TRANSFORMED
350  * - \ref SCIP_STAGE_SOLVING
351  */
354  SCIP* scip, /**< SCIP data structure */
355  SCIP_NODE* node, /**< current node of the branch and bound tree (or NULL) */
356  SCIP_Bool* restart /**< pointer to store of the reoptimitation process should be restarted */
357  );
358 
359 /** save bound change based on dual information in the reoptimization tree
360  *
361  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
362  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
363  *
364  * @pre This method can be called if @p scip is in one of the following stages:
365  * - \ref SCIP_STAGE_SOLVING
366  * - \ref SCIP_STAGE_SOLVED
367  */
370  SCIP* scip, /**< SCIP data structure */
371  SCIP_NODE* node, /**< node of the search tree */
372  SCIP_VAR* var, /**< variable whose bound changed */
373  SCIP_Real newbound, /**< new bound of the variable */
374  SCIP_Real oldbound /**< old bound of the variable */
375  );
376 
377 /** returns the optimal solution of the last iteration or NULL of none exists */
380  SCIP* scip /**< SCIP data structure */
381  );
382 
383 /** returns the objective coefficent of a given variable in a previous iteration
384  *
385  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
386  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
387  *
388  * @pre This method can be called if @p scip is in one of the following stages:
389  * - \ref SCIP_STAGE_PRESOLVING
390  * - \ref SCIP_STAGE_SOLVING
391  */
394  SCIP* scip, /**< SCIP data structure */
395  SCIP_VAR* var, /**< variable */
396  int run, /**< number of the run */
397  SCIP_Real* objcoef /**< pointer to store the objective coefficient */
398  );
399 
400 /** returns whether we are in the restarting phase
401  *
402  * @return TRUE, if we are in the restarting phase; FALSE, otherwise
403  *
404  * @pre This method can be called if @p scip is in one of the following stages:
405  * - \ref SCIP_STAGE_INITPRESOLVE
406  * - \ref SCIP_STAGE_PRESOLVING
407  * - \ref SCIP_STAGE_EXITPRESOLVE
408  * - \ref SCIP_STAGE_PRESOLVED
409  * - \ref SCIP_STAGE_INITSOLVE
410  * - \ref SCIP_STAGE_SOLVING
411  * - \ref SCIP_STAGE_SOLVED
412  * - \ref SCIP_STAGE_EXITSOLVE
413  * - \ref SCIP_STAGE_FREETRANS
414  */
417  SCIP* scip /**< SCIP data structure */
418  );
419 
420 /**@} */
421 
422 #ifdef __cplusplus
423 }
424 #endif
425 
426 #endif
SCIP_EXPORT void SCIPresetReoptSolMarks(SCIP *scip)
Definition: scip_solve.c:3482
SCIP_EXPORT SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3407
SCIP_EXPORT SCIP_Bool SCIPisReoptEnabled(SCIP *scip)
Definition: scip_solve.c:3446
SCIP_EXPORT SCIP_RETCODE SCIPfreeSolve(SCIP *scip, SCIP_Bool restart)
Definition: scip_solve.c:3199
SCIP_EXPORT SCIP_RETCODE SCIPcheckReoptRestart(SCIP *scip, SCIP_NODE *node, SCIP_Bool *restart)
Definition: scip_solve.c:3506
SCIP_EXPORT SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip_solve.c:357
#define SCIP_EXPORT
Definition: def.h:100
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_EXPORT SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2527
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_RETCODE SCIPfreeReoptSolve(SCIP *scip)
Definition: scip_solve.c:3266
SCIP_EXPORT SCIP_RETCODE SCIPaddReoptDualBndchg(SCIP *scip, SCIP_NODE *node, SCIP_VAR *var, SCIP_Real newbound, SCIP_Real oldbound)
Definition: scip_solve.c:3098
SCIP_EXPORT SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip_solve.c:2366
SCIP_EXPORT SCIP_RETCODE SCIPenableReoptimization(SCIP *scip, SCIP_Bool enable)
Definition: scip_solve.c:3028
SCIP_EXPORT SCIP_Bool SCIPisInRestart(SCIP *scip)
Definition: scip_solve.c:3539
type definitions for SCIP&#39;s main datastructure
type definitions for problem variables
SCIP_EXPORT SCIP_SOL * SCIPgetReoptLastOptSol(SCIP *scip)
Definition: scip_solve.c:3116
#define SCIP_Bool
Definition: def.h:70
type definitions for branch and bound tree
type definitions for storing primal CIP solutions
SCIP_EXPORT SCIP_RETCODE SCIPsolveConcurrent(SCIP *scip)
Definition: scip_solve.c:2853
SCIP_EXPORT SCIP_RETCODE SCIPgetReoptOldObjCoef(SCIP *scip, SCIP_VAR *var, int run, SCIP_Real *objcoef)
Definition: scip_solve.c:3143
SCIP_EXPORT SCIP_RETCODE SCIPgetReoptSolsRun(SCIP *scip, int run, SCIP_SOL **sols, int allocmem, int *nsols)
Definition: scip_solve.c:3456
#define SCIP_Real
Definition: def.h:163
SCIP_EXPORT SCIP_RETCODE SCIPsolveParallel(SCIP *scip)
Definition: scip_solve.c:2823
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_RETCODE SCIPrestartSolve(SCIP *scip)
Definition: scip_solve.c:3433
SCIP_EXPORT SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip_solve.c:3329