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