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-2019 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 nodesel.h
17  * @ingroup INTERNALAPI
18  * @brief internal methods for node selectors and node priority queues
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_NODESEL_H__
25 #define __SCIP_NODESEL_H__
26 
27 
28 #include "scip/def.h"
29 #include "blockmemshell/memory.h"
30 #include "scip/type_event.h"
31 #include "scip/type_retcode.h"
32 #include "scip/type_set.h"
33 #include "scip/type_stat.h"
34 #include "scip/type_lp.h"
35 #include "scip/type_tree.h"
36 #include "scip/type_reopt.h"
37 #include "scip/pub_nodesel.h"
38 
39 #ifdef __cplusplus
40 extern "C" {
41 #endif
42 
43 /*
44  * node priority queue methods
45  */
46 
47 /** creates node priority queue */
49  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
50  SCIP_SET* set, /**< global SCIP settings */
51  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
52  );
53 
54 /** frees node priority queue, but not the data nodes themselves */
56  SCIP_NODEPQ** nodepq /**< pointer to a node priority queue */
57  );
58 
59 /** frees node priority queue and all nodes in the queue */
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 */
72  SCIP_NODEPQ* nodepq, /**< node priority queue */
73  BMS_BLKMEM* blkmem, /**< block memory buffers */
74  SCIP_SET* set, /**< global SCIP settings */
75  SCIP_STAT* stat, /**< problem statistics */
76  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
77  SCIP_TREE* tree, /**< branch and bound tree */
78  SCIP_LP* lp /**< current LP data */
79  );
80 
81 /** returns the node selector associated with the given node priority queue */
83  SCIP_NODEPQ* nodepq /**< node priority queue */
84  );
85 
86 /** sets the node selector used for sorting the nodes in the queue, and resorts the queue if necessary */
88  SCIP_NODEPQ** nodepq, /**< pointer to a node priority queue */
89  SCIP_SET* set, /**< global SCIP settings */
90  SCIP_NODESEL* nodesel /**< node selector to use for sorting the nodes in the queue */
91  );
92 
93 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
95  SCIP_NODEPQ* nodepq, /**< node priority queue */
96  SCIP_SET* set, /**< global SCIP settings */
97  SCIP_NODE* node1, /**< first node to compare */
98  SCIP_NODE* node2 /**< second node to compare */
99  );
100 
101 /** inserts node into node priority queue */
103  SCIP_NODEPQ* nodepq, /**< node priority queue */
104  SCIP_SET* set, /**< global SCIP settings */
105  SCIP_NODE* node /**< node to be inserted */
106  );
107 
108 /** removes node from the node priority queue */
110  SCIP_NODEPQ* nodepq, /**< node priority queue */
111  SCIP_SET* set, /**< global SCIP settings */
112  SCIP_NODE* node /**< node to remove */
113  );
114 
115 /** returns the best node of the queue without removing it */
117  const SCIP_NODEPQ* nodepq /**< node priority queue */
118  );
119 
120 /** returns the nodes array of the queue */
122  const SCIP_NODEPQ* nodepq /**< node priority queue */
123  );
124 
125 /** returns the number of nodes stored in the node priority queue */
126 int SCIPnodepqLen(
127  const SCIP_NODEPQ* nodepq /**< node priority queue */
128  );
129 
130 /** gets the minimal lower bound of all nodes in the queue */
132  SCIP_NODEPQ* nodepq, /**< node priority queue */
133  SCIP_SET* set /**< global SCIP settings */
134  );
135 
136 /** gets the node with minimal lower bound of all nodes in the queue */
138  SCIP_NODEPQ* nodepq, /**< node priority queue */
139  SCIP_SET* set /**< global SCIP settings */
140  );
141 
142 /** gets the sum of lower bounds of all nodes in the queue */
144  SCIP_NODEPQ* nodepq /**< node priority queue */
145  );
146 
147 /** free all nodes from the queue that are cut off by the given upper bound */
149  SCIP_NODEPQ* nodepq, /**< node priority queue */
150  BMS_BLKMEM* blkmem, /**< block memory buffer */
151  SCIP_SET* set, /**< global SCIP settings */
152  SCIP_STAT* stat, /**< dynamic problem statistics */
153  SCIP_EVENTQUEUE* eventqueue, /**< event queue */
154  SCIP_TREE* tree, /**< branch and bound tree */
155  SCIP_REOPT* reopt, /**< reoptimization data structure */
156  SCIP_LP* lp, /**< current LP data */
157  SCIP_Real cutoffbound /**< cutoff bound: all nodes with lowerbound >= cutoffbound are cut off */
158  );
159 
160 
161 
162 
163 /*
164  * node selector methods
165  */
166 
167 /** copies the given node selector to a new scip */
169  SCIP_NODESEL* nodesel, /**< node selector */
170  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
171  );
172 
173 /** creates a node selector */
175  SCIP_NODESEL** nodesel, /**< pointer to store node selector */
176  SCIP_SET* set, /**< global SCIP settings */
177  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
178  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
179  const char* name, /**< name of node selector */
180  const char* desc, /**< description of node selector */
181  int stdpriority, /**< priority of the node selector in standard mode */
182  int memsavepriority, /**< priority of the node selector in memory saving mode */
183  SCIP_DECL_NODESELCOPY ((*nodeselcopy)), /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
184  SCIP_DECL_NODESELFREE ((*nodeselfree)), /**< destructor of node selector */
185  SCIP_DECL_NODESELINIT ((*nodeselinit)), /**< initialize node selector */
186  SCIP_DECL_NODESELEXIT ((*nodeselexit)), /**< deinitialize node selector */
187  SCIP_DECL_NODESELINITSOL((*nodeselinitsol)),/**< solving process initialization method of node selector */
188  SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)),/**< solving process deinitialization method of node selector */
189  SCIP_DECL_NODESELSELECT((*nodeselselect)),/**< node selection method */
190  SCIP_DECL_NODESELCOMP ((*nodeselcomp)), /**< node comparison method */
191  SCIP_NODESELDATA* nodeseldata /**< node selector data */
192  );
193 
194 /** frees memory of node selector */
196  SCIP_NODESEL** nodesel, /**< pointer to node selector data structure */
197  SCIP_SET* set /**< global SCIP settings */
198  );
199 
200 /** initializes node selector */
202  SCIP_NODESEL* nodesel, /**< node selector */
203  SCIP_SET* set /**< global SCIP settings */
204  );
205 
206 /** deinitializes node selector */
208  SCIP_NODESEL* nodesel, /**< node selector */
209  SCIP_SET* set /**< global SCIP settings */
210  );
211 
212 /** informs node selector that the branch and bound process is being started */
214  SCIP_NODESEL* nodesel, /**< node selector */
215  SCIP_SET* set /**< global SCIP settings */
216  );
217 
218 /** informs node selector that the branch and bound process data is being freed */
220  SCIP_NODESEL* nodesel, /**< node selector */
221  SCIP_SET* set /**< global SCIP settings */
222  );
223 
224 /** select next node to be processed */
226  SCIP_NODESEL* nodesel, /**< node selector */
227  SCIP_SET* set, /**< global SCIP settings */
228  SCIP_NODE** selnode /**< pointer to store node to be processed next */
229  );
230 
231 /** compares two nodes; returns -1/0/+1 if node1 better/equal/worse than node2 */
233  SCIP_NODESEL* nodesel, /**< node selector */
234  SCIP_SET* set, /**< global SCIP settings */
235  SCIP_NODE* node1, /**< first node to compare */
236  SCIP_NODE* node2 /**< second node to compare */
237  );
238 
239 /** sets priority of node selector in standard mode */
241  SCIP_NODESEL* nodesel, /**< node selector */
242  SCIP_SET* set, /**< global SCIP settings */
243  int priority /**< new priority of the node selector */
244  );
245 
246 /** sets priority of node selector in memory saving mode */
248  SCIP_NODESEL* nodesel, /**< node selector */
249  SCIP_SET* set, /**< global SCIP settings */
250  int priority /**< new priority of the node selector */
251  );
252 
253 /** sets copy method of node selector */
254 void SCIPnodeselSetCopy(
255  SCIP_NODESEL* nodesel, /**< node selector */
256  SCIP_DECL_NODESELCOPY ((*nodeselcopy)) /**< copy method of node selector or NULL if you don't want to copy your plugin into sub-SCIPs */
257  );
258 
259 /** sets destructor method of node selector */
260 void SCIPnodeselSetFree(
261  SCIP_NODESEL* nodesel, /**< node selector */
262  SCIP_DECL_NODESELFREE ((*nodeselfree)) /**< destructor of node selector */
263  );
264 
265 /** sets initialization method of node selector */
266 void SCIPnodeselSetInit(
267  SCIP_NODESEL* nodesel, /**< node selector */
268  SCIP_DECL_NODESELINIT ((*nodeselinit)) /**< initialize node selector */
269  );
270 
271 /** sets deinitialization method of node selector */
272 void SCIPnodeselSetExit(
273  SCIP_NODESEL* nodesel, /**< node selector */
274  SCIP_DECL_NODESELEXIT ((*nodeselexit)) /**< deinitialize node selector */
275  );
276 
277 /** sets solving process initialization method of node selector */
279  SCIP_NODESEL* nodesel, /**< node selector */
280  SCIP_DECL_NODESELINITSOL ((*nodeselinitsol))/**< solving process initialization method of node selector */
281  );
282 
283 /** sets solving process deinitialization method of node selector */
285  SCIP_NODESEL* nodesel, /**< node selector */
286  SCIP_DECL_NODESELEXITSOL ((*nodeselexitsol))/**< solving process deinitialization method of node selector */
287  );
288 
289 /** enables or disables all clocks of \p nodesel, depending on the value of the flag */
291  SCIP_NODESEL* nodesel, /**< the node selector for which all clocks should be enabled or disabled */
292  SCIP_Bool enable /**< should the clocks of the node selector be enabled? */
293  );
294 
295 #ifdef __cplusplus
296 }
297 #endif
298 
299 #endif
void SCIPnodeselSetInit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINIT((*nodeselinit)))
Definition: nodesel.c:1151
#define SCIP_DECL_NODESELCOMP(x)
Definition: type_nodesel.h:126
void SCIPnodeselEnableOrDisableClocks(SCIP_NODESEL *nodesel, SCIP_Bool enable)
Definition: nodesel.c:1205
int SCIPnodepqCompare(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node1, SCIP_NODE *node2)
Definition: nodesel.c:251
int SCIPnodepqLen(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:558
#define SCIP_DECL_NODESELINITSOL(x)
Definition: type_nodesel.h:83
SCIP_Real SCIPnodepqGetLowerboundSum(SCIP_NODEPQ *nodepq)
Definition: nodesel.c:616
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:626
type definitions for global SCIP settings
SCIP_RETCODE SCIPnodeselExitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:974
SCIP_NODE * SCIPnodepqGetLowerboundNode(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:592
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:735
#define SCIP_DECL_NODESELINIT(x)
Definition: type_nodesel.h:64
SCIP_RETCODE SCIPnodeselExit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:920
type definitions for LP management
SCIP_RETCODE SCIPnodeselSelect(SCIP_NODESEL *nodesel, SCIP_SET *set, SCIP_NODE **selnode)
Definition: nodesel.c:998
struct SCIP_NodeselData SCIP_NODESELDATA
Definition: type_nodesel.h:38
SCIP_RETCODE SCIPnodeselFree(SCIP_NODESEL **nodesel, SCIP_SET *set)
Definition: nodesel.c:855
SCIP_RETCODE SCIPnodepqInsert(SCIP_NODEPQ *nodepq, SCIP_SET *set, SCIP_NODE *node)
Definition: nodesel.c:267
SCIP_RETCODE SCIPnodeselInitsol(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:950
SCIP_RETCODE SCIPnodeselInit(SCIP_NODESEL *nodesel, SCIP_SET *set)
Definition: nodesel.c:884
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:511
type definitions for managing events
public methods for node selectors
void SCIPnodeselSetExit(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXIT((*nodeselexit)))
Definition: nodesel.c:1162
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:70
#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:1021
type definitions for branch and bound tree
void SCIPnodeselSetInitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELINITSOL((*nodeselinitsol)))
Definition: nodesel.c:1173
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:1092
void SCIPnodeselSetExitsol(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELEXITSOL((*nodeselexitsol)))
Definition: nodesel.c:1184
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:821
SCIP_RETCODE SCIPnodepqCreate(SCIP_NODEPQ **nodepq, SCIP_SET *set, SCIP_NODESEL *nodesel)
Definition: nodesel.c:95
#define SCIP_Real
Definition: def.h:164
void SCIPnodeselSetFree(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELFREE((*nodeselfree)))
Definition: nodesel.c:1140
#define SCIP_DECL_NODESELCOPY(x)
Definition: type_nodesel.h:47
SCIP_NODE * SCIPnodepqFirst(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:532
SCIP_Real SCIPnodepqGetLowerbound(SCIP_NODEPQ *nodepq, SCIP_SET *set)
Definition: nodesel.c:569
SCIP_NODE ** SCIPnodepqNodes(const SCIP_NODEPQ *nodepq)
Definition: nodesel.c:548
void SCIPnodeselSetCopy(SCIP_NODESEL *nodesel, SCIP_DECL_NODESELCOPY((*nodeselcopy)))
Definition: nodesel.c:1129
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:427
void SCIPnodeselSetStdPriority(SCIP_NODESEL *nodesel, SCIP_SET *set, int priority)
Definition: nodesel.c:1068
#define SCIP_DECL_NODESELSELECT(x)
Definition: type_nodesel.h:109
void SCIPnodepqDestroy(SCIP_NODEPQ **nodepq)
Definition: nodesel.c:116
memory allocation routines