Scippy

SCIP

Solving Constraint Integer Programs

prop.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 prop.c
17  * @brief methods and datastructures for propagators
18  * @author Tobias Achterberg
19  * @author Timo Berthold
20  */
21 
22 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
23 
24 #include <assert.h>
25 #include <string.h>
26 
27 #include "scip/def.h"
28 #include "scip/set.h"
29 #include "scip/stat.h"
30 #include "scip/clock.h"
31 #include "scip/paramset.h"
32 #include "scip/var.h"
33 #include "scip/scip.h"
34 #include "scip/prop.h"
35 #include "scip/pub_message.h"
36 #include "scip/pub_misc.h"
37 
38 #include "scip/struct_prop.h"
39 
40 
41 /** compares two propagators w. r. to their priority */
42 SCIP_DECL_SORTPTRCOMP(SCIPpropComp)
43 { /*lint --e{715}*/
44  return ((SCIP_PROP*)elem2)->priority - ((SCIP_PROP*)elem1)->priority;
45 }
46 
47 /** compares two propagators w. r. to their priority */
48 SCIP_DECL_SORTPTRCOMP(SCIPpropCompPresol)
49 { /*lint --e{715}*/
50  return ((SCIP_PROP*)elem2)->presolpriority - ((SCIP_PROP*)elem1)->presolpriority;
51 }
52 
53 /** comparison method for sorting propagators w.r.t. to their name */
54 SCIP_DECL_SORTPTRCOMP(SCIPpropCompName)
55 {
56  return strcmp(SCIPpropGetName((SCIP_PROP*)elem1), SCIPpropGetName((SCIP_PROP*)elem2));
57 }
58 
59 /** method to call, when the priority of a propagator was changed */
60 static
61 SCIP_DECL_PARAMCHGD(paramChgdPropPriority)
62 { /*lint --e{715}*/
63  SCIP_PARAMDATA* paramdata;
64 
65  paramdata = SCIPparamGetData(param);
66  assert(paramdata != NULL);
67 
68  /* use SCIPsetPropPriority() to mark the props unsorted */
69  SCIP_CALL( SCIPsetPropPriority(scip, (SCIP_PROP*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
70 
71  return SCIP_OKAY;
72 }
73 
74 /** method to call, when the presolving priority of a propagator was changed */
75 static
76 SCIP_DECL_PARAMCHGD(paramChgdPropPresolPriority)
77 { /*lint --e{715}*/
78  SCIP_PARAMDATA* paramdata;
79 
80  paramdata = SCIPparamGetData(param);
81  assert(paramdata != NULL);
82 
83  /* use SCIPsetPropPriority() to mark the props unsorted */
84  SCIP_CALL( SCIPsetPropPresolPriority(scip, (SCIP_PROP*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
85 
86  return SCIP_OKAY;
87 }
88 
89 /** copies the given propagator to a new scip */
91  SCIP_PROP* prop, /**< propagator */
92  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
93  )
94 {
95  assert(prop != NULL);
96  assert(set != NULL);
97  assert(set->scip != NULL);
98 
99  if( prop->propcopy != NULL )
100  {
101  SCIPsetDebugMsg(set, "including propagator %s in subscip %p\n", SCIPpropGetName(prop), (void*)set->scip);
102  SCIP_CALL( prop->propcopy(set->scip, prop) );
103  }
104  return SCIP_OKAY;
105 }
106 
107 /** internal method for creating a propagator */
108 static
110  SCIP_PROP** prop, /**< pointer to propagator data structure */
111  SCIP_SET* set, /**< global SCIP settings */
112  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
113  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
114  const char* name, /**< name of propagator */
115  const char* desc, /**< description of propagator */
116  int priority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
117  int freq, /**< frequency for calling propagator */
118  SCIP_Bool delay, /**< should propagator be delayed, if other propagators found reductions? */
119  SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagator should be executed */
120  int presolpriority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
121  int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */
122  SCIP_PRESOLTIMING presoltiming, /**< timing mask of the propagator's presolving method */
123  SCIP_DECL_PROPCOPY ((*propcopy)), /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */
124  SCIP_DECL_PROPFREE ((*propfree)), /**< destructor of propagator */
125  SCIP_DECL_PROPINIT ((*propinit)), /**< initialize propagator */
126  SCIP_DECL_PROPEXIT ((*propexit)), /**< deinitialize propagator */
127  SCIP_DECL_PROPINITPRE ((*propinitpre)), /**< presolving initialization method of propagator */
128  SCIP_DECL_PROPEXITPRE ((*propexitpre)), /**< presolving deinitialization method of propagator */
129  SCIP_DECL_PROPINITSOL ((*propinitsol)), /**< solving process initialization method of propagator */
130  SCIP_DECL_PROPEXITSOL ((*propexitsol)), /**< solving process deinitialization method of propagator */
131  SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */
132  SCIP_DECL_PROPEXEC ((*propexec)), /**< execution method of propagator */
133  SCIP_DECL_PROPRESPROP ((*propresprop)), /**< propagation conflict resolving method */
134  SCIP_PROPDATA* propdata /**< propagator data */
135  )
136 {
137  char paramname[SCIP_MAXSTRLEN];
138  char paramdesc[SCIP_MAXSTRLEN];
139 
140  assert(prop != NULL);
141  assert(name != NULL);
142  assert(desc != NULL);
143  assert(freq >= -1);
144  assert(propexec != NULL);
145 
146  /* the interface change from delay flags to timings cannot be recognized at compile time: Exit with an appropriate
147  * error message
148  */
149  if( presoltiming < SCIP_PRESOLTIMING_NONE || presoltiming > SCIP_PRESOLTIMING_MAX )
150  {
151  SCIPmessagePrintError("ERROR: 'PRESOLDELAY'-flag no longer available since SCIP 3.2, use an appropriate "
152  "'SCIP_PRESOLTIMING' for <%s> propagator instead.\n", name);
153 
154  return SCIP_PARAMETERWRONGVAL;
155  }
156 
157  SCIP_ALLOC( BMSallocMemory(prop) );
158  BMSclearMemory(*prop);
159 
160  SCIP_ALLOC( BMSduplicateMemoryArray(&(*prop)->name, name, strlen(name)+1) );
161  SCIP_ALLOC( BMSduplicateMemoryArray(&(*prop)->desc, desc, strlen(desc)+1) );
162  (*prop)->priority = priority;
163  (*prop)->freq = freq;
164  (*prop)->propcopy = propcopy;
165  (*prop)->propfree = propfree;
166  (*prop)->propinit = propinit;
167  (*prop)->propexit = propexit;
168  (*prop)->propinitpre = propinitpre;
169  (*prop)->propexitpre = propexitpre;
170  (*prop)->propinitsol = propinitsol;
171  (*prop)->propexitsol = propexitsol;
172  (*prop)->proppresol = proppresol;
173  (*prop)->propexec = propexec;
174  (*prop)->propresprop = propresprop;
175  (*prop)->propdata = propdata;
176  SCIP_CALL( SCIPclockCreate(&(*prop)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
177  SCIP_CALL( SCIPclockCreate(&(*prop)->proptime, SCIP_CLOCKTYPE_DEFAULT) );
178  SCIP_CALL( SCIPclockCreate(&(*prop)->sbproptime, SCIP_CLOCKTYPE_DEFAULT) );
179  SCIP_CALL( SCIPclockCreate(&(*prop)->resproptime, SCIP_CLOCKTYPE_DEFAULT) );
180  SCIP_CALL( SCIPclockCreate(&(*prop)->presoltime, SCIP_CLOCKTYPE_DEFAULT) );
181  (*prop)->ncalls = 0;
182  (*prop)->nrespropcalls = 0;
183  (*prop)->ncutoffs = 0;
184  (*prop)->ndomredsfound = 0;
185  (*prop)->wasdelayed = FALSE;
186  (*prop)->initialized = FALSE;
187 
188  /* add parameters */
189  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/priority", name);
190  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of propagator <%s>", name);
191  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
192  &(*prop)->priority, TRUE, priority, INT_MIN/4, INT_MAX/4,
193  paramChgdPropPriority, (SCIP_PARAMDATA*)(*prop)) ); /*lint !e740*/
194 
195  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/freq", name);
196  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "frequency for calling propagator <%s> (-1: never, 0: only in root node)", name);
197  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
198  &(*prop)->freq, FALSE, freq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
199 
200  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/delay", name);
201  SCIP_CALL( SCIPsetAddBoolParam(set, messagehdlr, blkmem, paramname,
202  "should propagator be delayed, if other propagators found reductions?",
203  &(*prop)->delay, TRUE, delay, NULL, NULL) ); /*lint !e740*/
204 
205  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/timingmask", name);
206  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "timing when propagator should be called (%u:BEFORELP, %u:DURINGLPLOOP, %u:AFTERLPLOOP, %u:ALWAYS))",
208  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
209  (int*)(&(*prop)->timingmask), TRUE, timingmask, (int) SCIP_PROPTIMING_BEFORELP, (int) SCIP_PROPTIMING_ALWAYS, NULL, NULL) ); /*lint !e713*/
210 
211  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/presolpriority", name);
212  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "presolving priority of propagator <%s>", name);
213  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
214  &(*prop)->presolpriority, TRUE, presolpriority, INT_MIN/4, INT_MAX/4,
215  paramChgdPropPresolPriority, (SCIP_PARAMDATA*)(*prop)) ); /*lint !e740*/
216 
217  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/maxprerounds", name);
218  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname,
219  "maximal number of presolving rounds the propagator participates in (-1: no limit)",
220  &(*prop)->maxprerounds, FALSE, presolmaxrounds, -1, INT_MAX, NULL, NULL) ); /*lint !e740*/
221 
222  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "propagating/%s/presoltiming", name);
223  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "timing mask of the presolving method of propagator <%s> (%u:FAST, %u:MEDIUM, %u:EXHAUSTIVE, %u:FINAL)",
225  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
226  (int*)&(*prop)->presoltiming, TRUE, (int)presoltiming, (int) SCIP_PRESOLTIMING_NONE, (int) SCIP_PRESOLTIMING_MAX, NULL, NULL) ); /*lint !e740*/
227 
228  return SCIP_OKAY;
229 }
230 
231 /** creates a propagator */
233  SCIP_PROP** prop, /**< pointer to propagator data structure */
234  SCIP_SET* set, /**< global SCIP settings */
235  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
236  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
237  const char* name, /**< name of propagator */
238  const char* desc, /**< description of propagator */
239  int priority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
240  int freq, /**< frequency for calling propagator */
241  SCIP_Bool delay, /**< should propagator be delayed, if other propagators found reductions? */
242  SCIP_PROPTIMING timingmask, /**< positions in the node solving loop where propagator should be executed */
243  int presolpriority, /**< priority of the propagator (>= 0: before, < 0: after constraint handlers) */
244  int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */
245  SCIP_PRESOLTIMING presoltiming, /**< timing mask of the propagator's presolving method */
246  SCIP_DECL_PROPCOPY ((*propcopy)), /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */
247  SCIP_DECL_PROPFREE ((*propfree)), /**< destructor of propagator */
248  SCIP_DECL_PROPINIT ((*propinit)), /**< initialize propagator */
249  SCIP_DECL_PROPEXIT ((*propexit)), /**< deinitialize propagator */
250  SCIP_DECL_PROPINITPRE ((*propinitpre)), /**< presolving initialization method of propagator */
251  SCIP_DECL_PROPEXITPRE ((*propexitpre)), /**< presolving deinitialization method of propagator */
252  SCIP_DECL_PROPINITSOL ((*propinitsol)), /**< solving process initialization method of propagator */
253  SCIP_DECL_PROPEXITSOL ((*propexitsol)), /**< solving process deinitialization method of propagator */
254  SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */
255  SCIP_DECL_PROPEXEC ((*propexec)), /**< execution method of propagator */
256  SCIP_DECL_PROPRESPROP ((*propresprop)), /**< propagation conflict resolving method */
257  SCIP_PROPDATA* propdata /**< propagator data */
258  )
259 {
260  assert(prop != NULL);
261  assert(name != NULL);
262  assert(desc != NULL);
263  assert(freq >= -1);
264  assert(propexec != NULL);
265 
266  SCIP_CALL_FINALLY( doPropCreate(prop, set, messagehdlr, blkmem, name, desc, priority, freq, delay, timingmask,
267  presolpriority, presolmaxrounds, presoltiming, propcopy, propfree, propinit, propexit, propinitpre, propexitpre,
268  propinitsol, propexitsol, proppresol, propexec, propresprop, propdata), (void) SCIPpropFree(prop, set) );
269 
270  return SCIP_OKAY;
271 }
272 
273 /** calls destructor and frees memory of propagator */
275  SCIP_PROP** prop, /**< pointer to propagator data structure */
276  SCIP_SET* set /**< global SCIP settings */
277  )
278 {
279  assert(prop != NULL);
280  if( *prop == NULL )
281  return SCIP_OKAY;
282  assert(!(*prop)->initialized);
283  assert(set != NULL);
284 
285  /* call destructor of propagator */
286  if( (*prop)->propfree != NULL )
287  {
288  SCIP_CALL( (*prop)->propfree(set->scip, *prop) );
289  }
290 
291  SCIPclockFree(&(*prop)->presoltime);
292  SCIPclockFree(&(*prop)->resproptime);
293  SCIPclockFree(&(*prop)->sbproptime);
294  SCIPclockFree(&(*prop)->proptime);
295  SCIPclockFree(&(*prop)->setuptime);
296  BMSfreeMemoryArrayNull(&(*prop)->desc);
297  BMSfreeMemoryArrayNull(&(*prop)->name);
298  BMSfreeMemory(prop);
299 
300  return SCIP_OKAY;
301 }
302 
303 /** initializes propagator */
305  SCIP_PROP* prop, /**< propagator */
306  SCIP_SET* set /**< global SCIP settings */
307  )
308 {
309  assert(prop != NULL);
310  assert(set != NULL);
311 
312  if( prop->initialized )
313  {
314  SCIPerrorMessage("propagator <%s> already initialized\n", prop->name);
315  return SCIP_INVALIDCALL;
316  }
317 
318  if( set->misc_resetstat )
319  {
320  SCIPclockReset(prop->proptime);
321  SCIPclockReset(prop->sbproptime);
323  SCIPclockReset(prop->presoltime);
324  SCIPclockReset(prop->setuptime);
325 
326  prop->ncalls = 0;
327  prop->nrespropcalls = 0;
328  prop->ncutoffs = 0;
329  prop->ndomredsfound = 0;
330  prop->lastnfixedvars = 0;
331  prop->lastnaggrvars = 0;
332  prop->lastnchgvartypes = 0;
333  prop->lastnchgbds = 0;
334  prop->lastnaddholes = 0;
335  prop->lastndelconss = 0;
336  prop->lastnaddconss = 0;
337  prop->lastnupgdconss = 0;
338  prop->lastnchgcoefs = 0;
339  prop->lastnchgsides = 0;
340  prop->nfixedvars = 0;
341  prop->naggrvars = 0;
342  prop->nchgvartypes = 0;
343  prop->nchgbds = 0;
344  prop->naddholes = 0;
345  prop->ndelconss = 0;
346  prop->naddconss = 0;
347  prop->nupgdconss = 0;
348  prop->nchgcoefs = 0;
349  prop->nchgsides = 0;
350  prop->npresolcalls = 0;
351  prop->wasdelayed = FALSE;
352  }
353 
354  if( prop->propinit != NULL )
355  {
356  /* start timing */
357  SCIPclockStart(prop->setuptime, set);
358 
359  SCIP_CALL( prop->propinit(set->scip, prop) );
360 
361  /* stop timing */
362  SCIPclockStop(prop->setuptime, set);
363  }
364  prop->initialized = TRUE;
365 
366  return SCIP_OKAY;
367 }
368 
369 /** calls exit method of propagator */
371  SCIP_PROP* prop, /**< propagator */
372  SCIP_SET* set /**< global SCIP settings */
373  )
374 {
375  assert(prop != NULL);
376  assert(set != NULL);
377 
378  if( !prop->initialized )
379  {
380  SCIPerrorMessage("propagator <%s> not initialized\n", prop->name);
381  return SCIP_INVALIDCALL;
382  }
383 
384  if( prop->propexit != NULL )
385  {
386  /* start timing */
387  SCIPclockStart(prop->setuptime, set);
388 
389  SCIP_CALL( prop->propexit(set->scip, prop) );
390 
391  /* stop timing */
392  SCIPclockStop(prop->setuptime, set);
393  }
394  prop->initialized = FALSE;
395 
396  return SCIP_OKAY;
397 }
398 
399 /** informs propagator that the presolving process is being started */
401  SCIP_PROP* prop, /**< propagator */
402  SCIP_SET* set /**< global SCIP settings */
403  )
404 {
405  assert(prop != NULL);
406  assert(set != NULL);
407 
408  prop->lastnfixedvars = 0;
409  prop->lastnaggrvars = 0;
410  prop->lastnchgvartypes = 0;
411  prop->lastnchgbds = 0;
412  prop->lastnaddholes = 0;
413  prop->lastndelconss = 0;
414  prop->lastnaddconss = 0;
415  prop->lastnupgdconss = 0;
416  prop->lastnchgcoefs = 0;
417  prop->lastnchgsides = 0;
418  prop->wasdelayed = FALSE;
419 
420  /* call presolving initialization method of propagator */
421  if( prop->propinitpre != NULL )
422  {
423  /* start timing */
424  SCIPclockStart(prop->setuptime, set);
425 
426  SCIP_CALL( prop->propinitpre(set->scip, prop) );
427 
428  /* stop timing */
429  SCIPclockStop(prop->setuptime, set);
430  }
431 
432  return SCIP_OKAY;
433 }
434 
435 /** informs propagator that the presolving process is finished */
437  SCIP_PROP* prop, /**< propagator */
438  SCIP_SET* set /**< global SCIP settings */
439  )
440 {
441  assert(prop != NULL);
442  assert(set != NULL);
443 
444  /* call presolving deinitialization method of propagator */
445  if( prop->propexitpre != NULL )
446  {
447  /* start timing */
448  SCIPclockStart(prop->setuptime, set);
449 
450  SCIP_CALL( prop->propexitpre(set->scip, prop) );
451 
452  /* stop timing */
453  SCIPclockStop(prop->setuptime, set);
454  }
455 
456  return SCIP_OKAY;
457 }
458 
459 /** informs propagator that the prop and bound process is being started */
461  SCIP_PROP* prop, /**< propagator */
462  SCIP_SET* set /**< global SCIP settings */
463  )
464 {
465  assert(prop != NULL);
466  assert(set != NULL);
467 
468  /* call solving process initialization method of propagator */
469  if( prop->propinitsol != NULL )
470  {
471  /* start timing */
472  SCIPclockStart(prop->setuptime, set);
473 
474  SCIP_CALL( prop->propinitsol(set->scip, prop) );
475 
476  /* stop timing */
477  SCIPclockStop(prop->setuptime, set);
478  }
479 
480  return SCIP_OKAY;
481 }
482 
483 /** informs propagator that the prop and bound process data is being freed */
485  SCIP_PROP* prop, /**< propagator */
486  SCIP_SET* set, /**< global SCIP settings */
487  SCIP_Bool restart /**< was this exit solve call triggered by a restart? */
488  )
489 {
490  assert(prop != NULL);
491  assert(set != NULL);
492 
493  /* call solving process deinitialization method of propagator */
494  if( prop->propexitsol != NULL )
495  {
496  /* start timing */
497  SCIPclockStart(prop->setuptime, set);
498 
499  SCIP_CALL( prop->propexitsol(set->scip, prop, restart) );
500 
501  /* stop timing */
502  SCIPclockStop(prop->setuptime, set);
503  }
504 
505  return SCIP_OKAY;
506 }
507 
508 /** executes presolving method of propagator */
510  SCIP_PROP* prop, /**< propagator */
511  SCIP_SET* set, /**< global SCIP settings */
512  SCIP_PRESOLTIMING timing, /**< current presolving timing */
513  int nrounds, /**< number of presolving rounds already done */
514  int* nfixedvars, /**< pointer to total number of variables fixed of all presolvers */
515  int* naggrvars, /**< pointer to total number of variables aggregated of all presolvers */
516  int* nchgvartypes, /**< pointer to total number of variable type changes of all presolvers */
517  int* nchgbds, /**< pointer to total number of variable bounds tightened of all presolvers */
518  int* naddholes, /**< pointer to total number of domain holes added of all presolvers */
519  int* ndelconss, /**< pointer to total number of deleted constraints of all presolvers */
520  int* naddconss, /**< pointer to total number of added constraints of all presolvers */
521  int* nupgdconss, /**< pointer to total number of upgraded constraints of all presolvers */
522  int* nchgcoefs, /**< pointer to total number of changed coefficients of all presolvers */
523  int* nchgsides, /**< pointer to total number of changed left/right hand sides of all presolvers */
524  SCIP_RESULT* result /**< pointer to store the result of the callback method */
525  )
526 {
527  assert(prop != NULL);
528  assert(set != NULL);
529  assert(nfixedvars != NULL);
530  assert(naggrvars != NULL);
531  assert(nchgvartypes != NULL);
532  assert(nchgbds != NULL);
533  assert(naddholes != NULL);
534  assert(ndelconss != NULL);
535  assert(naddconss != NULL);
536  assert(nupgdconss != NULL);
537  assert(nchgcoefs != NULL);
538  assert(nchgsides != NULL);
539  assert(result != NULL);
540 
541  *result = SCIP_DIDNOTRUN;
542 
543  if( prop->proppresol == NULL )
544  return SCIP_OKAY;
545 
546  /* check number of presolving rounds */
547  if( prop->maxprerounds >= 0 && prop->npresolcalls >= prop->maxprerounds )
548  return SCIP_OKAY;
549 
550  /* check, if presolver should be delayed */
551  if( prop->presoltiming & timing )
552  {
553  int nnewfixedvars;
554  int nnewaggrvars;
555  int nnewchgvartypes;
556  int nnewchgbds;
557  int nnewaddholes;
558  int nnewdelconss;
559  int nnewaddconss;
560  int nnewupgdconss;
561  int nnewchgcoefs;
562  int nnewchgsides;
563 
564  SCIPsetDebugMsg(set, "calling presolving method of propagator <%s>\n", prop->name);
565 
566  /* calculate the number of changes since last call */
567  nnewfixedvars = *nfixedvars - prop->lastnfixedvars;
568  nnewaggrvars = *naggrvars - prop->lastnaggrvars;
569  nnewchgvartypes = *nchgvartypes - prop->lastnchgvartypes;
570  nnewchgbds = *nchgbds - prop->lastnchgbds;
571  nnewaddholes = *naddholes - prop->lastnaddholes;
572  nnewdelconss = *ndelconss - prop->lastndelconss;
573  nnewaddconss = *naddconss - prop->lastnaddconss;
574  nnewupgdconss = *nupgdconss - prop->lastnupgdconss;
575  nnewchgcoefs = *nchgcoefs - prop->lastnchgcoefs;
576  nnewchgsides = *nchgsides - prop->lastnchgsides;
577 
578  /* remember the number of changes prior to the call of the presolver method of the propagator */
579  prop->lastnfixedvars = *nfixedvars;
580  prop->lastnaggrvars = *naggrvars;
581  prop->lastnchgvartypes = *nchgvartypes;
582  prop->lastnchgbds = *nchgbds;
583  prop->lastnaddholes = *naddholes;
584  prop->lastndelconss = *ndelconss;
585  prop->lastnaddconss = *naddconss;
586  prop->lastnupgdconss = *nupgdconss;
587  prop->lastnchgcoefs = *nchgcoefs;
588  prop->lastnchgsides = *nchgsides;
589 
590  /* start timing */
591  SCIPclockStart(prop->presoltime, set);
592 
593  /* call external method */
594  SCIP_CALL( prop->proppresol(set->scip, prop, nrounds, timing,
595  nnewfixedvars, nnewaggrvars, nnewchgvartypes, nnewchgbds, nnewaddholes,
596  nnewdelconss, nnewaddconss, nnewupgdconss, nnewchgcoefs, nnewchgsides,
597  nfixedvars, naggrvars, nchgvartypes, nchgbds, naddholes,
598  ndelconss, naddconss, nupgdconss, nchgcoefs, nchgsides, result) );
599 
600  /* stop timing */
601  SCIPclockStop(prop->presoltime, set);
602 
603  /* add/count the new changes */
604  prop->nfixedvars += *nfixedvars - prop->lastnfixedvars;
605  prop->naggrvars += *naggrvars - prop->lastnaggrvars;
606  prop->nchgvartypes += *nchgvartypes - prop->lastnchgvartypes;
607  prop->nchgbds += *nchgbds - prop->lastnchgbds;
608  prop->naddholes += *naddholes - prop->lastnaddholes;
609  prop->ndelconss += *ndelconss - prop->lastndelconss;
610  prop->naddconss += *naddconss - prop->lastnaddconss;
611  prop->nupgdconss += *nupgdconss - prop->lastnupgdconss;
612  prop->nchgcoefs += *nchgcoefs - prop->lastnchgcoefs;
613  prop->nchgsides += *nchgsides - prop->lastnchgsides;
614 
615  /* check result code of callback method */
616  if( *result != SCIP_CUTOFF
617  && *result != SCIP_UNBOUNDED
618  && *result != SCIP_SUCCESS
619  && *result != SCIP_DIDNOTFIND
620  && *result != SCIP_DIDNOTRUN )
621  {
622  SCIPerrorMessage("propagator <%s> returned invalid result <%d>\n", prop->name, *result);
623  return SCIP_INVALIDRESULT;
624  }
625 
626  /* increase the number of presolving calls, if the propagator tried to find reductions */
627  if( *result != SCIP_DIDNOTRUN )
628  ++(prop->npresolcalls);
629  }
630 
631  return SCIP_OKAY;
632 }
633 
634 /** calls execution method of propagator */
636  SCIP_PROP* prop, /**< propagator */
637  SCIP_SET* set, /**< global SCIP settings */
638  SCIP_STAT* stat, /**< dynamic problem statistics */
639  int depth, /**< depth of current node */
640  SCIP_Bool execdelayed, /**< execute propagator even if it is marked to be delayed */
641  SCIP_Bool instrongbranching, /**< are we currently doing strong branching? */
642  SCIP_PROPTIMING proptiming, /**< current point in the node solving process */
643  SCIP_RESULT* result /**< pointer to store the result of the callback method */
644  )
645 {
646  assert(prop != NULL);
647  assert(prop->propexec != NULL);
648  assert(prop->freq >= -1);
649  assert(set != NULL);
650  assert(set->scip != NULL);
651  assert(stat != NULL);
652  assert(depth >= 0);
653  assert(result != NULL);
654 
655  if( (depth == 0 && prop->freq == 0) || (prop->freq > 0 && depth % prop->freq == 0) )
656  {
657  if( !prop->delay || execdelayed )
658  {
659  SCIP_Longint oldndomchgs;
660  SCIP_Longint oldnprobdomchgs;
661 
662  SCIPsetDebugMsg(set, "executing propagator <%s>\n", prop->name);
663 
664  oldndomchgs = stat->nboundchgs + stat->nholechgs;
665  oldnprobdomchgs = stat->nprobboundchgs + stat->nprobholechgs;
666 
667  /* start timing */
668  if( instrongbranching )
669  SCIPclockStart(prop->sbproptime, set);
670  else
671  SCIPclockStart(prop->proptime, set);
672 
673  /* call external propagation method */
674  SCIP_CALL( prop->propexec(set->scip, prop, proptiming, result) );
675 
676  /* stop timing */
677  if( instrongbranching )
678  SCIPclockStop(prop->sbproptime, set);
679  else
680  SCIPclockStop(prop->proptime, set);
681 
682  /* update statistics */
683  if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
684  prop->ncalls++;
685  if( *result == SCIP_CUTOFF )
686  prop->ncutoffs++;
687 
688  /* update domain reductions; therefore remove the domain
689  * reduction counts which were generated in probing mode */
690  prop->ndomredsfound += stat->nboundchgs + stat->nholechgs - oldndomchgs;
691  prop->ndomredsfound -= (stat->nprobboundchgs + stat->nprobholechgs - oldnprobdomchgs);
692 
693  /* evaluate result */
694  if( *result != SCIP_CUTOFF
695  && *result != SCIP_REDUCEDDOM
696  && *result != SCIP_DIDNOTFIND
697  && *result != SCIP_DIDNOTRUN
698  && *result != SCIP_DELAYED
699  && *result != SCIP_DELAYNODE )
700  {
701  SCIPerrorMessage("execution method of propagator <%s> returned invalid result <%d>\n",
702  prop->name, *result);
703  return SCIP_INVALIDRESULT;
704  }
705  }
706  else
707  {
708  SCIPsetDebugMsg(set, "propagator <%s> was delayed\n", prop->name);
709  *result = SCIP_DELAYED;
710  }
711 
712  /* remember whether propagator was delayed */
713  prop->wasdelayed = (*result == SCIP_DELAYED);
714  }
715  else
716  *result = SCIP_DIDNOTRUN;
717 
718  return SCIP_OKAY;
719 }
720 
721 /** resolves the given conflicting bound, that was deduced by the given propagator, by putting all "reason" bounds
722  * leading to the deduction into the conflict queue with calls to SCIPaddConflictLb(), SCIPaddConflictUb(), SCIPaddConflictBd(),
723  * SCIPaddConflictRelaxedLb(), SCIPaddConflictRelaxedUb(), SCIPaddConflictRelaxedBd(), or SCIPaddConflictBinvar();
724  *
725  * @note it is sufficient to explain the relaxed bound change
726  */
728  SCIP_PROP* prop, /**< propagator */
729  SCIP_SET* set, /**< global SCIP settings */
730  SCIP_VAR* infervar, /**< variable whose bound was deduced by the constraint */
731  int inferinfo, /**< user inference information attached to the bound change */
732  SCIP_BOUNDTYPE inferboundtype, /**< bound that was deduced (lower or upper bound) */
733  SCIP_BDCHGIDX* bdchgidx, /**< bound change index, representing the point of time where change took place */
734  SCIP_Real relaxedbd, /**< the relaxed bound */
735  SCIP_RESULT* result /**< pointer to store the result of the callback method */
736  )
737 {
738  assert(prop != NULL);
739  assert((inferboundtype == SCIP_BOUNDTYPE_LOWER
740  && SCIPgetVarLbAtIndex(set->scip, infervar, bdchgidx, TRUE) > SCIPvarGetLbGlobal(infervar))
741  || (inferboundtype == SCIP_BOUNDTYPE_UPPER
742  && SCIPgetVarUbAtIndex(set->scip, infervar, bdchgidx, TRUE) < SCIPvarGetUbGlobal(infervar)));
743  assert(result != NULL);
744 
745  *result = SCIP_DIDNOTRUN;
746 
747  if( prop->propresprop != NULL )
748  {
749  /* start timing */
750  SCIPclockStart(prop->resproptime, set);
751 
752  SCIP_CALL( prop->propresprop(set->scip, prop, infervar, inferinfo, inferboundtype, bdchgidx,
753  relaxedbd, result) );
754 
755  /* stop timing */
756  SCIPclockStop(prop->resproptime, set);
757 
758  /* update statistic */
759  prop->nrespropcalls++;
760 
761  /* check result code */
762  if( *result != SCIP_SUCCESS && *result != SCIP_DIDNOTFIND )
763  {
764  SCIPerrorMessage("propagation conflict resolving method of propagator <%s> returned invalid result <%d>\n",
765  prop->name, *result);
766  return SCIP_INVALIDRESULT;
767  }
768  }
769  else
770  {
771  SCIPerrorMessage("propagation conflict resolving method of propagator <%s> is not implemented\n", prop->name);
772  return SCIP_PLUGINNOTFOUND;
773  }
774 
775  return SCIP_OKAY;
776 }
777 
778 /** gets user data of propagator */
780  SCIP_PROP* prop /**< propagator */
781  )
782 {
783  assert(prop != NULL);
784 
785  return prop->propdata;
786 }
787 
788 /** sets user data of propagator; user has to free old data in advance! */
790  SCIP_PROP* prop, /**< propagator */
791  SCIP_PROPDATA* propdata /**< new propagator user data */
792  )
793 {
794  assert(prop != NULL);
795 
796  prop->propdata = propdata;
797 }
798 
799 /** sets copy method of propagator */
801  SCIP_PROP* prop, /**< propagator */
802  SCIP_DECL_PROPCOPY ((*propcopy)) /**< copy method of propagator or NULL if you don't want to copy your plugin into sub-SCIPs */
803  )
804 {
805  assert(prop != NULL);
806 
807  prop->propcopy = propcopy;
808 }
809 
810 /** sets destructor method of propagator */
812  SCIP_PROP* prop, /**< propagator */
813  SCIP_DECL_PROPFREE ((*propfree)) /**< destructor of propagator */
814  )
815 {
816  assert(prop != NULL);
817 
818  prop->propfree = propfree;
819 }
820 
821 /** sets initialization method of propagator */
823  SCIP_PROP* prop, /**< propagator */
824  SCIP_DECL_PROPINIT ((*propinit)) /**< initialize propagator */
825  )
826 {
827  assert(prop != NULL);
828 
829  prop->propinit = propinit;
830 }
831 
832 /** sets deinitialization method of propagator */
834  SCIP_PROP* prop, /**< propagator */
835  SCIP_DECL_PROPEXIT ((*propexit)) /**< deinitialize propagator */
836  )
837 {
838  assert(prop != NULL);
839 
840  prop->propexit = propexit;
841 }
842 
843 /** sets solving process initialization method of propagator */
845  SCIP_PROP* prop, /**< propagator */
846  SCIP_DECL_PROPINITSOL((*propinitsol)) /**< solving process initialization method of propagator */
847  )
848 {
849  assert(prop != NULL);
850 
851  prop->propinitsol = propinitsol;
852 }
853 
854 /** sets solving process deinitialization method of propagator */
856  SCIP_PROP* prop, /**< propagator */
857  SCIP_DECL_PROPEXITSOL ((*propexitsol)) /**< solving process deinitialization method of propagator */
858  )
859 {
860  assert(prop != NULL);
861 
862  prop->propexitsol = propexitsol;
863 }
864 
865 /** sets preprocessing initialization method of propagator */
867  SCIP_PROP* prop, /**< propagator */
868  SCIP_DECL_PROPINITPRE((*propinitpre)) /**< preprocessing initialization method of propagator */
869  )
870 {
871  assert(prop != NULL);
872 
873  prop->propinitpre = propinitpre;
874 }
875 
876 
877 
878 /** sets preprocessing deinitialization method of propagator */
880  SCIP_PROP* prop, /**< propagator */
881  SCIP_DECL_PROPEXITPRE((*propexitpre)) /**< preprocessing deinitialization method of propagator */
882  )
883 {
884  assert(prop != NULL);
885 
886  prop->propexitpre = propexitpre;
887 }
888 
889 /** sets presolving method of propagator */
891  SCIP_PROP* prop, /**< propagator */
892  SCIP_DECL_PROPPRESOL ((*proppresol)), /**< presolving method */
893  int presolpriority, /**< presolving priority of the propagator (>= 0: before, < 0: after constraint handlers) */
894  int presolmaxrounds, /**< maximal number of presolving rounds the propagator participates in (-1: no limit) */
895  SCIP_PRESOLTIMING presoltiming /**< timing mask of the propagator's presolving method */
896  )
897 {
898  assert(prop != NULL);
899 
900  prop->proppresol = proppresol;
901  prop->presolpriority = presolpriority;
902  /* the interface change from delay flags to timings cannot be recognized at compile time: Exit with an appropriate
903  * error message
904  */
905  if( presoltiming < SCIP_PRESOLTIMING_FAST || presoltiming > SCIP_PRESOLTIMING_MAX )
906  {
907  SCIPmessagePrintError("ERROR: 'PRESOLDELAY'-flag no longer available since SCIP 3.2, use an appropriate "
908  "'SCIP_PRESOLTIMING' for <%s> constraint handler instead.\n", prop->name);
909 
910  return SCIP_PARAMETERWRONGVAL;
911  }
912 
913  prop->presoltiming = presoltiming;
914  prop->maxprerounds = presolmaxrounds;
915 
916  return SCIP_OKAY;
917 }
918 
919 /** sets propagation conflict resolving callback of propagator */
921  SCIP_PROP* prop, /**< propagator */
922  SCIP_DECL_PROPRESPROP ((*propresprop)) /**< propagation conflict resolving callback */
923  )
924 {
925  assert(prop != NULL);
926 
927  prop->propresprop = propresprop;
928 }
929 
930 /** gets name of propagator */
931 const char* SCIPpropGetName(
932  SCIP_PROP* prop /**< propagator */
933  )
934 {
935  assert(prop != NULL);
936 
937  return prop->name;
938 }
939 
940 /** gets description of propagator */
941 const char* SCIPpropGetDesc(
942  SCIP_PROP* prop /**< propagator */
943  )
944 {
945  assert(prop != NULL);
946 
947  return prop->desc;
948 }
949 
950 /** gets priority of propagator */
952  SCIP_PROP* prop /**< propagator */
953  )
954 {
955  assert(prop != NULL);
956 
957  return prop->priority;
958 }
959 
960 /** gets presolving priority of propagator */
962  SCIP_PROP* prop /**< propagator */
963  )
964 {
965  assert(prop != NULL);
966 
967  return prop->presolpriority;
968 }
969 
970 /** sets priority of propagator */
972  SCIP_PROP* prop, /**< propagator */
973  SCIP_SET* set, /**< global SCIP settings */
974  int priority /**< new priority of the propagator */
975  )
976 {
977  assert(prop != NULL);
978  assert(set != NULL);
979 
980  prop->priority = priority;
981  set->propssorted = FALSE;
982 }
983 
984 /** sets presolving priority of propagator */
986  SCIP_PROP* prop, /**< propagator */
987  SCIP_SET* set, /**< global SCIP settings */
988  int presolpriority /**< new priority of the propagator */
989  )
990 {
991  assert(prop != NULL);
992  assert(set != NULL);
993 
994  prop->presolpriority = presolpriority;
995  set->propspresolsorted = FALSE;
996 }
997 
998 /** gets frequency of propagator */
1000  SCIP_PROP* prop /**< propagator */
1001  )
1002 {
1003  assert(prop != NULL);
1004 
1005  return prop->freq;
1006 }
1007 
1008 /** enables or disables all clocks of \p prop, depending on the value of the flag */
1010  SCIP_PROP* prop, /**< the propagator for which all clocks should be enabled or disabled */
1011  SCIP_Bool enable /**< should the clocks of the propagator be enabled? */
1012  )
1013 {
1014  assert(prop != NULL);
1015 
1016  SCIPclockEnableOrDisable(prop->setuptime, enable);
1017  SCIPclockEnableOrDisable(prop->presoltime, enable);
1018  SCIPclockEnableOrDisable(prop->proptime, enable);
1019  SCIPclockEnableOrDisable(prop->resproptime, enable);
1020  SCIPclockEnableOrDisable(prop->sbproptime, enable);
1021 }
1022 
1023 /** gets time in seconds used for setting up this propagator for new stages */
1025  SCIP_PROP* prop /**< propagator */
1026  )
1027 {
1028  assert(prop != NULL);
1029 
1030  return SCIPclockGetTime(prop->setuptime);
1031 }
1032 
1033 /** sets frequency of propagator */
1035  SCIP_PROP* prop, /**< propagator */
1036  int freq /**< new frequency of propagator */
1037  )
1038 {
1039  assert(prop != NULL);
1040  assert(freq >= -1);
1041 
1042  prop->freq = freq;
1043 }
1044 
1045 /** gets time in seconds used in this propagator for propagation */
1047  SCIP_PROP* prop /**< propagator */
1048  )
1049 {
1050  assert(prop != NULL);
1051 
1052  return SCIPclockGetTime(prop->proptime);
1053 }
1054 
1055 /** gets time in seconds used in this propagator for propagation during strong branching */
1057  SCIP_PROP* prop /**< propagator */
1058  )
1059 {
1060  assert(prop != NULL);
1061 
1062  return SCIPclockGetTime(prop->sbproptime);
1063 }
1064 
1065 /** gets time in seconds used in this propagator for resolve propagation */
1067  SCIP_PROP* prop /**< propagator */
1068  )
1069 {
1070  assert(prop != NULL);
1071 
1072  return SCIPclockGetTime(prop->resproptime);
1073 }
1074 
1075 /** gets time in seconds used in this propagator for presolving */
1077  SCIP_PROP* prop /**< propagator */
1078  )
1079 {
1080  assert(prop != NULL);
1081 
1082  return SCIPclockGetTime(prop->presoltime);
1083 }
1084 
1085 /** gets the total number of times, the propagator was called */
1087  SCIP_PROP* prop /**< propagator */
1088  )
1089 {
1090  assert(prop != NULL);
1091 
1092  return prop->ncalls;
1093 }
1094 
1095 /** gets the total number of times, the propagator was called for resolving a propagation */
1097  SCIP_PROP* prop /**< propagator */
1098  )
1099 {
1100  assert(prop != NULL);
1101 
1102  return prop->nrespropcalls;
1103 }
1104 
1105 /** gets total number of times, this propagator detected a cutoff */
1107  SCIP_PROP* prop /**< propagator */
1108  )
1109 {
1110  assert(prop != NULL);
1111 
1112  return prop->ncutoffs;
1113 }
1114 
1115 /** gets total number of domain reductions found by this propagator */
1117  SCIP_PROP* prop /**< propagator */
1118  )
1119 {
1120  assert(prop != NULL);
1121 
1122  return prop->ndomredsfound;
1123 }
1124 
1125 /** should propagator be delayed, if other propagators found reductions? */
1127  SCIP_PROP* prop /**< propagator */
1128  )
1129 {
1130  assert(prop != NULL);
1131 
1132  return prop->delay;
1133 }
1134 
1135 /** was propagator delayed at the last call? */
1137  SCIP_PROP* prop /**< propagator */
1138  )
1139 {
1140  assert(prop != NULL);
1141 
1142  return prop->wasdelayed;
1143 }
1144 
1145 /** is propagator initialized? */
1147  SCIP_PROP* prop /**< propagator */
1148  )
1149 {
1150  assert(prop != NULL);
1151 
1152  return prop->initialized;
1153 }
1154 
1155 /** gets number of variables fixed during presolving of propagator */
1157  SCIP_PROP* prop /**< propagator */
1158  )
1159 {
1160  assert(prop != NULL);
1161 
1162  return prop->nfixedvars;
1163 }
1164 
1165 /** gets number of variables aggregated during presolving of propagator */
1167  SCIP_PROP* prop /**< propagator */
1168  )
1169 {
1170  assert(prop != NULL);
1171 
1172  return prop->naggrvars;
1173 }
1174 
1175 /** gets number of variable types changed during presolving of propagator */
1177  SCIP_PROP* prop /**< propagator */
1178  )
1179 {
1180  assert(prop != NULL);
1181 
1182  return prop->nchgvartypes;
1183 }
1184 
1185 /** gets number of bounds changed during presolving of propagator */
1187  SCIP_PROP* prop /**< propagator */
1188  )
1189 {
1190  assert(prop != NULL);
1191 
1192  return prop->nchgbds;
1193 }
1194 
1195 /** gets number of holes added to domains of variables during presolving of propagator */
1197  SCIP_PROP* prop /**< propagator */
1198  )
1199 {
1200  assert(prop != NULL);
1201 
1202  return prop->naddholes;
1203 }
1204 
1205 /** gets number of constraints deleted during presolving of propagator */
1207  SCIP_PROP* prop /**< propagator */
1208  )
1209 {
1210  assert(prop != NULL);
1211 
1212  return prop->ndelconss;
1213 }
1214 
1215 /** gets number of constraints added during presolving of propagator */
1217  SCIP_PROP* prop /**< propagator */
1218  )
1219 {
1220  assert(prop != NULL);
1221 
1222  return prop->naddconss;
1223 }
1224 
1225 /** gets number of constraints upgraded during presolving of propagator */
1227  SCIP_PROP* prop /**< propagator */
1228  )
1229 {
1230  assert(prop != NULL);
1231 
1232  return prop->nupgdconss;
1233 }
1234 
1235 /** gets number of coefficients changed during presolving of propagator */
1237  SCIP_PROP* prop /**< propagator */
1238  )
1239 {
1240  assert(prop != NULL);
1241 
1242  return prop->nchgcoefs;
1243 }
1244 
1245 /** gets number of constraint sides changed during presolving of propagator */
1247  SCIP_PROP* prop /**< propagator */
1248  )
1249 {
1250  assert(prop != NULL);
1251 
1252  return prop->nchgsides;
1253 }
1254 
1255 /** gets number of times the propagator was called in presolving and tried to find reductions */
1257  SCIP_PROP* prop /**< propagator */
1258  )
1259 {
1260  assert(prop != NULL);
1261 
1262  return prop->npresolcalls;
1263 }
1264 
1265 /** returns the timing mask of the propagator */
1267  SCIP_PROP* prop /**< propagator */
1268  )
1269 {
1270  assert(prop != NULL);
1271 
1272  return prop->timingmask;
1273 }
1274 
1275 /** does the propagator perform presolving? */
1277  SCIP_PROP* prop /**< propagator */
1278  )
1279 {
1280  assert(prop != NULL);
1281 
1282  return (prop->proppresol != NULL);
1283 }
1284 
1285 /** returns the timing mask of the presolving method of the propagator */
1287  SCIP_PROP* prop /**< propagator */
1288  )
1289 {
1290  assert(prop != NULL);
1291 
1292  return prop->presoltiming;
1293 }
1294 
1295 /** sets the timing mask of the presolving method of the propagator */
1297  SCIP_PROP* prop, /**< propagator */
1298  SCIP_PRESOLTIMING presoltiming /** timing mask to be set */
1299  )
1300 {
1301  assert(prop != NULL);
1302 
1303  prop->presoltiming = presoltiming;
1304 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
int lastndelconss
Definition: struct_prop.h:73
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
int SCIPpropGetNAddConss(SCIP_PROP *prop)
Definition: prop.c:1216
static SCIP_RETCODE doPropCreate(SCIP_PROP **prop, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_PROPCOPY((*propcopy)), SCIP_DECL_PROPFREE((*propfree)), SCIP_DECL_PROPINIT((*propinit)), SCIP_DECL_PROPEXIT((*propexit)), SCIP_DECL_PROPINITPRE((*propinitpre)), SCIP_DECL_PROPEXITPRE((*propexitpre)), SCIP_DECL_PROPINITSOL((*propinitsol)), SCIP_DECL_PROPEXITSOL((*propexitsol)), SCIP_DECL_PROPPRESOL((*proppresol)), SCIP_DECL_PROPEXEC((*propexec)), SCIP_DECL_PROPRESPROP((*propresprop)), SCIP_PROPDATA *propdata)
Definition: prop.c:109
int SCIPpropGetPriority(SCIP_PROP *prop)
Definition: prop.c:951
void SCIPpropSetFreq(SCIP_PROP *prop, int freq)
Definition: prop.c:1034
SCIP_RETCODE SCIPpropExitpre(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:436
int nfixedvars
Definition: struct_prop.h:78
SCIP_RETCODE SCIPpropInitsol(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:460
int SCIPpropGetFreq(SCIP_PROP *prop)
Definition: prop.c:999
#define NULL
Definition: def.h:253
void SCIPpropSetCopy(SCIP_PROP *prop, SCIP_DECL_PROPCOPY((*propcopy)))
Definition: prop.c:800
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:138
SCIP_Real SCIPgetVarLbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: scip_var.c:1994
SCIP_Real SCIPpropGetSetupTime(SCIP_PROP *prop)
Definition: prop.c:1024
SCIP_Longint SCIPpropGetNRespropCalls(SCIP_PROP *prop)
Definition: prop.c:1096
SCIP_RETCODE SCIPpropCopyInclude(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:90
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:661
#define SCIP_MAXSTRLEN
Definition: def.h:274
int lastnaddholes
Definition: struct_prop.h:72
internal methods for clocks and timing issues
int ndelconss
Definition: struct_prop.h:83
SCIP_RETCODE SCIPpropPresol(SCIP_PROP *prop, SCIP_SET *set, SCIP_PRESOLTIMING timing, int nrounds, int *nfixedvars, int *naggrvars, int *nchgvartypes, int *nchgbds, int *naddholes, int *ndelconss, int *naddconss, int *nupgdconss, int *nchgcoefs, int *nchgsides, SCIP_RESULT *result)
Definition: prop.c:509
char * desc
Definition: struct_prop.h:44
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:76
int maxprerounds
Definition: struct_prop.h:67
#define SCIP_CALL_FINALLY(x, y)
Definition: def.h:407
int naddholes
Definition: struct_prop.h:82
SCIP_CLOCK * presoltime
Definition: struct_prop.h:61
SCIP_Longint SCIPpropGetNDomredsFound(SCIP_PROP *prop)
Definition: prop.c:1116
int SCIPpropGetPresolPriority(SCIP_PROP *prop)
Definition: prop.c:961
SCIP_CLOCK * proptime
Definition: struct_prop.h:58
int npresolcalls
Definition: struct_prop.h:88
SCIP_Longint ncalls
Definition: struct_prop.h:39
SCIP_Longint nholechgs
Definition: struct_stat.h:107
#define SCIP_PROPTIMING_DURINGLPLOOP
Definition: type_timing.h:57
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:350
int nupgdconss
Definition: struct_prop.h:85
#define FALSE
Definition: def.h:73
int nchgbds
Definition: struct_prop.h:81
SCIP_Longint ncutoffs
Definition: struct_prop.h:41
void SCIPpropSetExitsol(SCIP_PROP *prop, SCIP_DECL_PROPEXITSOL((*propexitsol)))
Definition: prop.c:855
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:280
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_DECL_PROPEXITPRE(x)
Definition: type_prop.h:100
#define SCIP_PRESOLTIMING_EXHAUSTIVE
Definition: type_timing.h:45
void SCIPpropSetFree(SCIP_PROP *prop, SCIP_DECL_PROPFREE((*propfree)))
Definition: prop.c:811
void SCIPpropSetInitpre(SCIP_PROP *prop, SCIP_DECL_PROPINITPRE((*propinitpre)))
Definition: prop.c:866
char * name
Definition: struct_prop.h:43
int lastnfixedvars
Definition: struct_prop.h:68
#define SCIP_PRESOLTIMING_NONE
Definition: type_timing.h:42
internal methods for handling parameter settings
void SCIPpropSetInitsol(SCIP_PROP *prop, SCIP_DECL_PROPINITSOL((*propinitsol)))
Definition: prop.c:844
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: clock.c:250
int SCIPpropGetNChgSides(SCIP_PROP *prop)
Definition: prop.c:1246
#define BMSfreeMemory(ptr)
Definition: memory.h:135
SCIP_RETCODE SCIPpropInit(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:304
void SCIPpropSetData(SCIP_PROP *prop, SCIP_PROPDATA *propdata)
Definition: prop.c:789
#define SCIP_DECL_PROPEXEC(x)
Definition: type_prop.h:203
const char * SCIPpropGetDesc(SCIP_PROP *prop)
Definition: prop.c:941
SCIP_RETCODE SCIPsetPropPresolPriority(SCIP *scip, SCIP_PROP *prop, int presolpriority)
Definition: scip_prop.c:371
#define SCIP_PRESOLTIMING_FAST
Definition: type_timing.h:43
void SCIPpropSetPriority(SCIP_PROP *prop, SCIP_SET *set, int priority)
Definition: prop.c:971
SCIP_Bool SCIPpropIsDelayed(SCIP_PROP *prop)
Definition: prop.c:1126
SCIP_Real SCIPpropGetTime(SCIP_PROP *prop)
Definition: prop.c:1046
internal methods for propagators
SCIP_PROPTIMING timingmask
Definition: struct_prop.h:64
SCIP_Longint nrespropcalls
Definition: struct_prop.h:40
void SCIPpropSetExit(SCIP_PROP *prop, SCIP_DECL_PROPEXIT((*propexit)))
Definition: prop.c:833
SCIP_Bool SCIPpropDoesPresolve(SCIP_PROP *prop)
Definition: prop.c:1276
SCIP_PRESOLTIMING presoltiming
Definition: struct_prop.h:65
#define SCIP_PRESOLTIMING_MEDIUM
Definition: type_timing.h:44
SCIP_Bool delay
Definition: struct_prop.h:89
void SCIPmessagePrintError(const char *formatstr,...)
Definition: message.c:781
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_Bool SCIPpropIsInitialized(SCIP_PROP *prop)
Definition: prop.c:1146
SCIP_Real SCIPpropGetRespropTime(SCIP_PROP *prop)
Definition: prop.c:1066
SCIP_Real SCIPpropGetStrongBranchPropTime(SCIP_PROP *prop)
Definition: prop.c:1056
SCIP_RETCODE SCIPpropCreate(SCIP_PROP **prop, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int priority, int freq, SCIP_Bool delay, SCIP_PROPTIMING timingmask, int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming, SCIP_DECL_PROPCOPY((*propcopy)), SCIP_DECL_PROPFREE((*propfree)), SCIP_DECL_PROPINIT((*propinit)), SCIP_DECL_PROPEXIT((*propexit)), SCIP_DECL_PROPINITPRE((*propinitpre)), SCIP_DECL_PROPEXITPRE((*propexitpre)), SCIP_DECL_PROPINITSOL((*propinitsol)), SCIP_DECL_PROPEXITSOL((*propexitsol)), SCIP_DECL_PROPPRESOL((*proppresol)), SCIP_DECL_PROPEXEC((*propexec)), SCIP_DECL_PROPRESPROP((*propresprop)), SCIP_PROPDATA *propdata)
Definition: prop.c:232
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:199
int lastnaggrvars
Definition: struct_prop.h:69
int lastnchgcoefs
Definition: struct_prop.h:76
#define SCIP_DECL_PROPEXITSOL(x)
Definition: type_prop.h:127
const char * SCIPpropGetName(SCIP_PROP *prop)
Definition: prop.c:931
int lastnaddconss
Definition: struct_prop.h:74
int SCIPpropGetNAddHoles(SCIP_PROP *prop)
Definition: prop.c:1196
#define SCIP_DECL_PROPCOPY(x)
Definition: type_prop.h:47
SCIP_DECL_SORTPTRCOMP(SCIPpropComp)
Definition: prop.c:42
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:428
SCIP_CLOCK * resproptime
Definition: struct_prop.h:60
void SCIPpropSetPresolTiming(SCIP_PROP *prop, SCIP_PRESOLTIMING presoltiming)
Definition: prop.c:1296
void SCIPpropEnableOrDisableClocks(SCIP_PROP *prop, SCIP_Bool enable)
Definition: prop.c:1009
int SCIPpropGetNPresolCalls(SCIP_PROP *prop)
Definition: prop.c:1256
#define SCIP_PROPTIMING_ALWAYS
Definition: type_timing.h:64
int nchgvartypes
Definition: struct_prop.h:80
#define SCIP_PROPTIMING_AFTERLPLOOP
Definition: type_timing.h:58
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:365
int SCIPpropGetNChgVarTypes(SCIP_PROP *prop)
Definition: prop.c:1176
unsigned int SCIP_PRESOLTIMING
Definition: type_timing.h:52
#define SCIP_DECL_PROPINITPRE(x)
Definition: type_prop.h:85
SCIP_PRESOLTIMING SCIPpropGetPresolTiming(SCIP_PROP *prop)
Definition: prop.c:1286
void SCIPpropSetPresolPriority(SCIP_PROP *prop, SCIP_SET *set, int presolpriority)
Definition: prop.c:985
int SCIPpropGetNFixedVars(SCIP_PROP *prop)
Definition: prop.c:1156
SCIP_RETCODE SCIPsetAddIntParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, int *valueptr, SCIP_Bool isadvanced, int defaultvalue, int minvalue, int maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:2879
SCIP_CLOCK * setuptime
Definition: struct_prop.h:57
SCIP_Longint SCIPpropGetNCalls(SCIP_PROP *prop)
Definition: prop.c:1086
int nchgsides
Definition: struct_prop.h:87
SCIP_Real SCIPpropGetPresolTime(SCIP_PROP *prop)
Definition: prop.c:1076
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:133
SCIP_Longint nprobboundchgs
Definition: struct_stat.h:108
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:160
SCIP_Bool SCIPpropWasDelayed(SCIP_PROP *prop)
Definition: prop.c:1136
internal methods for problem variables
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:70
int SCIPpropGetNChgBds(SCIP_PROP *prop)
Definition: prop.c:1186
SCIP_Longint ndomredsfound
Definition: struct_prop.h:42
SCIP_CLOCK * sbproptime
Definition: struct_prop.h:59
SCIP_RETCODE SCIPpropResolvePropagation(SCIP_PROP *prop, SCIP_SET *set, SCIP_VAR *infervar, int inferinfo, SCIP_BOUNDTYPE inferboundtype, SCIP_BDCHGIDX *bdchgidx, SCIP_Real relaxedbd, SCIP_RESULT *result)
Definition: prop.c:727
#define SCIP_DECL_PROPFREE(x)
Definition: type_prop.h:55
SCIP_EXPORT SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17362
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:175
#define SCIPsetDebugMsg
Definition: set.h:1720
#define SCIP_DECL_PROPINITSOL(x)
Definition: type_prop.h:115
int SCIPpropGetNAggrVars(SCIP_PROP *prop)
Definition: prop.c:1166
#define SCIP_PRESOLTIMING_MAX
Definition: type_timing.h:50
#define SCIP_PROPTIMING_BEFORELP
Definition: type_timing.h:56
int nchgcoefs
Definition: struct_prop.h:86
SCIP_RETCODE SCIPpropInitpre(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:400
#define BMSclearMemory(ptr)
Definition: memory.h:119
#define SCIP_MAXTREEDEPTH
Definition: def.h:301
SCIP_Real SCIPgetVarUbAtIndex(SCIP *scip, SCIP_VAR *var, SCIP_BDCHGIDX *bdchgidx, SCIP_Bool after)
Definition: scip_var.c:2130
int priority
Definition: struct_prop.h:62
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:716
SCIP_PROPDATA * SCIPpropGetData(SCIP_PROP *prop)
Definition: prop.c:779
void SCIPpropSetInit(SCIP_PROP *prop, SCIP_DECL_PROPINIT((*propinit)))
Definition: prop.c:822
int lastnchgbds
Definition: struct_prop.h:71
static SCIP_DECL_PARAMCHGD(paramChgdPropPriority)
Definition: prop.c:61
datastructures for propagators
unsigned int SCIP_PROPTIMING
Definition: type_timing.h:66
SCIP_PROPDATA * propdata
Definition: struct_prop.h:56
SCIP_RETCODE SCIPsetPropPriority(SCIP *scip, SCIP_PROP *prop, int priority)
Definition: scip_prop.c:356
#define SCIP_PRESOLTIMING_FINAL
Definition: type_timing.h:46
SCIP_Bool wasdelayed
Definition: struct_prop.h:90
SCIP_EXPORT SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17352
#define SCIP_DECL_PROPRESPROP(x)
Definition: type_prop.h:244
public methods for message output
SCIP_RETCODE SCIPpropSetPresol(SCIP_PROP *prop, SCIP_DECL_PROPPRESOL((*proppresol)), int presolpriority, int presolmaxrounds, SCIP_PRESOLTIMING presoltiming)
Definition: prop.c:890
int lastnchgvartypes
Definition: struct_prop.h:70
#define SCIP_DECL_PROPPRESOL(x)
Definition: type_prop.h:179
SCIP_RETCODE SCIPpropExec(SCIP_PROP *prop, SCIP_SET *set, SCIP_STAT *stat, int depth, SCIP_Bool execdelayed, SCIP_Bool instrongbranching, SCIP_PROPTIMING proptiming, SCIP_RESULT *result)
Definition: prop.c:635
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10263
SCIP_Longint nboundchgs
Definition: struct_stat.h:106
#define SCIP_Real
Definition: def.h:164
internal methods for problem statistics
struct SCIP_PropData SCIP_PROPDATA
Definition: type_prop.h:38
int SCIPpropGetNChgCoefs(SCIP_PROP *prop)
Definition: prop.c:1236
#define BMSallocMemory(ptr)
Definition: memory.h:109
void SCIPpropSetResprop(SCIP_PROP *prop, SCIP_DECL_PROPRESPROP((*propresprop)))
Definition: prop.c:920
#define SCIP_Longint
Definition: def.h:149
#define SCIP_DECL_PROPEXIT(x)
Definition: type_prop.h:71
int lastnchgsides
Definition: struct_prop.h:77
void SCIPpropSetExitpre(SCIP_PROP *prop, SCIP_DECL_PROPEXITPRE((*propexitpre)))
Definition: prop.c:879
SCIP_Bool initialized
Definition: struct_prop.h:91
int naddconss
Definition: struct_prop.h:84
int presolpriority
Definition: struct_prop.h:66
int SCIPpropGetNUpgdConss(SCIP_PROP *prop)
Definition: prop.c:1226
int naggrvars
Definition: struct_prop.h:79
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:427
int lastnupgdconss
Definition: struct_prop.h:75
#define SCIP_ALLOC(x)
Definition: def.h:376
SCIP_RETCODE SCIPsetAddBoolParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:2857
SCIP_Longint nprobholechgs
Definition: struct_stat.h:109
SCIP_Longint SCIPpropGetNCutoffs(SCIP_PROP *prop)
Definition: prop.c:1106
int SCIPpropGetNDelConss(SCIP_PROP *prop)
Definition: prop.c:1206
SCIP_RETCODE SCIPpropExit(SCIP_PROP *prop, SCIP_SET *set)
Definition: prop.c:370
SCIP_RETCODE SCIPpropFree(SCIP_PROP **prop, SCIP_SET *set)
Definition: prop.c:274
SCIP callable library.
SCIP_RETCODE SCIPpropExitsol(SCIP_PROP *prop, SCIP_SET *set, SCIP_Bool restart)
Definition: prop.c:484
#define SCIP_DECL_PROPINIT(x)
Definition: type_prop.h:63
SCIP_PROPTIMING SCIPpropGetTimingmask(SCIP_PROP *prop)
Definition: prop.c:1266