Scippy

SCIP

Solving Constraint Integer Programs

heur.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-2018 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 heur.c
17  * @brief methods for primal heuristics
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/clock.h"
30 #include "scip/paramset.h"
31 #include "scip/primal.h"
32 #include "scip/scip.h"
33 #include "scip/heur.h"
34 #include "scip/pub_message.h"
35 #include "scip/pub_misc.h"
36 #include "scip/misc.h"
37 
38 #include "scip/struct_heur.h"
39 
40 /** compares two heuristics w. r. to their delay positions and their priority */
41 SCIP_DECL_SORTPTRCOMP(SCIPheurComp)
42 { /*lint --e{715}*/
43  SCIP_HEUR* heur1 = (SCIP_HEUR*)elem1;
44  SCIP_HEUR* heur2 = (SCIP_HEUR*)elem2;
45 
46  assert(heur1 != NULL);
47  assert(heur2 != NULL);
48 
49  if( heur1->delaypos == heur2->delaypos )
50  return heur2->priority - heur1->priority; /* prefer higher priorities */
51  else if( heur1->delaypos == -1 )
52  return +1; /* prefer delayed heuristics */
53  else if( heur2->delaypos == -1 )
54  return -1; /* prefer delayed heuristics */
55  else if( heur1->ncalls * heur1->freq > heur2->ncalls * heur2->freq )
56  return +1;
57  else if( heur1->ncalls * heur1->freq < heur2->ncalls * heur2->freq )
58  return -1;
59  else
60  return heur1->delaypos - heur2->delaypos; /* prefer lower delay positions */
61 }
62 
63 
64 /** comparison method for sorting heuristics w.r.t. to their name */
65 SCIP_DECL_SORTPTRCOMP(SCIPheurCompName)
66 {
67  return strcmp(SCIPheurGetName((SCIP_HEUR*)elem1), SCIPheurGetName((SCIP_HEUR*)elem2));
68 }
69 
70 /** method to call, when the priority of a heuristic was changed */
71 static
72 SCIP_DECL_PARAMCHGD(paramChgdHeurPriority)
73 { /*lint --e{715}*/
74  SCIP_PARAMDATA* paramdata;
75 
76  paramdata = SCIPparamGetData(param);
77  assert(paramdata != NULL);
78 
79  /* use SCIPsetHeurPriority() to mark the heuristics unsorted */
80  SCIP_CALL( SCIPsetHeurPriority(scip, (SCIP_HEUR*)paramdata, SCIPparamGetInt(param)) ); /*lint !e740*/
81 
82  return SCIP_OKAY;
83 }
84 
85 /* resets diving settings counters */
87  SCIP_DIVESET* diveset, /**< diveset to be reset */
88  SCIP_SET* set /**< global SCIP settings */
89  )
90 {
91  assert(diveset != NULL);
92  assert(diveset->randnumgen != NULL);
93 
94  diveset->nlpiterations = 0L;
95  diveset->totaldepth = 0L;
96  diveset->totalsoldepth = 0L;
97  diveset->totalnnodes = 0L;
98  diveset->totalnbacktracks = 0L;
99  diveset->minsoldepth = INT_MAX;
100  diveset->maxsoldepth = -1;
101  diveset->mindepth = INT_MAX;
102  diveset->maxdepth = -1;
103  diveset->nlps = 0;
104  diveset->nsolsfound = 0;
105  diveset->nbestsolsfound = 0;
106  diveset->nconflictsfound = 0;
107  diveset->ncalls = 0;
108  diveset->nsolcalls = 0;
109 
110  /* reset the random number generator */
111  SCIPrandomSetSeed(diveset->randnumgen, (unsigned int) SCIPsetInitializeRandomSeed(set, (int)(diveset->initialseed % INT_MAX)));
112 
113  return SCIP_OKAY;
114 }
115 
116 /** update diveset statistics and global diveset statistics */
118  SCIP_DIVESET* diveset, /**< diveset to be reset */
119  SCIP_STAT* stat, /**< global SCIP statistics */
120  int depth, /**< the depth reached this time */
121  int nprobingnodes, /**< the number of probing nodes explored this time */
122  int nbacktracks, /**< the number of backtracks during probing this time */
123  SCIP_Longint nsolsfound, /**< number of new solutions found this time */
124  SCIP_Longint nbestsolsfound, /**< number of new best solutions found this time */
125  SCIP_Longint nconflictsfound, /**< number of new conflicts found this time */
126  SCIP_Bool leavesol /**< has the diving heuristic reached a feasible leaf */
127  )
128 {
129  assert(diveset != NULL);
130 
131  diveset->totaldepth += depth;
132  diveset->mindepth = MIN(diveset->mindepth, depth);
133  diveset->maxdepth = MAX(diveset->maxdepth, depth);
134  diveset->totalnnodes += nprobingnodes;
135  diveset->totalnbacktracks += nbacktracks;
136  diveset->ncalls++;
137 
138  /* update solution statistics only if a solution was found */
139  if( leavesol )
140  {
141  diveset->totalsoldepth += depth;
142  diveset->minsoldepth = MIN(diveset->minsoldepth, depth);
143  diveset->maxsoldepth = MAX(diveset->maxsoldepth, depth);
144  diveset->nsolcalls++;
145  }
146 
147  diveset->nsolsfound += nsolsfound;
148  diveset->nbestsolsfound += nbestsolsfound;
149  diveset->nconflictsfound += nconflictsfound;
150 
151  stat->totaldivesetdepth += depth;
152  stat->ndivesetcalls++;
153 }
154 
155 /** append diveset to heuristic array of divesets */
156 static
158  SCIP_HEUR* heur, /**< the heuristic to which this dive setting belongs */
159  SCIP_DIVESET* diveset /**< pointer to the freshly created diveset */
160  )
161 {
162  assert(heur != NULL);
163  assert(diveset != NULL);
164  assert(diveset->heur == NULL);
165 
166  diveset->heur = heur;
167 
168  if( heur->divesets == NULL )
169  {
170  assert(heur->ndivesets == 0);
172  }
173  else
174  {
175  assert(heur->ndivesets > 0);
176  SCIP_ALLOC( BMSreallocMemoryArray(&heur->divesets, heur->ndivesets + 1) ); /*lint !e776 I expect no overflow here */
177  }
178 
179  /* append diveset to the end of the array */
180  heur->divesets[heur->ndivesets] = diveset;
181  heur->ndivesets++;
182 
183  return SCIP_OKAY;
184 }
185 
186 /** create a set of diving heuristic settings */
188  SCIP_DIVESET** divesetptr, /**< pointer to the freshly created diveset */
189  SCIP_HEUR* heur, /**< the heuristic to which this dive setting belongs */
190  const char* name, /**< name for the diveset, or NULL if the name of the heuristic should be used */
191  SCIP_SET* set, /**< global SCIP settings */
192  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
193  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
194  SCIP_Real minreldepth, /**< minimal relative depth to start diving */
195  SCIP_Real maxreldepth, /**< maximal relative depth to start diving */
196  SCIP_Real maxlpiterquot, /**< maximal fraction of diving LP iterations compared to node LP iterations */
197  SCIP_Real maxdiveubquot, /**< maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound)
198  * where diving is performed (0.0: no limit) */
199  SCIP_Real maxdiveavgquot, /**< maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound)
200  * where diving is performed (0.0: no limit) */
201  SCIP_Real maxdiveubquotnosol, /**< maximal UBQUOT when no solution was found yet (0.0: no limit) */
202  SCIP_Real maxdiveavgquotnosol,/**< maximal AVGQUOT when no solution was found yet (0.0: no limit) */
203  SCIP_Real lpresolvedomchgquot,/**< percentage of immediate domain changes during probing to trigger LP resolve */
204  int lpsolvefreq, /**< LP solve frequency for (0: only if enough domain reductions are found by propagation)*/
205  int maxlpiterofs, /**< additional number of allowed LP iterations */
206  unsigned int initialseed, /**< initial seed for random number generation */
207  SCIP_Bool backtrack, /**< use one level of backtracking if infeasibility is encountered? */
208  SCIP_Bool onlylpbranchcands, /**< should only LP branching candidates be considered instead of the slower but
209  * more general constraint handler diving variable selection? */
210  SCIP_DIVETYPE divetypemask, /**< bit mask that represents the supported dive types by this dive set */
211  SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)) /**< method for candidate score and rounding direction */
212  )
213 {
214  char paramname[SCIP_MAXSTRLEN];
215  const char* divesetname;
216  SCIP_DIVESET* diveset;
217 
218  assert(divesetptr != NULL);
219  assert(set != NULL);
220  assert(divesetgetscore != NULL);
221  assert(heur != NULL);
222  assert(blkmem != NULL);
223 
224  SCIP_ALLOC( BMSallocBlockMemory(blkmem, divesetptr) );
225  diveset = *divesetptr;
226 
227  /* allocate random number generator. Note that we must make explicit use of random seed initialization because
228  * we create the random number generator directly, not through the public SCIP API
229  */
230  diveset->initialseed = initialseed;
231 
232  /* simply use 0 as initial seed, the seed is reset in SCIPdivesetReset, anyway */
233  SCIP_CALL( SCIPrandomCreate(&diveset->randnumgen, blkmem, 0) );
234 
235  /* for convenience, the name gets inferred from the heuristic to which the diveset is added if no name is provided */
236  divesetname = (name == NULL ? SCIPheurGetName(heur) : name);
237  SCIP_ALLOC( BMSduplicateMemoryArray(&diveset->name, divesetname, strlen(divesetname)+1) );
238  diveset->heur = NULL;
239 
240  /* copy callbacks */
241  diveset->divesetgetscore = divesetgetscore;
242 
243  SCIP_CALL( heurAddDiveset(heur, diveset) );
244  diveset->sol = NULL;
245  diveset->divetypemask = divetypemask;
246 
247  SCIP_CALL( SCIPdivesetReset(diveset, set) );
248 
249  /* add collection of diving heuristic specific parameters */
250  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/minreldepth", diveset->name);
251  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
252  paramname, "minimal relative depth to start diving",
253  &diveset->minreldepth, TRUE, minreldepth, 0.0, 1.0, NULL, NULL) );
254 
255  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxreldepth", diveset->name);
256  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem, paramname,
257  "maximal relative depth to start diving",
258  &diveset->maxreldepth, TRUE, maxreldepth, 0.0, 1.0, NULL, NULL) );
259 
260  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterquot", diveset->name);
261  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
262  paramname,
263  "maximal fraction of diving LP iterations compared to node LP iterations",
264  &diveset->maxlpiterquot, FALSE, maxlpiterquot, 0.0, SCIP_REAL_MAX, NULL, NULL) );
265 
266  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxlpiterofs", diveset->name);
267  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem,
268  paramname,
269  "additional number of allowed LP iterations",
270  &diveset->maxlpiterofs, FALSE, maxlpiterofs, 0, INT_MAX, NULL, NULL) );
271 
272  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveubquot", diveset->name);
273  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
274  paramname,
275  "maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound) where diving is performed (0.0: no limit)",
276  &diveset->maxdiveubquot, TRUE, maxdiveubquot, 0.0, 1.0, NULL, NULL) );
277 
278  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveavgquot", diveset->name);
279  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
280  paramname,
281  "maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound) where diving is performed (0.0: no limit)",
282  &diveset->maxdiveavgquot, TRUE, maxdiveavgquot, 0.0, SCIP_REAL_MAX, NULL, NULL) );
283 
284  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveubquotnosol", diveset->name);
285  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
286  paramname,
287  "maximal UBQUOT when no solution was found yet (0.0: no limit)",
288  &diveset->maxdiveubquotnosol, TRUE, maxdiveubquotnosol, 0.0, 1.0, NULL, NULL) );
289 
290  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdiveavgquotnosol", diveset->name);
291  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem,
292  paramname,
293  "maximal AVGQUOT when no solution was found yet (0.0: no limit)",
294  &diveset->maxdiveavgquotnosol, TRUE, maxdiveavgquotnosol, 0.0, SCIP_REAL_MAX, NULL, NULL) );
295 
296  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/backtrack", diveset->name);
297  SCIP_CALL( SCIPsetAddBoolParam(set, messagehdlr, blkmem,
298  paramname,
299  "use one level of backtracking if infeasibility is encountered?",
300  &diveset->backtrack, FALSE, backtrack, NULL, NULL) );
301 
302  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/lpresolvedomchgquot", diveset->name);
303  SCIP_CALL( SCIPsetAddRealParam(set, messagehdlr, blkmem, paramname,
304  "percentage of immediate domain changes during probing to trigger LP resolve",
305  &diveset->lpresolvedomchgquot, FALSE, lpresolvedomchgquot, 0.0, SCIP_REAL_MAX, NULL, NULL) );
306 
307  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/lpsolvefreq", diveset->name);
308  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem,
309  paramname,
310  "LP solve frequency for diving heuristics (0: only after enough domain changes have been found)",
311  &diveset->lpsolvefreq, FALSE, lpsolvefreq, 0, INT_MAX,
312  NULL, NULL) );
313 
314  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/onlylpbranchcands", diveset->name);
315  SCIP_CALL( SCIPsetAddBoolParam(set, messagehdlr, blkmem,
316  paramname,
317  "should only LP branching candidates be considered instead of the slower but "
318  "more general constraint handler diving variable selection?",
319  &diveset->onlylpbranchcands, FALSE, onlylpbranchcands, NULL, NULL) );
320 
321  return SCIP_OKAY;
322 }
323 
324 /** get the heuristic to which this diving setting belongs */
326  SCIP_DIVESET* diveset /**< diving settings */
327  )
328 {
329  return diveset->heur;
330 }
331 
332 /** get the working solution of this dive set */
334  SCIP_DIVESET* diveset /**< diving settings */
335  )
336 {
337  assert(diveset != NULL);
338 
339  return diveset->sol;
340 }
341 
342 /** set the working solution for this dive set */
344  SCIP_DIVESET* diveset, /**< diving settings */
345  SCIP_SOL* sol /**< new working solution for this dive set, or NULL */
346  )
347 {
348  assert(diveset != NULL);
349 
350  diveset->sol = sol;
351 }
352 
353 /** get the name of the dive set */
354 const char* SCIPdivesetGetName(
355  SCIP_DIVESET* diveset /**< diving settings */
356  )
357 {
358  assert(diveset != NULL);
359 
360  return diveset->name;
361 }
362 
363 /** get the minimum relative depth of the diving settings */
365  SCIP_DIVESET* diveset /**< diving settings */
366  )
367 {
368  return diveset->minreldepth;
369 }
370 
371 /** get the maximum relative depth of the diving settings */
373  SCIP_DIVESET* diveset /**< diving settings */
374  )
375 {
376  return diveset->maxreldepth;
377 }
378 
379 /** get the number of successful runs of the diving settings */
381  SCIP_DIVESET* diveset /**< diving settings */
382  )
383 {
384  return 10 * diveset->nbestsolsfound + diveset->nsolsfound;
385 }
386 
387 /** get the number of calls to this dive set */
389  SCIP_DIVESET* diveset /**< diving settings */
390  )
391 {
392  assert(diveset != NULL);
393 
394  return diveset->ncalls;
395 }
396 
397 /** get the number of calls successfully terminated at a feasible leaf node */
399  SCIP_DIVESET* diveset /**< diving settings */
400  )
401 {
402  assert(diveset != NULL);
403 
404  return diveset->nsolcalls;
405 }
406 
407 /** get the minimum depth reached by this dive set */
409  SCIP_DIVESET* diveset /**< diving settings */
410  )
411 {
412  assert(diveset != NULL);
413 
414  return diveset->mindepth;
415 }
416 
417 /** get the maximum depth reached by this dive set */
419  SCIP_DIVESET* diveset /**< diving settings */
420  )
421 {
422  assert(diveset != NULL);
423 
424  return diveset->maxdepth;
425 }
426 
427 /** get the average depth this dive set reached during execution */
429  SCIP_DIVESET* diveset /**< diving settings */
430  )
431 {
432  assert(diveset != NULL);
433 
434  return (diveset->ncalls == 0 ? 0.0 : diveset->totaldepth / (SCIP_Real)diveset->ncalls);
435 }
436 
437 /** get the minimum depth at which this dive set found a solution */
439  SCIP_DIVESET* diveset /**< diving settings */
440  )
441 {
442  assert(diveset != NULL);
443 
444  return diveset->minsoldepth;
445 }
446 
447 /** get the maximum depth at which this dive set found a solution */
449  SCIP_DIVESET* diveset /**< diving settings */
450  )
451 {
452  assert(diveset != NULL);
453 
454  return diveset->maxsoldepth;
455 }
456 
457 /** get the average depth at which this dive set found a solution */
459  SCIP_DIVESET* diveset /**< diving settings */
460  )
461 {
462  assert(diveset != NULL);
463 
464  return (diveset->nsolcalls == 0 ? 0.0 : diveset->totalsoldepth / (SCIP_Real)diveset->nsolcalls);
465 }
466 
467 /** get the total number of LP iterations used by this dive set */
469  SCIP_DIVESET* diveset /**< diving settings */
470  )
471 {
472  assert(diveset != NULL);
473 
474  return diveset->nlpiterations;
475 }
476 
477 /** get the total number of probing nodes used by this dive set */
479  SCIP_DIVESET* diveset /**< diving settings */
480  )
481 {
482  assert(diveset != NULL);
483 
484  return diveset->totalnnodes;
485 }
486 
487 /** get the total number of backtracks performed by this dive set */
489  SCIP_DIVESET* diveset /**< diving settings */
490  )
491 {
492  assert(diveset != NULL);
493 
494  return diveset->totalnbacktracks;
495 }
496 
497 /** get the total number of conflicts found by this dive set */
499  SCIP_DIVESET* diveset /**< diving settings */
500  )
501 {
502  assert(diveset != NULL);
503 
504  return diveset->nconflictsfound;
505 }
506 
507 /** get the total number of solutions (leaf and rounded solutions) found by the dive set */
509  SCIP_DIVESET* diveset /**< diving settings */
510  )
511 {
512  assert(diveset != NULL);
513 
514  return diveset->nsolsfound;
515 }
516 
517 
518 /** get the maximum LP iterations quotient of the diving settings */
520  SCIP_DIVESET* diveset /**< diving settings */
521  )
522 {
523  return diveset->maxlpiterquot;
524 }
525 
526 /** get the maximum LP iterations offset of the diving settings */
528  SCIP_DIVESET* diveset /**< diving settings */
529  )
530 {
531  return diveset->maxlpiterofs;
532 }
533 
534 /** get the maximum upper bound quotient parameter of the diving settings if no solution is available */
536  SCIP_DIVESET* diveset /**< diving settings */
537  )
538 {
539  return diveset->maxdiveubquotnosol;
540 }
541 
542 /** get the average quotient parameter of the diving settings if no solution is available */
544  SCIP_DIVESET* diveset /**< diving settings */
545  )
546 {
547  return diveset->maxdiveavgquotnosol;
548 }
549 /** get the maximum upper bound quotient parameter of the diving settings if an incumbent solution exists */
551  SCIP_DIVESET* diveset /**< diving settings */
552  )
553 {
554  return diveset->maxdiveubquot;
555 }
556 
557 /** get the average upper bound quotient parameter of the diving settings if an incumbent solution exists */
559  SCIP_DIVESET* diveset /**< diving settings */
560  )
561 {
562  return diveset->maxdiveavgquot;
563 }
564 
565 /** should backtracking be applied? */
567  SCIP_DIVESET* diveset /**< diving settings */
568  )
569 {
570  return diveset->backtrack;
571 }
572 
573 /** returns the LP solve frequency for diving LPs (0: dynamically based on number of intermediate domain reductions) */
575  SCIP_DIVESET* diveset /**< diving settings */
576  )
577 {
578  assert(diveset != NULL);
579 
580  return diveset->lpsolvefreq;
581 }
582 
583 /** returns the random number generator of this \p diveset for tie-breaking */
585  SCIP_DIVESET* diveset /**< diving settings */
586  )
587 {
588  assert(diveset != NULL);
589  assert(diveset->randnumgen != NULL);
590 
591  return diveset->randnumgen;
592 }
593 
594 /** returns the domain reduction quotient for triggering an immediate resolve of the diving LP (0.0: always resolve)*/
596  SCIP_DIVESET* diveset /**< diving settings */
597  )
598 {
599  assert(diveset != NULL);
600 
601  return diveset->lpresolvedomchgquot;
602 }
603 
604 /** should only LP branching candidates be considered instead of the slower but
605  * more general constraint handler diving variable selection?
606  */
608  SCIP_DIVESET* diveset /**< diving settings */
609  )
610 {
611  assert(diveset != NULL);
612 
613  return diveset->onlylpbranchcands;
614 }
615 
616 /** returns TRUE if dive set supports diving of the specified type */
618  SCIP_DIVESET* diveset, /**< diving settings */
619  SCIP_DIVETYPE divetype /**< bit mask that represents the supported dive types by this dive set */
620  )
621 {
622  assert(diveset != NULL);
623 
624  return (divetype & diveset->divetypemask);
625 }
626 
627 /** update diveset LP statistics, should be called after every LP solved by this diving heuristic */
629  SCIP_DIVESET* diveset, /**< diving settings */
630  SCIP_STAT* stat, /**< global SCIP statistics */
631  SCIP_Longint niterstoadd /**< additional number of LP iterations to be added */
632  )
633 {
634  diveset->nlpiterations += niterstoadd;
635  stat->ndivesetlpiterations += niterstoadd;
636  diveset->nlps++;
637  stat->ndivesetlps++;
638 }
639 
640 /** frees memory of a diveset */
641 static
643  SCIP_DIVESET** divesetptr, /**< general diving settings */
644  BMS_BLKMEM* blkmem /**< block memory for parameter settings */
645  )
646 {
647  SCIP_DIVESET* diveset = *divesetptr;
648 
649  assert(diveset != NULL);
650  assert(diveset->name != NULL);
651  assert(diveset->randnumgen != NULL);
652 
653  SCIPrandomFree(&diveset->randnumgen, blkmem);
654 
655  BMSfreeMemoryArray(&diveset->name);
656  BMSfreeBlockMemory(blkmem, divesetptr);
657 }
658 
659 /** get the candidate score and preferred rounding direction for a candidate variable */
661  SCIP_DIVESET* diveset, /**< general diving settings */
662  SCIP_SET* set, /**< SCIP settings */
663  SCIP_DIVETYPE divetype, /**< the type of diving that should be applied */
664  SCIP_VAR* divecand, /**< the candidate for which the branching direction is requested */
665  SCIP_Real divecandsol, /**< LP solution value of the candidate */
666  SCIP_Real divecandfrac, /**< fractionality of the candidate */
667  SCIP_Real* candscore, /**< pointer to store the candidate score */
668  SCIP_Bool* roundup /**< pointer to store whether preferred direction for diving is upwards */
669  )
670 {
671  assert(diveset->divesetgetscore != NULL);
672  assert(candscore != NULL);
673  assert(roundup != NULL);
674  assert(divecand != NULL);
675  assert(divetype & diveset->divetypemask);
676 
677  SCIP_CALL( diveset->divesetgetscore(set->scip, diveset, divetype, divecand, divecandsol, divecandfrac,
678  candscore, roundup) );
679 
680  return SCIP_OKAY;
681 }
682 
683 
684 
685 /** copies the given primal heuristic to a new scip */
687  SCIP_HEUR* heur, /**< primal heuristic */
688  SCIP_SET* set /**< SCIP_SET of SCIP to copy to */
689  )
690 {
691  assert(heur != NULL);
692  assert(set != NULL);
693  assert(set->scip != NULL);
694 
695  if( heur->heurcopy != NULL )
696  {
697  SCIPsetDebugMsg(set, "including heur %s in subscip %p\n", SCIPheurGetName(heur), (void*)set->scip);
698  SCIP_CALL( heur->heurcopy(set->scip, heur) );
699  }
700 
701  return SCIP_OKAY;
702 }
703 
704 /** internal method for creating a primal heuristic */
705 static
707  SCIP_HEUR** heur, /**< pointer to primal heuristic data structure */
708  SCIP_SET* set, /**< global SCIP settings */
709  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
710  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
711  const char* name, /**< name of primal heuristic */
712  const char* desc, /**< description of primal heuristic */
713  char dispchar, /**< display character of primal heuristic */
714  int priority, /**< priority of the primal heuristic */
715  int freq, /**< frequency for calling primal heuristic */
716  int freqofs, /**< frequency offset for calling primal heuristic */
717  int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
718  SCIP_HEURTIMING timingmask, /**< positions in the node solving loop where heuristic should be executed */
719  SCIP_Bool usessubscip, /**< does the heuristic use a secondary SCIP instance? */
720  SCIP_DECL_HEURCOPY ((*heurcopy)), /**< copy method of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
721  SCIP_DECL_HEURFREE ((*heurfree)), /**< destructor of primal heuristic */
722  SCIP_DECL_HEURINIT ((*heurinit)), /**< initialize primal heuristic */
723  SCIP_DECL_HEUREXIT ((*heurexit)), /**< deinitialize primal heuristic */
724  SCIP_DECL_HEURINITSOL ((*heurinitsol)), /**< solving process initialization method of primal heuristic */
725  SCIP_DECL_HEUREXITSOL ((*heurexitsol)), /**< solving process deinitialization method of primal heuristic */
726  SCIP_DECL_HEUREXEC ((*heurexec)), /**< execution method of primal heuristic */
727  SCIP_HEURDATA* heurdata /**< primal heuristic data */
728  )
729 {
730  char paramname[SCIP_MAXSTRLEN];
731  char paramdesc[SCIP_MAXSTRLEN];
732 
733  assert(heur != NULL);
734  assert(name != NULL);
735  assert(desc != NULL);
736  assert(freq >= -1);
737  assert(freqofs >= 0);
738  assert(heurexec != NULL);
739 
740  SCIP_ALLOC( BMSallocMemory(heur) );
741  BMSclearMemory(*heur);
742 
743  SCIP_ALLOC( BMSduplicateMemoryArray(&(*heur)->name, name, strlen(name)+1) );
744  SCIP_ALLOC( BMSduplicateMemoryArray(&(*heur)->desc, desc, strlen(desc)+1) );
745  (*heur)->dispchar = dispchar;
746  (*heur)->priority = priority;
747  (*heur)->freq = freq;
748  (*heur)->freqofs = freqofs;
749  (*heur)->maxdepth = maxdepth;
750  (*heur)->delaypos = -1;
751  (*heur)->timingmask = timingmask;
752  (*heur)->usessubscip = usessubscip;
753  (*heur)->heurcopy = heurcopy;
754  (*heur)->heurfree = heurfree;
755  (*heur)->heurinit = heurinit;
756  (*heur)->heurexit = heurexit;
757  (*heur)->heurinitsol = heurinitsol;
758  (*heur)->heurexitsol = heurexitsol;
759  (*heur)->heurexec = heurexec;
760  (*heur)->heurdata = heurdata;
761  SCIP_CALL( SCIPclockCreate(&(*heur)->setuptime, SCIP_CLOCKTYPE_DEFAULT) );
762  SCIP_CALL( SCIPclockCreate(&(*heur)->heurclock, SCIP_CLOCKTYPE_DEFAULT) );
763  (*heur)->ncalls = 0;
764  (*heur)->nsolsfound = 0;
765  (*heur)->nbestsolsfound = 0;
766  (*heur)->initialized = FALSE;
767  (*heur)->divesets = NULL;
768  (*heur)->ndivesets = 0;
769 
770  /* add parameters */
771  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/priority", name);
772  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "priority of heuristic <%s>", name);
773  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
774  &(*heur)->priority, TRUE, priority, INT_MIN/4, INT_MAX/4,
775  paramChgdHeurPriority, (SCIP_PARAMDATA*)(*heur)) ); /*lint !e740*/
776  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freq", name);
777  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "frequency for calling primal heuristic <%s> (-1: never, 0: only at depth freqofs)", name);
778  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
779  &(*heur)->freq, FALSE, freq, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
780  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/freqofs", name);
781  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "frequency offset for calling primal heuristic <%s>", name);
782  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
783  &(*heur)->freqofs, FALSE, freqofs, 0, SCIP_MAXTREEDEPTH, NULL, NULL) );
784  (void) SCIPsnprintf(paramname, SCIP_MAXSTRLEN, "heuristics/%s/maxdepth", name);
785  (void) SCIPsnprintf(paramdesc, SCIP_MAXSTRLEN, "maximal depth level to call primal heuristic <%s> (-1: no limit)", name);
786  SCIP_CALL( SCIPsetAddIntParam(set, messagehdlr, blkmem, paramname, paramdesc,
787  &(*heur)->maxdepth, TRUE, maxdepth, -1, SCIP_MAXTREEDEPTH, NULL, NULL) );
788 
789  return SCIP_OKAY;
790 }
791 
792 /** creates a primal heuristic */
794  SCIP_HEUR** heur, /**< pointer to primal heuristic data structure */
795  SCIP_SET* set, /**< global SCIP settings */
796  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
797  BMS_BLKMEM* blkmem, /**< block memory for parameter settings */
798  const char* name, /**< name of primal heuristic */
799  const char* desc, /**< description of primal heuristic */
800  char dispchar, /**< display character of primal heuristic */
801  int priority, /**< priority of the primal heuristic */
802  int freq, /**< frequency for calling primal heuristic */
803  int freqofs, /**< frequency offset for calling primal heuristic */
804  int maxdepth, /**< maximal depth level to call heuristic at (-1: no limit) */
805  SCIP_HEURTIMING timingmask, /**< positions in the node solving loop where heuristic should be executed */
806  SCIP_Bool usessubscip, /**< does the heuristic use a secondary SCIP instance? */
807  SCIP_DECL_HEURCOPY ((*heurcopy)), /**< copy method of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
808  SCIP_DECL_HEURFREE ((*heurfree)), /**< destructor of primal heuristic */
809  SCIP_DECL_HEURINIT ((*heurinit)), /**< initialize primal heuristic */
810  SCIP_DECL_HEUREXIT ((*heurexit)), /**< deinitialize primal heuristic */
811  SCIP_DECL_HEURINITSOL ((*heurinitsol)), /**< solving process initialization method of primal heuristic */
812  SCIP_DECL_HEUREXITSOL ((*heurexitsol)), /**< solving process deinitialization method of primal heuristic */
813  SCIP_DECL_HEUREXEC ((*heurexec)), /**< execution method of primal heuristic */
814  SCIP_HEURDATA* heurdata /**< primal heuristic data */
815  )
816 {
817  assert(heur != NULL);
818  assert(name != NULL);
819  assert(desc != NULL);
820  assert(freq >= -1);
821  assert(freqofs >= 0);
822  assert(heurexec != NULL);
823 
824  SCIP_CALL_FINALLY( doHeurCreate(heur, set, messagehdlr, blkmem, name, desc, dispchar, priority, freq, freqofs,
825  maxdepth, timingmask, usessubscip, heurcopy, heurfree, heurinit, heurexit, heurinitsol, heurexitsol, heurexec,
826  heurdata), (void) SCIPheurFree(heur, set, blkmem) );
827 
828  return SCIP_OKAY;
829 }
830 
831 /** calls destructor and frees memory of primal heuristic */
833  SCIP_HEUR** heur, /**< pointer to primal heuristic data structure */
834  SCIP_SET* set, /**< global SCIP settings */
835  BMS_BLKMEM* blkmem /**< block memory */
836  )
837 {
838  int d;
839  assert(heur != NULL);
840  if( *heur == NULL )
841  return SCIP_OKAY;
842  assert(!(*heur)->initialized);
843  assert(set != NULL);
844  assert((*heur)->divesets != NULL || (*heur)->ndivesets == 0);
845 
846  /* call destructor of primal heuristic */
847  if( (*heur)->heurfree != NULL )
848  {
849  SCIP_CALL( (*heur)->heurfree(set->scip, *heur) );
850  }
851 
852  for( d = 0; d < (*heur)->ndivesets; ++d )
853  {
854  assert((*heur)->divesets[d] != NULL);
855  divesetFree(&((*heur)->divesets[d]), blkmem);
856  }
857  BMSfreeMemoryArrayNull(&(*heur)->divesets);
858  SCIPclockFree(&(*heur)->heurclock);
859  SCIPclockFree(&(*heur)->setuptime);
860  BMSfreeMemoryArrayNull(&(*heur)->name);
861  BMSfreeMemoryArrayNull(&(*heur)->desc);
862  BMSfreeMemory(heur);
863 
864  return SCIP_OKAY;
865 }
866 
867 /** initializes primal heuristic */
869  SCIP_HEUR* heur, /**< primal heuristic */
870  SCIP_SET* set /**< global SCIP settings */
871  )
872 {
873  int d;
874  assert(heur != NULL);
875  assert(set != NULL);
876 
877  if( heur->initialized )
878  {
879  SCIPerrorMessage("primal heuristic <%s> already initialized\n", heur->name);
880  return SCIP_INVALIDCALL;
881  }
882 
883  if( set->misc_resetstat )
884  {
885  SCIPclockReset(heur->setuptime);
886  SCIPclockReset(heur->heurclock);
887 
888  heur->delaypos = -1;
889  heur->ncalls = 0;
890  heur->nsolsfound = 0;
891  heur->nbestsolsfound = 0;
892  }
893 
894  if( heur->heurinit != NULL )
895  {
896  /* start timing */
897  SCIPclockStart(heur->setuptime, set);
898 
899  SCIP_CALL( heur->heurinit(set->scip, heur) );
900 
901  /* stop timing */
902  SCIPclockStop(heur->setuptime, set);
903  }
904 
905  /* reset dive sets */
906  for( d = 0; d < heur->ndivesets; ++d )
907  {
908  assert(heur->divesets[d] != NULL);
909  SCIP_CALL( SCIPdivesetReset(heur->divesets[d], set) );
910  }
911 
912  heur->initialized = TRUE;
913 
914  return SCIP_OKAY;
915 }
916 
917 /** calls exit method of primal heuristic */
919  SCIP_HEUR* heur, /**< primal heuristic */
920  SCIP_SET* set /**< global SCIP settings */
921  )
922 {
923  assert(heur != NULL);
924  assert(set != NULL);
925 
926  if( !heur->initialized )
927  {
928  SCIPerrorMessage("primal heuristic <%s> not initialized\n", heur->name);
929  return SCIP_INVALIDCALL;
930  }
931 
932  if( heur->heurexit != NULL )
933  {
934  /* start timing */
935  SCIPclockStart(heur->setuptime, set);
936 
937  SCIP_CALL( heur->heurexit(set->scip, heur) );
938 
939  /* stop timing */
940  SCIPclockStop(heur->setuptime, set);
941  }
942  heur->initialized = FALSE;
943 
944  return SCIP_OKAY;
945 }
946 
947 /** informs primal heuristic that the branch and bound process is being started */
949  SCIP_HEUR* heur, /**< primal heuristic */
950  SCIP_SET* set /**< global SCIP settings */
951  )
952 {
953  assert(heur != NULL);
954  assert(set != NULL);
955 
956  if( heur->delaypos != -1 )
957  {
958  heur->delaypos = -1;
959  set->heurssorted = FALSE;
960  }
961 
962  /* call solving process initialization method of primal heuristic */
963  if( heur->heurinitsol != NULL )
964  {
965  /* start timing */
966  SCIPclockStart(heur->setuptime, set);
967 
968  SCIP_CALL( heur->heurinitsol(set->scip, heur) );
969 
970  /* stop timing */
971  SCIPclockStop(heur->setuptime, set);
972  }
973 
974  return SCIP_OKAY;
975 }
976 
977 /** informs primal heuristic that the branch and bound process data is being freed */
979  SCIP_HEUR* heur, /**< primal heuristic */
980  SCIP_SET* set /**< global SCIP settings */
981  )
982 {
983  assert(heur != NULL);
984  assert(set != NULL);
985 
986  /* call solving process deinitialization method of primal heuristic */
987  if( heur->heurexitsol != NULL )
988  {
989  /* start timing */
990  SCIPclockStart(heur->setuptime, set);
991 
992  SCIP_CALL( heur->heurexitsol(set->scip, heur) );
993 
994  /* stop timing */
995  SCIPclockStop(heur->setuptime, set);
996  }
997 
998  return SCIP_OKAY;
999 }
1000 
1001 /** should the heuristic be executed at the given depth, frequency, timing, ... */
1003  SCIP_HEUR* heur, /**< primal heuristic */
1004  int depth, /**< depth of current node */
1005  int lpstateforkdepth, /**< depth of the last node with solved LP */
1006  SCIP_HEURTIMING heurtiming, /**< current point in the node solving process */
1007  SCIP_Bool* delayed /**< pointer to store whether the heuristic should be delayed */
1008  )
1009 {
1010  SCIP_Bool execute;
1011 
1014  {
1015  /* heuristic may be executed before/during presolving. Do so, if it was not disabled by setting the frequency to -1 */
1016  execute = heur->freq >= 0;
1017  }
1018  else if( (heur->timingmask & SCIP_HEURTIMING_AFTERPSEUDONODE) == 0
1019  && (heurtiming == SCIP_HEURTIMING_AFTERLPNODE || heurtiming == SCIP_HEURTIMING_AFTERLPPLUNGE) )
1020  {
1021  /* heuristic was skipped on intermediate pseudo nodes: check, if a node matching the execution frequency lies
1022  * between the current node and the last LP node of the path
1023  */
1024  execute = (heur->freq > 0 && depth >= heur->freqofs
1025  && ((depth + heur->freq - heur->freqofs) / heur->freq
1026  != (lpstateforkdepth + heur->freq - heur->freqofs) / heur->freq));
1027  }
1028  else
1029  {
1030  /* heuristic may be executed on every node: check, if the current depth matches the execution frequency and offset */
1031  execute = (heur->freq > 0 && depth >= heur->freqofs && (depth - heur->freqofs) % heur->freq == 0);
1032  }
1033 
1034  /* if frequency is zero, execute heuristic only at the depth level of the frequency offset */
1035  execute = execute || (depth == heur->freqofs && heur->freq == 0);
1036 
1037  /* compare current depth against heuristic's maximal depth level */
1038  execute = execute && (heur->maxdepth == -1 || depth <= heur->maxdepth);
1039 
1040  /* if the heuristic was delayed, execute it anyway */
1041  execute = execute || (heur->delaypos >= 0);
1042 
1043  /* if the heuristic should be called after plunging but not during plunging, delay it if we are in plunging */
1044  if( execute
1045  && ((heurtiming == SCIP_HEURTIMING_AFTERLPNODE
1046  && (heur->timingmask & SCIP_HEURTIMING_AFTERLPNODE) == 0
1047  && (heur->timingmask & SCIP_HEURTIMING_AFTERLPPLUNGE) > 0)
1048  || (heurtiming == SCIP_HEURTIMING_AFTERPSEUDONODE
1050  && (heur->timingmask & SCIP_HEURTIMING_AFTERPSEUDOPLUNGE) > 0)) )
1051  {
1052  /* the heuristic should be delayed until plunging is finished */
1053  execute = FALSE;
1054  *delayed = TRUE;
1055  }
1056 
1057  /* execute heuristic only if its timing mask fits the current point in the node solving process */
1058  execute = execute && (heur->timingmask & heurtiming) > 0;
1059 
1060  return execute;
1061 }
1062 
1063 /** calls execution method of primal heuristic */
1065  SCIP_HEUR* heur, /**< primal heuristic */
1066  SCIP_SET* set, /**< global SCIP settings */
1067  SCIP_PRIMAL* primal, /**< primal data */
1068  int depth, /**< depth of current node */
1069  int lpstateforkdepth, /**< depth of the last node with solved LP */
1070  SCIP_HEURTIMING heurtiming, /**< current point in the node solving process */
1071  SCIP_Bool nodeinfeasible, /**< was the current node already detected to be infeasible? */
1072  int* ndelayedheurs, /**< pointer to count the number of delayed heuristics */
1073  SCIP_RESULT* result /**< pointer to store the result of the callback method */
1074  )
1075 {
1076  SCIP_Bool execute;
1077  SCIP_Bool delayed;
1078 
1079  assert(heur != NULL);
1080  assert(heur->heurexec != NULL);
1081  assert(heur->freq >= -1);
1082  assert(heur->freqofs >= 0);
1083  assert(heur->maxdepth >= -1);
1084  assert(set != NULL);
1085  assert(set->scip != NULL);
1086  assert(primal != NULL);
1087  assert(depth >= 0 || heurtiming == SCIP_HEURTIMING_BEFOREPRESOL || heurtiming == SCIP_HEURTIMING_DURINGPRESOLLOOP);
1088  assert(ndelayedheurs != NULL);
1089  assert(result != NULL);
1090 
1091  *result = SCIP_DIDNOTRUN;
1092 
1093  delayed = FALSE;
1094  execute = SCIPheurShouldBeExecuted(heur, depth, lpstateforkdepth, heurtiming, &delayed);
1095 
1096  if( delayed )
1097  {
1098  assert(!execute);
1099  *result = SCIP_DELAYED;
1100  }
1101 
1102  if( execute )
1103  {
1104  SCIP_Longint oldnsolsfound;
1105  SCIP_Longint oldnbestsolsfound;
1106 
1107  SCIPsetDebugMsg(set, "executing primal heuristic <%s> in depth %d (delaypos: %d)\n", heur->name, depth, heur->delaypos);
1108 
1109  oldnsolsfound = primal->nsolsfound;
1110  oldnbestsolsfound = primal->nbestsolsfound;
1111 
1112  /* start timing */
1113  SCIPclockStart(heur->heurclock, set);
1114 
1115  /* call external method */
1116  SCIP_CALL( heur->heurexec(set->scip, heur, heurtiming, nodeinfeasible, result) );
1117 
1118  /* stop timing */
1119  SCIPclockStop(heur->heurclock, set);
1120 
1121  /* evaluate result */
1122  if( *result != SCIP_FOUNDSOL
1123  && *result != SCIP_DIDNOTFIND
1124  && *result != SCIP_DIDNOTRUN
1125  && *result != SCIP_DELAYED
1126  && *result != SCIP_UNBOUNDED )
1127  {
1128  SCIPerrorMessage("execution method of primal heuristic <%s> returned invalid result <%d>\n",
1129  heur->name, *result);
1130  return SCIP_INVALIDRESULT;
1131  }
1132  if( *result != SCIP_DIDNOTRUN && *result != SCIP_DELAYED )
1133  heur->ncalls++;
1134  heur->nsolsfound += primal->nsolsfound - oldnsolsfound;
1135  heur->nbestsolsfound += primal->nbestsolsfound - oldnbestsolsfound;
1136 
1137  /* update delay position of heuristic */
1138  if( *result != SCIP_DELAYED && heur->delaypos != -1 )
1139  {
1140  heur->delaypos = -1;
1141  set->heurssorted = FALSE;
1142  }
1143  }
1144  assert(*result == SCIP_DIDNOTRUN || *result == SCIP_DELAYED || *result == SCIP_UNBOUNDED || heur->delaypos == -1);
1145 
1146  /* check if the heuristic was (still) delayed */
1147  if( *result == SCIP_DELAYED || heur->delaypos >= 0 )
1148  {
1149  SCIPsetDebugMsg(set, "delaying execution of primal heuristic <%s> in depth %d (delaypos: %d), heur was%s delayed before, had delaypos %d\n",
1150  heur->name, depth, *ndelayedheurs, heur->delaypos >= 0 ? "" : " not", heur->delaypos);
1151 
1152  /* mark the heuristic delayed */
1153  if( heur->delaypos != *ndelayedheurs )
1154  {
1155  heur->delaypos = *ndelayedheurs;
1156  set->heurssorted = FALSE;
1157  }
1158  (*ndelayedheurs)++;
1159  }
1160 
1161  return SCIP_OKAY;
1162 }
1163 
1164 /** gets user data of primal heuristic */
1166  SCIP_HEUR* heur /**< primal heuristic */
1167  )
1168 {
1169  assert(heur != NULL);
1170 
1171  return heur->heurdata;
1172 }
1173 
1174 /** sets user data of primal heuristic; user has to free old data in advance! */
1176  SCIP_HEUR* heur, /**< primal heuristic */
1177  SCIP_HEURDATA* heurdata /**< new primal heuristic user data */
1178  )
1179 {
1180  assert(heur != NULL);
1181 
1182  heur->heurdata = heurdata;
1183 }
1184 
1185 /* new callback setter methods */
1186 
1187 /** sets copy callback of primal heuristic */
1189  SCIP_HEUR* heur, /**< primal heuristic */
1190  SCIP_DECL_HEURCOPY ((*heurcopy)) /**< copy callback of primal heuristic or NULL if you don't want to copy your plugin into sub-SCIPs */
1191  )
1192 {
1193  assert(heur != NULL);
1194 
1195  heur->heurcopy = heurcopy;
1196 }
1197 
1198 /** sets destructor callback of primal heuristic */
1200  SCIP_HEUR* heur, /**< primal heuristic */
1201  SCIP_DECL_HEURFREE ((*heurfree)) /**< destructor of primal heuristic */
1202  )
1203 {
1204  assert(heur != NULL);
1205 
1206  heur->heurfree = heurfree;
1207 }
1208 
1209 /** sets initialization callback of primal heuristic */
1211  SCIP_HEUR* heur, /**< primal heuristic */
1212  SCIP_DECL_HEURINIT ((*heurinit)) /**< initialize primal heuristic */
1213  )
1214 {
1215  assert(heur != NULL);
1216 
1217  heur->heurinit = heurinit;
1218 }
1219 
1220 /** sets deinitialization callback of primal heuristic */
1222  SCIP_HEUR* heur, /**< primal heuristic */
1223  SCIP_DECL_HEUREXIT ((*heurexit)) /**< deinitialize primal heuristic */
1224  )
1225 {
1226  assert(heur != NULL);
1227 
1228  heur->heurexit = heurexit;
1229 }
1230 
1231 /** sets solving process initialization callback of primal heuristic */
1233  SCIP_HEUR* heur, /**< primal heuristic */
1234  SCIP_DECL_HEURINITSOL ((*heurinitsol)) /**< solving process initialization callback of primal heuristic */
1235  )
1236 {
1237  assert(heur != NULL);
1238 
1239  heur->heurinitsol = heurinitsol;
1240 }
1241 
1242 /** sets solving process deinitialization callback of primal heuristic */
1244  SCIP_HEUR* heur, /**< primal heuristic */
1245  SCIP_DECL_HEUREXITSOL ((*heurexitsol)) /**< solving process deinitialization callback of primal heuristic */
1246  )
1247 {
1248  assert(heur != NULL);
1249 
1250  heur->heurexitsol = heurexitsol;
1251 }
1252 
1253 /** gets name of primal heuristic */
1254 const char* SCIPheurGetName(
1255  SCIP_HEUR* heur /**< primal heuristic */
1256  )
1257 {
1258  assert(heur != NULL);
1259 
1260  return heur->name;
1261 }
1262 
1263 /** gets description of primal heuristic */
1264 const char* SCIPheurGetDesc(
1265  SCIP_HEUR* heur /**< primal heuristic */
1266  )
1267 {
1268  assert(heur != NULL);
1269 
1270  return heur->desc;
1271 }
1272 
1273 /** gets display character of primal heuristic */
1275  SCIP_HEUR* heur /**< primal heuristic */
1276  )
1277 {
1278  assert(heur != NULL);
1279 
1280  return heur->dispchar;
1281 }
1282 
1283 /** returns the timing mask of the heuristic */
1285  SCIP_HEUR* heur /**< primal heuristic */
1286  )
1287 {
1288  assert(heur != NULL);
1289 
1290  return heur->timingmask;
1291 }
1292 
1293 /** sets new timing mask for heuristic */
1295  SCIP_HEUR* heur, /**< primal heuristic */
1296  SCIP_HEURTIMING timingmask /**< new timing mask of heuristic */
1297  )
1298 {
1299  assert(heur != NULL);
1300 
1301  heur->timingmask = timingmask;
1302 }
1303 
1304 /** does the heuristic use a secondary SCIP instance? */
1306  SCIP_HEUR* heur /**< primal heuristic */
1307  )
1308 {
1309  assert(heur != NULL);
1310 
1311  return heur->usessubscip;
1312 }
1313 
1314 /** gets priority of primal heuristic */
1316  SCIP_HEUR* heur /**< primal heuristic */
1317  )
1318 {
1319  assert(heur != NULL);
1320 
1321  return heur->priority;
1322 }
1323 
1324 /** sets priority of primal heuristic */
1326  SCIP_HEUR* heur, /**< primal heuristic */
1327  SCIP_SET* set, /**< global SCIP settings */
1328  int priority /**< new priority of the primal heuristic */
1329  )
1330 {
1331  assert(heur != NULL);
1332  assert(set != NULL);
1333 
1334  heur->priority = priority;
1335  set->heurssorted = FALSE;
1336 }
1337 
1338 /** gets frequency of primal heuristic */
1340  SCIP_HEUR* heur /**< primal heuristic */
1341  )
1342 {
1343  assert(heur != NULL);
1344 
1345  return heur->freq;
1346 }
1347 
1348 /** sets frequency of primal heuristic */
1350  SCIP_HEUR* heur, /**< primal heuristic */
1351  int freq /**< new frequency of heuristic */
1352  )
1353 {
1354  assert(heur != NULL);
1355 
1356  heur->freq = freq;
1357 }
1358 
1359 /** gets frequency offset of primal heuristic */
1361  SCIP_HEUR* heur /**< primal heuristic */
1362  )
1363 {
1364  assert(heur != NULL);
1365 
1366  return heur->freqofs;
1367 }
1368 
1369 /** gets maximal depth level for calling primal heuristic (returns -1, if no depth limit exists) */
1371  SCIP_HEUR* heur /**< primal heuristic */
1372  )
1373 {
1374  assert(heur != NULL);
1375 
1376  return heur->maxdepth;
1377 }
1378 
1379 /** gets the number of times, the heuristic was called and tried to find a solution */
1381  SCIP_HEUR* heur /**< primal heuristic */
1382  )
1383 {
1384  assert(heur != NULL);
1385 
1386  return heur->ncalls;
1387 }
1388 
1389 /** gets the number of primal feasible solutions found by this heuristic */
1391  SCIP_HEUR* heur /**< primal heuristic */
1392  )
1393 {
1394  assert(heur != NULL);
1395 
1396  return heur->nsolsfound;
1397 }
1398 
1399 /** gets the number of new best primal feasible solutions found by this heuristic */
1401  SCIP_HEUR* heur /**< primal heuristic */
1402  )
1403 {
1404  assert(heur != NULL);
1405 
1406  return heur->nbestsolsfound;
1407 }
1408 
1409 /** is primal heuristic initialized? */
1411  SCIP_HEUR* heur /**< primal heuristic */
1412  )
1413 {
1414  assert(heur != NULL);
1415 
1416  return heur->initialized;
1417 }
1418 
1419 /** enables or disables all clocks of \p heur, depending on the value of the flag */
1421  SCIP_HEUR* heur, /**< the heuristic for which all clocks should be enabled or disabled */
1422  SCIP_Bool enable /**< should the clocks of the heuristic be enabled? */
1423  )
1424 {
1425  assert(heur != NULL);
1426 
1427  SCIPclockEnableOrDisable(heur->setuptime, enable);
1428  SCIPclockEnableOrDisable(heur->heurclock, enable);
1429 }
1430 
1431 /** gets time in seconds used in this heuristic for setting up for next stages */
1433  SCIP_HEUR* heur /**< primal heuristic */
1434  )
1435 {
1436  assert(heur != NULL);
1437 
1438  return SCIPclockGetTime(heur->setuptime);
1439 }
1440 
1441 /** gets time in seconds used in this heuristic */
1443  SCIP_HEUR* heur /**< primal heuristic */
1444  )
1445 {
1446  assert(heur != NULL);
1447 
1448  return SCIPclockGetTime(heur->heurclock);
1449 }
1450 
1451 /** returns array of divesets of this primal heuristic, or NULL if it has no divesets */
1453  SCIP_HEUR* heur /**< primal heuristic */
1454  )
1455 {
1456  assert(heur != NULL);
1457 
1458  return heur->divesets;
1459 }
1460 
1461 /** returns the number of divesets of this primal heuristic */
1463  SCIP_HEUR* heur /**< primal heuristic */
1464  )
1465 {
1466  assert(heur != NULL);
1467 
1468  return heur->ndivesets;
1469 }
1470 
1471 /** Perform breadth-first (BFS) search on the variable constraint graph.
1472  *
1473  * The result of the algorithm is that the \p distances array contains the correct distances for
1474  * every variable from the start variables. The distance of a variable can then be accessed through its
1475  * problem index (calling SCIPvarGetProbindex()).
1476  * Hence, The method assumes that the length of \p distances is at least
1477  * SCIPgetNVars().
1478  * Variables that are not connected through constraints to the start variables have a distance of -1.
1479  *
1480  * Limits can be provided to further restrict the breadth-first search. If a distance limit is given,
1481  * the search will be performed until the first variable at this distance is popped from the queue, i.e.,
1482  * all variables with a distance < maxdistance have been labeled by the search.
1483  * If a variable limit is given, the search stops after it completes the distance level at which
1484  * the limit was reached. Hence, more variables may be actually labeled.
1485  * The start variables are accounted for those variable limits.
1486  *
1487  * If no variable variable constraint graph is provided, the method will create one and free it at the end
1488  * This is useful for a single use of the variable constraint graph. For several consecutive uses,
1489  * it is advised to create a variable constraint graph via SCIPvariableGraphCreate().
1490  */
1492  SCIP* scip, /**< SCIP data structure */
1493  SCIP_VGRAPH* vargraph, /**< pointer to the variable graph, or NULL to let the function create a local graph */
1494  SCIP_VAR** startvars, /**< array of start variables to calculate distance from */
1495  int nstartvars, /**< number of starting variables, at least 1 */
1496  int* distances, /**< array to keep distance in vargraph from start variables for every variable */
1497  int maxdistance, /**< maximum distance >= 0 from start variable (INT_MAX for complete BFS) */
1498  int maxvars, /**< maximum number of variables to compute distance for */
1499  int maxbinintvars /**< maximum number of binary or integer variables to compute distance for */
1500  )
1501 {
1502  SCIP_VAR** vars;
1503 
1504  int* queue;
1505  int nvars;
1506  int i;
1507  int currlvlidx;
1508  int nextlvlidx;
1509  int increment = 1;
1510  int currentdistance;
1511  int nbinintvarshit;
1512  int nvarshit;
1513  int nbinvars;
1514  int nintvars;
1515  int nbinintvars;
1516  SCIP_VAR** varbuffer;
1517  SCIP_Bool localvargraph;
1518 
1519  assert(scip != NULL);
1520  assert(startvars != NULL);
1521  assert(nstartvars >= 1);
1522  assert(distances != NULL);
1523  assert(maxdistance >= 0);
1524 
1525  /* get variable data */
1526  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, &nbinvars, &nintvars, NULL, NULL) );
1527  nbinintvars = nbinvars + nintvars;
1528 
1529  SCIP_CALL( SCIPallocBufferArray(scip, &queue, nvars) );
1530  SCIP_CALL( SCIPallocClearBufferArray(scip, &varbuffer, nvars) );
1531 
1532  /* create a variable graph locally for this method, if none is provided */
1533  if( vargraph == NULL )
1534  {
1535  SCIP_CALL( SCIPvariableGraphCreate(scip, &vargraph, FALSE, 1.0, NULL) );
1536  localvargraph = TRUE;
1537  }
1538  else
1539  localvargraph = FALSE;
1540 
1542 
1543  /* initialize distances to -1 */
1544  for( i = 0; i < nvars; ++i )
1545  {
1546  queue[i] = -1;
1547  distances[i] = -1;
1548  }
1549 
1550  nvarshit = 0;
1551  nbinintvarshit = 0;
1552  /* initialize distances for starting variables and add them to the queue */
1553  for( i = 0; i < nstartvars; ++i )
1554  {
1555  int probindex = SCIPvarGetProbindex(startvars[i]);
1556  assert(probindex >= 0);
1557  /* start variables have a distance of 0 */
1558  distances[probindex] = 0;
1559  queue[i] = probindex;
1560  nvarshit++;
1561 
1562  if( probindex < nbinintvars )
1563  nbinintvarshit++;
1564  }
1565  currlvlidx = 0;
1566  nextlvlidx = nvars - 1;
1567 
1568  /* loop over the queue and pop the next variable, starting with start variables */
1569  do
1570  {
1571  SCIP_VAR* currvar;
1572  int c;
1573  int varpos;
1574 
1575  currvar = vars[queue[currlvlidx]];
1576  varpos = SCIPvarGetProbindex(currvar);
1577  currentdistance = distances[varpos];
1578  assert(currentdistance >= 0);
1579 
1580  /* distances must only be computed up to maxdistance */
1581  assert(currentdistance <= maxdistance);
1582 
1583  /* check for termination because maximum distance has been reached */
1584  if( currentdistance == maxdistance )
1585  break;
1586 
1587  assert(varpos >= 0);
1588 
1589  /* loop over variable constraints and enqueue variables that were not visited yet */
1590  for( c = 0; c < vargraph->nvarconss[varpos]; ++c )
1591  {
1592  int nconsvars;
1593  int v;
1594  SCIP_Bool success;
1595  SCIP_CONS* cons = vargraph->varconss[varpos][c];
1596 
1597  /* check first if this constraint has already been visited */
1598  if( SCIPhashtableExists(vargraph->visitedconss, (void *)cons) )
1599  continue;
1600 
1601  /* request number of constraint variables */
1602  SCIP_CALL( SCIPgetConsNVars(scip, cons, &nconsvars, &success) );
1603 
1604  if( !success )
1605  continue;
1606 
1607  /* collect constraint variables in buffer */
1608  SCIP_CALL( SCIPgetConsVars(scip, cons, varbuffer, nvars, &success) );
1609 
1610  if( !success )
1611  continue;
1612 
1613  /* collect previously unvisited variables of the constraint and enqueue them for breadth-first search */
1614  for( v = 0; v < nconsvars; ++v )
1615  {
1616  SCIP_VAR* nextvar = varbuffer[v];
1617  int nextvarpos;
1618  assert(nextvar != NULL);
1619  if( !SCIPvarIsActive(nextvar) )
1620  continue;
1621 
1622  nextvarpos = SCIPvarGetProbindex(nextvar);
1623  assert(nextvarpos >= 0);
1624 
1625  /* insert variables that were not considered yet into the next level queue */
1626  if( distances[nextvarpos] == -1 )
1627  {
1628  distances[nextvarpos] = currentdistance + 1;
1629  queue[nextlvlidx] = nextvarpos;
1630  nextlvlidx -= increment;
1631 
1632  nvarshit++;
1633  if( nextvarpos < nbinintvars )
1634  ++nbinintvarshit;
1635  }
1636  } /* end constraint variables loop */
1637 
1638  /* mark the constraint as visited */
1639  SCIP_CALL( SCIPhashtableInsert(vargraph->visitedconss, (void *)cons) );
1640  } /* end constraint loop */
1641 
1642  queue[currlvlidx] = -1;
1643  currlvlidx += increment;
1644 
1645  /* check if we need to swap current and next level index and reverse the increment */
1646  if( currlvlidx == nvars || currlvlidx == 0 || queue[currlvlidx] == -1 || currlvlidx == nextlvlidx )
1647  {
1648  /* break early if the distance has been determined for enough variables */
1649  if( nvarshit >= maxvars || nbinintvarshit >= maxbinintvars )
1650  break;
1651 
1652  /* increment knows whether we are currently looping upwards (all variables with odd distance) or downwards the
1653  * queue
1654  */
1655  if( increment == +1 )
1656  {
1657  currlvlidx = nvars - 1;
1658  nextlvlidx = 0;
1659  increment = -1;
1660  }
1661  else
1662  {
1663  currlvlidx = 0;
1664  nextlvlidx = nvars - 1;
1665  increment = +1;
1666  }
1667  }
1668  }
1669  while( queue[currlvlidx] != -1 && distances[queue[currlvlidx]] >= currentdistance );
1670 
1671  SCIPfreeBufferArray(scip, &varbuffer);
1672  SCIPfreeBufferArray(scip, &queue);
1673 
1674  /* free also the variable graph, if it wasn't provided by the caller */
1675  if( localvargraph )
1676  {
1677  SCIPvariableGraphFree(scip, &vargraph);
1678  }
1679 
1680  return SCIP_OKAY;
1681 }
1682 
1683 /* fills variable graph data structure
1684  *
1685  * loops over global problem constraints and creates a mapping from the variables to their respective constraints
1686  */
1687 static
1689  SCIP* scip, /**< SCIP data structure */
1690  SCIP_VGRAPH* vargraph, /**< variable graph data structure for breadth-first-search neighborhoods */
1691  SCIP_Bool relaxdenseconss, /**< should dense constraints (at least as dense as \p density) be
1692  * ignored by connectivity graph? */
1693  SCIP_Real relaxdensity, /**< density (with respect to number of variables) to relax constraint from graph */
1694  int* nrelaxedconstraints /**< pointer to store the number of constraints that were relaxed, or NULL if not needed */
1695  )
1696 {
1697  SCIP_CONS** conss;
1698  int nconss;
1699  int nvars;
1700  int c;
1701  int relaxlimit;
1702  SCIP_VAR** varbuffer;
1703 
1704  assert(scip != NULL);
1705  assert(vargraph != NULL);
1706 
1707  conss = SCIPgetConss(scip);
1708  nconss = SCIPgetNConss(scip);
1709 
1710  nvars = SCIPgetNVars(scip);
1711  SCIP_CALL( SCIPallocBufferArray(scip, &varbuffer, nvars) );
1712 
1713  if( nrelaxedconstraints != NULL )
1714  *nrelaxedconstraints = 0;
1715 
1716  relaxlimit = (int)(relaxdensity * nvars);
1717 
1718  for( c = 0; c < nconss; ++c )
1719  {
1720  int nconsvars;
1721  int v;
1722  SCIP_Bool success;
1723  SCIP_CONS* cons = conss[c];
1724 
1725  /* we only consider constraints that are checkable */
1726  if( !SCIPconsIsChecked(cons) )
1727  continue;
1728 
1729  /* request number of variables */
1730  SCIP_CALL( SCIPgetConsNVars(scip, cons, &nconsvars, &success) );
1731 
1732  if( !success )
1733  continue;
1734 
1735  /* relax constraints with density above the allowed number of free variables */
1736  if( relaxdenseconss && nconsvars >= relaxlimit )
1737  {
1738  if( nrelaxedconstraints != NULL )
1739  ++(*nrelaxedconstraints);
1740 
1741  continue;
1742  }
1743 
1744  /* collect constraint variables in buffer */
1745  SCIP_CALL( SCIPgetConsVars(scip, cons, varbuffer, nvars, &success) );
1746 
1747  if( !success )
1748  continue;
1749 
1750  /* loop over constraint variables and add this constraint to them if they are active */
1751  for( v = 0; v < nconsvars; ++v )
1752  {
1753  int varpos = SCIPvarGetProbindex(varbuffer[v]);
1754 
1755  /* skip inactive variables */
1756  if( varpos == -1 )
1757  continue;
1758 
1759  /* ensure array size */
1760  if( vargraph->varconssize[varpos] == vargraph->nvarconss[varpos] )
1761  {
1762  int newmem = SCIPcalcMemGrowSize(scip, vargraph->nvarconss[varpos] + 1);
1763 
1764  assert(newmem > vargraph->varconssize[varpos]);
1765 
1766  if( vargraph->varconss[varpos] == NULL )
1767  {
1768  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &vargraph->varconss[varpos], newmem) );
1769  }
1770  else
1771  {
1772  SCIP_CALL( SCIPreallocBlockMemoryArray(scip, &vargraph->varconss[varpos], vargraph->varconssize[varpos], newmem) ); /*lint !e866*/
1773  }
1774  vargraph->varconssize[varpos] = newmem;
1775  }
1776 
1777  assert(vargraph->nvarconss[varpos] < vargraph->varconssize[varpos]);
1778 
1779  /* add constraint to constraint array for this variable */
1780  vargraph->varconss[varpos][vargraph->nvarconss[varpos]] = cons;
1781  vargraph->nvarconss[varpos] += 1;
1782  }
1783  }
1784 
1785  /* free the buffer */
1786  SCIPfreeBufferArray(scip, &varbuffer);
1787 
1788  return SCIP_OKAY;
1789 }
1790 
1791 /** initialization method of variable graph data structure */
1793  SCIP* scip, /**< SCIP data structure */
1794  SCIP_VGRAPH** vargraph, /**< pointer to the variable graph */
1795  SCIP_Bool relaxdenseconss, /**< should dense constraints (at least as dense as \p density) be
1796  * ignored by connectivity graph? */
1797  SCIP_Real relaxdensity, /**< density (with respect to number of variables) to relax constraint from graph */
1798  int* nrelaxedconstraints /**< pointer to store the number of constraints that were relaxed, or NULL if not needed */
1799  )
1800 {
1801  int nvars;
1802  int nconss;
1803 
1804  assert(scip != NULL);
1805  assert(vargraph != NULL);
1806 
1807  nvars = SCIPgetNVars(scip);
1808  nconss = SCIPgetNConss(scip);
1809 
1810  if( nvars == 0 )
1811  return SCIP_OKAY;
1812 
1813  SCIP_CALL( SCIPallocBlockMemory(scip, vargraph) );
1814 
1815  SCIP_CALL( SCIPhashtableCreate(&(*vargraph)->visitedconss, SCIPblkmem(scip), 2 * nconss, SCIPhashGetKeyStandard,
1816  SCIPhashKeyEqPtr, SCIPhashKeyValPtr, NULL) );
1817 
1818  /* allocate and clear memory */
1819  SCIP_CALL( SCIPallocClearBlockMemoryArray(scip, &(*vargraph)->varconss, nvars) );
1820  SCIP_CALL( SCIPallocClearBlockMemoryArray(scip, &(*vargraph)->nvarconss, nvars) );
1821  SCIP_CALL( SCIPallocClearBlockMemoryArray(scip, &(*vargraph)->varconssize, nvars) );
1822 
1823  /* fill the variable graph with variable-constraint mapping for breadth-first search*/
1824  SCIP_CALL( fillVariableGraph(scip, *vargraph, relaxdenseconss, relaxdensity, nrelaxedconstraints) );
1825 
1826  return SCIP_OKAY;
1827 }
1828 
1829 /** deinitialization method of variable graph data structure */
1831  SCIP* scip, /**< SCIP data structure */
1832  SCIP_VGRAPH** vargraph /**< pointer to the variable graph */
1833  )
1834 {
1835  int nvars;
1836  int v;
1837  assert(scip != NULL);
1838  assert(vargraph != NULL);
1839 
1840  nvars = SCIPgetNVars(scip);
1841 
1842  for( v = nvars - 1; v >= 0; --v )
1843  {
1844  SCIPfreeBlockMemoryArrayNull(scip, &(*vargraph)->varconss[v], (*vargraph)->varconssize[v]); /*lint !e866*/
1845  }
1846 
1847  /* allocate and clear memory */
1848  SCIPfreeBlockMemoryArray(scip, &(*vargraph)->varconssize, nvars);
1849  SCIPfreeBlockMemoryArray(scip, &(*vargraph)->nvarconss, nvars);
1850  SCIPfreeBlockMemoryArray(scip, &(*vargraph)->varconss, nvars);
1851 
1852  SCIPhashtableFree(&(*vargraph)->visitedconss);
1853 
1854  SCIPfreeBlockMemory(scip, vargraph);
1855 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_Bool onlylpbranchcands
Definition: struct_heur.h:72
int * nvarconss
Definition: struct_heur.h:119
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:116
SCIP_HEURTIMING SCIPheurGetTimingmask(SCIP_HEUR *heur)
Definition: heur.c:1284
#define SCIPreallocBlockMemoryArray(scip, ptr, oldnum, newnum)
Definition: scip_mem.h:105
void SCIPheurSetInitsol(SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
Definition: heur.c:1232
static SCIP_DECL_PARAMCHGD(paramChgdHeurPriority)
Definition: heur.c:72
SCIP_Longint totalnnodes
Definition: struct_heur.h:57
#define SCIP_DECL_HEURINITSOL(x)
Definition: type_heur.h:97
#define NULL
Definition: def.h:239
int SCIPdivesetGetMinSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:438
int SCIPheurGetPriority(SCIP_HEUR *heur)
Definition: heur.c:1315
SCIP_Real SCIPheurGetSetupTime(SCIP_HEUR *heur)
Definition: heur.c:1432
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:99
#define BMSfreeMemoryArrayNull(ptr)
Definition: memory.h:130
SCIP_RETCODE SCIPdivesetGetScore(SCIP_DIVESET *diveset, SCIP_SET *set, SCIP_DIVETYPE divetype, SCIP_VAR *divecand, SCIP_Real divecandsol, SCIP_Real divecandfrac, SCIP_Real *candscore, SCIP_Bool *roundup)
Definition: heur.c:660
SCIP_Longint SCIPdivesetGetNBacktracks(SCIP_DIVESET *diveset)
Definition: heur.c:488
unsigned int SCIPsetInitializeRandomSeed(SCIP_SET *set, unsigned int initialseedvalue)
Definition: set.c:7133
SCIP_HEUR * heur
Definition: struct_heur.h:39
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2265
SCIP_Longint totalnbacktracks
Definition: struct_heur.h:58
SCIP_DIVESET ** divesets
Definition: struct_heur.h:94
#define SCIPallocClearBufferArray(scip, ptr, num)
Definition: scip_mem.h:132
SCIP_PARAMDATA * SCIPparamGetData(SCIP_PARAM *param)
Definition: paramset.c:661
#define SCIP_MAXSTRLEN
Definition: def.h:260
int ndivesets
Definition: struct_heur.h:102
SCIP_Bool SCIPdivesetUseBacktrack(SCIP_DIVESET *diveset)
Definition: heur.c:566
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1400
void SCIPvariableGraphFree(SCIP *scip, SCIP_VGRAPH **vargraph)
Definition: heur.c:1830
internal methods for clocks and timing issues
#define SCIPallocClearBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:103
unsigned int SCIP_HEURTIMING
Definition: type_timing.h:97
int SCIPcalcMemGrowSize(SCIP *scip, int num)
Definition: scip_mem.c:210
void SCIPheurSetExitsol(SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
Definition: heur.c:1243
struct SCIP_ParamData SCIP_PARAMDATA
Definition: type_paramset.h:76
SCIP_Real SCIPdivesetGetUbQuot(SCIP_DIVESET *diveset)
Definition: heur.c:550
int delaypos
Definition: struct_heur.h:101
#define SCIP_CALL_FINALLY(x, y)
Definition: def.h:393
int SCIPdivesetGetMaxLPIterOffset(SCIP_DIVESET *diveset)
Definition: heur.c:527
SCIP_Real maxreldepth
Definition: struct_heur.h:44
SCIP_Bool backtrack
Definition: struct_heur.h:71
SCIP_DIVESET ** SCIPheurGetDivesets(SCIP_HEUR *heur)
Definition: heur.c:1452
SCIP_Real SCIPdivesetGetAvgQuotNoSol(SCIP_DIVESET *diveset)
Definition: heur.c:543
static SCIP_RETCODE heurAddDiveset(SCIP_HEUR *heur, SCIP_DIVESET *diveset)
Definition: heur.c:157
SCIP_RETCODE SCIPheurFree(SCIP_HEUR **heur, SCIP_SET *set, BMS_BLKMEM *blkmem)
Definition: heur.c:832
SCIP_Real maxlpiterquot
Definition: struct_heur.h:45
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1918
void SCIPclockStop(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:350
#define FALSE
Definition: def.h:65
void SCIPclockStart(SCIP_CLOCK *clck, SCIP_SET *set)
Definition: clock.c:280
SCIP_Longint nsolsfound
Definition: struct_heur.h:82
SCIP_CLOCK * heurclock
Definition: struct_heur.h:96
int * varconssize
Definition: struct_heur.h:120
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10017
SCIP_RETCODE SCIPheurExec(SCIP_HEUR *heur, SCIP_SET *set, SCIP_PRIMAL *primal, int depth, int lpstateforkdepth, SCIP_HEURTIMING heurtiming, SCIP_Bool nodeinfeasible, int *ndelayedheurs, SCIP_RESULT *result)
Definition: heur.c:1064
SCIP_Longint totaldepth
Definition: struct_heur.h:55
#define TRUE
Definition: def.h:64
char * name
Definition: struct_heur.h:40
#define SCIP_DECL_HEURCOPY(x)
Definition: type_heur.h:62
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_DECL_HEUREXEC(x)
Definition: type_heur.h:128
SCIP_Real SCIPdivesetGetMaxRelDepth(SCIP_DIVESET *diveset)
Definition: heur.c:372
SCIP_RETCODE SCIPheurInitsol(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:948
int SCIPheurGetFreqofs(SCIP_HEUR *heur)
Definition: heur.c:1360
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:17036
SCIP_Longint SCIPdivesetGetNSols(SCIP_DIVESET *diveset)
Definition: heur.c:508
void SCIPheurSetPriority(SCIP_HEUR *heur, SCIP_SET *set, int priority)
Definition: heur.c:1325
SCIP_CLOCK * setuptime
Definition: struct_heur.h:95
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
SCIP_Longint SCIPdivesetGetNLPIterations(SCIP_DIVESET *diveset)
Definition: heur.c:468
#define BMSallocMemoryArray(ptr, num)
Definition: memory.h:105
char dispchar
Definition: struct_heur.h:106
SCIP_Longint nsolsfound
Definition: struct_primal.h:39
SCIP_Longint SCIPdivesetGetNConflicts(SCIP_DIVESET *diveset)
Definition: heur.c:498
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:114
SCIP_Bool SCIPheurUsesSubscip(SCIP_HEUR *heur)
Definition: heur.c:1305
unsigned int SCIP_DIVETYPE
Definition: type_heur.h:48
SCIP_Real SCIPdivesetGetMinRelDepth(SCIP_DIVESET *diveset)
Definition: heur.c:364
SCIP_CONS ** SCIPgetConss(SCIP *scip)
Definition: scip_prob.c:3140
internal methods for handling parameter settings
SCIP_RETCODE SCIPheurCopyInclude(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:686
static SCIP_RETCODE fillVariableGraph(SCIP *scip, SCIP_VGRAPH *vargraph, SCIP_Bool relaxdenseconss, SCIP_Real relaxdensity, int *nrelaxedconstraints)
Definition: heur.c:1688
int SCIPdivesetGetNSolutionCalls(SCIP_DIVESET *diveset)
Definition: heur.c:398
void SCIPclockEnableOrDisable(SCIP_CLOCK *clck, SCIP_Bool enable)
Definition: clock.c:250
SCIP_Longint nconflictsfound
Definition: struct_heur.h:61
SCIP_Real SCIPdivesetGetAvgSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:458
SCIP_RETCODE SCIPheurCreate(SCIP_HEUR **heur, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEURCOPY((*heurcopy)), SCIP_DECL_HEURFREE((*heurfree)), SCIP_DECL_HEURINIT((*heurinit)), SCIP_DECL_HEUREXIT((*heurexit)), SCIP_DECL_HEURINITSOL((*heurinitsol)), SCIP_DECL_HEUREXITSOL((*heurexitsol)), SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: heur.c:793
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:142
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1175
#define BMSfreeMemory(ptr)
Definition: memory.h:127
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:97
SCIP_Bool usessubscip
Definition: struct_heur.h:104
#define SCIP_DECL_DIVESETGETSCORE(x)
Definition: type_heur.h:149
void SCIPheurSetFreq(SCIP_HEUR *heur, int freq)
Definition: heur.c:1349
SCIP_Bool SCIPdivesetUseOnlyLPBranchcands(SCIP_DIVESET *diveset)
Definition: heur.c:607
SCIP_RETCODE SCIPdivesetReset(SCIP_DIVESET *diveset, SCIP_SET *set)
Definition: heur.c:86
internal methods for collecting primal CIP solutions and primal informations
#define SCIP_HEURTIMING_AFTERPSEUDOPLUNGE
Definition: type_timing.h:82
SCIP_Real SCIPdivesetGetMaxLPIterQuot(SCIP_DIVESET *diveset)
Definition: heur.c:519
SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2014
SCIP_Real maxdiveavgquotnosol
Definition: struct_heur.h:51
void SCIPdivesetUpdateLPStats(SCIP_DIVESET *diveset, SCIP_STAT *stat, SCIP_Longint niterstoadd)
Definition: heur.c:628
SCIP_RETCODE SCIPsetHeurPriority(SCIP *scip, SCIP_HEUR *heur, int priority)
Definition: scip_heur.c:365
SCIP_HEUR * SCIPdivesetGetHeur(SCIP_DIVESET *diveset)
Definition: heur.c:325
SCIP_RETCODE SCIPvariableGraphCreate(SCIP *scip, SCIP_VGRAPH **vargraph, SCIP_Bool relaxdenseconss, SCIP_Real relaxdensity, int *nrelaxedconstraints)
Definition: heur.c:1792
int SCIPdivesetGetMaxSolutionDepth(SCIP_DIVESET *diveset)
Definition: heur.c:448
SCIP_HEURTIMING timingmask
Definition: struct_heur.h:103
char * name
Definition: struct_heur.h:84
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1254
#define BMSfreeMemoryArray(ptr)
Definition: memory.h:129
int SCIPheurGetMaxdepth(SCIP_HEUR *heur)
Definition: heur.c:1370
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_RETCODE SCIPgetConsNVars(SCIP *scip, SCIP_CONS *cons, int *nvars, SCIP_Bool *success)
Definition: scip_cons.c:2635
SCIP_Longint nbestsolsfound
Definition: struct_primal.h:42
int ndivesetcalls
Definition: struct_stat.h:201
#define SCIP_HEURTIMING_AFTERLPNODE
Definition: type_timing.h:73
void SCIPclockReset(SCIP_CLOCK *clck)
Definition: clock.c:199
int SCIPdivesetGetMaxDepth(SCIP_DIVESET *diveset)
Definition: heur.c:418
SCIP_Real SCIPdivesetGetAvgQuot(SCIP_DIVESET *diveset)
Definition: heur.c:558
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:128
SCIP_Real SCIPdivesetGetAvgDepth(SCIP_DIVESET *diveset)
Definition: heur.c:428
SCIP_SOL * sol
Definition: struct_heur.h:41
const char * SCIPheurGetDesc(SCIP_HEUR *heur)
Definition: heur.c:1264
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:428
void SCIPheurSetCopy(SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: heur.c:1188
internal miscellaneous methods
SCIP_Real lpresolvedomchgquot
Definition: struct_heur.h:52
void SCIPrandomFree(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem)
Definition: misc.c:9356
SCIP_RANDNUMGEN * randnumgen
Definition: struct_heur.h:42
SCIP_Real maxdiveubquot
Definition: struct_heur.h:46
int SCIPheurGetFreq(SCIP_HEUR *heur)
Definition: heur.c:1339
void SCIPrandomSetSeed(SCIP_RANDNUMGEN *randnumgen, unsigned int initseed)
Definition: misc.c:9286
internal methods for global SCIP settings
#define SCIP_CALL(x)
Definition: def.h:351
#define SCIP_HEURTIMING_DURINGPRESOLLOOP
Definition: type_timing.h:87
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2473
SCIP_Bool initialized
Definition: struct_heur.h:105
#define SCIP_HEURTIMING_BEFOREPRESOL
Definition: type_timing.h:86
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_Real SCIPdivesetGetLPResolveDomChgQuot(SCIP_DIVESET *diveset)
Definition: heur.c:595
int SCIPheurGetNDivesets(SCIP_HEUR *heur)
Definition: heur.c:1462
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
Definition: heur.c:1380
static void divesetFree(SCIP_DIVESET **divesetptr, BMS_BLKMEM *blkmem)
Definition: heur.c:642
SCIP_Bool SCIPdivesetSupportsType(SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype)
Definition: heur.c:617
SCIP_Longint nlpiterations
Definition: struct_heur.h:53
SCIP_RETCODE SCIPgetConsVars(SCIP *scip, SCIP_CONS *cons, SCIP_VAR **vars, int varssize, SCIP_Bool *success)
Definition: scip_cons.c:2591
#define BMSduplicateMemoryArray(ptr, source, num)
Definition: memory.h:125
SCIP_RETCODE SCIPclockCreate(SCIP_CLOCK **clck, SCIP_CLOCKTYPE clocktype)
Definition: clock.c:160
#define BMSfreeBlockMemory(mem, ptr)
Definition: memory.h:446
SCIP_Longint totalsoldepth
Definition: struct_heur.h:56
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:130
datastructures for primal heuristics
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:62
SCIP_Longint ndivesetlpiterations
Definition: struct_stat.h:66
SCIP_Longint ndivesetlps
Definition: struct_stat.h:191
void SCIPdivesetUpdateStats(SCIP_DIVESET *diveset, SCIP_STAT *stat, int depth, int nprobingnodes, int nbacktracks, SCIP_Longint nsolsfound, SCIP_Longint nbestsolsfound, SCIP_Longint nconflictsfound, SCIP_Bool leavesol)
Definition: heur.c:117
SCIP_RETCODE SCIPvariablegraphBreadthFirst(SCIP *scip, SCIP_VGRAPH *vargraph, SCIP_VAR **startvars, int nstartvars, int *distances, int maxdistance, int maxvars, int maxbinintvars)
Definition: heur.c:1491
SCIP_Real SCIPdivesetGetUbQuotNoSol(SCIP_DIVESET *diveset)
Definition: heur.c:535
SCIP_RANDNUMGEN * SCIPdivesetGetRandnumgen(SCIP_DIVESET *diveset)
Definition: heur.c:584
void SCIPclockFree(SCIP_CLOCK **clck)
Definition: clock.c:175
SCIP_Bool SCIPheurShouldBeExecuted(SCIP_HEUR *heur, int depth, int lpstateforkdepth, SCIP_HEURTIMING heurtiming, SCIP_Bool *delayed)
Definition: heur.c:1002
SCIP_RETCODE SCIPheurInit(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:868
char * desc
Definition: struct_heur.h:85
#define MIN(x, y)
Definition: def.h:209
void SCIPheurSetFree(SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: heur.c:1199
#define SCIPsetDebugMsg
Definition: set.h:1940
SCIP_Bool SCIPconsIsChecked(SCIP_CONS *cons)
Definition: cons.c:8275
int priority
Definition: struct_heur.h:97
void SCIPheurEnableOrDisableClocks(SCIP_HEUR *heur, SCIP_Bool enable)
Definition: heur.c:1420
SCIP_DIVETYPE divetypemask
Definition: struct_heur.h:74
SCIP_HEURDATA * heurdata
Definition: struct_heur.h:93
unsigned int initialseed
Definition: struct_heur.h:70
#define BMSclearMemory(ptr)
Definition: memory.h:111
#define SCIP_MAXTREEDEPTH
Definition: def.h:287
SCIP_CONS *** varconss
Definition: struct_heur.h:117
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2064
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:2044
#define SCIP_REAL_MAX
Definition: def.h:151
int SCIPparamGetInt(SCIP_PARAM *param)
Definition: paramset.c:716
void SCIPdivesetSetWorkSolution(SCIP_DIVESET *diveset, SCIP_SOL *sol)
Definition: heur.c:343
#define MAX(x, y)
Definition: def.h:208
SCIP_Real maxdiveavgquot
Definition: struct_heur.h:48
SCIP_HASHTABLE * visitedconss
Definition: struct_heur.h:118
SCIP_DECL_SORTPTRCOMP(SCIPheurComp)
Definition: heur.c:41
SCIP_Longint ncalls
Definition: struct_heur.h:81
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3094
void SCIPheurSetExit(SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
Definition: heur.c:1221
#define SCIP_DECL_HEUREXIT(x)
Definition: type_heur.h:86
SCIP_RETCODE SCIPheurExit(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:918
public methods for message output
SCIP_Longint nsolsfound
Definition: struct_heur.h:59
#define SCIP_DECL_HEURINIT(x)
Definition: type_heur.h:78
#define SCIP_HEURTIMING_AFTERPSEUDONODE
Definition: type_timing.h:76
SCIP_Longint nbestsolsfound
Definition: struct_heur.h:83
#define SCIP_Real
Definition: def.h:150
void SCIPheurSetInit(SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: heur.c:1210
char SCIPheurGetDispchar(SCIP_HEUR *heur)
Definition: heur.c:1274
SCIP_RETCODE SCIPrandomCreate(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem, unsigned int initialseed)
Definition: misc.c:9340
SCIP_Longint nbestsolsfound
Definition: struct_heur.h:60
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
Definition: heur.c:1294
#define SCIP_DECL_HEURFREE(x)
Definition: type_heur.h:70
#define BMSallocMemory(ptr)
Definition: memory.h:101
#define BMSreallocMemoryArray(ptr, num)
Definition: memory.h:109
#define SCIP_Longint
Definition: def.h:135
SCIP_Longint SCIPheurGetNSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1390
SCIP_Longint SCIPdivesetGetSolSuccess(SCIP_DIVESET *diveset)
Definition: heur.c:380
SCIP_Real minreldepth
Definition: struct_heur.h:43
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2377
SCIP_RETCODE SCIPdivesetCreate(SCIP_DIVESET **divesetptr, SCIP_HEUR *heur, const char *name, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, SCIP_Real minreldepth, SCIP_Real maxreldepth, SCIP_Real maxlpiterquot, SCIP_Real maxdiveubquot, SCIP_Real maxdiveavgquot, SCIP_Real maxdiveubquotnosol, SCIP_Real maxdiveavgquotnosol, SCIP_Real lpresolvedomchgquot, int lpsolvefreq, int maxlpiterofs, unsigned int initialseed, SCIP_Bool backtrack, SCIP_Bool onlylpbranchcands, SCIP_DIVETYPE divetypemask, SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)))
Definition: heur.c:187
#define SCIP_HEURTIMING_AFTERLPPLUNGE
Definition: type_timing.h:79
int maxlpiterofs
Definition: struct_heur.h:62
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:117
#define BMSallocBlockMemory(mem, ptr)
Definition: memory.h:433
SCIP_Longint nlps
Definition: struct_heur.h:54
SCIP_Bool SCIPheurIsInitialized(SCIP_HEUR *heur)
Definition: heur.c:1410
common defines and data types used in all packages of SCIP
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
SCIP_RETCODE SCIPsetAddRealParam(SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, SCIP_Real *valueptr, SCIP_Bool isadvanced, SCIP_Real defaultvalue, SCIP_Real minvalue, SCIP_Real maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: set.c:2927
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1165
internal methods for primal heuristics
SCIP_RETCODE SCIPheurExitsol(SCIP_HEUR *heur, SCIP_SET *set)
Definition: heur.c:978
SCIP_Real SCIPheurGetTime(SCIP_HEUR *heur)
Definition: heur.c:1442
#define SCIP_ALLOC(x)
Definition: def.h:362
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
#define SCIP_DECL_HEUREXITSOL(x)
Definition: type_heur.h:108
int SCIPdivesetGetNCalls(SCIP_DIVESET *diveset)
Definition: heur.c:388
SCIP_SOL * SCIPdivesetGetWorkSolution(SCIP_DIVESET *diveset)
Definition: heur.c:333
static SCIP_RETCODE doHeurCreate(SCIP_HEUR **heur, SCIP_SET *set, SCIP_MESSAGEHDLR *messagehdlr, BMS_BLKMEM *blkmem, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEURCOPY((*heurcopy)), SCIP_DECL_HEURFREE((*heurfree)), SCIP_DECL_HEURINIT((*heurinit)), SCIP_DECL_HEUREXIT((*heurexit)), SCIP_DECL_HEURINITSOL((*heurinitsol)), SCIP_DECL_HEUREXITSOL((*heurexitsol)), SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: heur.c:706
SCIP_Real maxdiveubquotnosol
Definition: struct_heur.h:50
SCIP_Longint SCIPdivesetGetNProbingNodes(SCIP_DIVESET *diveset)
Definition: heur.c:478
SCIP callable library.
int SCIPdivesetGetLPSolveFreq(SCIP_DIVESET *diveset)
Definition: heur.c:574
int maxdepth
Definition: struct_heur.h:100
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:17016
SCIP_Longint totaldivesetdepth
Definition: struct_stat.h:199
const char * SCIPdivesetGetName(SCIP_DIVESET *diveset)
Definition: heur.c:354
int SCIPdivesetGetMinDepth(SCIP_DIVESET *diveset)
Definition: heur.c:408
int freqofs
Definition: struct_heur.h:99