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-2016 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** bounds;
127  int** conss_nvars;
128  unsigned int* leaveids;
129  int* nconss;
130  int* nvars;
131  int depth;
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  depth = 0;
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  depth = SCIPnodeGetDepth(currentnode);
155  }
156 
157  SCIPdebugMessage(">> start <%s> at node %llu (nleaves: %d, depth: %d)\n", COMPR_NAME,
159  nleaveids, depth);
160 
161  if( SCIPcomprGetMinNodes(compr) > nleaveids )
162  {
163  SCIPdebugMessage("-> skip compression (min. leaves = %d)\n", SCIPcomprGetMinNodes(compr));
164  return SCIP_OKAY;
165  }
166 
167  if( nleaveids == 0 )
168  {
169  SCIPdebugMessage("-> skip compression (k = %d, nleaves = %d)\n", 1, nleaveids);
170  return SCIP_OKAY;
171  }
172 
173  SCIPdebugMessage("-> try compression with %d node(s)\n", 1);
174 
175  *result = SCIP_DIDNOTFIND;
176 
177  /* collect the nodes to compress */
178  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &leaveids, nleaveids) );
179 
180  SCIP_CALL( SCIPgetReoptLeaveIDs(scip, currentnode, leaveids, nleaveids, &nids) );
181  assert(nids == nleaveids);
182 
183  /* sort the ids */
184  SCIP_CALL( sortIDs(scip, leaveids, nleaveids) );
185 
186  /* allocate memory to store the old tree */
187  SCIP_CALL( SCIPallocBufferArray(scip, &vars, size) );
188  SCIP_CALL( SCIPallocBufferArray(scip, &vals, size) );
189  SCIP_CALL( SCIPallocBufferArray(scip, &bounds, size) );
190  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var, size) );
191  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val, size) );
192  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars, size) );
193  SCIP_CALL( SCIPallocBufferArray(scip, &nvars, size) );
194  SCIP_CALL( SCIPallocBufferArray(scip, &nconss, size) );
195 
196  /* get data of nodes */
197  for(k = size-1; k < 1; k++)
198  {
199  SCIP_REOPTNODE* reoptnode;
200  int mem_vars;
201  int mem_conss;
202  int nvars2;
203  int nafterdualvars;
204  SCIPdebug(int c);
205 
206  mem_vars = SCIPgetNBinVars(scip);
207 
208  /* allocate memory */
209  SCIP_CALL( SCIPallocBufferArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
210  SCIP_CALL( SCIPallocBufferArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
211  SCIP_CALL( SCIPallocBufferArray(scip, &bounds[k], mem_vars) ); /*lint !e866*/
212 
213  /* get the branching path */
214  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
215  assert(reoptnode != NULL);
216 
217  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], bounds[k], mem_vars, &nvars2, &nafterdualvars);
218 
219  /* reallocate memory */
220  if( mem_vars < nvars2 + nafterdualvars )
221  {
222  mem_vars = nvars2 + nafterdualvars;
223  SCIP_CALL( SCIPreallocBufferArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
224  SCIP_CALL( SCIPreallocBufferArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
225  SCIP_CALL( SCIPreallocBufferArray(scip, &bounds[k], mem_vars) ); /*lint !e866*/
226 
227  /* get the branching path */
228  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], bounds[k], mem_vars, &nvars2, &nafterdualvars);
229  }
230 
231  nvars[k] = nvars2 + nafterdualvars;
232 
233  /* get the constraints */
234  mem_conss = SCIPreoptnodeGetNConss(reoptnode);
235 
236  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var[k], mem_conss) ); /*lint !e866*/
237  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val[k], mem_conss) ); /*lint !e866*/
238  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars[k], mem_conss) ); /*lint !e866*/
239 
240  SCIPreoptnodeGetConss(reoptnode, conss_var[k], conss_val[k], mem_conss, &nconss[k], conss_nvars[k]);
241  assert(mem_conss == nconss[k]);
242 
243 #ifdef SCIP_DEBUG
244  for(c = 0; c < mem_conss; c++)
245  assert(conss_nvars[k][c] <= SCIPgetNBinVars(scip));
246 #endif
247 
248 #ifndef NDEBUG
249  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
250  assert(reoptnode != NULL);
251 
252  SCIPdebugMessage("-> use node at id %u, %d vars, %d conss, lowerbound = %.g\n", leaveids[k], nvars[k],
253  SCIPreoptnodeGetNConss(reoptnode), SCIPreoptnodeGetLowerbound(reoptnode));
254 #endif
255  }
256 
257  /* perform the compression */
258  assert(comprdata->nrepresentatives == 0);
259 
260  pos_repr_fix = 1;
261 
262  /* calculate the number of representatives */
263  comprdata->nrepresentatives = (nvars[0] > 0 ? 2 : 1);
264  comprdata->nrepresentatives += nconss[0];
265 
266  /* check memory size */
267  SCIP_CALL( checkMemSize(scip, comprdata, comprdata->nrepresentatives) );
268  assert(comprdata->nrepresentatives <= comprdata->representativessize);
269 
270  /* initialize the representatives */
271  SCIP_CALL( SCIPinitRepresentation(scip, comprdata->representatives, comprdata->nrepresentatives) );
272 
273  /* create 2 candidates for the fixed variables */
274  if( nvars[0] >= 1 )
275  {
276  int v;
277 
278  assert(pos_repr_fix < comprdata->nrepresentatives);
279 
280  /* create a representative at position 1 with fixed branching path */
281  assert(SCIPreoptnodeGetNVars(comprdata->representatives[pos_repr_fix]) == 0);
282  for(r = pos_repr_fix; r < comprdata->nrepresentatives; r++)
283  {
284  /* copy the branching path to all representatives */
285  assert(comprdata->representatives[r] != NULL);
286 
287  for(v = 0; v < nvars[0]; v++)
288  {
289  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[r], vars[0][v],
290  vals[0][v], SCIPisFeasEQ(scip, vals[0][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
291  }
292  }
293 
294  /* create a representative at position 0 with an added constraint corresponding
295  * to the branching path of the node*/
296  assert(comprdata->representatives[pos_repr_fix-1] != NULL);
297  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[pos_repr_fix-1], vars[0], vals[0], nvars[0], REOPT_CONSTYPE_STRBRANCHED) );
298 
299  }
300 
301  assert(0 <= pos_repr_fix && pos_repr_fix < comprdata->nrepresentatives);
302 
303  /* create nconss[0] nodes for the added constraints */
304  for(k = 0; k < nconss[0]; k++)
305  {
306  int v;
307 
308  assert(pos_repr_fix < comprdata->nrepresentatives);
309 
310  /* create a node with fixed bounds corresponding to constraint at position k */
311 
312  /* fix the branching path */
313  for(v = 0; v < conss_nvars[0][k]; v++)
314  {
315  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[pos_repr_fix], conss_var[0][k][v], conss_val[0][k][v],
316  SCIPisFeasEQ(scip, conss_val[0][k][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
317  }
318 
319  /* add this constraint to all further representatives */
320  for(r = pos_repr_fix+1; r < comprdata->nrepresentatives; r++)
321  {
322  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[r], conss_var[0][k], conss_val[0][k],
323  conss_nvars[0][k], REOPT_CONSTYPE_STRBRANCHED) );
324  }
325 
326  pos_repr_fix++;
327  }
328 
329  /* @todo use more than one node */
330 
331  *result = SCIP_SUCCESS;
332 
333  SCIPdebugMessage("-> found representation of size %d.\n", comprdata->nrepresentatives);
334 
335  /* free memory */
336  for(k = size-1; k >= 0; k--)
337  {
338  SCIPfreeBufferArray(scip, &conss_nvars[k]);
339  SCIPfreeBufferArray(scip, &conss_val[k]);
340  SCIPfreeBufferArray(scip, &conss_var[k]);
341  SCIPfreeBufferArray(scip, &bounds[k]);
342  SCIPfreeBufferArray(scip, &vals[k]);
343  SCIPfreeBufferArray(scip, &vars[k]);
344  }
345 
346  SCIPfreeBufferArray(scip, &nconss);
347  SCIPfreeBufferArray(scip, &nvars);
348  SCIPfreeBufferArray(scip, &conss_nvars);
349  SCIPfreeBufferArray(scip, &conss_val);
350  SCIPfreeBufferArray(scip, &conss_var);
351  SCIPfreeBufferArray(scip, &bounds);
352  SCIPfreeBufferArray(scip, &vals);
353  SCIPfreeBufferArray(scip, &vars);
354 
355  SCIPfreeBlockMemoryArray(scip, &leaveids, nleaveids);
356 
357  return SCIP_OKAY;
358 }
359 
360 /** apply the stored representation to the reopttree */
361 static
363  SCIP* scip, /**< SCIP data structure */
364  SCIP_COMPR* compr, /**< compression method */
365  SCIP_COMPRDATA* comprdata, /**< compression data */
366  SCIP_RESULT* result /**< result pointer */
367  )
368 {
369  SCIP_Bool success;
370  int r;
371 
372  assert(scip != NULL);
373  assert(compr != NULL);
374  assert(comprdata != NULL);
375 
376  *result = SCIP_DIDNOTRUN;
377 
378  if( comprdata->nrepresentatives == 0 )
379  return SCIP_OKAY;
380 
381  /* set references to the root node */
382  for(r = 0; r < comprdata->nrepresentatives; r++)
383  SCIPreoptnodeSetParentID(comprdata->representatives[r], 0);
384 
385  success = FALSE;
386  SCIP_CALL( SCIPsetReoptCompression(scip, comprdata->representatives, comprdata->nrepresentatives, &success) );
387 
388  if( success )
389  *result = SCIP_SUCCESS;
390 
391  return SCIP_OKAY;
392 }
393 
394 /*
395  * Callback methods of tree compression
396  */
397 
398 /** copy method for tree compression plugins (called when SCIP copies plugins) */
399 static
400 SCIP_DECL_COMPRCOPY(comprCopyWeakcompr)
401 { /*lint --e{715}*/
402  assert(scip != NULL);
403  assert(compr != NULL);
404  assert(strcmp(SCIPcomprGetName(compr), COMPR_NAME) == 0);
405 
406  /* call inclusion method of primal heuristic */
408 
409  return SCIP_OKAY;
410 }
411 
412 /** destructor of tree compression to free user data (called when SCIP is exiting) */
413 static
414 SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
415 {
416  SCIP_COMPRDATA* comprdata;
417 
418  assert(scip != NULL);
419  assert(compr != NULL);
420 
421  comprdata = SCIPcomprGetData(compr);
422  assert(comprdata != NULL);
423 
424  SCIPfreeMemory(scip, &comprdata);
425  SCIPcomprSetData(compr, NULL);
426 
427  return SCIP_OKAY;
428 }
429 
430 /** deinitialization method of tree compression (called before transformed problem is freed) */
431 static
432 SCIP_DECL_COMPREXIT(comprExitWeakcompr)
433 {
434  SCIP_COMPRDATA* comprdata;
435 
436  assert(scip != NULL);
437  assert(compr != NULL);
438 
439  comprdata = SCIPcomprGetData(compr);
440  assert(comprdata != NULL);
441 
442  if( comprdata->initialized )
443  {
444  int r;
445 
446  for( r = 0; r < comprdata->nrepresentatives; r++ )
447  {
448  SCIP_CALL( SCIPdeleteReoptnode(scip, &comprdata->representatives[r]) );
449  }
450 
451  if( comprdata->representativessize > 0 )
452  {
453  SCIPfreeMemoryArray(scip, &comprdata->representatives);
454  }
455 
456  comprdata->representatives = NULL;
457  comprdata->representativessize = 0;
458  comprdata->nrepresentatives = 0;
459  comprdata->initialized = FALSE;
460  }
461 
462  return SCIP_OKAY;
463 }
464 
465 /** execution method of tree compression */
466 static
467 SCIP_DECL_COMPREXEC(comprExecWeakcompr)
468 {
469  SCIP_COMPRDATA* comprdata;
470 
471  assert(SCIPcomprIsInitialized(compr));
472 
473  comprdata = SCIPcomprGetData(compr);
474  assert(comprdata != NULL);
475 
476  if( !comprdata->initialized )
477  {
478  SCIPdebugMessage(">> initializing <%s>\n", COMPR_NAME);
479 
480  comprdata->representativessize = DEFAULT_MEM_REPR;
481  comprdata->nrepresentatives = 0;
482  SCIP_CALL( SCIPallocClearMemoryArray(scip, &comprdata->representatives, comprdata->representativessize) );
483  comprdata->initialized = TRUE;
484  }
485 
486  /* try to find a representation */
487  SCIP_CALL( constructCompression(scip, compr, comprdata, result) );
488 
489  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_DIDNOTFIND || *result == SCIP_SUCCESS);
490 
491  /* apply the representation, if some was found */
492  if( *result == SCIP_SUCCESS )
493  {
494  SCIP_CALL( applyCompression(scip, compr, comprdata, result) );
495  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_SUCCESS);
496 
497  SCIPdebugMessage("->%s apply compression.\n", *result == SCIP_DIDNOTRUN ? " did not" : "");
498  }
499 
500  return SCIP_OKAY;
501 }
502 
503 
504 /*
505  * tree compression specific interface methods
506  */
507 
508 /** creates the weakcompr tree compression and includes it in SCIP */
510  SCIP* scip /**< SCIP data structure */
511  )
512 {
513  SCIP_COMPRDATA* comprdata;
514  SCIP_COMPR* compr;
515 
516  /* create weakcompr tree compression data */
517  SCIP_CALL( SCIPallocMemory(scip, &comprdata) );
518  assert(comprdata != NULL);
519  comprdata->initialized = FALSE;
520 
521  /* include tree compression */
523  comprExecWeakcompr, comprdata) );
524 
525  assert(compr != NULL);
526 
527  /* set non fundamental callbacks via setter functions */
528  SCIP_CALL( SCIPsetComprCopy(scip, compr, comprCopyWeakcompr) );
529  SCIP_CALL( SCIPsetComprExit(scip, compr, comprExitWeakcompr) );
530  SCIP_CALL( SCIPsetComprFree(scip, compr, comprFreeWeakcompr) );
531 
532  /* add weakcompr tree compression parameters */
533  SCIP_CALL( SCIPaddBoolParam(scip, "compression/"COMPR_NAME"/convertconss", "convert constraints into nodes", &comprdata->convertconss, FALSE, FALSE, NULL, NULL) );
534 
535  return SCIP_OKAY;
536 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
int SCIPcomprGetMinNodes(SCIP_COMPR *compr)
Definition: compr.c:453
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
#define DEFAULT_MEM_REPR
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20526
#define SCIPreallocBufferArray(scip, ptr, num)
Definition: scip.h:20589
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20573
SCIP_REOPTNODE * SCIPgetReoptnode(SCIP *scip, unsigned int id)
Definition: scip.c:15038
#define NULL
Definition: lpi_spx.cpp:130
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7026
#define SCIPfreeMemoryArray(scip, ptr)
Definition: scip.h:20544
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:15139
SCIP_COMPRDATA * SCIPcomprGetData(SCIP_COMPR *compr)
Definition: compr.c:306
#define FALSE
Definition: def.h:56
static SCIP_DECL_COMPRCOPY(comprCopyWeakcompr)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10743
#define TRUE
Definition: def.h:55
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_CALL(x)
Definition: def.h:266
void SCIPcomprSetData(SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata)
Definition: compr.c:316
SCIP_RETCODE SCIPsetReoptCompression(SCIP *scip, SCIP_REOPTNODE **representation, int nrepresentatives, SCIP_Bool *success)
Definition: scip.c:15088
static SCIP_RETCODE sortIDs(SCIP *scip, unsigned int *childids, int nchildids)
static SCIP_RETCODE checkMemSize(SCIP *scip, SCIP_COMPRDATA *comprdata, int nrepresentatives)
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20556
public methods for reoptimization
#define SCIPdebugMessage
Definition: pub_message.h:77
void SCIPsortDownRealInt(SCIP_Real *realarray, int *intarray, int len)
SCIP_Bool SCIPcomprIsInitialized(SCIP_COMPR *compr)
Definition: compr.c:483
SCIP_RETCODE SCIPaddReoptnodeBndchg(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR *var, SCIP_Real val, SCIP_BOUNDTYPE boundtype)
Definition: scip.c:15060
#define COMPR_PRIORITY
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7016
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:3547
int SCIPgetNReoptLeaves(SCIP *scip, SCIP_NODE *node)
Definition: scip.c:15025
void SCIPreoptnodeGetConss(SCIP_REOPTNODE *reoptnode, SCIP_VAR ***vars, SCIP_Real **vals, int mem, int *nconss, int *nvars)
Definition: reopt.c:4718
SCIP_RETCODE SCIPsetComprFree(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRFREE((*comprfree)))
Definition: scip.c:7547
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20542
weakcompr tree compression
methods for block memory pools and memory buffers
void SCIPreoptnodeSetParentID(SCIP_REOPTNODE *reoptnode, unsigned int parentid)
Definition: reopt.c:4754
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41907
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip.h:20562
internal miscellaneous methods
static SCIP_DECL_COMPREXEC(comprExecWeakcompr)
static SCIP_DECL_COMPREXIT(comprExitWeakcompr)
SCIP_RETCODE SCIPinitRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip.c:15168
struct SCIP_ComprData SCIP_COMPRDATA
Definition: type_compr.h:40
int SCIPreoptnodeGetNVars(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4621
#define SCIP_Bool
Definition: def.h:53
SCIP_Real SCIPreoptnodeGetLowerbound(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4664
static SCIP_RETCODE applyCompression(SCIP *scip, SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata, SCIP_RESULT *result)
SCIP_RETCODE SCIPsetComprExit(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPREXIT((*comprexit)))
Definition: scip.c:7579
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:801
SCIP_RETCODE SCIPsetComprCopy(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRCOPY((*comprcopy)))
Definition: scip.c:7531
const char * SCIPcomprGetName(SCIP_COMPR *compr)
Definition: compr.c:409
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:36779
SCIP_RETCODE SCIPincludeComprWeakcompr(SCIP *scip)
#define SCIPallocClearMemoryArray(scip, ptr, num)
Definition: scip.h:20530
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20585
#define COMPR_NAME
SCIP_RETCODE SCIPaddReoptnodeCons(SCIP *scip, SCIP_REOPTNODE *reoptnode, SCIP_VAR **vars, SCIP_Real *vals, int nvars, REOPT_CONSTYPE constype)
Definition: scip.c:15116
internal methods for tree compressions
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:7493
#define COMPR_DESC
#define SCIP_Real
Definition: def.h:127
static SCIP_RETCODE constructCompression(SCIP *scip, SCIP_COMPR *compr, SCIP_COMPRDATA *comprdata, SCIP_RESULT *result)
SCIP_RETCODE SCIPdeleteReoptnode(SCIP *scip, SCIP_REOPTNODE **reoptnode)
Definition: scip.c:15617
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20597
#define SCIPdebug(x)
Definition: pub_message.h:74
#define COMPR_MINNNODES
SCIP_RETCODE SCIPgetReoptLeaveIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int idssize, int *nids)
Definition: scip.c:14985
static SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
int SCIPreoptnodeGetNConss(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4631