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-2016 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/type_reopt.h"
35 #include "scip/pub_nodesel.h"
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /*
42  * node priority queue methods
43  */
44 
45 /** creates node priority queue */
46 extern
48  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
49  SCIP_SET* set, /**< global SCIP settings */
50  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
51  );
52 
53 /** frees node priority queue, but not the data nodes themselves */
54 extern
56  SCIP_NODEPQ** nodepq /**< pointer to a node priority queue */
57  );
58 
59 /** frees node priority queue and all nodes in the queue */
60 extern
62  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
63  BMS_BLKMEM* blkmem, /**< block memory buffers */
64  SCIP_SET* set, /**< global SCIP settings */
65  SCIP_STAT* stat, /**< problem statistics */
66  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
67  SCIP_TREE* tree, /**< branch and bound tree */
68  SCIP_LP* lp /**< current LP data */
69  );
70 
71 /** deletes all nodes in the node priority queue */
72 extern
74  SCIP_NODEPQ* nodepq, /**< node priority queue */
75  BMS_BLKMEM* blkmem, /**< block memory buffers */
76  SCIP_SET* set, /**< global SCIP settings */
77  SCIP_STAT* stat, /**< problem statistics */
78  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
79  SCIP_TREE* tree, /**< branch and bound tree */
80  SCIP_LP* lp /**< current LP data */
81  );
82 
83 /** returns the node selector associated with the given node priority queue */
84 extern
86  SCIP_NODEPQ* nodepq /**< node priority queue */
87  );
88 
89 /** sets the node selector used for sorting the nodes in the queue, and resorts the queue if necessary */
90 extern
92  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
93  SCIP_SET* set, /**< global SCIP settings */
94  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
95  );
96 
97 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
98 extern
100  SCIP_NODEPQ* nodepq, /**< node priority queue */
101  SCIP_SET* set, /**< global SCIP settings */
102  SCIP_NODE* node1, /**< first node to compare */
103  SCIP_NODE* node2 /**< second node to compare */
104  );
105 
106 /** inserts node into node priority queue */
107 extern
109  SCIP_NODEPQ* nodepq, /**< node priority queue */
110  SCIP_SET* set, /**< global SCIP settings */
111  SCIP_NODE* node /**< node to be inserted */
112  );
113 
114 /** removes node from the node priority queue */
115 extern
117  SCIP_NODEPQ* nodepq, /**< node priority queue */
118  SCIP_SET* set, /**< global SCIP settings */
119  SCIP_NODE* node /**< node to remove */
120  );
121 
122 /** returns the best node of the queue without removing it */
123 extern
125  const SCIP_NODEPQ* nodepq /**< node priority queue */
126  );
127 
128 /** returns the nodes array of the queue */
129 extern
131  const SCIP_NODEPQ* nodepq /**< node priority queue */
132  );
133 
134 /** returns the number of nodes stored in the node priority queue */
135 extern
136 int SCIPnodepqLen(
137  const SCIP_NODEPQ* nodepq /**< node priority queue */
138  );
139 
140 /** gets the minimal lower bound of all nodes in the queue */
141 extern
143  SCIP_NODEPQ* nodepq, /**< node priority queue */
144  SCIP_SET* set /**< global SCIP settings */
145  );
146 
147 /** gets the node with minimal lower bound of all nodes in the queue */
148 extern
150  SCIP_NODEPQ* nodepq, /**< node priority queue */
151  SCIP_SET* set /**< global SCIP settings */
152  );
153 
154 /** gets the sum of lower bounds of all nodes in the queue */
155 extern
157  SCIP_NODEPQ* nodepq /**< node priority queue */
158  );
159 
160 /** free all nodes from the queue that are cut off by the given upper bound */
161 extern
163  SCIP_NODEPQ* nodepq, /**< node priority queue */
164  BMS_BLKMEM* blkmem, /**< block memory buffer */
165  SCIP_SET* set, /**< global SCIP settings */
166  SCIP_STAT* stat, /**< dynamic problem statistics */
167  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
168  SCIP_TREE* tree, /**< branch and bound tree */
169  SCIP_REOPT* reopt, /**< reoptimization data structure */
170  SCIP_LP* lp, /**< current LP data */
171  SCIP_Real cutoffbound /**< cutoff bound: all nodes with lowerbound >= cutoffbound are cut off */
172  );
173 
174 
175 
176 
177 /*
178  * node selector methods
179  */
180 
181 /** copies the given node selector to a new scip */
182 extern
184  SCIP_NODESEL* nodesel, /**< node selector */
185  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
186  );
187 
188 /** creates a node selector */
189 extern
191  SCIP_NODESEL** nodesel, /**< pointer to store node selector */
192  SCIP_SET* set, /**< global SCIP settings */
193  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
194  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
195  const char* name, /**< name of node selector */
196  const char* desc, /**< description of node selector */
197  int stdpriority, /**< priority of the node selector in standard mode */
198  int memsavepriority, /**< priority of the node selector in memory saving mode */
199  SCIP_DECL_NODESELCOPY ((*nodeselcopy)), /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
200  SCIP_DECL_NODESELFREE ((*nodeselfree)), /**< destructor of node selector */
201  SCIP_DECL_NODESELINIT ((*nodeselinit)), /**< initialize node selector */
202  SCIP_DECL_NODESELEXIT ((*nodeselexit)), /**< deinitialize node selector */
203  SCIP_DECL_NODESELINITSOL((*nodeselinitsol)),/**< solving process initialization method of node selector */
204  SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)),/**< solving process deinitialization method of node selector */
205  SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
206  SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
207  SCIP_NODESELDATA* nodeseldata /**< node selector data */
208  );
209 
210 /** frees memory of node selector */
211 extern
213  SCIP_NODESEL** nodesel, /**< pointer to node selector data structure */
214  SCIP_SET* set /**< global SCIP settings */
215  );
216 
217 /** initializes node selector */
218 extern
220  SCIP_NODESEL* nodesel, /**< node selector */
221  SCIP_SET* set /**< global SCIP settings */
222  );
223 
224 /** deinitializes node selector */
225 extern
227  SCIP_NODESEL* nodesel, /**< node selector */
228  SCIP_SET* set /**< global SCIP settings */
229  );
230 
231 /** informs node selector that the branch and bound process is being started */
232 extern
234  SCIP_NODESEL* nodesel, /**< node selector */
235  SCIP_SET* set /**< global SCIP settings */
236  );
237 
238 /** informs node selector that the branch and bound process data is being freed */
239 extern
241  SCIP_NODESEL* nodesel, /**< node selector */
242  SCIP_SET* set /**< global SCIP settings */
243  );
244 
245 /** select next node to be processed */
246 extern
248  SCIP_NODESEL* nodesel, /**< node selector */
249  SCIP_SET* set, /**< global SCIP settings */
250  SCIP_NODE** selnode /**< pointer to store node to be processed next */
251  );
252 
253 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
254 extern
256  SCIP_NODESEL* nodesel, /**< node selector */
257  SCIP_SET* set, /**< global SCIP settings */
258  SCIP_NODE* node1, /**< first node to compare */
259  SCIP_NODE* node2 /**< second node to compare */
260  );
261 
262 /** sets priority of node selector in standard mode */
263 extern
265  SCIP_NODESEL* nodesel, /**< node selector */
266  SCIP_SET* set, /**< global SCIP settings */
267  int priority /**< new priority of the node selector */
268  );
269 
270 /** sets priority of node selector in memory saving mode */
271 extern
273  SCIP_NODESEL* nodesel, /**< node selector */
274  SCIP_SET* set, /**< global SCIP settings */
275  int priority /**< new priority of the node selector */
276  );
277 
278 /** sets copy method of node selector */
279 extern
280 void SCIPnodeselSetCopy(
281  SCIP_NODESEL* nodesel, /**< node selector */
282  SCIP_DECL_NODESELCOPY ((*nodeselcopy)) /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
283  );
284 
285 /** sets destructor method of node selector */
286 extern
287 void SCIPnodeselSetFree(
288  SCIP_NODESEL* nodesel, /**< node selector */
289  SCIP_DECL_NODESELFREE ((*nodeselfree)) /**< destructor of node selector */
290  );
291 
292 /** sets initialization method of node selector */
293 extern
294 void SCIPnodeselSetInit(
295  SCIP_NODESEL* nodesel, /**< node selector */
296  SCIP_DECL_NODESELINIT ((*nodeselinit)) /**< initialize node selector */
297  );
298 
299 /** sets deinitialization method of node selector */
300 extern
301 void SCIPnodeselSetExit(
302  SCIP_NODESEL* nodesel, /**< node selector */
303  SCIP_DECL_NODESELEXIT ((*nodeselexit)) /**< deinitialize node selector */
304  );
305 
306 /** sets solving process initialization method of node selector */
307 extern
309  SCIP_NODESEL* nodesel, /**< node selector */
310  SCIP_DECL_NODESELINITSOL ((*nodeselinitsol))/**< solving process initialization method of node selector */
311  );
312 
313 /** sets solving process deinitialization method of node selector */
314 extern
316  SCIP_NODESEL* nodesel, /**< node selector */
317  SCIP_DECL_NODESELEXITSOL ((*nodeselexitsol))/**< solving process deinitialization method of node selector */
318  );
319 
320 /** enables or disables all clocks of \p nodesel, depending on the value of the flag */
321 extern
323  SCIP_NODESEL* nodesel, /**< the node selector for which all clocks should be enabled or disabled */
324  SCIP_Bool enable /**< should the clocks of the node selector be enabled? */
325  );
326 
327 #ifdef __cplusplus
328 }
329 #endif
330 
331 #endif
void SCIPnodeselSetInit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINIT((*nodeselinit)))
Definition: nodesel.c:1105
#define SCIP_DECL_NODESELCOMP(x)
Definition: type_nodesel.h:126
void SCIPnodeselEnableOrDisableClocks(SCIP_NODESEL *nodesel, SCIP_Bool enable)
Definition: nodesel.c:1159
int SCIPnodepqCompare(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
Definition: nodesel.c:243
int SCIPnodepqLen(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:550
#define SCIP_DECL_NODESELINITSOL(x)
Definition: type_nodesel.h:83
SCIP_Real SCIPnodepqGetLowerboundSum(SCIP_NODEPQ *nodepq)
Definition: nodesel.c:608
SCIP_NODESEL * SCIPnodepqGetNodesel(SCIP_NODEPQ *nodepq)
Definition: nodesel.c:193
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPnodepqBound(SCIP_NODEPQ *nodepq, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_TREE *tree, SCIP_REOPT *reopt, SCIP_LP *lp, SCIP_Real cutoffbound)
Definition: nodesel.c:618
type definitions for global SCIP settings
SCIP_RETCODE SCIPnodeselExitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:928
SCIP_NODE * SCIPnodepqGetLowerboundNode(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:584
type definitions for return codes for SCIP methods
type definitions for collecting reoptimization information
#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:727
#define SCIP_DECL_NODESELINIT(x)
Definition: type_nodesel.h:64
SCIP_RETCODE SCIPnodeselExit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:874
type definitions for LP management
SCIP_RETCODE SCIPnodeselSelect(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE **selnode)
Definition: nodesel.c:952
struct SCIP_NodeselData SCIP_NODESELDATA
Definition: type_nodesel.h:38
SCIP_RETCODE SCIPnodeselFree(SCIP_NODESEL **nodesel, SCIP_SET *set)
Definition: nodesel.c:810
SCIP_RETCODE SCIPnodepqInsert(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
Definition: nodesel.c:259
SCIP_RETCODE SCIPnodeselInitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:904
SCIP_RETCODE SCIPnodeselInit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:838
SCIP_RETCODE SCIPnodepqSetNodesel(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: nodesel.c:203
#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:503
public methods for node selectors
void SCIPnodeselSetExit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXIT((*nodeselexit)))
Definition: nodesel.c:1116
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:130
#define SCIP_Bool
Definition: def.h:53
#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:975
type definitions for branch and bound tree
void SCIPnodeselSetInitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINITSOL((*nodeselinitsol)))
Definition: nodesel.c:1127
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:153
void SCIPnodeselSetMemsavePriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
Definition: nodesel.c:1046
void SCIPnodeselSetExitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)))
Definition: nodesel.c:1138
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:745
SCIP_RETCODE SCIPnodepqCreate(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: nodesel.c:95
#define SCIP_Real
Definition: def.h:127
void SCIPnodeselSetFree(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELFREE((*nodeselfree)))
Definition: nodesel.c:1094
#define SCIP_DECL_NODESELCOPY(x)
Definition: type_nodesel.h:47
SCIP_NODE * SCIPnodepqFirst(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:524
SCIP_Real SCIPnodepqGetLowerbound(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:561
BMS_BLKMEM * blkmem
Definition: nlpioracle.c:59
SCIP_NODE ** SCIPnodepqNodes(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:540
void SCIPnodeselSetCopy(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELCOPY((*nodeselcopy)))
Definition: nodesel.c:1083
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:392
void SCIPnodeselSetStdPriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
Definition: nodesel.c:1022
#define SCIP_DECL_NODESELSELECT(x)
Definition: type_nodesel.h:109
void SCIPnodepqDestroy(SCIP_NODEPQ **nodepq)
Definition: nodesel.c:116
memory allocation routines