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-2015 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 
25 #include "scip/mem.h"
26 #include "scip/misc.h"
27 #include "scip/compr_weakcompr.h"
28 #include "scip/compr.h"
29 #include "scip/pub_reopt.h"
30 
31 #define COMPR_NAME "weakcompr"
32 #define COMPR_DESC "reduce the search frontier to k+1 or max{2, |C|+1} nodes."
33 #define COMPR_PRIORITY 1000
34 #define COMPR_MINNNODES 50
35 
36 #define DEFAULT_MEM_REPR 2 /* since we cannot convert the added constraints into node currently, we choose 2 as default value */
37 /*
38  * Data structures
39  */
40 
41 /** tree compression data */
42 struct SCIP_ComprData
43 {
44  /* representative data */
45  SCIP_REOPTNODE** representatives; /**< list of representatives */
46  int nrepresentatives; /**< number of representatives */
47  int representativessize;/**< size of array representatives */
48  SCIP_Bool initialized; /**< was compressor data initialized? */
49 
50  /* parameter */
51  SCIP_Bool convertconss; /**< convert added logic-or constraints of size k into k nodes */
52 };
53 
54 
55 /*
56  * Local methods
57  */
58 
59 /** sort the ids of child nodes by their dual bound of the last iteration */
60 static
62  SCIP* scip, /**< SCIP data structure */
63  unsigned int* childids, /**< array of child ids */
64  int nchildids /**< first position */
65  )
66 {
67  SCIP_Real* lowerbounds;
68  int i;
69 
70  SCIP_CALL( SCIPallocBufferArray(scip, &lowerbounds, nchildids) );
71 
72  for( i = 0; i < nchildids; i++ )
73  {
74  lowerbounds[i] = SCIPreoptnodeGetLowerbound(SCIPgetReoptnode(scip, childids[i]));
75  }
76 
77  /* sort the ids in decreasing order */
78  SCIPsortDownRealInt(lowerbounds, (signed int*)childids, nchildids);
79 
80  /* free buffer memory */
81  SCIPfreeBufferArray(scip, &lowerbounds);
82 
83  return SCIP_OKAY;
84 }
85 
86 /** check of enough memory is allocated and reallocate of necessary. */
87 static
89  SCIP* scip, /**< SCIP data structure */
90  SCIP_COMPRDATA* comprdata, /**< compression data */
91  int nrepresentatives /**< number of representatives */
92  )
93 {
94  assert(scip != NULL);
95  assert(comprdata != NULL);
96 
97  if( comprdata->representativessize < nrepresentatives )
98  {
99  SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &comprdata->representatives, comprdata->representativessize, nrepresentatives) );
100  comprdata->representativessize = nrepresentatives;
101  }
102 
103  return SCIP_OKAY;
104 }
105 
106 /** try to find a good representation
107  *
108  * @todo implement:
109  * 1) using k nodes without added constraint;
110  * 2) resolve the added nods via some kind of interdiction branching
111  */
112 static
114  SCIP* scip, /**< SCIP data structure */
115  SCIP_COMPR* compr, /**< compression method */
116  SCIP_COMPRDATA* comprdata, /**< compression data */
117  SCIP_RESULT* result /**< result pointer */
118  )
119 {
120  SCIP_NODE* currentnode;
121  SCIP_VAR**** conss_var;
122  SCIP_VAR*** vars;
123  SCIP_Real*** conss_val;
124  SCIP_Real** vals;
125  SCIP_BOUNDTYPE** bounds;
126  int** conss_nvars;
127  unsigned int* leaveids;
128  int* nconss;
129  int* nvars;
130  int depth;
131  int nids;
132  int nleaveids;
133  int pos_repr_fix;
134  int size;
135  int k;
136  int r;
137 
138  assert(scip != NULL);
139  assert(comprdata != NULL);
140 
141  *result = SCIP_DIDNOTRUN;
142 
143  depth = 0;
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  depth = SCIPnodeGetDepth(currentnode);
154  }
155 
156  SCIPdebugMessage(">> start <%s> at node %llu (nleaves: %d, depth: %d)\n", COMPR_NAME,
158  nleaveids, depth);
159 
160  if( SCIPcomprGetMinNodes(compr) > nleaveids )
161  {
162  SCIPdebugMessage("-> skip compression (min. leaves = %d)\n", SCIPcomprGetMinNodes(compr));
163  return SCIP_OKAY;
164  }
165 
166  if( nleaveids == 0 )
167  {
168  SCIPdebugMessage("-> skip compression (k = %d, nleaves = %d)\n", 1, nleaveids);
169  return SCIP_OKAY;
170  }
171 
172  SCIPdebugMessage("-> 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  SCIP_CALL( SCIPallocBufferArray(scip, &vars, size) );
187  SCIP_CALL( SCIPallocBufferArray(scip, &vals, size) );
188  SCIP_CALL( SCIPallocBufferArray(scip, &bounds, size) );
189  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var, size) );
190  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val, size) );
191  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars, size) );
192  SCIP_CALL( SCIPallocBufferArray(scip, &nvars, size) );
193  SCIP_CALL( SCIPallocBufferArray(scip, &nconss, size) );
194 
195  /* get data of nodes */
196  for(k = size-1; k < 1; k++)
197  {
198  SCIP_REOPTNODE* reoptnode;
199  int mem_vars;
200  int mem_conss;
201  int nvars2;
202  int nafterdualvars;
203 
204  mem_vars = SCIPgetNBinVars(scip);
205 
206  /* allocate memory */
207  SCIP_CALL( SCIPallocBufferArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
208  SCIP_CALL( SCIPallocBufferArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
209  SCIP_CALL( SCIPallocBufferArray(scip, &bounds[k], mem_vars) ); /*lint !e866*/
210 
211  /* get the branching path */
212  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
213  assert(reoptnode != NULL);
214 
215  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], bounds[k], mem_vars, &nvars2, &nafterdualvars);
216 
217  /* reallocate memory */
218  if( mem_vars < nvars2 + nafterdualvars )
219  {
220  mem_vars = nvars2 + nafterdualvars;
221  SCIP_CALL( SCIPreallocBufferArray(scip, &vars[k], mem_vars) ); /*lint !e866*/
222  SCIP_CALL( SCIPreallocBufferArray(scip, &vals[k], mem_vars) ); /*lint !e866*/
223  SCIP_CALL( SCIPreallocBufferArray(scip, &bounds[k], mem_vars) ); /*lint !e866*/
224 
225  /* get the branching path */
226  SCIPgetReoptnodePath(scip, reoptnode, vars[k], vals[k], bounds[k], mem_vars, &nvars2, &nafterdualvars);
227  }
228 
229  nvars[k] = nvars2 + nafterdualvars;
230 
231  /* get the constraints */
232  mem_conss = SCIPreoptnodeGetNConss(reoptnode);
233 
234  SCIP_CALL( SCIPallocBufferArray(scip, &conss_var[k], mem_conss) ); /*lint !e866*/
235  SCIP_CALL( SCIPallocBufferArray(scip, &conss_val[k], mem_conss) ); /*lint !e866*/
236  SCIP_CALL( SCIPallocBufferArray(scip, &conss_nvars[k], mem_conss) ); /*lint !e866*/
237 
238  SCIPreoptnodeGetConss(reoptnode, conss_var[k], conss_val[k], mem_conss, &nconss[k], conss_nvars[k]);
239  assert(mem_conss == nconss[k]);
240 
241 #ifdef SCIP_DEBUG
242  for(c = 0; c < mem_conss; c++)
243  assert(conss_nvars[k][c] <= SCIPgetNBinVars(scip));
244 #endif
245 
246 #ifndef NDEBUG
247  reoptnode = SCIPgetReoptnode(scip, leaveids[k]);
248  assert(reoptnode != NULL);
249 
250  SCIPdebugMessage("-> use node at id %u, %d vars, %d conss, lowerbound = %.g\n", leaveids[k], nvars[k],
251  SCIPreoptnodeGetNConss(reoptnode), SCIPreoptnodeGetLowerbound(reoptnode));
252 #endif
253  }
254 
255  /* perform the compression */
256  assert(comprdata->nrepresentatives == 0);
257 
258  pos_repr_fix = 1;
259 
260  /* calculate the number of representatives */
261  comprdata->nrepresentatives = (nvars[0] > 0 ? 2 : 1);
262  comprdata->nrepresentatives += nconss[0];
263 
264  /* check memory size */
265  SCIP_CALL( checkMemSize(scip, comprdata, comprdata->nrepresentatives) );
266  assert(comprdata->nrepresentatives <= comprdata->representativessize);
267 
268  /* initialize the representatives */
269  SCIP_CALL( SCIPinitRepresentation(scip, comprdata->representatives, comprdata->nrepresentatives) );
270 
271  /* create 2 candidates for the fixed variables */
272  if( nvars[0] >= 1 )
273  {
274  int v;
275 
276  assert(pos_repr_fix < comprdata->nrepresentatives);
277 
278  /* create a representative at position 1 with fixed branching path */
279  assert(SCIPreoptnodeGetNVars(comprdata->representatives[pos_repr_fix]) == 0);
280  for(r = pos_repr_fix; r < comprdata->nrepresentatives; r++)
281  {
282  /* copy the branching path to all representatives */
283  assert(comprdata->representatives[r] != NULL);
284 
285  for(v = 0; v < nvars[0]; v++)
286  {
287  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[r], vars[0][v],
288  vals[0][v], SCIPisFeasEQ(scip, vals[0][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
289  }
290  }
291 
292  /* create a representative at position 0 with an added constraint corresponding
293  * to the branching path of the node*/
294  assert(comprdata->representatives[pos_repr_fix-1] != NULL);
295  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[pos_repr_fix-1], vars[0], vals[0], nvars[0], REOPT_CONSTYPE_STRBRANCHED) );
296 
297  }
298 
299  assert(0 <= pos_repr_fix && pos_repr_fix < comprdata->nrepresentatives);
300 
301  /* create nconss[0] nodes for the added constraints */
302  for(k = 0; k < nconss[0]; k++)
303  {
304  int v;
305 
306  assert(pos_repr_fix < comprdata->nrepresentatives);
307 
308  /* create a node with fixed bounds corresponding to constraint at position k */
309 
310  /* fix the branching path */
311  for(v = 0; v < conss_nvars[0][k]; v++)
312  {
313  SCIP_CALL( SCIPaddReoptnodeBndchg(scip, comprdata->representatives[pos_repr_fix], conss_var[0][k][v], conss_val[0][k][v],
314  SCIPisFeasEQ(scip, conss_val[0][k][v], 1.0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER) );
315  }
316 
317  /* add this constraint to all further representatives */
318  for(r = pos_repr_fix+1; r < comprdata->nrepresentatives; r++)
319  {
320  SCIP_CALL( SCIPaddReoptnodeCons(scip, comprdata->representatives[r], conss_var[0][k], conss_val[0][k],
321  conss_nvars[0][k], REOPT_CONSTYPE_STRBRANCHED) );
322  }
323 
324  pos_repr_fix++;
325  }
326 
327  /* @todo use more than one node */
328 
329  *result = SCIP_SUCCESS;
330 
331  SCIPdebugMessage("-> found representation of size %d.\n", comprdata->nrepresentatives);
332 
333  /* free memory */
334  for(k = size-1; k >= 0; k--)
335  {
336  SCIPfreeBufferArray(scip, &conss_nvars[k]);
337  SCIPfreeBufferArray(scip, &conss_val[k]);
338  SCIPfreeBufferArray(scip, &conss_var[k]);
339  SCIPfreeBufferArray(scip, &bounds[k]);
340  SCIPfreeBufferArray(scip, &vals[k]);
341  SCIPfreeBufferArray(scip, &vars[k]);
342  }
343 
344  SCIPfreeBufferArray(scip, &nconss);
345  SCIPfreeBufferArray(scip, &nvars);
346  SCIPfreeBufferArray(scip, &conss_nvars);
347  SCIPfreeBufferArray(scip, &conss_val);
348  SCIPfreeBufferArray(scip, &conss_var);
349  SCIPfreeBufferArray(scip, &bounds);
350  SCIPfreeBufferArray(scip, &vals);
351  SCIPfreeBufferArray(scip, &vars);
352 
353  SCIPfreeBlockMemoryArray(scip, &leaveids, nleaveids);
354 
355  return SCIP_OKAY;
356 }
357 
358 /** apply the stored representation to the reopttree */
359 static
361  SCIP* scip, /**< SCIP data structure */
362  SCIP_COMPR* compr, /**< compression method */
363  SCIP_COMPRDATA* comprdata, /**< compression data */
364  SCIP_RESULT* result /**< result pointer */
365  )
366 {
367  SCIP_Bool success;
368  int r;
369 
370  assert(scip != NULL);
371  assert(compr != NULL);
372  assert(comprdata != NULL);
373 
374  *result = SCIP_DIDNOTRUN;
375 
376  if( comprdata->nrepresentatives == 0 )
377  return SCIP_OKAY;
378 
379  /* set references to the root node */
380  for(r = 0; r < comprdata->nrepresentatives; r++)
381  SCIPreoptnodeSetParentID(comprdata->representatives[r], 0);
382 
383  success = FALSE;
384  SCIP_CALL( SCIPsetReoptCompression(scip, comprdata->representatives, comprdata->nrepresentatives, &success) );
385 
386  if( success )
387  *result = SCIP_SUCCESS;
388 
389  return SCIP_OKAY;
390 }
391 
392 /*
393  * Callback methods of tree compression
394  */
395 
396 /** destructor of tree compression to free user data (called when SCIP is exiting) */
397 static
398 SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
399 {
400  SCIP_COMPRDATA* comprdata;
401 
402  assert(scip != NULL);
403  assert(compr != NULL);
404 
405  comprdata = SCIPcomprGetData(compr);
406  assert(comprdata != NULL);
407 
408  SCIPfreeMemory(scip, &comprdata);
409  SCIPcomprSetData(compr, NULL);
410 
411  return SCIP_OKAY;
412 }
413 
414 /** deinitialization method of tree compression (called before transformed problem is freed) */
415 static
416 SCIP_DECL_COMPREXIT(comprExitWeakcompr)
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  if( comprdata->initialized )
427  {
428  int r;
429 
430  for( r = 0; r < comprdata->nrepresentatives; r++ )
431  {
432  SCIP_CALL( SCIPdeleteReoptnode(scip, &comprdata->representatives[r]) );
433  }
434 
435  if( comprdata->representativessize > 0 )
436  {
437  SCIPfreeMemoryArray(scip, &comprdata->representatives);
438  }
439 
440  comprdata->representatives = NULL;
441  comprdata->representativessize = 0;
442  comprdata->nrepresentatives = 0;
443  comprdata->initialized = FALSE;
444  }
445 
446  return SCIP_OKAY;
447 }
448 
449 /** execution method of tree compression */
450 static
451 SCIP_DECL_COMPREXEC(comprExecWeakcompr)
452 {
453  SCIP_COMPRDATA* comprdata;
454 
455  assert(SCIPcomprIsInitialized(compr));
456 
457  comprdata = SCIPcomprGetData(compr);
458  assert(comprdata != NULL);
459 
460  if( !comprdata->initialized )
461  {
462  SCIPdebugMessage(">> initializing <%s>\n", COMPR_NAME);
463 
464  comprdata->representativessize = DEFAULT_MEM_REPR;
465  comprdata->nrepresentatives = 0;
466  SCIP_CALL( SCIPallocClearMemoryArray(scip, &comprdata->representatives, comprdata->representativessize) );
467  comprdata->initialized = TRUE;
468  }
469 
470  /* try to find a representation */
471  SCIP_CALL( constructCompression(scip, compr, comprdata, result) );
472 
473  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_DIDNOTFIND || *result == SCIP_SUCCESS);
474 
475  /* apply the representation, if some was found */
476  if( *result == SCIP_SUCCESS )
477  {
478  SCIP_CALL( applyCompression(scip, compr, comprdata, result) );
479  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_SUCCESS);
480 
481  SCIPdebugMessage("->%s apply compression.\n", *result == SCIP_DIDNOTRUN ? " did not" : "");
482  }
483 
484  return SCIP_OKAY;
485 }
486 
487 
488 /*
489  * tree compression specific interface methods
490  */
491 
492 /** creates the weakcompr tree compression and includes it in SCIP */
494  SCIP* scip /**< SCIP data structure */
495  )
496 {
497  SCIP_COMPRDATA* comprdata;
498  SCIP_COMPR* compr;
499 
500  /* create weakcompr tree compression data */
501  SCIP_CALL( SCIPallocMemory(scip, &comprdata) );
502  assert(comprdata != NULL);
503  comprdata->initialized = FALSE;
504 
505  /* include tree compression */
507  comprExecWeakcompr, comprdata) );
508 
509  assert(compr != NULL);
510 
511  /* set non fundamental callbacks via setter functions */
512  SCIP_CALL( SCIPsetComprExit(scip, compr, comprExitWeakcompr) );
513  SCIP_CALL( SCIPsetComprFree(scip, compr, comprFreeWeakcompr) );
514 
515  /* add weakcompr tree compression parameters */
516  SCIP_CALL( SCIPaddBoolParam(scip, "compression/"COMPR_NAME"/convertconss", "convert constraints into nodes", &comprdata->convertconss, FALSE, FALSE, NULL, NULL) );
517 
518  return SCIP_OKAY;
519 }
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 SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20402
SCIP_REOPTNODE * SCIPgetReoptnode(SCIP *scip, unsigned int id)
Definition: scip.c:15127
#define NULL
Definition: lpi_spx.cpp:130
int SCIPnodeGetDepth(SCIP_NODE *node)
Definition: tree.c:7026
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:15228
SCIP_COMPRDATA * SCIPcomprGetData(SCIP_COMPR *compr)
Definition: compr.c:306
#define FALSE
Definition: def.h:53
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10780
#define TRUE
Definition: def.h:52
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
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:15177
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:20385
public methods for reoptimization
#define SCIPdebugMessage
Definition: pub_message.h:77
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20414
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:15149
#define SCIPreallocBufferArray(scip, ptr, num)
Definition: scip.h:20418
#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:3516
int SCIPgetNReoptLeaves(SCIP *scip, SCIP_NODE *node)
Definition: scip.c:15114
void SCIPreoptnodeGetConss(SCIP_REOPTNODE *reoptnode, SCIP_VAR ***vars, SCIP_Real **vals, int mem, int *nconss, int *nvars)
Definition: reopt.c:4781
SCIP_RETCODE SCIPsetComprFree(SCIP *scip, SCIP_COMPR *compr, SCIP_DECL_COMPRFREE((*comprfree)))
Definition: scip.c:7516
weakcompr tree compression
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20355
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20426
methods for block memory pools and memory buffers
void SCIPreoptnodeSetParentID(SCIP_REOPTNODE *reoptnode, unsigned int parentid)
Definition: reopt.c:4817
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41515
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip.h:20391
internal miscellaneous methods
static SCIP_DECL_COMPREXEC(comprExecWeakcompr)
static SCIP_DECL_COMPREXIT(comprExitWeakcompr)
#define SCIP_CALL(x)
Definition: def.h:263
SCIP_RETCODE SCIPinitRepresentation(SCIP *scip, SCIP_REOPTNODE **representatives, int nrepresentatives)
Definition: scip.c:15257
struct SCIP_ComprData SCIP_COMPRDATA
Definition: type_compr.h:40
int SCIPreoptnodeGetNVars(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4683
#define SCIP_Bool
Definition: def.h:50
SCIP_Real SCIPreoptnodeGetLowerbound(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4726
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:7548
SCIP_STAGE SCIPgetStage(SCIP *scip)
Definition: scip.c:801
#define SCIPfreeMemoryArray(scip, ptr)
Definition: scip.h:20373
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip.c:36389
SCIP_RETCODE SCIPincludeComprWeakcompr(SCIP *scip)
#define SCIPallocClearMemoryArray(scip, ptr, num)
Definition: scip.h:20359
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20371
#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:15205
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:7462
#define COMPR_DESC
#define SCIP_Real
Definition: def.h:124
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:15703
#define COMPR_MINNNODES
SCIP_RETCODE SCIPgetReoptLeaveIDs(SCIP *scip, SCIP_NODE *node, unsigned int *ids, int idssize, int *nids)
Definition: scip.c:15074
static SCIP_DECL_COMPRFREE(comprFreeWeakcompr)
int SCIPreoptnodeGetNConss(SCIP_REOPTNODE *reoptnode)
Definition: reopt.c:4693