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 /** enables or disables all clocks of \p nodesel, depending on the value of the flag */
319 extern
321  SCIP_NODESEL* nodesel, /**< the node selector for which all clocks should be enabled or disabled */
322  SCIP_Bool enable /**< should the clocks of the node selector be enabled? */
323  );
324 
325 #ifdef __cplusplus
326 }
327 #endif
328 
329 #endif
void SCIPnodeselSetInit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINIT((*nodeselinit)))
Definition: nodesel.c:1095
#define SCIP_DECL_NODESELCOMP(x)
Definition: type_nodesel.h:126
void SCIPnodeselEnableOrDisableClocks(SCIP_NODESEL *nodesel, SCIP_Bool enable)
Definition: nodesel.c:1149
int SCIPnodepqCompare(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
Definition: nodesel.c:242
int SCIPnodepqLen(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:549
#define SCIP_DECL_NODESELINITSOL(x)
Definition: type_nodesel.h:83
SCIP_Real SCIPnodepqGetLowerboundSum(SCIP_NODEPQ *nodepq)
Definition: nodesel.c:607
SCIP_NODESEL * SCIPnodepqGetNodesel(SCIP_NODEPQ *nodepq)
Definition: nodesel.c:192
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
type definitions for global SCIP settings
SCIP_RETCODE SCIPnodeselExitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:918
SCIP_NODE * SCIPnodepqGetLowerboundNode(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:583
type definitions for return codes for SCIP methods
#define SCIP_DECL_NODESELEXITSOL(x)
Definition: type_nodesel.h:94
type definitions for problem statistics
SCIP_RETCODE SCIPnodeselCopyInclude(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:717
#define SCIP_DECL_NODESELINIT(x)
Definition: type_nodesel.h:64
SCIP_RETCODE SCIPnodeselExit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:864
type definitions for LP management
SCIP_RETCODE SCIPnodeselSelect(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE **selnode)
Definition: nodesel.c:942
struct SCIP_NodeselData SCIP_NODESELDATA
Definition: type_nodesel.h:38
SCIP_RETCODE SCIPnodeselFree(SCIP_NODESEL **nodesel, SCIP_SET *set)
Definition: nodesel.c:800
SCIP_RETCODE SCIPnodepqInsert(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
Definition: nodesel.c:258
SCIP_RETCODE SCIPnodeselInitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:894
SCIP_RETCODE SCIPnodeselInit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:828
SCIP_RETCODE SCIPnodepqSetNodesel(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: nodesel.c:202
#define SCIP_DECL_NODESELFREE(x)
Definition: type_nodesel.h:56
SCIP_RETCODE SCIPnodepqRemove(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
Definition: nodesel.c:502
public methods for node selectors
void SCIPnodeselSetExit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXIT((*nodeselexit)))
Definition: nodesel.c:1106
SCIP_RETCODE SCIPnodepqFree(SCIP_NODEPQ **nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_TREE *tree, SCIP_LP *lp)
Definition: nodesel.c:129
#define SCIP_Bool
Definition: def.h:49
#define SCIP_DECL_NODESELEXIT(x)
Definition: type_nodesel.h:72
int SCIPnodeselCompare(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
Definition: nodesel.c:965
type definitions for branch and bound tree
void SCIPnodeselSetInitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINITSOL((*nodeselinitsol)))
Definition: nodesel.c:1117
SCIP_RETCODE SCIPnodepqClear(SCIP_NODEPQ *nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_TREE *tree, SCIP_LP *lp)
Definition: nodesel.c:152
void SCIPnodeselSetMemsavePriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
Definition: nodesel.c:1036
void SCIPnodeselSetExitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)))
Definition: nodesel.c:1128
SCIP_RETCODE SCIPnodeselCreate(SCIP_NODESEL **nodesel, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int stdpriority, int memsavepriority, SCIP_DECL_NODESELCOPY((*nodeselcopy)), SCIP_DECL_NODESELFREE((*nodeselfree)), SCIP_DECL_NODESELINIT((*nodeselinit)), SCIP_DECL_NODESELEXIT((*nodeselexit)), SCIP_DECL_NODESELINITSOL((*nodeselinitsol)), SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)), SCIP_DECL_NODESELSELECT((*nodeselselect)), SCIP_DECL_NODESELCOMP((*nodeselcomp)), SCIP_NODESELDATA *nodeseldata)
Definition: nodesel.c:735
SCIP_RETCODE SCIPnodepqBound(SCIP_NODEPQ *nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_TREE *tree, SCIP_LP *lp, SCIP_Real cutoffbound)
Definition: nodesel.c:617
SCIP_RETCODE SCIPnodepqCreate(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: nodesel.c:94
#define SCIP_Real
Definition: def.h:123
void SCIPnodeselSetFree(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELFREE((*nodeselfree)))
Definition: nodesel.c:1084
#define SCIP_DECL_NODESELCOPY(x)
Definition: type_nodesel.h:47
SCIP_NODE * SCIPnodepqFirst(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:523
SCIP_Real SCIPnodepqGetLowerbound(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:560
BMS_BLKMEM * blkmem
Definition: nlpioracle.c:59
SCIP_NODE ** SCIPnodepqNodes(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:539
void SCIPnodeselSetCopy(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELCOPY((*nodeselcopy)))
Definition: nodesel.c:1073
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:371
void SCIPnodeselSetStdPriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
Definition: nodesel.c:1012
#define SCIP_DECL_NODESELSELECT(x)
Definition: type_nodesel.h:109
void SCIPnodepqDestroy(SCIP_NODEPQ **nodepq)
Definition: nodesel.c:115
memory allocation routines