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-2018 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 mem_vars;
133  int nids;
134  int nleaveids;
135  int pos_repr_fix;
136  int size;
137  int k;
138  int r;
139 
140  assert(scip != NULL);
141  assert(comprdata != NULL);
142 
143  *result = SCIP_DIDNOTRUN;
144 
145  size = 1;
146  currentnode = SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED ? NULL : SCIPgetCurrentNode(scip);
147 
148  if( SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED )
149  nleaveids = SCIPgetNReoptLeaves(scip, currentnode);
150  else
151  {
152  assert(currentnode != NULL);
153  nleaveids = SCIPgetNReoptLeaves(scip, currentnode);
154  }
155 
156  SCIPdebugMsg(scip, ">> start <%s> at node %llu (nleaves: %d, depth: %d)\n", COMPR_NAME,
158  nleaveids, SCIPgetStage(scip) <= SCIP_STAGE_PRESOLVED ? 0 : SCIPnodeGetDepth(currentnode));
159 
160  if( SCIPcomprGetMinNodes(compr) > nleaveids )
161  {
162  SCIPdebugMsg(scip, "-> skip compression (min. leaves = %d)\n", SCIPcomprGetMinNodes(compr));
163  return SCIP_OKAY;
164  }
165 
166  if( nleaveids == 0 )
167  {
168  SCIPdebugMsg(scip, "-> skip compression (k = %d, nleaves = %d)\n", 1, nleaveids);
169  return SCIP_OKAY;
170  }
171 
172  SCIPdebugMsg(scip, "-> try compression with %d node(s)\n", 1);
173 
174  *result = SCIP_DIDNOTFIND;
175 
176  /* collect the nodes to compress */
177  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &leaveids, nleaveids) );
178 
179  SCIP_CALL( SCIPgetReoptLeaveIDs(scip, currentnode, leaveids, nleaveids, &nids) );
180  assert(nids == nleaveids);
181 
182  /* sort the ids */
183  SCIP_CALL( sortIDs(scip, leaveids, nleaveids) );
184 
185  /* allocate memory to store the old tree */
186 
187  mem_vars = 2*SCIPgetNVars(scip);
188 
189  /* we use normal instead of buffer memory because we may need to reallocate the 2-dimensional arrays */
190  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vars, size) );
191  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vals, size) );
192  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &boundtypes, size) );
193 
194  /* allocate buffer memory */
195  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var, size) );
196  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val, size) );
197  SCIP_CALL( SCIPallocBufferArray(scip, &conss_boundtypes, size) );
198  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars, size) );
199  SCIP_CALL( SCIPallocBufferArray(scip, &nvars, size) );
200  SCIP_CALL( SCIPallocBufferArray(scip, &nconss, size) );
201 
202  /* get data of nodes */
203  for( k = size-1; k < 1; k++ )
204  {
205  SCIP_REOPTNODE* reoptnode;
206  int mem_conss;
207  int nvars2;
208  int nafterdualvars;
209  SCIPdebug(int c);
210 
211  /* we use normal instead of buffer memory because we may need to reallocate the 2-dimensional arrays */
212  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vars[k], mem_vars) );
213  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vals[k], mem_vars) );
214  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &boundtypes[k], mem_vars) );
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  assert(mem_vars >= nvars2 + nafterdualvars);
222 
223  nvars[k] = nvars2 + nafterdualvars;
224 
225  /* get the constraints */
226  mem_conss = SCIPreoptnodeGetNConss(reoptnode);
227 
228  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var[k], mem_conss) ); /*lint !e866*/
229  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val[k], mem_conss) ); /*lint !e866*/
230  SCIP_CALL( SCIPallocBufferArray(scip, &conss_boundtypes[k], mem_conss) ); /*lint !e866*/
231  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars[k], mem_conss) ); /*lint !e866*/
232 
233  SCIPreoptnodeGetConss(reoptnode, conss_var[k], conss_val[k], conss_boundtypes[k], mem_conss, &nconss[k],
234  conss_nvars[k]);
235  assert(mem_conss == nconss[k]);
236 
237 #ifdef SCIP_DEBUG
238  for( c = 0; c < mem_conss; c++ )
239  assert(conss_nvars[k][c] <= SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip));
240 #endif
241 
242 #ifndef NDEBUG
243  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
244  assert(reoptnode != NULL);
245 
246  SCIPdebugMsg(scip, "-> use node at id %u, %d vars, %d conss, lowerbound = %.g\n", leaveids[k], nvars[k],
247  SCIPreoptnodeGetNConss(reoptnode), SCIPreoptnodeGetLowerbound(reoptnode));
248 #endif
249  }
250 
251  /* perform the compression */
252  assert(comprdata->nrepresentatives == 0);
253 
254  pos_repr_fix = 1;
255 
256  /* calculate the number of representatives */
257  comprdata->nrepresentatives = (nvars[0] > 0 ? 2 : 1);
258  comprdata->nrepresentatives += nconss[0];
259 
260  /* check memory size */
261  SCIP_CALL( checkMemSize(scip, comprdata, comprdata->nrepresentatives) );
262  assert(comprdata->nrepresentatives <= comprdata->representativessize);
263 
264  /* initialize the representatives */
265  SCIP_CALL( SCIPinitRepresentation(scip, comprdata->representatives, comprdata->nrepresentatives) );
266 
267  /* create 2 candidates for the fixed variables */
268  if( nvars[0] >= 1 )
269  {
270  SCIP_Bool linear;
271  int v;
272 
273  assert(pos_repr_fix < comprdata->nrepresentatives);
274 
275  linear = TRUE; /* todo: we have to adapt the compression to handle integer variables */
276 
277  /* create a representative at position 1 with fixed branching path */
278  assert(SCIPreoptnodeGetNVars(comprdata->representatives[pos_repr_fix]) == 0);
279  for( r = pos_repr_fix; r < comprdata->nrepresentatives; r++ )
280  {
281  /* copy the branching path to all representatives */
282  assert(comprdata->representatives[r] != NULL);
283 
284  for( v = 0; v < nvars[0]; v++ )
285  {
286  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[r], vars[0][v],
287  vals[0][v], SCIPisFeasEQ(scip, vals[0][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
288  }
289  }
290 
291  /* create a representative at position 0 with an added constraint corresponding
292  * to the branching path of the node
293  */
294  assert(comprdata->representatives[pos_repr_fix-1] != NULL);
295  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[pos_repr_fix-1], vars[0], vals[0], boundtypes[k],
296  1.0, SCIPinfinity(scip), nvars[0], REOPT_CONSTYPE_DUALREDS, linear) );
297 
298  }
299 
300  assert(0 <= pos_repr_fix && pos_repr_fix < comprdata->nrepresentatives);
301 
302  /* create nconss[0] nodes for the added constraints */
303  for( k = 0; k < nconss[0]; k++ )
304  {
305  SCIP_Bool linear;
306  int v;
307 
308  assert(pos_repr_fix < comprdata->nrepresentatives);
309 
310  linear = TRUE; /* todo: we have to adapt the compression to handle integer variables */
311 
312  /* create a node with fixed bounds corresponding to constraint at position k */
313 
314  /* fix the branching path */
315  for( v = 0; v < conss_nvars[0][k]; v++ )
316  {
317  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[pos_repr_fix], conss_var[0][k][v],
318  conss_val[0][k][v], SCIPisFeasEQ(scip, conss_val[0][k][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
319  }
320 
321  /* add this constraint to all further representatives */
322  for( r = pos_repr_fix + 1; r < comprdata->nrepresentatives; r++ )
323  {
324  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[r], conss_var[0][k], conss_val[0][k],
325  conss_boundtypes[0][k], 1.0, SCIPinfinity(scip), conss_nvars[0][k], REOPT_CONSTYPE_DUALREDS, linear) );
326  }
327 
328  pos_repr_fix++;
329  }
330 
331  /* @todo use more than one node */
332 
333  *result = SCIP_SUCCESS;
334 
335  SCIPdebugMsg(scip, "-> found representation of size %d.\n", comprdata->nrepresentatives);
336 
337  /* free memory */
338  for( k = size-1; k >= 0; k-- )
339  {
340  SCIPfreeBufferArray(scip, &conss_nvars[k]);
341  SCIPfreeBufferArray(scip, &conss_val[k]);
342  SCIPfreeBufferArray(scip, &conss_var[k]);
343  SCIPfreeBlockMemoryArray(scip, &boundtypes[k], mem_vars);
344  SCIPfreeBlockMemoryArray(scip, &vals[k], mem_vars);
345  SCIPfreeBlockMemoryArray(scip, &vars[k], mem_vars);
346  }
347 
348  SCIPfreeBufferArray(scip, &nconss);
349  SCIPfreeBufferArray(scip, &nvars);
350  SCIPfreeBufferArray(scip, &conss_nvars);
351  SCIPfreeBufferArray(scip, &conss_val);
352  SCIPfreeBufferArray(scip, &conss_var);
353  SCIPfreeBlockMemoryArray(scip, &boundtypes, size);
354  SCIPfreeBlockMemoryArray(scip, &vals, size);
355  SCIPfreeBlockMemoryArray(scip, &vars, size);
356 
357  SCIPfreeBlockMemoryArray(scip, &leaveids, nleaveids);
358 
359  return SCIP_OKAY;
360 }
361 
362 /** apply the stored representation to the reopttree */
363 static
365  SCIP* scip, /**< SCIP data structure */
366  SCIP_COMPR* compr, /**< compression method */
367  SCIP_COMPRDATA* comprdata, /**< compression data */
368  SCIP_RESULT* result /**< result pointer */
369  )
370 {
371  SCIP_Bool success;
372  int r;
373 
374  assert(scip != NULL);
375  assert(compr != NULL);
376  assert(comprdata != NULL);
377 
378  *result = SCIP_DIDNOTRUN;
379 
380  if( comprdata->nrepresentatives == 0 )
381  return SCIP_OKAY;
382 
383  /* set references to the root node */
384  for( r = 0; r < comprdata->nrepresentatives; r++ )
385  SCIPreoptnodeSetParentID(comprdata->representatives[r], 0);
386 
387  success = FALSE;
388  SCIP_CALL( SCIPsetReoptCompression(scip, comprdata->representatives, comprdata->nrepresentatives, &success) );
389 
390  if( success )
391  *result = SCIP_SUCCESS;
392 
393  return SCIP_OKAY;
394 }
395 
396 /*
397  * Callback methods of tree compression
398  */
399 
400 /** copy method for tree compression plugins (called when SCIP copies plugins) */
401 static
402 SCIP_DECL_COMPRCOPY(comprCopyWeakcompr)
403 { /*lint --e{715}*/
404  assert(scip != NULL);
405  assert(compr != NULL);
406  assert(strcmp(SCIPcomprGetName(compr), COMPR_NAME) == 0);
407 
408  /* call inclusion method of primal heuristic */
410 
411  return SCIP_OKAY;
412 }
413 
414 /** destructor of tree compression to free user data (called when SCIP is exiting) */
415 static
416 SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
417 {
418  SCIP_COMPRDATA* comprdata;
419 
420  assert(scip != NULL);
421  assert(compr != NULL);
422 
423  comprdata = SCIPcomprGetData(compr);
424  assert(comprdata != NULL);
425 
426  SCIPfreeBlockMemory(scip, &comprdata);
427  SCIPcomprSetData(compr, NULL);
428 
429  return SCIP_OKAY;
430 }
431 
432 /** deinitialization method of tree compression (called before transformed problem is freed) */
433 static
434 SCIP_DECL_COMPREXIT(comprExitWeakcompr)
435 {
436  SCIP_COMPRDATA* comprdata;
437 
438  assert(scip != NULL);
439  assert(compr != NULL);
440 
441  comprdata = SCIPcomprGetData(compr);
442  assert(comprdata != NULL);
443 
444  if( comprdata->initialized )
445  {
446  int r;
447 
448  for( r = 0; r < comprdata->nrepresentatives; r++ )
449  {
450  SCIP_CALL( SCIPdeleteReoptnode(scip, &comprdata->representatives[r]) );
451  }
452 
453  if( comprdata->representativessize > 0 )
454  {
455  SCIPfreeBlockMemoryArray(scip, &comprdata->representatives, comprdata->representativessize);
456  }
457 
458  comprdata->representatives = NULL;
459  comprdata->representativessize = 0;
460  comprdata->nrepresentatives = 0;
461  comprdata->initialized = FALSE;
462  }
463 
464  return SCIP_OKAY;
465 }
466 
467 /** execution method of tree compression */
468 static
469 SCIP_DECL_COMPREXEC(comprExecWeakcompr)
470 {
471  SCIP_COMPRDATA* comprdata;
472 
473  assert(SCIPcomprIsInitialized(compr));
474 
475  comprdata = SCIPcomprGetData(compr);
476  assert(comprdata != NULL);
477 
478  if( !comprdata->initialized )
479  {
480  SCIPdebugMsg(scip, ">> initializing <%s>\n", COMPR_NAME);
481 
482  comprdata->representativessize = DEFAULT_MEM_REPR;
483  comprdata->nrepresentatives = 0;
484  SCIP_CALL( SCIPallocClearMemoryArray(scip, &comprdata->representatives, comprdata->representativessize) );
485  comprdata->initialized = TRUE;
486  }
487 
488  /* try to find a representation */
489  SCIP_CALL( constructCompression(scip, compr, comprdata, result) );
490 
491  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_DIDNOTFIND || *result == SCIP_SUCCESS);
492 
493  /* apply the representation, if some was found */
494  if( *result == SCIP_SUCCESS )
495  {
496  SCIP_CALL( applyCompression(scip, compr, comprdata, result) );
497  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_SUCCESS);
498 
499  SCIPdebugMsg(scip, "->%s apply compression.\n", *result == SCIP_DIDNOTRUN ? " did not" : "");
500  }
501 
502  return SCIP_OKAY;
503 }
504 
505 
506 /*
507  * tree compression specific interface methods
508  */
509 
510 /** creates the weakcompr tree compression and includes it in SCIP */
512  SCIP* scip /**< SCIP data structure */
513  )
514 {
515  SCIP_COMPRDATA* comprdata;
516  SCIP_COMPR* compr;
517 
518  /* create weakcompr tree compression data */
519  SCIP_CALL( SCIPallocBlockMemory(scip, &comprdata) );
520  assert(comprdata != NULL);
521  comprdata->initialized = FALSE;
522 
523  /* include tree compression */
525  comprExecWeakcompr, comprdata) );
526 
527  assert(compr != NULL);
528 
529  /* set non fundamental callbacks via setter functions */
530  SCIP_CALL( SCIPsetComprCopy(scip, compr, comprCopyWeakcompr) );
531  SCIP_CALL( SCIPsetComprExit(scip, compr, comprExitWeakcompr) );
532  SCIP_CALL( SCIPsetComprFree(scip, compr, comprFreeWeakcompr) );
533 
534  /* add weakcompr tree compression parameters */
535  SCIP_CALL( SCIPaddBoolParam(scip, "compression/" COMPR_NAME "/convertconss", "convert constraints into nodes", &comprdata->convertconss, FALSE, FALSE, NULL, NULL) );
536 
537  return SCIP_OKAY;
538 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:22604
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
int SCIPgetNIntVars(SCIP *scip)
Definition: scip.c:11902
#define DEFAULT_MEM_REPR
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip.h:22593
SCIP_RETCODE SCIPsetComprFree(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRFREE((*comprfree)))
Definition: scip.c:8379
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip.h:22587
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:47298
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:41404
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:821
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:47028
#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:8325
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:22602
public methods for reoptimization
SCIP_RETCODE SCIPinitRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip.c:16985
void SCIPsortDownRealInt(SCIP_Real *realarray, int *intarray, int len)
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7352
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:22632
SCIP_COMPRDATA * SCIPcomprGetData(SCIP_COMPR *compr)
Definition: compr.c:306
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip.h:22585
#define SCIPdebugMsg
Definition: scip.h:455
#define COMPR_PRIORITY
SCIP_RETCODE SCIPdeleteReoptnode(SCIP *scip, SCIP_REOPTNODE **reoptnode)
Definition: scip.c:17499
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7342
SCIP_RETCODE SCIPsetReoptCompression(SCIP *scip, SCIP_REOPTNODE **representation, int nrepresentatives, SCIP_Bool *success)
Definition: scip.c:16900
weakcompr tree compression
SCIP_RETCODE SCIPsetComprCopy(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRCOPY((*comprcopy)))
Definition: scip.c:8363
methods for block memory pools and memory buffers
void SCIPreoptnodeSetParentID(SCIP_REOPTNODE *reoptnode, unsigned int parentid)
Definition: reopt.c:5898
internal miscellaneous methods
static SCIP_DECL_COMPREXEC(comprExecWeakcompr)
static SCIP_DECL_COMPREXIT(comprExitWeakcompr)
#define SCIP_CALL(x)
Definition: def.h:350
struct SCIP_ComprData SCIP_COMPRDATA
Definition: type_compr.h:40
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:22620
int SCIPreoptnodeGetNVars(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5798
#define SCIP_Bool
Definition: def.h:61
SCIP_Real SCIPreoptnodeGetLowerbound(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5841
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:16928
SCIP_RETCODE SCIPaddReoptnodeBndchg(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR *var, SCIP_Real bound, SCIP_BOUNDTYPE boundtype)
Definition: scip.c:16872
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:16956
SCIP_RETCODE SCIPincludeComprWeakcompr(SCIP *scip)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:11857
#define SCIPallocClearMemoryArray(scip, ptr, num)
Definition: scip.h:22555
int SCIPgetNVars(SCIP *scip)
Definition: scip.c:11812
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:5861
SCIP_RETCODE SCIPsetComprExit(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPREXIT((*comprexit)))
Definition: scip.c:8411
#define COMPR_DESC
#define SCIP_Real
Definition: def.h:149
SCIP_RETCODE SCIPgetReoptLeaveIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int idssize, int *nids)
Definition: scip.c:16797
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:16850
int SCIPgetNReoptLeaves(SCIP *scip, SCIP_NODE *node)
Definition: scip.c:16837
#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:4239
static SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
int SCIPreoptnodeGetNConss(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:5808