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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file 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 )
238  {
239  assert(divetype != SCIP_DIVETYPE_SOS1VARIABLE || heurdata->lockweight > 0);
240 
241  /* try to avoid variability; decide randomly if the LP solution can contain some noise */
242  if( SCIPisEQ(scip, candsfrac, 0.5) )
243  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 0);
244  else
245  *roundup = (candsfrac > 0.5);
246  }
247  else
248  *roundup = mayrounddown;
249  }
250  else
251  {
252  /* the candidate may not be rounded */
253  *roundup = (SCIPisGT(scip, downweight, upweight) || (SCIPisEQ(scip, downweight, upweight) && candsfrac > 0.5));
254  }
255 
256  if( *roundup )
257  {
258  switch( divetype )
259  {
261  candsfrac = 1.0 - candsfrac;
262  break;
264  if( SCIPisFeasPositive(scip, candsol) )
265  candsfrac = 1.0 - candsfrac;
266  break;
267  default:
268  SCIPerrorMessage("Error: Unsupported diving type\n");
269  SCIPABORT();
270  return SCIP_INVALIDDATA; /*lint !e527*/
271  } /*lint !e788*/
272 
273  /* add some noise to avoid ties */
274  *score = upweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
275  }
276  else
277  {
278  if( divetype == SCIP_DIVETYPE_SOS1VARIABLE && SCIPisFeasNegative(scip, candsol) )
279  candsfrac = 1.0 - candsfrac;
280 
281  /* add some noise to avoid ties */
282  *score = downweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
283  }
284 
285  /* penalize too small fractions */
286  if( SCIPisEQ(scip, candsfrac, 0.01) )
287  {
288  /* try to avoid variability; decide randomly if the LP solution can contain some noise.
289  * use a 1:SCIP_PROBINGSCORE_PENALTYRATIO chance for scaling the score
290  */
292  (*score) *= 0.01;
293  }
294  else if( candsfrac < 0.01 )
295  (*score) *= 0.1;
296 
297  /* prefer decisions on binary variables */
298  if( !SCIPvarIsBinary(cand) )
299  *score = -1.0 / *score;
300 
301  return SCIP_OKAY;
302 }
303 
304 /** calculate score variant 2: use a rounding strategy that tends towards infeasibility */
305 static
307  SCIP* scip, /**< SCIP data structure */
308  SCIP_HEUR* heur, /**< heuristic data structure */
309  SCIP_HEURDATA* heurdata, /**< heuristic data */
310  SCIP_RANDNUMGEN* rng, /**< random number generator of the diveset */
311  SCIP_DIVESET* diveset, /**< diveset of the heuristic */
312  SCIP_DIVETYPE divetype, /**< divetype of the heuristic */
313  SCIP_VAR* cand, /**< diving candidate */
314  SCIP_Real candsol, /**< diving candidate solution */
315  SCIP_Real candsfrac, /**< fractionality of the candidate solution */
316  SCIP_Real* score, /**< pointer to store the score */
317  SCIP_Bool* roundup /**< pointer to store whether the candidate should be rounded upwards */
318  )
319 {
320  SCIP_Real conflictlocksum;
321  SCIP_Real upweight;
322  SCIP_Real downweight;
323  SCIP_Bool mayrounddown;
324  SCIP_Bool mayroundup;
325  int nlocksup;
326  int nlocksdown;
327  int nconflictlocksup;
328  int nconflictlocksdown;
329 
330  assert(scip != NULL);
331  assert(heur != NULL);
332  assert(heurdata != NULL);
333  assert(rng != NULL);
334 
335  /* get conflict locks */
336  nconflictlocksup = SCIPvarGetNLocksUpType(cand, SCIP_LOCKTYPE_CONFLICT);
337  nconflictlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_CONFLICT);
338  conflictlocksum = nconflictlocksup + nconflictlocksdown;
339 
340  /* get variable locks */
342  nlocksdown = SCIPvarGetNLocksDownType(cand, SCIP_LOCKTYPE_MODEL);
343 
344  /* combine conflict and variable locks */
345  upweight = heurdata->lockweight * nconflictlocksup + (1.0 - heurdata->lockweight) * nlocksup;
346  downweight = heurdata->lockweight * nconflictlocksdown + (1.0 - heurdata->lockweight) * nlocksdown;
347 
348  /* check whether there exists a rounding direction w/o any locks */
349  mayrounddown = SCIPisZero(scip, upweight);
350  mayroundup = SCIPisZero(scip, downweight);
351 
352  /* variable can be rounded in exactly one direction and we try to go into the feasible direction */
353  if( mayrounddown || mayroundup )
354  {
355  /* choose rounding direction:
356  * - if variable may be rounded in both directions, round corresponding to the fractionality
357  * - otherwise, round in the feasible direction
358  */
359  if( mayrounddown && mayroundup )
360  {
361  assert(divetype != SCIP_DIVETYPE_SOS1VARIABLE || heurdata->lockweight > 0);
362 
363  /* try to avoid variability; decide randomly if the LP solution can contain some noise */
364  if( SCIPisEQ(scip, candsfrac, 0.5) )
365  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 0);
366  else
367  *roundup = (candsfrac > 0.5);
368  }
369  else
370  *roundup = mayroundup;
371  }
372  else
373  {
374  assert(!mayrounddown);
375 
376  /* both rounding directions have a different amount of locks */
377  if( !SCIPisEQ(scip, upweight, downweight) )
378  {
379  *roundup = (heurdata->maxviol ? SCIPisGT(scip, upweight, downweight) : SCIPisLT(scip, upweight, downweight));
380  }
381  /* break ties with lp fractionality != 0.5 */
382  else if( !SCIPisEQ(scip, candsfrac, 0.5) )
383  {
384  *roundup = (candsfrac > 0.5);
385  }
386  /* break tie randomly */
387  else
388  {
389  *roundup = (SCIPrandomGetInt(rng, 0, 1) == 1);
390  }
391  }
392 
393  if( *roundup )
394  {
395  switch( divetype )
396  {
398  candsfrac = 1.0 - candsfrac;
399  break;
401  if( SCIPisFeasPositive(scip, candsol) )
402  candsfrac = 1.0 - candsfrac;
403  break;
404  default:
405  SCIPerrorMessage("Error: Unsupported diving type\n");
406  SCIPABORT();
407  return SCIP_INVALIDDATA; /*lint !e527*/
408  } /*lint !e788*/
409 
410  /* add some noise to avoid ties */
411  *score = upweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
412  }
413  else
414  {
415  if( divetype == SCIP_DIVETYPE_SOS1VARIABLE && SCIPisFeasNegative(scip, candsol) )
416  candsfrac = 1.0 - candsfrac;
417 
418  /* add some noise to avoid ties */
419  *score = downweight + SCIPrandomGetReal(rng, MIN_RAND, MAX_RAND);
420  }
421 
422  /* penalize too few conflict locks */
423  if( conflictlocksum > 0 && conflictlocksum < heurdata->minconflictlocks )
424  (*score) *= 0.1;
425 
426  /* penalize if no conflict locks exist at all */
427  if( conflictlocksum == 0 )
428  (*score) *= 0.01;
429 
430  /* penalize too small fractions */
431  if( SCIPisEQ(scip, candsfrac, 0.01) )
432  {
433  /* try to avoid variability; decide randomly if the LP solution can contain some noise.
434  * use a 1:SCIP_PROBINGSCORE_PENALTYRATIO chance for scaling the score
435  */
437  (*score) *= 0.01;
438  }
439  else if( candsfrac < 0.01 )
440  (*score) *= 0.01;
441 
442  /* prefer decisions on binary variables */
443  if( !SCIPvarIsBinary(cand) )
444  *score = -1.0 / *score;
445 
446  return SCIP_OKAY;
447 }
448 
449 
450 /** returns a score for the given candidate -- the best candidate maximizes the diving score */
451 static
452 SCIP_DECL_DIVESETGETSCORE(divesetGetScoreConflictdiving)
453 {
454  SCIP_HEUR* heur;
455  SCIP_HEURDATA* heurdata;
456  SCIP_RANDNUMGEN* rng;
457 
458  rng = SCIPdivesetGetRandnumgen(diveset);
459  assert(rng != NULL);
460 
461  heur = SCIPdivesetGetHeur(diveset);
462  assert(heur != NULL);
463 
464  heurdata = SCIPheurGetData(heur);
465  assert(heurdata != NULL);
466 
467  if( heurdata->likecoefdiving )
468  {
469  SCIP_CALL( getScoreLikeCoefdiving(scip, heur, heurdata, rng, diveset, divetype, cand, candsol, candsfrac, score, roundup) );
470  }
471  else
472  {
473  SCIP_CALL( getScore(scip, heur, heurdata, rng, diveset, divetype, cand, candsol, candsfrac, score, roundup) );
474  }
475 
476  /* check, if candidate is new best candidate: prefer unroundable candidates in any case */
477  assert( (0.0 < candsfrac && candsfrac < 1.0) || SCIPvarIsBinary(cand) || divetype == SCIP_DIVETYPE_SOS1VARIABLE );
478 
479  return SCIP_OKAY;
480 }
481 
482 /*
483  * heuristic specific interface methods
484  */
485 
486 /** creates the conflictdiving heuristic and includes it in SCIP */
488  SCIP* scip /**< SCIP data structure */
489  )
490 {
491  SCIP_HEURDATA* heurdata;
492  SCIP_HEUR* heur;
493 
494  /* create conflictdiving primal heuristic data */
495  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
496 
497  /* include primal heuristic */
499  HEUR_FREQOFS, HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecConflictdiving, heurdata) );
500 
501  assert(heur != NULL);
502 
503  /* set non-NULL pointers to callback methods */
504  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyConflictdiving) );
505  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeConflictdiving) );
506  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitConflictdiving) );
507  SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitConflictdiving) );
508 
509  /* create a diveset (this will automatically install some additional parameters for the heuristic)*/
513 
514  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/maxviol", "try to maximize the violation",
515  &heurdata->maxviol, TRUE, DEFAULT_MAXVIOL, NULL, NULL) );
516 
517  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/likecoef",
518  "perform rounding like coefficient diving",
519  &heurdata->likecoefdiving, TRUE, DEFAULT_LIKECOEF, NULL, NULL) );
520 
521  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/minconflictlocks",
522  "minimal number of conflict locks per variable",
523  &heurdata->minconflictlocks, TRUE, DEFAULT_MINCONFLICTLOCKS, 0, INT_MAX, NULL, NULL) );
524 
525  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/lockweight",
526  "weight used in a convex combination of conflict and variable locks",
527  &heurdata->lockweight, TRUE, DEFAULT_LOCKWEIGHT, 0.0, 1.0, NULL, NULL) );
528 
529  return SCIP_OKAY;
530 }
static SCIP_DECL_HEURINIT(heurInitConflictdiving)
#define NULL
Definition: def.h:246
#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:16910
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:71
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:9608
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:358
int SCIPheurGetNDivesets(SCIP_HEUR *heur)
Definition: heur.c:1462
#define SCIP_PROBINGSCORE_PENALTYRATIO
Definition: def.h:300
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:69
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:9630
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:157
#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:330
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