Scippy

SCIP

Solving Constraint Integer Programs

heur_conflictdiving.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_conflictdiving.c
17  * @brief LP diving heuristic that chooses fixings w.r.t. conflict locks
18  * @author Jakob Witzig
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
24 #include "scip/heuristics.h"
25 #include "scip/pub_heur.h"
26 #include "scip/pub_message.h"
27 #include "scip/pub_misc.h"
28 #include "scip/pub_var.h"
29 #include "scip/scip_heur.h"
30 #include "scip/scip_mem.h"
31 #include "scip/scip_numerics.h"
32 #include "scip/scip_param.h"
33 #include "scip/scip_sol.h"
34 #include "scip/scip_solvingstats.h"
35 #include <string.h>
36 
37 #define HEUR_NAME "conflictdiving"
38 #define HEUR_DESC "LP diving heuristic that chooses fixings w.r.t. conflict locks"
39 #define HEUR_DISPCHAR '~'
40 #define HEUR_PRIORITY -1000100
41 #define HEUR_FREQ -1
42 #define HEUR_FREQOFS 0
43 #define HEUR_MAXDEPTH -1
44 #define HEUR_TIMING SCIP_HEURTIMING_AFTERLPPLUNGE
45 #define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
46 #define DIVESET_DIVETYPES SCIP_DIVETYPE_INTEGRALITY | SCIP_DIVETYPE_SOS1VARIABLE /**< bit mask that represents all supported dive types */
47 #define DEFAULT_RANDSEED 151 /**< default random seed */
48 
49 /*
50  * Default parameter settings
51  */
52 
53 #define DEFAULT_MINRELDEPTH 0.0 /**< minimal relative depth to start diving */
54 #define DEFAULT_MAXRELDEPTH 1.0 /**< maximal relative depth to start diving */
55 #define DEFAULT_MAXLPITERQUOT 0.15 /**< maximal fraction of diving LP iterations compared to node LP iterations */
56 #define DEFAULT_MAXLPITEROFS 1000 /**< additional number of allowed LP iterations */
57 #define DEFAULT_MAXDIVEUBQUOT 0.8 /**< maximal quotient (curlowerbound - lowerbound)/(cutoffbound - lowerbound)
58  * where diving is performed (0.0: no limit) */
59 #define DEFAULT_MAXDIVEAVGQUOT 0.0 /**< maximal quotient (curlowerbound - lowerbound)/(avglowerbound - lowerbound)
60  * where diving is performed (0.0: no limit) */
61 #define DEFAULT_MAXDIVEUBQUOTNOSOL 0.1 /**< maximal UBQUOT when no solution was found yet (0.0: no limit) */
62 #define DEFAULT_MAXDIVEAVGQUOTNOSOL 0.0 /**< maximal AVGQUOT when no solution was found yet (0.0: no limit) */
63 #define DEFAULT_BACKTRACK TRUE /**< use one level of backtracking if infeasibility is encountered? */
64 #define DEFAULT_LPRESOLVEDOMCHGQUOT 0.15/**< percentage of immediate domain changes during probing to trigger LP resolve */
65 #define DEFAULT_LPSOLVEFREQ 0 /**< LP solve frequency for diving heuristics */
66 #define DEFAULT_ONLYLPBRANCHCANDS FALSE /**< should only LP branching candidates be considered instead of the slower but
67  * more general constraint handler diving variable selection? */
68 #define DEFAULT_LOCKWEIGHT 1.0 /**< weight used in a convex combination of conflict and variable locks */
69 #define DEFAULT_LIKECOEF FALSE /**< perform rounding like coefficient diving */
70 #define DEFAULT_MAXVIOL TRUE /**< prefer rounding direction with most violation */
71 #define DEFAULT_MINCONFLICTLOCKS 5 /**< threshold for penalizing the score */
72 
73 /* locally defined heuristic data */
74 struct SCIP_HeurData
75 {
76  SCIP_SOL* sol; /**< working solution */
77  SCIP_Real lockweight; /**< weight factor to combine conflict and variable locks */
78  SCIP_Bool likecoefdiving; /**< use the same rounding strategy like coefficent diving */
79  SCIP_Bool maxviol; /**< rounding into potentially infeasible direction */
80  int minconflictlocks; /**< threshold for penalizing the score */
81 };
82 
83 /*
84  * Callback methods
85  */
86 
87 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
88 static
89 SCIP_DECL_HEURCOPY(heurCopyConflictdiving)
90 { /*lint --e{715}*/
91  assert(scip != NULL);
92  assert(heur != NULL);
93  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
94 
95  /* call inclusion method of constraint handler */
97 
98  return SCIP_OKAY;
99 }
100 
101 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
102 static
103 SCIP_DECL_HEURFREE(heurFreeConflictdiving) /*lint --e{715}*/
104 { /*lint --e{715}*/
105  SCIP_HEURDATA* heurdata;
107  assert(heur != NULL);
108  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
109  assert(scip != NULL);
110 
111  /* free heuristic data */
112  heurdata = SCIPheurGetData(heur);
113  assert(heurdata != NULL);
114 
115  SCIPfreeBlockMemory(scip, &heurdata);
116  SCIPheurSetData(heur, NULL);
117 
118  return SCIP_OKAY;
119 }
120 
121 
122 /** initialization method of primal heuristic (called after problem was transformed) */
123 static
124 SCIP_DECL_HEURINIT(heurInitConflictdiving) /*lint --e{715}*/
125 { /*lint --e{715}*/
126  SCIP_HEURDATA* heurdata;
128  assert(heur != NULL);
129  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
130 
131  /* get heuristic data */
132  heurdata = SCIPheurGetData(heur);
133  assert(heurdata != NULL);
134 
135  /* create working solution */
136  SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
137 
138  return SCIP_OKAY;
139 }
140 
141 
142 /** deinitialization method of primal heuristic (called before transformed problem is freed) */
143 static
144 SCIP_DECL_HEUREXIT(heurExitConflictdiving) /*lint --e{715}*/
145 { /*lint --e{715}*/
146  SCIP_HEURDATA* heurdata;
148  assert(heur != NULL);
149  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
150 
151  /* get heuristic data */
152  heurdata = SCIPheurGetData(heur);
153  assert(heurdata != NULL);
154 
155  /* free working solution */
156  SCIP_CALL( SCIPfreeSol(scip, &heurdata->sol) );
157 
158  return SCIP_OKAY;
159 }
160 
161 /** execution method of primal heuristic */
162 static
163 SCIP_DECL_HEUREXEC(heurExecConflictdiving) /*lint --e{715}*/
164 { /*lint --e{715}*/
165  SCIP_HEURDATA* heurdata;
166  SCIP_DIVESET* diveset;
167 
168  heurdata = SCIPheurGetData(heur);
169  assert(heurdata != NULL);
170 
171  assert(SCIPheurGetNDivesets(heur) > 0);
172  assert(SCIPheurGetDivesets(heur) != NULL);
173  diveset = SCIPheurGetDivesets(heur)[0];
174  assert(diveset != NULL);
175 
176  *result = SCIP_DELAYED;
177 
178  /* don't run if no conflict constraints where found */
179  if( SCIPgetNConflictConssFound(scip) == 0 )
180  return SCIP_OKAY;
181 
182  SCIP_CALL( SCIPperformGenericDivingAlgorithm(scip, diveset, heurdata->sol, heur, result, nodeinfeasible) );
183 
184  return SCIP_OKAY;
185 }
186 
187 #define MIN_RAND 1e-06
188 #define MAX_RAND 1e-05
189 
190 /** calculate score variant 1: use rounding strategy like coefficent diving */
191 static
193  SCIP* scip, /**< SCIP data structure */
194  SCIP_HEUR* heur, /**< heuristic data structure */
195  SCIP_HEURDATA* heurdata, /**< heuristic data */
196  SCIP_RANDNUMGEN* rng, /**< random number generator of the diveset */
197  SCIP_DIVESET* diveset, /**< diveset of the heuristic */
198  SCIP_DIVETYPE divetype, /**< divetype of the heuristic */
199  SCIP_VAR* cand, /**< diving candidate */
200  SCIP_Real candsol, /**< diving candidate solution */
201  SCIP_Real candsfrac, /**< fractionality of the candidate solution */
202  SCIP_Real* score, /**< pointer to store the score */
203  SCIP_Bool* roundup /**< pointer to store whether the candidate should be rounded upwards */
204  )
205 {
206  SCIP_Real upweight;
207  SCIP_Real downweight;
208  SCIP_Bool mayrounddown;
209  SCIP_Bool mayroundup;
210  int nconflictlocksdown;
211  int nconflictlocksup;
212  int nlocksdown;
213  int nlocksup;
214 
215  /* get conflict locks */
216  nconflictlocksup = SCIPvarGetNLocksUpType(cand, SCIP_LOCKTYPE_CONFLICT);
217  nconflictlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_CONFLICT);
218 
219  /* get variable locks */
221  nlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_MODEL);
222 
223  /* combine conflict and variable locks */
224  upweight = heurdata->lockweight * nconflictlocksup + (1.0 - heurdata->lockweight) * nlocksup;
225  downweight = heurdata->lockweight * nconflictlocksdown + (1.0 - heurdata->lockweight) * nlocksdown;
226 
227  /* check whether there exists a direction w/o any locks */
228  mayrounddown = SCIPisZero(scip, upweight);
229  mayroundup = SCIPisZero(scip, downweight);
230 
231  if( mayrounddown || mayroundup )
232  {
233  /* choose rounding direction:
234  * - if variable may be rounded in both directions, round corresponding to the fractionality
235  * - otherwise, round in the infeasible direction
236  */
237  if( mayrounddown && mayroundup && divetype != SCIP_DIVETYPE_SOS1VARIABLE )
238  {
239  /* try to avoid variability; decide randomly if the LP solution can contain some noise */
240  if( SCIPisEQ(scip, candsfrac, 0.5) )
241  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 0);
242  else
243  *roundup = (candsfrac > 0.5);
244  }
245  else
246  *roundup = mayrounddown;
247  }
248  else
249  {
250  /* the candidate may not be rounded */
251  *roundup = (SCIPisGT(scip, downweight, upweight) || (SCIPisEQ(scip, downweight, upweight) && candsfrac > 0.5));
252  }
253 
254  if( *roundup )
255  {
256  switch( divetype )
257  {
259  candsfrac = 1.0 - candsfrac;
260  break;
262  if( SCIPisFeasPositive(scip, candsol) )
263  candsfrac = 1.0 - candsfrac;
264  break;
265  default:
266  SCIPerrorMessage("Error: Unsupported diving type\n");
267  SCIPABORT();
268  return SCIP_INVALIDDATA; /*lint !e527*/
269  } /*lint !e788*/
270 
271  /* add some noise to avoid ties */
272  *score = upweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
273  }
274  else
275  {
276  if( divetype == SCIP_DIVETYPE_SOS1VARIABLE && SCIPisFeasNegative(scip, candsol) )
277  candsfrac = 1.0 - candsfrac;
278 
279  /* add some noise to avoid ties */
280  *score = downweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
281  }
282 
283 
284  /* penalize too small fractions */
285  if( SCIPisEQ(scip, candsfrac, 0.01) )
286  {
287  /* try to avoid variability; decide randomly if the LP solution can contain some noise.
288  * use a 1:SCIP_PROBINGSCORE_PENALTYRATIO chance for scaling the score
289  */
291  (*score) *= 0.01;
292  }
293  else if( candsfrac < 0.01 )
294  (*score) *= 0.1;
295 
296  /* prefer decisions on binary variables */
297  if( !SCIPvarIsBinary(cand) )
298  *score = -1.0 / *score;
299 
300  return SCIP_OKAY;
301 }
302 
303 /** calculate score variant 2: use a rounding strategy that tends towards infeasibility */
304 static
306  SCIP* scip, /**< SCIP data structure */
307  SCIP_HEUR* heur, /**< heuristic data structure */
308  SCIP_HEURDATA* heurdata, /**< heuristic data */
309  SCIP_RANDNUMGEN* rng, /**< random number generator of the diveset */
310  SCIP_DIVESET* diveset, /**< diveset of the heuristic */
311  SCIP_DIVETYPE divetype, /**< divetype of the heuristic */
312  SCIP_VAR* cand, /**< diving candidate */
313  SCIP_Real candsol, /**< diving candidate solution */
314  SCIP_Real candsfrac, /**< fractionality of the candidate solution */
315  SCIP_Real* score, /**< pointer to store the score */
316  SCIP_Bool* roundup /**< pointer to store whether the candidate should be rounded upwards */
317  )
318 {
319  SCIP_Real conflictlocksum;
320  SCIP_Real upweight;
321  SCIP_Real downweight;
322  SCIP_Bool mayrounddown;
323  SCIP_Bool mayroundup;
324  int nlocksup;
325  int nlocksdown;
326  int nconflictlocksup;
327  int nconflictlocksdown;
328 
329  assert(scip != NULL);
330  assert(heur != NULL);
331  assert(heurdata != NULL);
332  assert(rng != NULL);
333 
334  /* get conflict locks */
335  nconflictlocksup = SCIPvarGetNLocksUpType(cand, SCIP_LOCKTYPE_CONFLICT);
336  nconflictlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_CONFLICT);
337  conflictlocksum = nconflictlocksup + nconflictlocksdown;
338 
339  /* get variable locks */
341  nlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_MODEL);
342 
343  /* combine conflict and variable locks */
344  upweight = heurdata->lockweight * nconflictlocksup + (1.0 - heurdata->lockweight) * nlocksup;
345  downweight = heurdata->lockweight * nconflictlocksdown + (1.0 - heurdata->lockweight) * nlocksdown;
346 
347  /* check whether there exists a rounding direction w/o any locks */
348  mayrounddown = SCIPisZero(scip, upweight);
349  mayroundup = SCIPisZero(scip, downweight);
350 
351  /* variable can be rounded in exactly one direction and we try to go into the feasible direction */
352  if( mayrounddown || mayroundup )
353  {
354  /* choose rounding direction:
355  * - if variable may be rounded in both directions, round corresponding to the fractionality
356  * - otherwise, round in the feasible direction
357  */
358  if( mayrounddown && mayroundup && divetype != SCIP_DIVETYPE_SOS1VARIABLE )
359  {
360  /* try to avoid variability; decide randomly if the LP solution can contain some noise */
361  if( SCIPisEQ(scip, candsfrac, 0.5) )
362  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 0);
363  else
364  *roundup = (candsfrac > 0.5);
365  }
366  else
367  *roundup = mayroundup;
368  }
369  else
370  {
371  assert(!mayrounddown);
372 
373  /* both rounding directions have a different amount of locks */
374  if( !SCIPisEQ(scip, upweight, downweight) )
375  {
376  *roundup = (heurdata->maxviol ? SCIPisGT(scip, upweight, downweight) : SCIPisLT(scip, upweight, downweight));
377  }
378  /* break ties with lp fractionality != 0.5 */
379  else if( !SCIPisEQ(scip, candsfrac, 0.5) )
380  {
381  *roundup = (candsfrac > 0.5);
382  }
383  /* break tie randomly */
384  else
385  {
386  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 1);
387  }
388  }
389 
390  if( *roundup )
391  {
392  switch( divetype )
393  {
395  candsfrac = 1.0 - candsfrac;
396  break;
398  if( SCIPisFeasPositive(scip, candsol) )
399  candsfrac = 1.0 - candsfrac;
400  break;
401  default:
402  SCIPerrorMessage("Error: Unsupported diving type\n");
403  SCIPABORT();
404  return SCIP_INVALIDDATA; /*lint !e527*/
405  } /*lint !e788*/
406 
407  /* add some noise to avoid ties */
408  *score = upweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
409  }
410  else
411  {
412  if( divetype == SCIP_DIVETYPE_SOS1VARIABLE && SCIPisFeasNegative(scip, candsol) )
413  candsfrac = 1.0 - candsfrac;
414 
415  /* add some noise to avoid ties */
416  *score = downweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
417  }
418 
419  /* penalize too few conflict locks */
420  if( conflictlocksum > 0 && conflictlocksum < heurdata->minconflictlocks )
421  (*score) *= 0.1;
422 
423  /* penalize if no conflict locks exist at all */
424  if( conflictlocksum == 0 )
425  (*score) *= 0.01;
426 
427  /* penalize too small fractions */
428  if( SCIPisEQ(scip, candsfrac, 0.01) )
429  {
430  /* try to avoid variability; decide randomly if the LP solution can contain some noise.
431  * use a 1:SCIP_PROBINGSCORE_PENALTYRATIO chance for scaling the score
432  */
434  (*score) *= 0.01;
435  }
436  else if( candsfrac < 0.01 )
437  (*score) *= 0.01;
438 
439  /* prefer decisions on binary variables */
440  if( !SCIPvarIsBinary(cand) )
441  *score = -1.0 / *score;
442 
443  return SCIP_OKAY;
444 }
445 
446 
447 /** returns a score for the given candidate -- the best candidate maximizes the diving score */
448 static
449 SCIP_DECL_DIVESETGETSCORE(divesetGetScoreConflictdiving)
450 {
451  SCIP_HEUR* heur;
452  SCIP_HEURDATA* heurdata;
453  SCIP_RANDNUMGEN* rng;
454 
455  rng = SCIPdivesetGetRandnumgen(diveset);
456  assert(rng != NULL);
457 
458  heur = SCIPdivesetGetHeur(diveset);
459  assert(heur != NULL);
460 
461  heurdata = SCIPheurGetData(heur);
462  assert(heurdata != NULL);
463 
464  if( heurdata->likecoefdiving )
465  {
466  SCIP_CALL( getScoreLikeCoefdiving(scip, heur, heurdata, rng, diveset, divetype, cand, candsol, candsfrac, score, roundup) );
467  }
468  else
469  {
470  SCIP_CALL( getScore(scip, heur, heurdata, rng, diveset, divetype, cand, candsol, candsfrac, score, roundup) );
471  }
472 
473  /* check, if candidate is new best candidate: prefer unroundable candidates in any case */
474  assert( (0.0 < candsfrac && candsfrac < 1.0) || SCIPvarIsBinary(cand) || divetype == SCIP_DIVETYPE_SOS1VARIABLE );
475 
476  return SCIP_OKAY;
477 }
478 
479 /*
480  * heuristic specific interface methods
481  */
482 
483 /** creates the conflictdiving heuristic and includes it in SCIP */
485  SCIP* scip /**< SCIP data structure */
486  )
487 {
488  SCIP_HEURDATA* heurdata;
489  SCIP_HEUR* heur;
490 
491  /* create conflictdiving primal heuristic data */
492  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
493 
494  /* include primal heuristic */
496  HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecConflictdiving, heurdata) );
497 
498  assert(heur != NULL);
499 
500  /* set non-NULL pointers to callback methods */
501  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyConflictdiving) );
502  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeConflictdiving) );
503  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitConflictdiving) );
504  SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitConflictdiving) );
505 
506  /* create a diveset (this will automatically install some additional parameters for the heuristic)*/
510 
511  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/maxviol", "try to maximize the violation",
512  &heurdata->maxviol, TRUE, DEFAULT_MAXVIOL, NULL, NULL) );
513 
514  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/likecoef",
515  "perform rounding like coefficient diving",
516  &heurdata->likecoefdiving, TRUE, DEFAULT_LIKECOEF, NULL, NULL) );
517 
518  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/minconflictlocks",
519  "minimal number of conflict locks per variable",
520  &heurdata->minconflictlocks, TRUE, DEFAULT_MINCONFLICTLOCKS, 0, INT_MAX, NULL, NULL) );
521 
522  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/lockweight",
523  "weight used in a convex combination of conflict and variable locks",
524  &heurdata->lockweight, TRUE, DEFAULT_LOCKWEIGHT, 0.0, 1.0, NULL, NULL) );
525 
526 
527  return SCIP_OKAY;
528 }
static SCIP_DECL_HEURINIT(heurInitConflictdiving)
#define NULL
Definition: def.h:239
#define DEFAULT_MAXVIOL
public methods for SCIP parameter handling
int SCIPvarGetNLocksDownType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
Definition: var.c:3176
#define DEFAULT_ONLYLPBRANCHCANDS
public methods for memory management
int SCIPvarGetNLocksUpType(SCIP_VAR *var, SCIP_LOCKTYPE locktype)
Definition: var.c:3233
SCIP_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
Definition: scip_heur.c:280
#define DEFAULT_MAXDIVEUBQUOTNOSOL
SCIP_DIVESET ** SCIPheurGetDivesets(SCIP_HEUR *heur)
Definition: heur.c:1452
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:16909
SCIP_Bool SCIPisFeasNegative(SCIP *scip, SCIP_Real val)
#define HEUR_MAXDEPTH
#define DEFAULT_MAXDIVEAVGQUOT
#define DEFAULT_RANDSEED
#define DEFAULT_BACKTRACK
#define TRUE
Definition: def.h:64
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
methods commonly used by primal heuristics
#define DEFAULT_LIKECOEF
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
public methods for problem variables
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:114
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: scip_heur.c:187
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
Definition: misc.c:9372
unsigned int SCIP_DIVETYPE
Definition: type_heur.h:48
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1175
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:97
SCIP_RETCODE SCIPaddIntParam(SCIP *scip, 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: scip_param.c:155
#define HEUR_TIMING
public methods for numerical tolerances
#define DEFAULT_LOCKWEIGHT
public methods for querying solving statistics
static SCIP_RETCODE getScore(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_RANDNUMGEN *rng, SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype, SCIP_VAR *cand, SCIP_Real candsol, SCIP_Real candsfrac, SCIP_Real *score, SCIP_Bool *roundup)
static SCIP_DECL_DIVESETGETSCORE(divesetGetScoreConflictdiving)
SCIP_HEUR * SCIPdivesetGetHeur(SCIP_DIVESET *diveset)
Definition: heur.c:325
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1254
#define SCIPerrorMessage
Definition: pub_message.h:45
#define HEUR_FREQOFS
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:248
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define HEUR_USESSUBSCIP
#define HEUR_PRIORITY
SCIP_SOL * sol
Definition: struct_heur.h:41
#define DEFAULT_LPRESOLVEDOMCHGQUOT
#define MAX_RAND
#define DEFAULT_MAXRELDEPTH
static SCIP_DECL_HEUREXEC(heurExecConflictdiving)
#define SCIP_CALL(x)
Definition: def.h:351
int SCIPheurGetNDivesets(SCIP_HEUR *heur)
Definition: heur.c:1462
#define SCIP_PROBINGSCORE_PENALTYRATIO
Definition: def.h:293
public methods for primal heuristic plugins and divesets
static SCIP_DECL_HEUREXIT(heurExitConflictdiving)
#define DEFAULT_MAXDIVEAVGQUOTNOSOL
public data structures and miscellaneous methods
SCIP_RETCODE SCIPincludeHeurConflictdiving(SCIP *scip)
#define SCIP_Bool
Definition: def.h:62
SCIP_RANDNUMGEN * SCIPdivesetGetRandnumgen(SCIP_DIVESET *diveset)
Definition: heur.c:584
#define DEFAULT_LPSOLVEFREQ
SCIP_RETCODE SCIPcreateDiveset(SCIP *scip, SCIP_DIVESET **diveset, SCIP_HEUR *heur, const char *name, 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_Bool specificsos1score, SCIP_DECL_DIVESETGETSCORE((*divesetgetscore)))
Definition: scip_heur.c:390
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip_sol.c:1034
SCIP_Longint SCIPgetNConflictConssFound(SCIP *scip)
#define HEUR_FREQ
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition: misc.c:9394
SCIP_RETCODE SCIPperformGenericDivingAlgorithm(SCIP *scip, SCIP_DIVESET *diveset, SCIP_SOL *worksol, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Bool nodeinfeasible)
Definition: heuristics.c:192
#define DEFAULT_MAXDIVEUBQUOT
#define DIVESET_DIVETYPES
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
public methods for solutions
#define DEFAULT_MAXLPITEROFS
public methods for message output
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip_heur.c:264
#define HEUR_DESC
SCIP_Bool SCIPisFeasPositive(SCIP *scip, SCIP_Real val)
#define SCIP_Real
Definition: def.h:150
#define DEFAULT_MINRELDEPTH
LP diving heuristic that chooses fixings w.r.t. conflict locks.
#define SCIP_DIVETYPE_SOS1VARIABLE
Definition: type_heur.h:46
static SCIP_RETCODE getScoreLikeCoefdiving(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_RANDNUMGEN *rng, SCIP_DIVESET *diveset, SCIP_DIVETYPE divetype, SCIP_VAR *cand, SCIP_Real candsol, SCIP_Real candsfrac, SCIP_Real *score, SCIP_Bool *roundup)
#define MIN_RAND
#define HEUR_NAME
static SCIP_DECL_HEURCOPY(heurCopyConflictdiving)
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip_heur.c:232
public methods for primal heuristics
#define SCIP_DIVETYPE_INTEGRALITY
Definition: type_heur.h:45
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1165
#define DEFAULT_MAXLPITERQUOT
#define SCIPABORT()
Definition: def.h:323
static SCIP_DECL_HEURFREE(heurFreeConflictdiving)
SCIP_RETCODE SCIPaddRealParam(SCIP *scip, 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: scip_param.c:211
#define DEFAULT_MINCONFLICTLOCKS
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:129
#define HEUR_DISPCHAR
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:377