Scippy

SCIP

Solving Constraint Integer Programs

nodesel.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-2014 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file nodesel.h
17  * @brief internal methods for node selectors and node priority queues
18  * @author Tobias Achterberg
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __SCIP_NODESEL_H__
24 #define __SCIP_NODESEL_H__
25 
26 
27 #include "scip/def.h"
28 #include "blockmemshell/memory.h"
29 #include "scip/type_retcode.h"
30 #include "scip/type_set.h"
31 #include "scip/type_stat.h"
32 #include "scip/type_lp.h"
33 #include "scip/type_tree.h"
34 #include "scip/pub_nodesel.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /*
41  * node priority queue methods
42  */
43 
44 /** creates node priority queue */
45 extern
47  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
48  SCIP_SET* set, /**< global SCIP settings */
49  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
50  );
51 
52 /** frees node priority queue, but not the data nodes themselves */
53 extern
55  SCIP_NODEPQ** nodepq /**< pointer to a node priority queue */
56  );
57 
58 /** frees node priority queue and all nodes in the queue */
59 extern
61  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
62  BMS_BLKMEM* blkmem, /**< block memory buffers */
63  SCIP_SET* set, /**< global SCIP settings */
64  SCIP_STAT* stat, /**< problem statistics */
65  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
66  SCIP_TREE* tree, /**< branch and bound tree */
67  SCIP_LP* lp /**< current LP data */
68  );
69 
70 /** deletes all nodes in the node priority queue */
71 extern
73  SCIP_NODEPQ* nodepq, /**< node priority queue */
74  BMS_BLKMEM* blkmem, /**< block memory buffers */
75  SCIP_SET* set, /**< global SCIP settings */
76  SCIP_STAT* stat, /**< problem statistics */
77  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
78  SCIP_TREE* tree, /**< branch and bound tree */
79  SCIP_LP* lp /**< current LP data */
80  );
81 
82 /** returns the node selector associated with the given node priority queue */
83 extern
85  SCIP_NODEPQ* nodepq /**< node priority queue */
86  );
87 
88 /** sets the node selector used for sorting the nodes in the queue, and resorts the queue if necessary */
89 extern
91  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
92  SCIP_SET* set, /**< global SCIP settings */
93  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
94  );
95 
96 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
97 extern
99  SCIP_NODEPQ* nodepq, /**< node priority queue */
100  SCIP_SET* set, /**< global SCIP settings */
101  SCIP_NODE* node1, /**< first node to compare */
102  SCIP_NODE* node2 /**< second node to compare */
103  );
104 
105 /** inserts node into node priority queue */
106 extern
108  SCIP_NODEPQ* nodepq, /**< node priority queue */
109  SCIP_SET* set, /**< global SCIP settings */
110  SCIP_NODE* node /**< node to be inserted */
111  );
112 
113 /** removes node from the node priority queue */
114 extern
116  SCIP_NODEPQ* nodepq, /**< node priority queue */
117  SCIP_SET* set, /**< global SCIP settings */
118  SCIP_NODE* node /**< node to remove */
119  );
120 
121 /** returns the best node of the queue without removing it */
122 extern
124  const SCIP_NODEPQ* nodepq /**< node priority queue */
125  );
126 
127 /** returns the nodes array of the queue */
128 extern
130  const SCIP_NODEPQ* nodepq /**< node priority queue */
131  );
132 
133 /** returns the number of nodes stored in the node priority queue */
134 extern
135 int SCIPnodepqLen(
136  const SCIP_NODEPQ* nodepq /**< node priority queue */
137  );
138 
139 /** gets the minimal lower bound of all nodes in the queue */
140 extern
142  SCIP_NODEPQ* nodepq, /**< node priority queue */
143  SCIP_SET* set /**< global SCIP settings */
144  );
145 
146 /** gets the node with minimal lower bound of all nodes in the queue */
147 extern
149  SCIP_NODEPQ* nodepq, /**< node priority queue */
150  SCIP_SET* set /**< global SCIP settings */
151  );
152 
153 /** gets the sum of lower bounds of all nodes in the queue */
154 extern
156  SCIP_NODEPQ* nodepq /**< node priority queue */
157  );
158 
159 /** free all nodes from the queue that are cut off by the given upper bound */
160 extern
162  SCIP_NODEPQ* nodepq, /**< node priority queue */
163  BMS_BLKMEM* blkmem, /**< block memory buffer */
164  SCIP_SET* set, /**< global SCIP settings */
165  SCIP_STAT* stat, /**< dynamic problem statistics */
166  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
167  SCIP_TREE* tree, /**< branch and bound tree */
168  SCIP_LP* lp, /**< current LP data */
169  SCIP_Real cutoffbound /**< cutoff bound: all nodes with lowerbound >= cutoffbound are cut off */
170  );
171 
172 
173 
174 
175 /*
176  * node selector methods
177  */
178 
179 /** copies the given node selector to a new scip */
180 extern
182  SCIP_NODESEL* nodesel, /**< node selector */
183  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
184  );
185 
186 /** creates a node selector */
187 extern
189  SCIP_NODESEL** nodesel, /**< pointer to store node selector */
190  SCIP_SET* set, /**< global SCIP settings */
191  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
192  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
193  const char* name, /**< name of node selector */
194  const char* desc, /**< description of node selector */
195  int stdpriority, /**< priority of the node selector in standard mode */
196  int memsavepriority, /**< priority of the node selector in memory saving mode */
197  SCIP_DECL_NODESELCOPY ((*nodeselcopy)), /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
198  SCIP_DECL_NODESELFREE ((*nodeselfree)), /**< destructor of node selector */
199  SCIP_DECL_NODESELINIT ((*nodeselinit)), /**< initialize node selector */
200  SCIP_DECL_NODESELEXIT ((*nodeselexit)), /**< deinitialize node selector */
201  SCIP_DECL_NODESELINITSOL((*nodeselinitsol)),/**< solving process initialization method of node selector */
202  SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)),/**< solving process deinitialization method of node selector */
203  SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
204  SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
205  SCIP_NODESELDATA* nodeseldata /**< node selector data */
206  );
207 
208 /** frees memory of node selector */
209 extern
211  SCIP_NODESEL** nodesel, /**< pointer to node selector data structure */
212  SCIP_SET* set /**< global SCIP settings */
213  );
214 
215 /** initializes node selector */
216 extern
218  SCIP_NODESEL* nodesel, /**< node selector */
219  SCIP_SET* set /**< global SCIP settings */
220  );
221 
222 /** deinitializes node selector */
223 extern
225  SCIP_NODESEL* nodesel, /**< node selector */
226  SCIP_SET* set /**< global SCIP settings */
227  );
228 
229 /** informs node selector that the branch and bound process is being started */
230 extern
232  SCIP_NODESEL* nodesel, /**< node selector */
233  SCIP_SET* set /**< global SCIP settings */
234  );
235 
236 /** informs node selector that the branch and bound process data is being freed */
237 extern
239  SCIP_NODESEL* nodesel, /**< node selector */
240  SCIP_SET* set /**< global SCIP settings */
241  );
242 
243 /** select next node to be processed */
244 extern
246  SCIP_NODESEL* nodesel, /**< node selector */
247  SCIP_SET* set, /**< global SCIP settings */
248  SCIP_NODE** selnode /**< pointer to store node to be processed next */
249  );
250 
251 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
252 extern
254  SCIP_NODESEL* nodesel, /**< node selector */
255  SCIP_SET* set, /**< global SCIP settings */
256  SCIP_NODE* node1, /**< first node to compare */
257  SCIP_NODE* node2 /**< second node to compare */
258  );
259 
260 /** sets priority of node selector in standard mode */
261 extern
263  SCIP_NODESEL* nodesel, /**< node selector */
264  SCIP_SET* set, /**< global SCIP settings */
265  int priority /**< new priority of the node selector */
266  );
267 
268 /** sets priority of node selector in memory saving mode */
269 extern
271  SCIP_NODESEL* nodesel, /**< node selector */
272  SCIP_SET* set, /**< global SCIP settings */
273  int priority /**< new priority of the node selector */
274  );
275 
276 /** sets copy method of node selector */
277 extern
278 void SCIPnodeselSetCopy(
279  SCIP_NODESEL* nodesel, /**< node selector */
280  SCIP_DECL_NODESELCOPY ((*nodeselcopy)) /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
281  );
282 
283 /** sets destructor method of node selector */
284 extern
285 void SCIPnodeselSetFree(
286  SCIP_NODESEL* nodesel, /**< node selector */
287  SCIP_DECL_NODESELFREE ((*nodeselfree)) /**< destructor of node selector */
288  );
289 
290 /** sets initialization method of node selector */
291 extern
292 void SCIPnodeselSetInit(
293  SCIP_NODESEL* nodesel, /**< node selector */
294  SCIP_DECL_NODESELINIT ((*nodeselinit)) /**< initialize node selector */
295  );
296 
297 /** sets deinitialization method of node selector */
298 extern
299 void SCIPnodeselSetExit(
300  SCIP_NODESEL* nodesel, /**< node selector */
301  SCIP_DECL_NODESELEXIT ((*nodeselexit)) /**< deinitialize node selector */
302  );
303 
304 /** sets solving process initialization method of node selector */
305 extern
307  SCIP_NODESEL* nodesel, /**< node selector */
308  SCIP_DECL_NODESELINITSOL ((*nodeselinitsol))/**< solving process initialization method of node selector */
309  );
310 
311 /** sets solving process deinitialization method of node selector */
312 extern
314  SCIP_NODESEL* nodesel, /**< node selector */
315  SCIP_DECL_NODESELEXITSOL ((*nodeselexitsol))/**< solving process deinitialization method of node selector */
316  );
317 
318 
319 #ifdef __cplusplus
320 }
321 #endif
322 
323 #endif
324