Scippy

SCIP

Solving Constraint Integer Programs

scip_reopt.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_reopt.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for reoptimization
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_REOPT_H__
32 #define __SCIP_SCIP_REOPT_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_lp.h"
37 #include "scip/type_reopt.h"
38 #include "scip/type_retcode.h"
39 #include "scip/type_scip.h"
40 #include "scip/type_tree.h"
41 #include "scip/type_var.h"
42 
43 /* In debug mode, we include the SCIP's structure in scip.c, such that no one can access
44  * this structure except the interface methods in scip.c.
45  * In optimized mode, the structure is included in scip.h, because some of the methods
46  * are implemented as defines for performance reasons (e.g. the numerical comparisons).
47  * Additionally, the internal "set.h" is included, such that the defines in set.h are
48  * available in optimized mode.
49  */
50 #ifdef NDEBUG
51 #include "scip/struct_scip.h"
52 #include "scip/struct_stat.h"
53 #include "scip/set.h"
54 #include "scip/tree.h"
55 #include "scip/misc.h"
56 #include "scip/var.h"
57 #include "scip/cons.h"
58 #include "scip/solve.h"
59 #include "scip/debug.h"
60 #endif
61 
62 #ifdef __cplusplus
63 extern "C" {
64 #endif
65 
66 /**@addtogroup PublicReoptimizationMethods
67  *
68  * @{
69  */
70 
71 /** return the ids of child nodes stored in the reoptimization tree
72  *
73  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
74  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
75  *
76  * @pre This method can be called if @p scip is in one of the following stages:
77  * - \ref SCIP_STAGE_PRESOLVED
78  * - \ref SCIP_STAGE_SOLVING
79  * - \ref SCIP_STAGE_SOLVED
80  */
81 extern
83  SCIP* scip, /**< SCIP data structure */
84  SCIP_NODE* node, /**< node of the search tree */
85  unsigned int* ids, /**< array to store the ids of child nodes */
86  int mem, /**< allocated memory */
87  int* nids /**< number of child nodes */
88  );
89 
90 /** return the ids of all leave nodes store in the reoptimization tree induced by the given node
91  *
92  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
93  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
94  *
95  * @pre This method can be called if @p scip is in one of the following stages:
96  * - \ref SCIP_STAGE_PRESOLVED
97  * - \ref SCIP_STAGE_SOLVING
98  * - \ref SCIP_STAGE_SOLVED
99  */
100 extern
102  SCIP* scip, /**< SCIP data strcuture */
103  SCIP_NODE* node, /**< node of the search tree */
104  unsigned int* ids, /**< array of ids */
105  int mem, /**< allocated memory */
106  int* nids /**< number of child nodes */
107  );
108 
109 /** returns the number of nodes in the reoptimization tree induced by @p node; if @p node == NULL, the method
110  * returns the number of nodes of the whole reoptimization tree.
111  */
112 extern
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_NODE* node /**< node of the search tree */
116  );
117 
118 /** returns the number of leave nodes of the subtree induced by @p node; if @p node == NULL, the method
119  * returns the number of leaf nodes of the whole reoptimization tree.
120  */
121 extern
123  SCIP* scip, /**< SCIP data structure */
124  SCIP_NODE* node /**< node of the search tree */
125  );
126 
127 /** gets the node of the reoptimization tree corresponding to the unique @p id */
129  SCIP* scip, /**< SCIP data structure */
130  unsigned int id /**< unique id */
131  );
132 
133 /** add a variable bound change to a given reoptnode
134  *
135  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
136  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
137  *
138  * @pre This method can be called if @p scip is in one of the following stages:
139  * - \ref SCIP_STAGE_PRESOLVED
140  * - \ref SCIP_STAGE_SOLVING
141  * - \ref SCIP_STAGE_SOLVED
142  */
143 extern
145  SCIP* scip, /**< SCIP data structure */
146  SCIP_REOPTNODE* reoptnode, /**< node of the reoptimization tree */
147  SCIP_VAR* var, /**< variable pointer */
148  SCIP_Real bound, /**< variable bound to add */
149  SCIP_BOUNDTYPE boundtype /**< bound type of the variable value */
150  );
151 
152 /** set the @p representation as the new search frontier
153  *
154  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
155  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
156  *
157  * @pre This method can be called if @p scip is in one of the following stages:
158  * - \ref SCIP_STAGE_PRESOLVED
159  */
160 extern
162  SCIP* scip, /**< SCIP data structure */
163  SCIP_REOPTNODE** representation, /**< array of representatives */
164  int nrepresentatives, /**< number of representatives */
165  SCIP_Bool* success /**< pointer to store the result */
166  );
167 
168 /** add stored constraint to a reoptimization node
169  *
170  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
171  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
172  *
173  * @pre This method can be called if @p scip is in one of the following stages:
174  * - \ref SCIP_STAGE_PRESOLVED
175  */
176 extern
178  SCIP* scip, /**< SCIP data structure */
179  SCIP_REOPTNODE* reoptnode, /**< node of the reoptimization tree */
180  SCIP_VAR** vars, /**< array of variables */
181  SCIP_Real* vals, /**< array of variable bounds */
182  SCIP_BOUNDTYPE* boundtypes, /**< array of variable boundtypes */
183  SCIP_Real lhs, /**< lhs of the constraint */
184  SCIP_Real rhs, /**< rhs of the constraint */
185  int nvars, /**< number of variables */
186  REOPT_CONSTYPE constype, /**< type of the constraint */
187  SCIP_Bool linear /**< the given constraint has a linear representation */
188  );
189 
190 /** return the branching path stored in the reoptree at ID id */
191 extern
193  SCIP* scip, /**< SCIP data structure */
194  SCIP_REOPTNODE* reoptnode, /**< node of the reoptimization tree */
195  SCIP_VAR** vars, /**< array of variables */
196  SCIP_Real* vals, /**< array of variable bounds */
197  SCIP_BOUNDTYPE* boundtypes, /**< array of bound types */
198  int mem, /**< allocated memory */
199  int* nvars, /**< number of variables */
200  int* nafterdualvars /**< number of variables directly after the first based on dual information */
201  );
202 
203 /** initialize a set of empty reoptimization nodes
204  *
205  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
206  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
207  *
208  * @pre This method can be called if @p scip is in one of the following stages:
209  * - \ref SCIP_STAGE_PRESOLVED
210  */
211 extern
213  SCIP* scip, /**< SCIP data structure */
214  SCIP_REOPTNODE** representatives, /**< array of representatives */
215  int nrepresentatives /**< number of representatives */
216  );
217 
218 /** reset a set of initialized reoptimization nodes
219  *
220  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
221  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
222  *
223  * @pre This method can be called if @p scip is in one of the following stages:
224  * - \ref SCIP_STAGE_PRESOLVED
225  */
227  SCIP* scip, /**< SCIP data structure */
228  SCIP_REOPTNODE** representatives, /**< array of representatives */
229  int nrepresentatives /**< number of representatives */
230  );
231 
232 /** free a set of initialized reoptimization nodes
233  *
234  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
235  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
236  *
237  * @pre This method can be called if @p scip is in one of the following stages:
238  * - \ref SCIP_STAGE_PRESOLVED
239  */
240 extern
242  SCIP* scip, /**< SCIP data structure */
243  SCIP_REOPTNODE** representatives, /**< array of representatives */
244  int nrepresentatives /**< number of representatives */
245  );
246 
247 /** reactivate the given @p reoptnode and split them into several nodes if necessary
248  *
249  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
250  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
251  *
252  * @pre This method can be called if @p scip is in one of the following stages:
253  * - \ref SCIP_STAGE_SOLVING
254  * - \ref SCIP_STAGE_SOLVED
255  */
256 extern
258  SCIP* scip, /**< SCIP data structure */
259  SCIP_REOPTNODE* reoptnode, /**< node to reactivate */
260  unsigned int id, /**< unique id of the reoptimization node */
261  SCIP_Real estimate, /**< estimate of the child nodes that should be created */
262  SCIP_NODE** childnodes, /**< array to store the created child nodes */
263  int* ncreatedchilds, /**< pointer to store number of created child nodes */
264  int* naddedconss, /**< pointer to store number of generated constraints */
265  int childnodessize, /**< available size of childnodes array */
266  SCIP_Bool* success /**< pointer store the result*/
267  );
268 
269 /** remove the stored information about bound changes based in dual information
270  *
271  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
272  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
273  *
274  * @pre This method can be called if @p scip is in one of the following stages:
275  * - \ref SCIP_STAGE_SOLVING
276  * - \ref SCIP_STAGE_SOLVED
277  */
278 extern
280  SCIP* scip, /**< SCIP data structure */
281  SCIP_NODE* node /**< node of the search tree */
282  );
283 
284 /** splits the root into several nodes and moves the child nodes of the root to one of the created nodes
285  *
286  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
287  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
288  *
289  * @pre This method can be called if @p scip is in one of the following stages:
290  * - \ref SCIP_STAGE_TRANSFORMED
291  * - \ref SCIP_STAGE_SOLVING
292  */
293 extern
295  SCIP* scip, /**< SCIP data structure */
296  int* ncreatedchilds, /**< pointer to store the number of created nodes */
297  int* naddedconss /**< pointer to store the number added constraints */
298  );
299 
300 /** returns if a node should be reoptimized */
301 extern
303  SCIP* scip, /**< SCIP data structure */
304  SCIP_NODE* node /**< node of the search tree */
305  );
306 
307 /** deletes the given reoptimization node
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_SOLVING
314  */
315 extern
317  SCIP* scip, /**< SCIP data structure */
318  SCIP_REOPTNODE** reoptnode /**< node of the reoptimization tree */
319  );
320 
321 /** return the similarity between two objective functions */
322 extern
324  SCIP* scip, /**< SCIP data structure */
325  int run1, /**< number of run */
326  int run2 /**< number of run */
327  );
328 
329 /** check the changes of the variable coefficient in the objective function */
330 extern
331 void SCIPgetVarCoefChg(
332  SCIP* scip, /**< SCIP data structure */
333  int varidx, /**< index of variable */
334  SCIP_Bool* negated, /**< coefficient changed the sign */
335  SCIP_Bool* entering, /**< coefficient gets non-zero coefficient */
336  SCIP_Bool* leaving /**< coefficient gets zero coefficient */
337  );
338 
339 /* @} */
340 
341 #ifdef __cplusplus
342 }
343 #endif
344 
345 #endif
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
internal methods for branch and bound tree
static long bound
SCIP_Bool SCIPreoptimizeNode(SCIP *scip, SCIP_NODE *node)
Definition: scip_reopt.c:492
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
int SCIPgetNReoptnodes(SCIP *scip, SCIP_NODE *node)
Definition: scip_reopt.c:194
SCIP_RETCODE SCIPinitRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip_reopt.c:357
type definitions for return codes for SCIP methods
type definitions for collecting reoptimization information
SCIP_RETCODE SCIPdeleteReoptnode(SCIP *scip, SCIP_REOPTNODE **reoptnode)
Definition: scip_reopt.c:532
type definitions for LP management
SCIP_RETCODE SCIPfreeRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip_reopt.c:416
SCIP_RETCODE SCIPsetReoptCompression(SCIP *scip, SCIP_REOPTNODE **representation, int nrepresentatives, SCIP_Bool *success)
Definition: scip_reopt.c:272
SCIP_RETCODE SCIPgetReoptChildIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int mem, int *nids)
Definition: scip_reopt.c:137
type definitions for SCIP&#39;s main datastructure
internal miscellaneous methods
internal methods for global SCIP settings
SCIP main data structure.
type definitions for problem variables
internal methods for problem variables
SCIP_RETCODE SCIPresetReoptnodeDualcons(SCIP *scip, SCIP_NODE *node)
Definition: scip_reopt.c:584
#define SCIP_Bool
Definition: def.h:62
SCIP_RETCODE SCIPaddReoptnodeCons(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR **vars, SCIP_Real *vals, SCIP_BOUNDTYPE *boundtypes, SCIP_Real lhs, SCIP_Real rhs, int nvars, REOPT_CONSTYPE constype, SCIP_Bool linear)
Definition: scip_reopt.c:300
methods for debugging
SCIP_RETCODE SCIPaddReoptnodeBndchg(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR *var, SCIP_Real bound, SCIP_BOUNDTYPE boundtype)
Definition: scip_reopt.c:244
SCIP_Real SCIPgetReoptSimilarity(SCIP *scip, int run1, int run2)
Definition: scip_reopt.c:475
type definitions for branch and bound tree
void SCIPgetReoptnodePath(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR **vars, SCIP_Real *vals, SCIP_BOUNDTYPE *boundtypes, int mem, int *nvars, int *nafterdualvars)
Definition: scip_reopt.c:328
datastructures for problem statistics
internal methods for main solving loop and node processing
SCIP_RETCODE SCIPsplitReoptRoot(SCIP *scip, int *ncreatedchilds, int *naddedconss)
Definition: scip_reopt.c:557
SCIP_RETCODE SCIPapplyReopt(SCIP *scip, SCIP_REOPTNODE *reoptnode, unsigned int id, SCIP_Real estimate, SCIP_NODE **childnodes, int *ncreatedchilds, int *naddedconss, int childnodessize, SCIP_Bool *success)
Definition: scip_reopt.c:450
#define SCIP_Real
Definition: def.h:150
SCIP_RETCODE SCIPgetReoptLeaveIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int mem, int *nids)
Definition: scip_reopt.c:169
internal methods for constraints and constraint handlers
void SCIPgetVarCoefChg(SCIP *scip, int varidx, SCIP_Bool *negated, SCIP_Bool *entering, SCIP_Bool *leaving)
enum Reopt_ConsType REOPT_CONSTYPE
Definition: type_reopt.h:67
common defines and data types used in all packages of SCIP
SCIP_REOPTNODE * SCIPgetReoptnode(SCIP *scip, unsigned int id)
Definition: scip_reopt.c:222
int SCIPgetNReoptLeaves(SCIP *scip, SCIP_NODE *node)
Definition: scip_reopt.c:209
SCIP_RETCODE SCIPresetRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip_reopt.c:387