Scippy

SCIP

Solving Constraint Integer Programs

struct_var.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_var.h
17  * @ingroup INTERNALAPI
18  * @brief datastructures for problem variables
19  * @author Tobias Achterberg
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #ifndef __SCIP_STRUCT_VAR_H__
25 #define __SCIP_STRUCT_VAR_H__
26 
27 
28 #include "scip/def.h"
29 #include "scip/type_history.h"
30 #include "scip/type_event.h"
31 #include "scip/type_var.h"
32 #include "scip/type_implics.h"
33 #include "scip/type_cons.h"
34 #include "scip/type_prop.h"
35 
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 
40 /** hole in a domain */
41 struct SCIP_Hole
42 {
43  SCIP_Real left; /**< left bound of open interval defining the hole (left,right) */
44  SCIP_Real right; /**< right bound of open interval defining the hole (left,right) */
45 };
46 
47 /** list of domain holes */
49 {
50  SCIP_HOLE hole; /**< this hole */
51  SCIP_HOLELIST* next; /**< next hole in list */
52 };
53 
54 /** change in a hole list */
56 {
57  SCIP_HOLELIST** ptr; /**< changed list pointer */
58  SCIP_HOLELIST* newlist; /**< new value of list pointer */
59  SCIP_HOLELIST* oldlist; /**< old value of list pointer */
60 };
61 
62 /** data for branching decision bound changes */
63 struct SCIP_BranchingData
64 {
65  SCIP_Real lpsolval; /**< sol val of var in last LP prior to bound change, or SCIP_INVALID if unknown */
66 };
67 
68 /** data for infered bound changes */
69 struct SCIP_InferenceData
70 {
71  SCIP_VAR* var; /**< variable that was changed (parent of var, or var itself) */
72  union
73  {
74  SCIP_CONS* cons; /**< constraint that infered this bound change, or NULL */
75  SCIP_PROP* prop; /**< propagator that infered this bound change, or NULL */
76  } reason;
77  int info; /**< user information for inference to help resolving the conflict */
78 };
79 
80 /** change in one bound of a variable */
82 {
83  SCIP_Real newbound; /**< new value for bound */
84  union
85  {
86  SCIP_BRANCHINGDATA branchingdata; /**< data for branching decisions */
87  SCIP_INFERENCEDATA inferencedata; /**< data for infered bound changes */
88  } data;
89  SCIP_VAR* var; /**< active variable to change the bounds for */
90  unsigned int boundchgtype:2; /**< bound change type: branching decision or infered bound change */
91  unsigned int boundtype:1; /**< type of bound for var: lower or upper bound */
92  unsigned int inferboundtype:1; /**< type of bound for inference var (see inference data): lower or upper bound */
93  unsigned int applied:1; /**< was this bound change applied at least once? */
94  unsigned int redundant:1; /**< is this bound change redundant? */
95 };
96 
97 /** bound change index representing the time of the bound change in path from root to current node */
99 {
100  int depth; /**< depth of node where the bound change was created */
101  int pos; /**< position of bound change in node's domchg array */
102 };
103 
104 /** bound change information to track bound changes from root node to current node */
106 {
107  SCIP_Real oldbound; /**< old value for bound */
108  SCIP_Real newbound; /**< new value for bound */
109  SCIP_VAR* var; /**< active variable that changed the bounds */
110  SCIP_INFERENCEDATA inferencedata; /**< data for infered bound changes */
111  SCIP_BDCHGIDX bdchgidx; /**< bound change index in path from root to current node */
112  unsigned int pos:27; /**< position in the variable domain change array */
113  unsigned int boundchgtype:2; /**< bound change type: branching decision or infered bound change */
114  unsigned int boundtype:1; /**< type of bound for var: lower or upper bound */
115  unsigned int inferboundtype:1; /**< type of bound for inference var (see inference data): lower or upper bound */
116  unsigned int redundant:1; /**< does the bound change info belong to a redundant bound change? */
117 };
118 
119 /** tracks changes of the variables' domains (static arrays, bound changes only) */
121 {
122  unsigned int nboundchgs:30; /**< number of bound changes (must be first structure entry!) */
123  unsigned int domchgtype:2; /**< type of domain change data (must be first structure entry!) */
124  SCIP_BOUNDCHG* boundchgs; /**< array with changes in bounds of variables */
125 };
126 
127 /** tracks changes of the variables' domains (static arrays, bound and hole changes) */
129 {
130  unsigned int nboundchgs:30; /**< number of bound changes (must be first structure entry!) */
131  unsigned int domchgtype:2; /**< type of domain change data (must be first structure entry!) */
132  SCIP_BOUNDCHG* boundchgs; /**< array with changes in bounds of variables */
133  SCIP_HOLECHG* holechgs; /**< array with changes in hole lists */
134  int nholechgs; /**< number of hole list changes */
135 };
136 
137 /** tracks changes of the variables' domains (dynamic arrays) */
139 {
140  unsigned int nboundchgs:30; /**< number of bound changes (must be first structure entry!) */
141  unsigned int domchgtype:2; /**< type of domain change data (must be first structure entry!) */
142  SCIP_BOUNDCHG* boundchgs; /**< array with changes in bounds of variables */
143  SCIP_HOLECHG* holechgs; /**< array with changes in hole lists */
144  int nholechgs; /**< number of hole list changes */
145  int boundchgssize; /**< size of bound changes array */
146  int holechgssize; /**< size of hole changes array */
147 };
148 
149 /** tracks changes of the variables' domains */
151 {
152  SCIP_DOMCHGBOUND domchgbound; /**< bound changes */
153  SCIP_DOMCHGBOTH domchgboth; /**< bound and hole changes */
154  SCIP_DOMCHGDYN domchgdyn; /**< bound and hole changes with dynamic arrays */
155 };
156 
157 /** domain of a variable */
158 struct SCIP_Dom
159 {
160  SCIP_Real lb; /**< lower bounds of variables */
161  SCIP_Real ub; /**< upper bounds of variables */
162  SCIP_HOLELIST* holelist; /**< list of holes */
163 };
164 
165 /** original variable information */
167 {
168  SCIP_DOM origdom; /**< domain of variable in original problem */
169  SCIP_VAR* transvar; /**< pointer to representing transformed variable */
170 };
171 
172 /** aggregation information: x = a*y + c */
174 {
175  SCIP_Real scalar; /**< multiplier a in aggregation */
176  SCIP_Real constant; /**< constant shift c in aggregation */
177  SCIP_VAR* var; /**< variable y in aggregation */
178 };
179 
180 /** multiple aggregation information: x = a_1*y_1 + ... + a_k*y_k + c */
182 {
183  SCIP_Real constant; /**< constant shift c in multiple aggregation */
184  SCIP_Real* scalars; /**< multipliers a in multiple aggregation */
185  SCIP_VAR** vars; /**< variables y in multiple aggregation */
186  int nvars; /**< number of variables in aggregation */
187  int varssize; /**< size of vars and scalars arrays */
188 };
189 
190 /** negation information: x' = c - x */
192 {
193  SCIP_Real constant; /**< constant shift c in negation */
194 };
195 
196 /** variable of the problem */
197 struct SCIP_Var
198 {
199 #ifndef NDEBUG
200  SCIP* scip; /**< SCIP data structure */
201 #endif
202  SCIP_Real obj; /**< objective function value of variable (might be changed temporarily in probing mode)*/
203  SCIP_Real unchangedobj; /**< unchanged objective function value of variable (ignoring temporary changes in probing mode) */
204  SCIP_Real branchfactor; /**< factor to weigh variable's branching score with */
205  SCIP_Real rootsol; /**< last primal solution of variable in root node, or zero */
206  SCIP_Real bestrootsol; /**< best primal solution of variable in root node, or zero, w.r.t. root LP value and root reduced cost */
207  SCIP_Real bestrootredcost; /**< best reduced costs of variable in root node, or zero, w.r.t. root LP value and root solution value */
208  SCIP_Real bestrootlpobjval; /**< best root LP objective value, or SCIP_INVALID, w.r.t. root solution value and root reduced cost */
209  SCIP_Real relaxsol; /**< primal solution of variable in current relaxation solution, or SCIP_INVALID */
210  SCIP_Real nlpsol; /**< primal solution of variable in current NLP solution, or SCIP_INVALID */
211  SCIP_Real primsolavg; /**< weighted average of all values of variable in primal feasible solutions */
212  SCIP_Real conflictlb; /**< maximal lower bound of variable in the current conflict */
213  SCIP_Real conflictub; /**< minimal upper bound of variable in the current conflict */
214  SCIP_Real conflictrelaxedlb; /**< minimal relaxed lower bound of variable in the current conflict (conflictrelqxlb <= conflictlb) */
215  SCIP_Real conflictrelaxedub; /**< minimal release upper bound of variable in the current conflict (conflictrelqxlb <= conflictlb) */
216  SCIP_Real lazylb; /**< global lower bound that is ensured by constraints and has not to be added to the LP */
217  SCIP_Real lazyub; /**< global upper bound that is ensured by constraints and has not to be added to the LP */
218  SCIP_DOM glbdom; /**< domain of variable in global problem */
219  SCIP_DOM locdom; /**< domain of variable in current subproblem */
220  union
221  {
222  SCIP_ORIGINAL original; /**< original variable information */
223  SCIP_COL* col; /**< LP column (for column variables) */
224  SCIP_AGGREGATE aggregate; /**< aggregation information (for aggregated variables) */
225  SCIP_MULTAGGR multaggr; /**< multiple aggregation information (for multiple aggregated variables) */
226  SCIP_NEGATE negate; /**< negation information (for negated variables) */
227  } data;
228  char* name; /**< name of the variable */
229  SCIP_DECL_VARCOPY ((*varcopy)); /**< copies variable data if wanted to subscip, or NULL */
230  SCIP_DECL_VARDELORIG ((*vardelorig)); /**< frees user data of original variable */
231  SCIP_DECL_VARTRANS ((*vartrans)); /**< creates transformed user data by transforming original user data */
232  SCIP_DECL_VARDELTRANS ((*vardeltrans)); /**< frees user data of transformed variable */
233  SCIP_VARDATA* vardata; /**< user data for this specific variable */
234  SCIP_VAR** parentvars; /**< parent variables in the aggregation tree */
235  SCIP_VAR* negatedvar; /**< pointer to the variables negation: x' = lb + ub - x, or NULL if not created */
236  SCIP_VBOUNDS* vlbs; /**< variable lower bounds x >= b*y + d */
237  SCIP_VBOUNDS* vubs; /**< variable upper bounds x <= b*y + d */
238  SCIP_IMPLICS* implics; /**< implications y >=/<= b following from x <= 0 and x >= 1 (x binary), or NULL if x is not binary */
239  SCIP_CLIQUELIST* cliquelist; /**< list of cliques the variable and its negation is member of */
240  SCIP_EVENTFILTER* eventfilter; /**< event filter for events concerning this variable; not for ORIGINAL vars */
241  SCIP_BDCHGINFO* lbchginfos; /**< bound change informations for lower bound changes from root to current node */
242  SCIP_BDCHGINFO* ubchginfos; /**< bound change informations for upper bound changes from root to current node */
243  SCIP_HISTORY* history; /**< branching and inference history information */
244  SCIP_HISTORY* historycrun; /**< branching and inference history information for current run */
245  SCIP_VALUEHISTORY* valuehistory; /**< branching and inference history information which are value based, or NULL if not used */
246  SCIP_Longint closestvblpcount; /**< LP count for which the closestvlbidx/closestvubidx entries are valid */
247  int clqcomponentidx; /**< index of clique graph's connected component that the variable belongs to,
248  * or -1 if not computed */
249  int index; /**< consecutively numbered variable identifier */
250  int probindex; /**< array position in problems vars array, or -1 if not assigned to a problem */
251  int pseudocandindex; /**< array position in pseudo branching candidates array, or -1 */
252  int eventqueueindexobj; /**< array position in event queue of objective change event, or -1 */
253  int eventqueueindexlb; /**< array position in event queue of lower bound change event, or -1 */
254  int eventqueueindexub; /**< array position in event queue of upper bound change event, or -1 */
255  int parentvarssize; /**< available slots in parentvars array */
256  int nparentvars; /**< number of parent variables in aggregation tree (used slots of parentvars) */
257  int nuses; /**< number of times, this variable is referenced */
258  int nlocksdown; /**< number of locks for rounding down; if zero, rounding down is always feasible */
259  int nlocksup; /**< number of locks for rounding up; if zero, rounding up is always feasible */
260  int branchpriority; /**< priority of the variable for branching */
261  int lbchginfossize; /**< available slots in lbchginfos array */
262  int nlbchginfos; /**< number of lower bound changes from root node to current node */
263  int ubchginfossize; /**< available slots in ubchginfos array */
264  int nubchginfos; /**< number of upper bound changes from root node to current node */
265  int conflictlbcount; /**< number of last conflict, the lower bound was member of */
266  int conflictubcount; /**< number of last conflict, the upper bound was member of */
267  int closestvlbidx; /**< index of closest VLB variable in current LP solution, or -1 */
268  int closestvubidx; /**< index of closest VUB variable in current LP solution, or -1 */
269  unsigned int initial:1; /**< TRUE iff var's column should be present in the initial root LP */
270  unsigned int removable:1; /**< TRUE iff var's column is removable from the LP (due to aging or cleanup) */
271  unsigned int deletable:1; /**< TRUE iff the variable is removable from the problem */
272  unsigned int deleted:1; /**< TRUE iff variable was marked for deletion from the problem */
273  unsigned int donotmultaggr:1; /**< TRUE iff variable is not allowed to be multi-aggregated */
274  unsigned int vartype:2; /**< type of variable: binary, integer, implicit integer, continuous */
275  unsigned int varstatus:3; /**< status of variable: original, loose, column, fixed, aggregated, multiaggregated, negated */
276  unsigned int pseudocostflag:2; /**< temporary flag used in pseudo cost update */
277  unsigned int branchdirection:2; /**< preferred branching direction of the variable (downwards, upwards, auto) */
278  unsigned int eventqueueimpl:1; /**< is an IMPLADDED event on this variable currently in the event queue? */
279  unsigned int delglobalstructs:1; /**< is variable marked to be removed from global structures (cliques etc.)? */
280 };
281 
282 #ifdef __cplusplus
283 }
284 #endif
285 
286 #endif
SCIP_HOLELIST * holelist
Definition: struct_var.h:162
SCIP_BRANCHINGDATA branchingdata
Definition: struct_var.h:86
int nubchginfos
Definition: struct_var.h:264
SCIP_BDCHGIDX bdchgidx
Definition: struct_var.h:111
type definitions for implications, variable bounds, and cliques
SCIP_Real conflictlb
Definition: struct_var.h:212
unsigned int inferboundtype
Definition: struct_var.h:92
char * name
Definition: struct_var.h:228
unsigned int boundchgtype
Definition: struct_var.h:113
int eventqueueindexub
Definition: struct_var.h:254
SCIP_HOLE hole
Definition: struct_var.h:50
SCIP_Real bestrootsol
Definition: struct_var.h:206
#define SCIP_DECL_VARTRANS(x)
Definition: type_var.h:129
SCIP_DOM origdom
Definition: struct_var.h:168
SCIP_BOUNDCHG * boundchgs
Definition: struct_var.h:124
SCIP_Real constant
Definition: struct_var.h:183
SCIP_Real bestrootredcost
Definition: struct_var.h:207
SCIP_HISTORY * historycrun
Definition: struct_var.h:244
SCIP_Longint closestvblpcount
Definition: struct_var.h:246
SCIP_DOMCHGBOTH domchgboth
Definition: struct_var.h:153
SCIP_BDCHGINFO * ubchginfos
Definition: struct_var.h:242
unsigned int nboundchgs
Definition: struct_var.h:122
SCIP_HOLELIST * newlist
Definition: struct_var.h:58
SCIP_Real right
Definition: struct_var.h:44
struct SCIP_VarData SCIP_VARDATA
Definition: type_var.h:98
struct SCIP_BranchingData SCIP_BRANCHINGDATA
Definition: type_var.h:87
SCIP_Real constant
Definition: struct_var.h:193
SCIP_INFERENCEDATA inferencedata
Definition: struct_var.h:110
SCIP_HOLELIST * oldlist
Definition: struct_var.h:59
unsigned int nboundchgs
Definition: struct_var.h:130
int nlbchginfos
Definition: struct_var.h:262
#define SCIP_DECL_VARCOPY(x)
Definition: type_var.h:172
int index
Definition: struct_var.h:249
SCIP_Real constant
Definition: struct_var.h:176
unsigned int domchgtype
Definition: struct_var.h:141
SCIP_HOLECHG * holechgs
Definition: struct_var.h:133
SCIP_Real obj
Definition: struct_var.h:202
unsigned int domchgtype
Definition: struct_var.h:123
SCIP_Real relaxsol
Definition: struct_var.h:209
int conflictlbcount
Definition: struct_var.h:265
SCIP_VAR ** vars
Definition: struct_var.h:185
int branchpriority
Definition: struct_var.h:260
SCIP_VAR * var
Definition: struct_var.h:177
#define SCIP_DECL_VARDELTRANS(x)
Definition: type_var.h:142
int pseudocandindex
Definition: struct_var.h:251
SCIP_Real conflictrelaxedub
Definition: struct_var.h:215
unsigned int inferboundtype
Definition: struct_var.h:115
struct SCIP_InferenceData SCIP_INFERENCEDATA
Definition: type_var.h:88
SCIP_Real conflictrelaxedlb
Definition: struct_var.h:214
SCIP_AGGREGATE aggregate
Definition: struct_var.h:224
SCIP_Real lazylb
Definition: struct_var.h:216
SCIP_VBOUNDS * vlbs
Definition: struct_var.h:236
int lbchginfossize
Definition: struct_var.h:261
unsigned int varstatus
Definition: struct_var.h:275
SCIP_Real bestrootlpobjval
Definition: struct_var.h:208
SCIP_VARDATA * vardata
Definition: struct_var.h:233
SCIP_Real primsolavg
Definition: struct_var.h:211
SCIP_HOLECHG * holechgs
Definition: struct_var.h:143
unsigned int pos
Definition: struct_var.h:112
SCIP_VAR * transvar
Definition: struct_var.h:169
SCIP_DOMCHGDYN domchgdyn
Definition: struct_var.h:154
unsigned int initial
Definition: struct_var.h:269
SCIP_NEGATE negate
Definition: struct_var.h:226
int nparentvars
Definition: struct_var.h:256
SCIP_Real unchangedobj
Definition: struct_var.h:203
SCIP_VBOUNDS * vubs
Definition: struct_var.h:237
type definitions for problem variables
int eventqueueindexlb
Definition: struct_var.h:253
int closestvubidx
Definition: struct_var.h:268
unsigned int nboundchgs
Definition: struct_var.h:140
unsigned int branchdirection
Definition: struct_var.h:277
int ubchginfossize
Definition: struct_var.h:263
type definitions for managing events
unsigned int vartype
Definition: struct_var.h:274
int clqcomponentidx
Definition: struct_var.h:247
unsigned int boundchgtype
Definition: struct_var.h:90
SCIP_VAR * var
Definition: struct_var.h:89
SCIP_INFERENCEDATA inferencedata
Definition: struct_var.h:87
SCIP_Real ub
Definition: struct_var.h:161
unsigned int boundtype
Definition: struct_var.h:91
unsigned int deletable
Definition: struct_var.h:271
SCIP_MULTAGGR multaggr
Definition: struct_var.h:225
unsigned int deleted
Definition: struct_var.h:272
unsigned int removable
Definition: struct_var.h:270
unsigned int domchgtype
Definition: struct_var.h:131
SCIP_Real conflictub
Definition: struct_var.h:213
unsigned int redundant
Definition: struct_var.h:94
SCIP_Real oldbound
Definition: struct_var.h:107
int closestvlbidx
Definition: struct_var.h:267
int nuses
Definition: struct_var.h:257
int probindex
Definition: struct_var.h:250
SCIP * scip
Definition: struct_var.h:200
SCIP_EVENTFILTER * eventfilter
Definition: struct_var.h:240
int nlocksup
Definition: struct_var.h:259
int conflictubcount
Definition: struct_var.h:266
SCIP_DOM locdom
Definition: struct_var.h:219
SCIP_VALUEHISTORY * valuehistory
Definition: struct_var.h:245
#define SCIP_DECL_VARDELORIG(x)
Definition: type_var.h:109
SCIP_Real newbound
Definition: struct_var.h:83
type definitions for propagators
SCIP_VAR ** parentvars
Definition: struct_var.h:234
SCIP_DOMCHGBOUND domchgbound
Definition: struct_var.h:152
SCIP_HOLELIST * next
Definition: struct_var.h:51
unsigned int boundtype
Definition: struct_var.h:114
SCIP_Real lazyub
Definition: struct_var.h:217
unsigned int redundant
Definition: struct_var.h:116
unsigned int pseudocostflag
Definition: struct_var.h:276
int eventqueueindexobj
Definition: struct_var.h:252
SCIP_VAR * var
Definition: struct_var.h:109
SCIP_Real * scalars
Definition: struct_var.h:184
SCIP_IMPLICS * implics
Definition: struct_var.h:238
#define SCIP_Real
Definition: def.h:135
type definitions for branching and inference history
unsigned int eventqueueimpl
Definition: struct_var.h:278
int parentvarssize
Definition: struct_var.h:255
SCIP_CLIQUELIST * cliquelist
Definition: struct_var.h:239
SCIP_Real branchfactor
Definition: struct_var.h:204
unsigned int donotmultaggr
Definition: struct_var.h:273
#define SCIP_Longint
Definition: def.h:120
SCIP_Real nlpsol
Definition: struct_var.h:210
SCIP_BOUNDCHG * boundchgs
Definition: struct_var.h:132
SCIP_Real lb
Definition: struct_var.h:160
SCIP_DOM glbdom
Definition: struct_var.h:218
SCIP_VAR * negatedvar
Definition: struct_var.h:235
SCIP_Real newbound
Definition: struct_var.h:108
int nlocksdown
Definition: struct_var.h:258
unsigned int delglobalstructs
Definition: struct_var.h:279
SCIP_Real rootsol
Definition: struct_var.h:205
SCIP_HISTORY * history
Definition: struct_var.h:243
common defines and data types used in all packages of SCIP
SCIP_ORIGINAL original
Definition: struct_var.h:222
unsigned int applied
Definition: struct_var.h:93
SCIP_HOLELIST ** ptr
Definition: struct_var.h:57
SCIP_BOUNDCHG * boundchgs
Definition: struct_var.h:142
SCIP_COL * col
Definition: struct_var.h:223
SCIP_Real left
Definition: struct_var.h:43
type definitions for constraints and constraint handlers
SCIP_BDCHGINFO * lbchginfos
Definition: struct_var.h:241
SCIP_Real scalar
Definition: struct_var.h:175