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