Scippy

SCIP

Solving Constraint Integer Programs

compr_weakcompr.c
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 compr_weakcompr.c
17  * @brief weakcompr tree compression
18  * @author Jakob Witzig
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #include <assert.h>
24 #include <string.h>
25 
26 #include "scip/mem.h"
27 #include "scip/misc.h"
28 #include "scip/compr_weakcompr.h"
29 #include "scip/compr.h"
30 #include "scip/pub_reopt.h"
31 
32 #define COMPR_NAME "weakcompr"
33 #define COMPR_DESC "reduce the search frontier to k+1 or max{2, |C|+1} nodes."
34 #define COMPR_PRIORITY 1000
35 #define COMPR_MINNNODES 50
36 
37 #define DEFAULT_MEM_REPR 2 /* since we cannot convert the added constraints into node currently, we choose 2 as default value */
38 /*
39  * Data structures
40  */
41 
42 /** tree compression data */
43 struct SCIP_ComprData
44 {
45  /* representative data */
46  SCIP_REOPTNODE** representatives; /**< list of representatives */
47  int nrepresentatives; /**< number of representatives */
48  int representativessize;/**< size of array representatives */
49  SCIP_Bool initialized; /**< was compressor data initialized? */
50 
51  /* parameter */
52  SCIP_Bool convertconss; /**< convert added logic-or constraints of size k into k nodes */
53 };
54 
55 
56 /*
57  * Local methods
58  */
59 
60 /** sort the ids of child nodes by their dual bound of the last iteration */
61 static
63  SCIP* scip, /**< SCIP data structure */
64  unsigned int* childids, /**< array of child ids */
65  int nchildids /**< first position */
66  )
67 {
68  SCIP_Real* lowerbounds;
69  int i;
70 
71  SCIP_CALL( SCIPallocBufferArray(scip, &lowerbounds, nchildids) );
72 
73  for( i = 0; i < nchildids; i++ )
74  {
75  lowerbounds[i] = SCIPreoptnodeGetLowerbound(SCIPgetReoptnode(scip, childids[i]));
76  }
77 
78  /* sort the ids in decreasing order */
79  SCIPsortDownRealInt(lowerbounds, (signed int*)childids, nchildids);
80 
81  /* free buffer memory */
82  SCIPfreeBufferArray(scip, &lowerbounds);
83 
84  return SCIP_OKAY;
85 }
86 
87 /** check of enough memory is allocated and reallocate of necessary. */
88 static
90  SCIP* scip, /**< SCIP data structure */
91  SCIP_COMPRDATA* comprdata, /**< compression data */
92  int nrepresentatives /**< number of representatives */
93  )
94 {
95  assert(scip != NULL);
96  assert(comprdata != NULL);
97 
98  if( comprdata->representativessize < nrepresentatives )
99  {
100  SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &comprdata->representatives, comprdata->representativessize, nrepresentatives) );
101  comprdata->representativessize = nrepresentatives;
102  }
103 
104  return SCIP_OKAY;
105 }
106 
107 /** try to find a good representation
108  *
109  * @todo implement:
110  * 1) using k nodes without added constraint;
111  * 2) resolve the added nods via some kind of interdiction branching
112  */
113 static
115  SCIP* scip, /**< SCIP data structure */
116  SCIP_COMPR* compr, /**< compression method */
117  SCIP_COMPRDATA* comprdata, /**< compression data */
118  SCIP_RESULT* result /**< result pointer */
119  )
120 {
121  SCIP_NODE* currentnode;
122  SCIP_VAR**** conss_var;
123  SCIP_VAR*** vars;
124  SCIP_Real*** conss_val;
125  SCIP_Real** vals;
126  SCIP_BOUNDTYPE** boundtypes;
127  SCIP_BOUNDTYPE*** conss_boundtypes;
128  int** conss_nvars;
129  unsigned int* leaveids;
130  int* nconss;
131  int* nvars;
132  int nids;
133  int nleaveids;
134  int pos_repr_fix;
135  int size;
136  int k;
137  int r;
138 
139  assert(scip != NULL);
140  assert(comprdata != NULL);
141 
142  *result = SCIP_DIDNOTRUN;
143 
144  size = 1;
145  currentnode = SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED ? NULL : SCIPgetCurrentNode(scip);
146 
147  if( SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED )
148  nleaveids = SCIPgetNReoptLeaves(scip, currentnode);
149  else
150  {
151  assert(currentnode != NULL);
152  nleaveids = SCIPgetNReoptLeaves(scip, currentnode);
153  }
154 
155  SCIPdebugMsg(scip, ">> start <%s> at node %llu (nleaves: %d, depth: %d)\n", COMPR_NAME,
157  nleaveids, SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED ? 0 : SCIPnodeGetDepth(currentnode));
158 
159  if( SCIPcomprGetMinNodes(compr) > nleaveids )
160  {
161  SCIPdebugMsg(scip, "-> skip compression (min. leaves = %d)\n", SCIPcomprGetMinNodes(compr));
162  return SCIP_OKAY;
163  }
164 
165  if( nleaveids == 0 )
166  {
167  SCIPdebugMsg(scip, "-> skip compression (k = %d, nleaves = %d)\n", 1, nleaveids);
168  return SCIP_OKAY;
169  }
170 
171  SCIPdebugMsg(scip, "-> try compression with %d node(s)\n", 1);
172 
173  *result = SCIP_DIDNOTFIND;
174 
175  /* collect the nodes to compress */
176  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &leaveids, nleaveids) );
177 
178  SCIP_CALL( SCIPgetReoptLeaveIDs(scip, currentnode, leaveids, nleaveids, &nids) );
179  assert(nids == nleaveids);
180 
181  /* sort the ids */
182  SCIP_CALL( sortIDs(scip, leaveids, nleaveids) );
183 
184  /* allocate memory to store the old tree */
185 
186  /* we use normal instead of buffer memory because we may need to reallocate the 2-dimensional arrays */
187  SCIP_CALL( SCIPallocMemoryArray(scip, &vars, size) );
188  SCIP_CALL( SCIPallocMemoryArray(scip, &vals, size) );
189  SCIP_CALL( SCIPallocMemoryArray(scip, &boundtypes, size) );
190 
191  /* allocate buffer memory */
192  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var, size) );
193  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val, size) );
194  SCIP_CALL( SCIPallocBufferArray(scip, &conss_boundtypes, size) );
195  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars, size) );
196  SCIP_CALL( SCIPallocBufferArray(scip, &nvars, size) );
197  SCIP_CALL( SCIPallocBufferArray(scip, &nconss, size) );
198 
199  /* get data of nodes */
200  for( k = size-1; k < 1; k++ )
201  {
202  SCIP_REOPTNODE* reoptnode;
203  int mem_vars;
204  int mem_conss;
205  int nvars2;
206  int nafterdualvars;
207  SCIPdebug(int c);
208 
209  mem_vars = SCIPgetNBinVars(scip);
210 
211  /* we use normal instead of buffer memory because we may need to reallocate the 2-dimensional arrays */
212  SCIP_CALL( SCIPallocMemoryArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
213  SCIP_CALL( SCIPallocMemoryArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
214  SCIP_CALL( SCIPallocMemoryArray(scip, &boundtypes[k], mem_vars) ); /*lint !e866*/
215 
216  /* get the branching path */
217  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
218  assert(reoptnode != NULL);
219 
220  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], boundtypes[k], mem_vars, &nvars2, &nafterdualvars);
221 
222  /* reallocate memory */
223  if( mem_vars < nvars2 + nafterdualvars )
224  {
225  mem_vars = nvars2 + nafterdualvars;
226  SCIP_CALL( SCIPreallocMemoryArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
227  SCIP_CALL( SCIPreallocMemoryArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
228  SCIP_CALL( SCIPreallocMemoryArray(scip, &boundtypes[k], mem_vars) ); /*lint !e866*/
229 
230  /* get the branching path */
231  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], boundtypes[k], mem_vars, &nvars2, &nafterdualvars);
232  }
233 
234  nvars[k] = nvars2 + nafterdualvars;
235 
236  /* get the constraints */
237  mem_conss = SCIPreoptnodeGetNConss(reoptnode);
238 
239  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var[k], mem_conss) ); /*lint !e866*/
240  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val[k], mem_conss) ); /*lint !e866*/
241  SCIP_CALL( SCIPallocBufferArray(scip, &conss_boundtypes[k], mem_conss) ); /*lint !e866*/
242  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars[k], mem_conss) ); /*lint !e866*/
243 
244  SCIPreoptnodeGetConss(reoptnode, conss_var[k], conss_val[k], conss_boundtypes[k], mem_conss, &nconss[k],
245  conss_nvars[k]);
246  assert(mem_conss == nconss[k]);
247 
248 #ifdef SCIP_DEBUG
249  for( c = 0; c < mem_conss; c++ )
250  assert(conss_nvars[k][c] <= SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip));
251 #endif
252 
253 #ifndef NDEBUG
254  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
255  assert(reoptnode != NULL);
256 
257  SCIPdebugMsg(scip, "-> use node at id %u, %d vars, %d conss, lowerbound = %.g\n", leaveids[k], nvars[k],
258  SCIPreoptnodeGetNConss(reoptnode), SCIPreoptnodeGetLowerbound(reoptnode));
259 #endif
260  }
261 
262  /* perform the compression */
263  assert(comprdata->nrepresentatives == 0);
264 
265  pos_repr_fix = 1;
266 
267  /* calculate the number of representatives */
268  comprdata->nrepresentatives = (nvars[0] > 0 ? 2 : 1);
269  comprdata->nrepresentatives += nconss[0];
270 
271  /* check memory size */
272  SCIP_CALL( checkMemSize(scip, comprdata, comprdata->nrepresentatives) );
273  assert(comprdata->nrepresentatives <= comprdata->representativessize);
274 
275  /* initialize the representatives */
276  SCIP_CALL( SCIPinitRepresentation(scip, comprdata->representatives, comprdata->nrepresentatives) );
277 
278  /* create 2 candidates for the fixed variables */
279  if( nvars[0] >= 1 )
280  {
281  SCIP_Bool linear;
282  int v;
283 
284  assert(pos_repr_fix < comprdata->nrepresentatives);
285 
286  linear = TRUE; /* todo: we have to adapt the compression to handle integer variables */
287 
288  /* create a representative at position 1 with fixed branching path */
289  assert(SCIPreoptnodeGetNVars(comprdata->representatives[pos_repr_fix]) == 0);
290  for( r = pos_repr_fix; r < comprdata->nrepresentatives; r++ )
291  {
292  /* copy the branching path to all representatives */
293  assert(comprdata->representatives[r] != NULL);
294 
295  for( v = 0; v < nvars[0]; v++ )
296  {
297  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[r], vars[0][v],
298  vals[0][v], SCIPisFeasEQ(scip, vals[0][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
299  }
300  }
301 
302  /* create a representative at position 0 with an added constraint corresponding
303  * to the branching path of the node
304  */
305  assert(comprdata->representatives[pos_repr_fix-1] != NULL);
306  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[pos_repr_fix-1], vars[0], vals[0], boundtypes[k],
307  1.0, SCIPinfinity(scip), nvars[0], REOPT_CONSTYPE_DUALREDS, linear) );
308 
309  }
310 
311  assert(0 <= pos_repr_fix && pos_repr_fix < comprdata->nrepresentatives);
312 
313  /* create nconss[0] nodes for the added constraints */
314  for( k = 0; k < nconss[0]; k++ )
315  {
316  SCIP_Bool linear;
317  int v;
318 
319  assert(pos_repr_fix < comprdata->nrepresentatives);
320 
321  linear = TRUE; /* todo: we have to adapt the compression to handle integer variables */
322 
323  /* create a node with fixed bounds corresponding to constraint at position k */
324 
325  /* fix the branching path */
326  for( v = 0; v < conss_nvars[0][k]; v++ )
327  {
328  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[pos_repr_fix], conss_var[0][k][v],
329  conss_val[0][k][v], SCIPisFeasEQ(scip, conss_val[0][k][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
330  }
331 
332  /* add this constraint to all further representatives */
333  for( r = pos_repr_fix + 1; r < comprdata->nrepresentatives; r++ )
334  {
335  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[r], conss_var[0][k], conss_val[0][k],
336  conss_boundtypes[0][k], 1.0, SCIPinfinity(scip), conss_nvars[0][k], REOPT_CONSTYPE_DUALREDS, linear) );
337  }
338 
339  pos_repr_fix++;
340  }
341 
342  /* @todo use more than one node */
343 
344  *result = SCIP_SUCCESS;
345 
346  SCIPdebugMsg(scip, "-> found representation of size %d.\n", comprdata->nrepresentatives);
347 
348  /* free memory */
349  for( k = size-1; k >= 0; k-- )
350  {
351  SCIPfreeBufferArray(scip, &conss_nvars[k]);
352  SCIPfreeBufferArray(scip, &conss_val[k]);
353  SCIPfreeBufferArray(scip, &conss_var[k]);
354  SCIPfreeMemoryArray(scip, &boundtypes[k]);
355  SCIPfreeMemoryArray(scip, &vals[k]);
356  SCIPfreeMemoryArray(scip, &vars[k]);
357  }
358 
359  SCIPfreeBufferArray(scip, &nconss);
360  SCIPfreeBufferArray(scip, &nvars);
361  SCIPfreeBufferArray(scip, &conss_nvars);
362  SCIPfreeBufferArray(scip, &conss_val);
363  SCIPfreeBufferArray(scip, &conss_var);
364  SCIPfreeMemoryArray(scip, &boundtypes);
365  SCIPfreeMemoryArray(scip, &vals);
366  SCIPfreeMemoryArray(scip, &vars);
367 
368  SCIPfreeBlockMemoryArray(scip, &leaveids, nleaveids);
369 
370  return SCIP_OKAY;
371 }
372 
373 /** apply the stored representation to the reopttree */
374 static
376  SCIP* scip, /**< SCIP data structure */
377  SCIP_COMPR* compr, /**< compression method */
378  SCIP_COMPRDATA* comprdata, /**< compression data */
379  SCIP_RESULT* result /**< result pointer */
380  )
381 {
382  SCIP_Bool success;
383  int r;
384 
385  assert(scip != NULL);
386  assert(compr != NULL);
387  assert(comprdata != NULL);
388 
389  *result = SCIP_DIDNOTRUN;
390 
391  if( comprdata->nrepresentatives == 0 )
392  return SCIP_OKAY;
393 
394  /* set references to the root node */
395  for( r = 0; r < comprdata->nrepresentatives; r++ )
396  SCIPreoptnodeSetParentID(comprdata->representatives[r], 0);
397 
398  success = FALSE;
399  SCIP_CALL( SCIPsetReoptCompression(scip, comprdata->representatives, comprdata->nrepresentatives, &success) );
400 
401  if( success )
402  *result = SCIP_SUCCESS;
403 
404  return SCIP_OKAY;
405 }
406 
407 /*
408  * Callback methods of tree compression
409  */
410 
411 /** copy method for tree compression plugins (called when SCIP copies plugins) */
412 static
413 SCIP_DECL_COMPRCOPY(comprCopyWeakcompr)
414 { /*lint --e{715}*/
415  assert(scip != NULL);
416  assert(compr != NULL);
417  assert(strcmp(SCIPcomprGetName(compr), COMPR_NAME) == 0);
418 
419  /* call inclusion method of primal heuristic */
421 
422  return SCIP_OKAY;
423 }
424 
425 /** destructor of tree compression to free user data (called when SCIP is exiting) */
426 static
427 SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
428 {
429  SCIP_COMPRDATA* comprdata;
430 
431  assert(scip != NULL);
432  assert(compr != NULL);
433 
434  comprdata = SCIPcomprGetData(compr);
435  assert(comprdata != NULL);
436 
437  SCIPfreeBlockMemory(scip, &comprdata);
438  SCIPcomprSetData(compr, NULL);
439 
440  return SCIP_OKAY;
441 }
442 
443 /** deinitialization method of tree compression (called before transformed problem is freed) */
444 static
445 SCIP_DECL_COMPREXIT(comprExitWeakcompr)
446 {
447  SCIP_COMPRDATA* comprdata;
448 
449  assert(scip != NULL);
450  assert(compr != NULL);
451 
452  comprdata = SCIPcomprGetData(compr);
453  assert(comprdata != NULL);
454 
455  if( comprdata->initialized )
456  {
457  int r;
458 
459  for( r = 0; r < comprdata->nrepresentatives; r++ )
460  {
461  SCIP_CALL( SCIPdeleteReoptnode(scip, &comprdata->representatives[r]) );
462  }
463 
464  if( comprdata->representativessize > 0 )
465  {
466  SCIPfreeBlockMemoryArray(scip, &comprdata->representatives, comprdata->representativessize);
467  }
468 
469  comprdata->representatives = NULL;
470  comprdata->representativessize = 0;
471  comprdata->nrepresentatives = 0;
472  comprdata->initialized = FALSE;
473  }
474 
475  return SCIP_OKAY;
476 }
477 
478 /** execution method of tree compression */
479 static
480 SCIP_DECL_COMPREXEC(comprExecWeakcompr)
481 {
482  SCIP_COMPRDATA* comprdata;
483 
484  assert(SCIPcomprIsInitialized(compr));
485 
486  comprdata = SCIPcomprGetData(compr);
487  assert(comprdata != NULL);
488 
489  if( !comprdata->initialized )
490  {
491  SCIPdebugMsg(scip, ">> initializing <%s>\n", COMPR_NAME);
492 
493  comprdata->representativessize = DEFAULT_MEM_REPR;
494  comprdata->nrepresentatives = 0;
495  SCIP_CALL( SCIPallocClearMemoryArray(scip, &comprdata->representatives, comprdata->representativessize) );
496  comprdata->initialized = TRUE;
497  }
498 
499  /* try to find a representation */
500  SCIP_CALL( constructCompression(scip, compr, comprdata, result) );
501 
502  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_DIDNOTFIND || *result == SCIP_SUCCESS);
503 
504  /* apply the representation, if some was found */
505  if( *result == SCIP_SUCCESS )
506  {
507  SCIP_CALL( applyCompression(scip, compr, comprdata, result) );
508  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_SUCCESS);
509 
510  SCIPdebugMsg(scip, "->%s apply compression.\n", *result == SCIP_DIDNOTRUN ? " did not" : "");
511  }
512 
513  return SCIP_OKAY;
514 }
515 
516 
517 /*
518  * tree compression specific interface methods
519  */
520 
521 /** creates the weakcompr tree compression and includes it in SCIP */
523  SCIP* scip /**< SCIP data structure */
524  )
525 {
526  SCIP_COMPRDATA* comprdata;
527  SCIP_COMPR* compr;
528 
529  /* create weakcompr tree compression data */
530  SCIP_CALL( SCIPallocBlockMemory(scip, &comprdata) );
531  assert(comprdata != NULL);
532  comprdata->initialized = FALSE;
533 
534  /* include tree compression */
536  comprExecWeakcompr, comprdata) );
537 
538  assert(compr != NULL);
539 
540  /* set non fundamental callbacks via setter functions */
541  SCIP_CALL( SCIPsetComprCopy(scip, compr, comprCopyWeakcompr) );
542  SCIP_CALL( SCIPsetComprExit(scip, compr, comprExitWeakcompr) );
543  SCIP_CALL( SCIPsetComprFree(scip, compr, comprFreeWeakcompr) );
544 
545  /* add weakcompr tree compression parameters */
546  SCIP_CALL( SCIPaddBoolParam(scip, "compression/" COMPR_NAME "/convertconss", "convert constraints into nodes", &comprdata->convertconss, FALSE, FALSE, NULL, NULL) );
547 
548  return SCIP_OKAY;
549 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:21975
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:11770
#define DEFAULT_MEM_REPR
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip.h:21964
SCIP_RETCODE SCIPsetComprFree(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRFREE((*comprfree)))
Definition: scip.c:8329
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip.h:21958
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:46320
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:40680
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:814
int SCIPcomprGetMinNodes(SCIP_COMPR *compr)
Definition: compr.c:453
SCIP_Bool SCIPcomprIsInitialized(SCIP_COMPR *compr)
Definition: compr.c:483
#define FALSE
Definition: def.h:64
static SCIP_DECL_COMPRCOPY(comprCopyWeakcompr)
SCIP_Real SCIPinfinity(SCIP *scip)
Definition: scip.c:46050
#define TRUE
Definition: def.h:63
#define SCIPdebug(x)
Definition: pub_message.h:74
SCIP_RETCODE SCIPincludeComprBasic(SCIP *scip, SCIP_COMPR **compr, const char *name, const char *desc, int priority, int minnnodes, SCIP_DECL_COMPREXEC((*comprexec)), SCIP_COMPRDATA *comprdata)
Definition: scip.c:8275
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
static SCIP_RETCODE sortIDs(SCIP *scip, unsigned int *childids, int nchildids)
static SCIP_RETCODE checkMemSize(SCIP *scip, SCIP_COMPRDATA *comprdata, int nrepresentatives)
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip.h:21973
public methods for reoptimization
SCIP_RETCODE SCIPinitRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip.c:16680
void SCIPsortDownRealInt(SCIP_Real *realarray, int *intarray, int len)
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7182
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:22003
SCIP_COMPRDATA * SCIPcomprGetData(SCIP_COMPR *compr)
Definition: compr.c:306
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip.h:21956
#define SCIPdebugMsg
Definition: scip.h:451
#define COMPR_PRIORITY
SCIP_RETCODE SCIPdeleteReoptnode(SCIP *scip, SCIP_REOPTNODE **reoptnode)
Definition: scip.c:17194
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7172
SCIP_RETCODE SCIPsetReoptCompression(SCIP *scip, SCIP_REOPTNODE **representation, int nrepresentatives, SCIP_Bool *success)
Definition: scip.c:16595
weakcompr tree compression
SCIP_RETCODE SCIPsetComprCopy(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRCOPY((*comprcopy)))
Definition: scip.c:8313
methods for block memory pools and memory buffers
void SCIPreoptnodeSetParentID(SCIP_REOPTNODE *reoptnode, unsigned int parentid)
Definition: reopt.c:5850
internal miscellaneous methods
#define NULL
Definition: lpi_spx1.cpp:137
static SCIP_DECL_COMPREXEC(comprExecWeakcompr)
static SCIP_DECL_COMPREXIT(comprExitWeakcompr)
#define SCIP_CALL(x)
Definition: def.h:316
struct SCIP_ComprData SCIP_COMPRDATA
Definition: type_compr.h:40
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:21991
int SCIPreoptnodeGetNVars(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5750
#define SCIP_Bool
Definition: def.h:61
SCIP_Real SCIPreoptnodeGetLowerbound(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5793
static SCIP_RETCODE applyCompression(SCIP *scip, SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata, SCIP_RESULT *result)
SCIP_RETCODE SCIPaddReoptnodeCons(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR **vars, SCIP_Real *vals, SCIP_BOUNDTYPE *boundtypes, SCIP_Real lhs, SCIP_Real rhs, int nvars, REOPT_CONSTYPE constype, SCIP_Bool linear)
Definition: scip.c:16623
SCIP_RETCODE SCIPaddReoptnodeBndchg(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR *var, SCIP_Real bound, SCIP_BOUNDTYPE boundtype)
Definition: scip.c:16567
#define SCIPfreeMemoryArray(scip, ptr)
Definition: scip.h:21940
#define SCIPreallocMemoryArray(scip, ptr, newnum)
Definition: scip.h:21930
void SCIPgetReoptnodePath(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR **vars, SCIP_Real *vals, SCIP_BOUNDTYPE *boundtypes, int mem, int *nvars, int *nafterdualvars)
Definition: scip.c:16651
#define SCIPallocMemoryArray(scip, ptr, num)
Definition: scip.h:21924
SCIP_RETCODE SCIPincludeComprWeakcompr(SCIP *scip)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:11725
#define SCIPallocClearMemoryArray(scip, ptr, num)
Definition: scip.h:21926
const char * SCIPcomprGetName(SCIP_COMPR *compr)
Definition: compr.c:409
#define COMPR_NAME
internal methods for tree compressions
void SCIPreoptnodeGetConss(SCIP_REOPTNODE *reoptnode, SCIP_VAR ***vars, SCIP_Real **bounds, SCIP_BOUNDTYPE **boundtypes, int mem, int *nconss, int *nvars)
Definition: reopt.c:5813
SCIP_RETCODE SCIPsetComprExit(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPREXIT((*comprexit)))
Definition: scip.c:8361
#define COMPR_DESC
#define SCIP_Real
Definition: def.h:145
SCIP_RETCODE SCIPgetReoptLeaveIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int idssize, int *nids)
Definition: scip.c:16492
static SCIP_RETCODE constructCompression(SCIP *scip, SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata, SCIP_RESULT *result)
void SCIPcomprSetData(SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata)
Definition: compr.c:316
SCIP_REOPTNODE * SCIPgetReoptnode(SCIP *scip, unsigned int id)
Definition: scip.c:16545
int SCIPgetNReoptLeaves(SCIP *scip, SCIP_NODE *node)
Definition: scip.c:16532
#define COMPR_MINNNODES
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip.c:4211
static SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
int SCIPreoptnodeGetNConss(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5760