Scippy

SCIP

Solving Constraint Integer Programs

struct_tree.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-2017 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 struct_tree.h
17  * @ingroup INTERNALAPI
18  * @brief data structures for branch and bound tree
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_STRUCT_TREE_H__
25 #define __SCIP_STRUCT_TREE_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_lp.h"
30 #include "scip/type_var.h"
31 #include "scip/type_tree.h"
32 #include "scip/type_cons.h"
33 #include "scip/type_nodesel.h"
34 #include "lpi/type_lpi.h"
35 
36 
37 #ifdef __cplusplus
38 extern "C" {
39 #endif
40 
41 /** probing node, possibly with solved LP, where bounds and constraints have been changed,
42  * and rows and columns might have been added
43  */
45 {
46  SCIP_LPISTATE* lpistate; /**< LP state information */
47  int ninitialcols; /**< number of LP columns before the node was processed */
48  int ninitialrows; /**< number of LP rows before the node was processed */
49  int ncols; /**< total number of columns of this node's LP */
50  int nrows; /**< total number of rows of this node's LP */
51  SCIP_VAR** origobjvars; /**< variables whose objective function coefficients have changed */
52  SCIP_Real* origobjvals; /**< original objective function coefficients */
53  int nchgdobjs; /**< number of changed objective coefficients */
54  SCIP_Bool lpwasprimfeas; /**< primal feasibility of saved LP state information */
55  SCIP_Bool lpwasprimchecked; /**< primal feasibility check state of saved LP state information */
56  SCIP_Bool lpwasdualfeas; /**< dual feasibility of saved LP state information */
57  SCIP_Bool lpwasdualchecked; /**< dual feasibility check state of saved LP state information */
58 };
59 
60 /** sibling information (should not exceed the size of a pointer) */
62 {
63  int arraypos; /**< position of node in the siblings array */
64 };
65 
66 /** child information (should not exceed the size of a pointer) */
67 struct SCIP_Child
68 {
69  int arraypos; /**< position of node in the children array */
70 };
71 
72 /** leaf information (should not exceed the size of a pointer) */
73 struct SCIP_Leaf
74 {
75  SCIP_NODE* lpstatefork; /**< fork/subroot node defining the LP state of the leaf */
76 };
77 
78 /** fork without LP solution, where only bounds and constraints have been changed */
80 {
81  int nchildren; /**< number of children of this parent node */
82 };
83 
84 /** fork without LP solution, where bounds and constraints have been changed, and rows and columns were added */
86 {
87  SCIP_COL** addedcols; /**< array with pointers to new columns added at this node into the LP */
88  SCIP_ROW** addedrows; /**< array with pointers to new rows added at this node into the LP */
89  int naddedcols; /**< number of columns added at this node */
90  int naddedrows; /**< number of rows added at this node */
91  int nchildren; /**< number of children of this parent node */
92 };
93 
94 /** fork with solved LP, where bounds and constraints have been changed, and rows and columns were added */
95 struct SCIP_Fork
96 {
97  SCIP_COL** addedcols; /**< array with pointers to new columns added at this node into the LP */
98  SCIP_ROW** addedrows; /**< array with pointers to new rows added at this node into the LP */
99  SCIP_LPISTATE* lpistate; /**< LP state information */
100  SCIP_Real lpobjval; /**< the LP objective value for that node, needed to compute the pseudo costs correctly */
101  int naddedcols; /**< number of columns added at this node */
102  int naddedrows; /**< number of rows added at this node */
103  int nlpistateref; /**< number of times, the LP state is needed */
104  unsigned int nchildren:28; /**< number of children of this parent node */
105  unsigned int lpwasprimfeas:1; /**< primal feasibility of saved LP state information */
106  unsigned int lpwasprimchecked:1; /**< primal feasibility check state of saved LP state information */
107  unsigned int lpwasdualfeas:1; /**< dual feasibility of saved LP state information */
108  unsigned int lpwasdualchecked:1; /**< dual feasibility check state of saved LP state information */
109 };
110 
111 /** fork with solved LP, where bounds and constraints have been changed, and rows and columns were removed and added */
113 {
114  SCIP_COL** cols; /**< array with pointers to the columns in the same order as in the LP */
115  SCIP_ROW** rows; /**< array with pointers to the rows in the same order as in the LP */
116  SCIP_LPISTATE* lpistate; /**< LP state information */
117  SCIP_Real lpobjval; /**< the LP objective value for that node, needed to compute the pseudo costs correctly */
118  int ncols; /**< number of columns in the LP */
119  int nrows; /**< number of rows in the LP */
120  int nlpistateref; /**< number of times, the LP state is needed */
121  unsigned int nchildren:30; /**< number of children of this parent node */
122  unsigned int lpwasprimfeas:1; /**< primal feasibility of saved LP state information */
123  unsigned int lpwasprimchecked:1; /**< primal feasibility check state of saved LP state information */
124  unsigned int lpwasdualfeas:1; /**< dual feasibility of saved LP state information */
125  unsigned int lpwasdualchecked:1; /**< dual feasibility check state of saved LP state information */
126 };
127 
128 /** node data structure */
129 struct SCIP_Node
130 {
131  SCIP_Longint number; /**< successively assigned number of the node */
132  SCIP_Real lowerbound; /**< lower (dual) bound of subtree */
133  SCIP_Real estimate; /**< estimated value of feasible solution in subtree */
134  union
135  {
136  SCIP_PROBINGNODE* probingnode; /**< data for probing nodes */
137  SCIP_SIBLING sibling; /**< data for sibling nodes */
138  SCIP_CHILD child; /**< data for child nodes */
139  SCIP_LEAF leaf; /**< data for leaf nodes */
140  SCIP_JUNCTION junction; /**< data for junction nodes */
141  SCIP_PSEUDOFORK* pseudofork; /**< data for pseudo fork nodes */
142  SCIP_FORK* fork; /**< data for fork nodes */
143  SCIP_SUBROOT* subroot; /**< data for subroot nodes */
144  } data;
145  SCIP_NODE* parent; /**< parent node in the tree */
146  SCIP_CONSSETCHG* conssetchg; /**< constraint set changes at this node or NULL */
147  SCIP_DOMCHG* domchg; /**< domain changes at this node or NULL */
148  unsigned int depth:16; /**< depth in the tree */
149  unsigned int nodetype:4; /**< type of node */
150  unsigned int active:1; /**< is node in the path to the current node? */
151  unsigned int cutoff:1; /**< should the node and all sub nodes be cut off from the tree? */
152  unsigned int reprop:1; /**< should propagation be applied again, if the node is on the active path? */
153  unsigned int repropsubtreemark:9;/**< subtree repropagation marker for subtree repropagation */
154  unsigned int reoptid:29; /**< unique id to identify the node during reoptimization */
155  unsigned int reopttype:3; /**< node type during reoptimization */
156 };
157 
158 /** bound change information for pending bound changes */
160 {
161  SCIP_NODE* node; /**< node to add bound change to */
162  SCIP_VAR* var; /**< variable to change the bounds for */
163  SCIP_Real newbound; /**< new value for bound */
164  SCIP_BOUNDTYPE boundtype; /**< type of bound: lower or upper bound */
165  SCIP_CONS* infercons; /**< constraint that deduced the bound change, or NULL */
166  SCIP_PROP* inferprop; /**< propagator that deduced the bound change, or NULL */
167  int inferinfo; /**< user information for inference to help resolving the conflict */
168  SCIP_Bool probingchange; /**< is the bound change a temporary setting due to probing? */
169 };
170 
171 /** branch and bound tree */
172 struct SCIP_Tree
173 {
174  SCIP_NODE* root; /**< root node of the tree */
175  SCIP_NODEPQ* leaves; /**< leaves of the tree */
176  SCIP_NODE** path; /**< array of nodes storing the active path from root to current node, which
177  * is usually the focus or a probing node; in case of a cut off, the path
178  * may already end earlier */
179  SCIP_NODE* focusnode; /**< focus node: the node that is stored together with its children and
180  * siblings in the tree data structure; the focus node is the currently
181  * processed node; it doesn't need to be active all the time, because it
182  * may be cut off and the active path stops at the cut off node */
183  SCIP_NODE* focuslpfork; /**< LP defining pseudofork/fork/subroot of the focus node */
184  SCIP_NODE* focuslpstatefork; /**< LP state defining fork/subroot of the focus node */
185  SCIP_NODE* focussubroot; /**< subroot of the focus node's sub tree */
186  SCIP_NODE* probingroot; /**< root node of the current probing path, or NULL */
187  SCIP_NODE** children; /**< array with children of the focus node */
188  SCIP_NODE** siblings; /**< array with siblings of the focus node */
189  SCIP_Real* childrenprio; /**< array with node selection priorities of children */
190  SCIP_Real* siblingsprio; /**< array with node selection priorities of siblings */
191  SCIP_VAR** divebdchgvars[2]; /**< two arrays to store variables for branching */
192  SCIP_BRANCHDIR* divebdchgdirs[2]; /**< arrays to hold the directions for diving */
193  SCIP_Real* divebdchgvals[2]; /**< arrays to store bound change values for diving */
194  int* pathnlpcols; /**< array with number of LP columns for each problem in active path (except
195  * newly added columns of the focus node and the current probing node) */
196  int* pathnlprows; /**< array with number of LP rows for each problem in active path (except
197  * newly added rows of the focus node and the current probing node) */
198  SCIP_LPISTATE* probinglpistate; /**< LP state information before probing started */
199  SCIP_LPISTATE* focuslpistate; /**< LP state information of focus node */
200  SCIP_LPINORMS* probinglpinorms; /**< LP pricing norms information before probing started */
201  SCIP_PENDINGBDCHG* pendingbdchgs; /**< array of pending bound changes, or NULL */
202  SCIP_Longint focuslpstateforklpcount; /**< LP number of last solved LP in current LP state fork, or -1 if unknown */
203  int divebdchgsize[2]; /**< holds the two sizes of the dive bound change information */
204  int ndivebdchanges[2]; /**< current number of stored dive bound changes for the next depth */
205  int pendingbdchgssize; /**< size of pendingbdchgs array */
206  int npendingbdchgs; /**< number of pending bound changes */
207  int childrensize; /**< available slots in children vector */
208  int nchildren; /**< number of children of focus node (number of used slots in children vector) */
209  int siblingssize; /**< available slots in siblings vector */
210  int nsiblings; /**< number of siblings of focus node (number of used slots in siblings vector) */
211  int pathlen; /**< length of the current path */
212  int pathsize; /**< number of available slots in path arrays */
213  int effectiverootdepth; /**< first depth with node with at least two children */
214  int appliedeffectiverootdepth; /**< the effective root depth which was already enforced (that is constraint and bound changes were made global) */
215  int correctlpdepth; /**< depth to which current LP data corresponds to LP data of active path */
216  int cutoffdepth; /**< depth of first node in active path that is marked being cutoff */
217  int repropdepth; /**< depth of first node in active path that has to be propagated again */
218  int repropsubtreecount; /**< cyclicly increased counter to create markers for subtree repropagation */
219  int probingsumchgdobjs; /**< number of changed objective coefficients in all probing nodes */
220  SCIP_Bool focusnodehaslp; /**< is LP being processed in the focus node? */
221  SCIP_Bool probingnodehaslp; /**< was the LP solved (at least once) in the current probing node? */
222  SCIP_Bool focuslpconstructed; /**< was the LP of the focus node already constructed? */
223  SCIP_Bool cutoffdelayed; /**< the treeCutoff() call was delayed because of diving and has to be executed */
224  SCIP_Bool probinglpwasflushed;/**< was the LP flushed before we entered the probing mode? */
225  SCIP_Bool probinglpwassolved; /**< was the LP solved before we entered the probing mode? */
226  SCIP_Bool probingloadlpistate;/**< must the LP state be reloaded because of a backtrack in probing? */
227  SCIP_Bool probinglpwasrelax; /**< was the LP a valid relaxation before we entered the probing mode? */
228  SCIP_Bool probingsolvedlp; /**< was the LP solved during probing mode, i.e., was SCIPsolveProbingLP() called? */
229  SCIP_Bool forcinglpmessage; /**< was forcing LP solving message be posted */
230  SCIP_Bool probingobjchanged; /**< was the objective function changed during probing? */
231  SCIP_Bool sbprobing; /**< is the probing mode used for strong branching? */
232  SCIP_Bool probinglpwasprimfeas;/**< primal feasibility when probing started */
233  SCIP_Bool probinglpwasprimchecked;/**< primal feasibility has been checked when probing started */
234  SCIP_Bool probinglpwasdualfeas;/**< dual feasibility when probing started */
235  SCIP_Bool probinglpwasdualchecked;/**< dual feasibility has been check when probing started */
236 };
237 
238 #ifdef __cplusplus
239 }
240 #endif
241 
242 #endif
SCIP_NODE * node
Definition: struct_tree.h:161
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
SCIP_NODE * lpstatefork
Definition: struct_tree.h:75
SCIP_Bool lpwasdualchecked
Definition: struct_tree.h:57
SCIP_PSEUDOFORK * pseudofork
Definition: struct_tree.h:141
SCIP_NODE * focussubroot
Definition: struct_tree.h:185
unsigned int lpwasdualfeas
Definition: struct_tree.h:124
SCIP_Real * origobjvals
Definition: struct_tree.h:52
int naddedcols
Definition: struct_tree.h:101
SCIP_Longint focuslpstateforklpcount
Definition: struct_tree.h:202
int * pathnlprows
Definition: struct_tree.h:196
unsigned int active
Definition: struct_tree.h:150
SCIP_PROBINGNODE * probingnode
Definition: struct_tree.h:136
unsigned int repropsubtreemark
Definition: struct_tree.h:153
int naddedrows
Definition: struct_tree.h:102
SCIP_Bool probingchange
Definition: struct_tree.h:168
SCIP_VAR * var
Definition: struct_tree.h:162
SCIP_Real newbound
Definition: struct_tree.h:163
unsigned int lpwasdualchecked
Definition: struct_tree.h:108
unsigned int cutoff
Definition: struct_tree.h:151
unsigned int nodetype
Definition: struct_tree.h:149
SCIP_LPINORMS * probinglpinorms
Definition: struct_tree.h:200
SCIP_Bool probinglpwasdualchecked
Definition: struct_tree.h:235
unsigned int reprop
Definition: struct_tree.h:152
SCIP_Bool sbprobing
Definition: struct_tree.h:231
SCIP_Real estimate
Definition: struct_tree.h:133
SCIP_FORK * fork
Definition: struct_tree.h:142
SCIP_Real lpobjval
Definition: struct_tree.h:117
SCIP_Bool probinglpwasflushed
Definition: struct_tree.h:224
SCIP_COL ** addedcols
Definition: struct_tree.h:97
SCIP_Bool probingsolvedlp
Definition: struct_tree.h:228
SCIP_NODE ** siblings
Definition: struct_tree.h:188
SCIP_JUNCTION junction
Definition: struct_tree.h:140
unsigned int lpwasdualfeas
Definition: struct_tree.h:107
int childrensize
Definition: struct_tree.h:207
unsigned int reoptid
Definition: struct_tree.h:154
int pathsize
Definition: struct_tree.h:212
int npendingbdchgs
Definition: struct_tree.h:206
SCIP_Real lpobjval
Definition: struct_tree.h:100
SCIP_Longint number
Definition: struct_tree.h:131
SCIP_ROW ** rows
Definition: struct_tree.h:115
unsigned int lpwasprimchecked
Definition: struct_tree.h:106
type definitions for LP management
int nlpistateref
Definition: struct_tree.h:103
int pendingbdchgssize
Definition: struct_tree.h:205
SCIP_Real * siblingsprio
Definition: struct_tree.h:190
enum SCIP_BranchDir SCIP_BRANCHDIR
Definition: type_history.h:39
SCIP_LPISTATE * lpistate
Definition: struct_tree.h:99
unsigned int lpwasprimchecked
Definition: struct_tree.h:123
SCIP_Bool probinglpwassolved
Definition: struct_tree.h:225
SCIP_Bool probingloadlpistate
Definition: struct_tree.h:226
SCIP_DOMCHG * domchg
Definition: struct_tree.h:147
SCIP_Bool forcinglpmessage
Definition: struct_tree.h:229
int nsiblings
Definition: struct_tree.h:210
int cutoffdepth
Definition: struct_tree.h:216
SCIP_Real * childrenprio
Definition: struct_tree.h:189
SCIP_SUBROOT * subroot
Definition: struct_tree.h:143
SCIP_Bool probingobjchanged
Definition: struct_tree.h:230
unsigned int reopttype
Definition: struct_tree.h:155
int repropsubtreecount
Definition: struct_tree.h:218
int siblingssize
Definition: struct_tree.h:209
SCIP_LPISTATE * probinglpistate
Definition: struct_tree.h:198
SCIP_NODE ** path
Definition: struct_tree.h:176
int repropdepth
Definition: struct_tree.h:217
SCIP_NODE * focuslpstatefork
Definition: struct_tree.h:184
type definitions for specific LP solvers interface
int appliedeffectiverootdepth
Definition: struct_tree.h:214
int correctlpdepth
Definition: struct_tree.h:215
SCIP_SIBLING sibling
Definition: struct_tree.h:137
SCIP_NODEPQ * leaves
Definition: struct_tree.h:175
type definitions for problem variables
SCIP_Bool probinglpwasprimchecked
Definition: struct_tree.h:233
SCIP_COL ** cols
Definition: struct_tree.h:114
SCIP_CONS * infercons
Definition: struct_tree.h:165
SCIP_BOUNDTYPE boundtype
Definition: struct_tree.h:164
SCIP_LEAF leaf
Definition: struct_tree.h:139
SCIP_Bool lpwasdualfeas
Definition: struct_tree.h:56
#define SCIP_Bool
Definition: def.h:61
int arraypos
Definition: struct_tree.h:69
SCIP_Bool lpwasprimchecked
Definition: struct_tree.h:55
SCIP_Bool focuslpconstructed
Definition: struct_tree.h:222
unsigned int depth
Definition: struct_tree.h:148
SCIP_NODE ** children
Definition: struct_tree.h:187
SCIP_VAR ** origobjvars
Definition: struct_tree.h:51
unsigned int lpwasdualchecked
Definition: struct_tree.h:125
int probingsumchgdobjs
Definition: struct_tree.h:219
SCIP_Bool lpwasprimfeas
Definition: struct_tree.h:54
SCIP_ROW ** addedrows
Definition: struct_tree.h:88
int * pathnlpcols
Definition: struct_tree.h:194
SCIP_Bool probinglpwasrelax
Definition: struct_tree.h:227
type definitions for branch and bound tree
SCIP_Bool cutoffdelayed
Definition: struct_tree.h:223
SCIP_CONSSETCHG * conssetchg
Definition: struct_tree.h:146
SCIP_NODE * probingroot
Definition: struct_tree.h:186
SCIP_NODE * parent
Definition: struct_tree.h:145
SCIP_LPISTATE * lpistate
Definition: struct_tree.h:46
SCIP_NODE * focuslpfork
Definition: struct_tree.h:183
SCIP_Real lowerbound
Definition: struct_tree.h:132
SCIP_LPISTATE * lpistate
Definition: struct_tree.h:116
#define SCIP_Real
Definition: def.h:145
int effectiverootdepth
Definition: struct_tree.h:213
#define SCIP_Longint
Definition: def.h:130
SCIP_COL ** addedcols
Definition: struct_tree.h:87
SCIP_Bool probinglpwasprimfeas
Definition: struct_tree.h:232
int nchildren
Definition: struct_tree.h:208
unsigned int lpwasprimfeas
Definition: struct_tree.h:122
common defines and data types used in all packages of SCIP
SCIP_PENDINGBDCHG * pendingbdchgs
Definition: struct_tree.h:201
SCIP_Bool probingnodehaslp
Definition: struct_tree.h:221
SCIP_NODE * root
Definition: struct_tree.h:174
SCIP_LPISTATE * focuslpistate
Definition: struct_tree.h:199
SCIP_CHILD child
Definition: struct_tree.h:138
unsigned int nchildren
Definition: struct_tree.h:121
type definitions for node selectors
SCIP_PROP * inferprop
Definition: struct_tree.h:166
SCIP_ROW ** addedrows
Definition: struct_tree.h:98
unsigned int lpwasprimfeas
Definition: struct_tree.h:105
unsigned int nchildren
Definition: struct_tree.h:104
type definitions for constraints and constraint handlers
SCIP_Bool probinglpwasdualfeas
Definition: struct_tree.h:234
SCIP_NODE * focusnode
Definition: struct_tree.h:179
SCIP_Bool focusnodehaslp
Definition: struct_tree.h:220