Scippy

SCIP

Solving Constraint Integer Programs

heur_localbranching.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-2016 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 email to scip@zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file heur_localbranching.c
17  * @brief Local branching heuristic according to Fischetti and Lodi
18  * @author Timo Berthold
19  * @author Marc Pfetsch
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 #include "scip/scip.h"
27 #include "scip/cons_linear.h"
28 #include "scip/scipdefplugins.h"
30 #include "scip/pub_misc.h"
31 
32 #define HEUR_NAME "localbranching"
33 #define HEUR_DESC "local branching heuristic by Fischetti and Lodi"
34 #define HEUR_DISPCHAR 'L'
35 #define HEUR_PRIORITY -1102000
36 #define HEUR_FREQ -1
37 #define HEUR_FREQOFS 0
38 #define HEUR_MAXDEPTH -1
39 #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE
40 #define HEUR_USESSUBSCIP TRUE /**< does the heuristic use a secondary SCIP instance? */
41 
42 #define DEFAULT_NEIGHBORHOODSIZE 18 /* radius of the incumbents neighborhood to be searched */
43 #define DEFAULT_NODESOFS 1000 /* number of nodes added to the contingent of the total nodes */
44 #define DEFAULT_MAXNODES 10000 /* maximum number of nodes to regard in the subproblem */
45 #define DEFAULT_MINIMPROVE 0.01 /* factor by which localbranching should at least improve the incumbent */
46 #define DEFAULT_MINNODES 1000 /* minimum number of nodes required to start the subproblem */
47 #define DEFAULT_NODESQUOT 0.05 /* contingent of sub problem nodes in relation to original nodes */
48 #define DEFAULT_LPLIMFAC 1.5 /* factor by which the limit on the number of LP depends on the node limit */
49 #define DEFAULT_NWAITINGNODES 200 /* number of nodes without incumbent change that heuristic should wait */
50 #define DEFAULT_USELPROWS FALSE /* should subproblem be created out of the rows in the LP rows,
51  * otherwise, the copy constructors of the constraints handlers are used */
52 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
53  * of the original scip be copied to constraints of the subscip
54  */
55 
56 /* event handler properties */
57 #define EVENTHDLR_NAME "Localbranching"
58 #define EVENTHDLR_DESC "LP event handler for " HEUR_NAME " heuristic"
59 
60 
61 #define EXECUTE 0
62 #define WAITFORNEWSOL 1
63 
64 
65 /*
66  * Data structures
67  */
68 
69 /** primal heuristic data */
70 struct SCIP_HeurData
71 {
72  int nwaitingnodes; /**< number of nodes without incumbent change that heuristic should wait */
73  int nodesofs; /**< number of nodes added to the contingent of the total nodes */
74  int minnodes; /**< minimum number of nodes required to start the subproblem */
75  int maxnodes; /**< maximum number of nodes to regard in the subproblem */
76  SCIP_Longint usednodes; /**< amount of nodes local branching used during all calls */
77  SCIP_Real nodesquot; /**< contingent of sub problem nodes in relation to original nodes */
78  SCIP_Real minimprove; /**< factor by which localbranching should at least improve the incumbent */
79  SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
80  SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
81  int neighborhoodsize; /**< radius of the incumbent's neighborhood to be searched */
82  int callstatus; /**< current status of localbranching heuristic */
83  SCIP_SOL* lastsol; /**< the last incumbent localbranching used as reference point */
84  int curneighborhoodsize;/**< current neighborhoodsize */
85  int curminnodes; /**< current minimal number of nodes required to start the subproblem */
86  int emptyneighborhoodsize;/**< size of neighborhood that was proven to be empty */
87  SCIP_Bool uselprows; /**< should subproblem be created out of the rows in the LP rows? */
88  SCIP_Bool copycuts; /**< if uselprows == FALSE, should all active cuts from cutpool be copied
89  * to constraints in subproblem?
90  */
91 };
92 
93 
94 /*
95  * Local methods
96  */
97 
98 /** copies the problem of scip to the problem of subscip - only necessary if uselprows is false */
99 static
101  SCIP* scip, /**< SCIP data structure of the original problem */
102  SCIP* subscip, /**< SCIP data structure of the subproblem */
103  SCIP_VAR** subvars /**< variables of the subproblem */
104  )
105 {
106  SCIP_ROW** rows;
107  int nrows;
108  int i;
109 
110  /* get the rows and their number */
111  SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
112 
113  for( i = 0; i < nrows; i++ )
114  {
115  SCIP_CONS* cons;
116  SCIP_VAR** consvars;
117  SCIP_COL** cols;
118  SCIP_Real constant;
119  SCIP_Real lhs;
120  SCIP_Real rhs;
121  SCIP_Real* vals;
122  int nnonz;
123  int j;
124 
125  /* ignore rows that are only locally valid */
126  if( SCIProwIsLocal(rows[i]) )
127  continue;
128 
129  /* get the row's data */
130  constant = SCIProwGetConstant(rows[i]);
131  lhs = SCIProwGetLhs(rows[i]) - constant;
132  rhs = SCIProwGetRhs(rows[i]) - constant;
133  vals = SCIProwGetVals(rows[i]);
134  nnonz = SCIProwGetNNonz(rows[i]);
135  cols = SCIProwGetCols(rows[i]);
136 
137  assert(lhs <= rhs);
138 
139  /* allocate memory array to be filled with the corresponding subproblem variables */
140  SCIP_CALL( SCIPallocBufferArray(scip, &consvars, nnonz) );
141  for( j = 0; j < nnonz; j++ )
142  consvars[j] = subvars[SCIPvarGetProbindex(SCIPcolGetVar(cols[j]))];
143 
144  /* create new constraint and add it to subscip */
145  SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
146  TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
147  SCIP_CALL( SCIPaddCons(subscip, cons) );
148  SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
149 
150  /* free memory */
151  SCIPfreeBufferArray(scip, &consvars);
152  }
153 
154  return SCIP_OKAY;
155 }
156 
157 /** create the extra constraint of local branching and add it to subscip */
158 static
160  SCIP* scip, /**< SCIP data structure of the original problem */
161  SCIP* subscip, /**< SCIP data structure of the subproblem */
162  SCIP_VAR** subvars, /**< variables of the subproblem */
163  SCIP_HEURDATA* heurdata /**< heuristic's data structure */
164  )
165 {
166  SCIP_CONS* cons; /* local branching constraint to create */
167  SCIP_VAR** consvars;
168  SCIP_VAR** vars;
169  SCIP_SOL* bestsol;
170 
171  int nbinvars;
172  int i;
173  SCIP_Real lhs;
174  SCIP_Real rhs;
175  SCIP_Real* consvals;
176  char consname[SCIP_MAXSTRLEN];
177 
178  (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "%s_localbranchcons", SCIPgetProbName(scip));
179 
180  /* get the data of the variables and the best solution */
181  SCIP_CALL( SCIPgetVarsData(scip, &vars, NULL, &nbinvars, NULL, NULL, NULL) );
182  bestsol = SCIPgetBestSol(scip);
183  assert( bestsol != NULL );
184 
185  /* memory allocation */
186  SCIP_CALL( SCIPallocBufferArray(scip, &consvars, nbinvars) );
187  SCIP_CALL( SCIPallocBufferArray(scip, &consvals, nbinvars) );
188 
189  /* set initial left and right hand sides of local branching constraint */
190  lhs = (SCIP_Real)heurdata->emptyneighborhoodsize + 1.0;
191  rhs = (SCIP_Real)heurdata->curneighborhoodsize;
192 
193  /* create the distance (to incumbent) function of the binary variables */
194  for( i = 0; i < nbinvars; i++ )
195  {
196  SCIP_Real solval;
197 
198  solval = SCIPgetSolVal(scip, bestsol, vars[i]);
199  assert( SCIPisFeasIntegral(scip,solval) );
200 
201  /* is variable i part of the binary support of bestsol? */
202  if( SCIPisFeasEQ(scip,solval,1.0) )
203  {
204  consvals[i] = -1.0;
205  rhs -= 1.0;
206  lhs -= 1.0;
207  }
208  else
209  consvals[i] = 1.0;
210  consvars[i] = subvars[i];
211  assert( SCIPvarGetType(consvars[i]) == SCIP_VARTYPE_BINARY );
212  }
213 
214  /* creates localbranching constraint and adds it to subscip */
215  SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, consname, nbinvars, consvars, consvals,
216  lhs, rhs, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
217  SCIP_CALL( SCIPaddCons(subscip, cons) );
218  SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
219 
220  /* free local memory */
221  SCIPfreeBufferArray(scip, &consvals);
222  SCIPfreeBufferArray(scip, &consvars);
223 
224  return SCIP_OKAY;
225 }
226 
227 
228 /** creates a new solution for the original problem by copying the solution of the subproblem */
229 static
231  SCIP* scip, /**< SCIP data structure of the original problem */
232  SCIP* subscip, /**< SCIP data structure of the subproblem */
233  SCIP_VAR** subvars, /**< the variables of the subproblem */
234  SCIP_HEUR* heur, /**< the Localbranching heuristic */
235  SCIP_SOL* subsol, /**< solution of the subproblem */
236  SCIP_Bool* success /**< pointer to store, whether new solution was found */
237  )
238 {
239  SCIP_VAR** vars;
240  int nvars;
241  SCIP_SOL* newsol;
242  SCIP_Real* subsolvals;
243 
244  assert( scip != NULL );
245  assert( subscip != NULL );
246  assert( subvars != NULL );
247  assert( subsol != NULL );
248 
249  /* copy the solution */
250  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
251  /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
252  * since constraint copying may have required the copy of variables that are fixed in the main SCIP
253  */
254  assert(nvars <= SCIPgetNOrigVars(subscip));
255 
256  SCIP_CALL( SCIPallocBufferArray(scip, &subsolvals, nvars) );
257 
258  /* copy the solution */
259  SCIP_CALL( SCIPgetSolVals(subscip, subsol, nvars, subvars, subsolvals) );
260 
261  /* create new solution for the original problem */
262  SCIP_CALL( SCIPcreateSol(scip, &newsol, heur) );
263  SCIP_CALL( SCIPsetSolVals(scip, newsol, nvars, vars, subsolvals) );
264 
265  SCIP_CALL( SCIPtrySolFree(scip, &newsol, FALSE, TRUE, TRUE, TRUE, success) );
266 
267  SCIPfreeBufferArray(scip, &subsolvals);
268 
269  return SCIP_OKAY;
270 }
271 
272 
273 /* ---------------- Callback methods of event handler ---------------- */
274 
275 /* exec the event handler
276  *
277  * we interrupt the solution process
278  */
279 static
280 SCIP_DECL_EVENTEXEC(eventExecLocalbranching)
281 {
282  SCIP_HEURDATA* heurdata;
283 
284  assert(eventhdlr != NULL);
285  assert(eventdata != NULL);
286  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
287  assert(event != NULL);
288  assert(SCIPeventGetType(event) & SCIP_EVENTTYPE_LPSOLVED);
289 
290  heurdata = (SCIP_HEURDATA*)eventdata;
291  assert(heurdata != NULL);
292 
293  /* interrupt solution process of sub-SCIP */
294  if( SCIPgetNLPs(scip) > heurdata->lplimfac * heurdata->nodelimit )
295  {
296  SCIPdebugMessage("interrupt after %" SCIP_LONGINT_FORMAT " LPs\n",SCIPgetNLPs(scip));
298  }
299 
300  return SCIP_OKAY;
301 }
302 
303 
304 /*
305  * Callback methods of primal heuristic
306  */
307 
308 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
309 static
310 SCIP_DECL_HEURCOPY(heurCopyLocalbranching)
311 { /*lint --e{715}*/
312  assert(scip != NULL);
313  assert(heur != NULL);
314  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
315 
316  /* call inclusion method of primal heuristic */
318 
319  return SCIP_OKAY;
320 }
321 
322 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
323 static
324 SCIP_DECL_HEURFREE(heurFreeLocalbranching)
325 { /*lint --e{715}*/
326  SCIP_HEURDATA* heurdata;
327 
328  assert( heur != NULL );
329  assert( scip != NULL );
330 
331  /* get heuristic data */
332  heurdata = SCIPheurGetData(heur);
333  assert( heurdata != NULL );
334 
335  /* free heuristic data */
336  SCIPfreeMemory(scip, &heurdata);
337  SCIPheurSetData(heur, NULL);
338 
339  return SCIP_OKAY;
340 }
341 
342 
343 /** initialization method of primal heuristic (called after problem was transformed) */
344 static
345 SCIP_DECL_HEURINIT(heurInitLocalbranching)
346 { /*lint --e{715}*/
347  SCIP_HEURDATA* heurdata;
348 
349  assert( heur != NULL );
350  assert( scip != NULL );
351 
352  /* get heuristic's data */
353  heurdata = SCIPheurGetData(heur);
354  assert( heurdata != NULL );
355 
356  /* with a little abuse we initialize the heurdata as if localbranching would have finished its last step regularly */
357  heurdata->callstatus = WAITFORNEWSOL;
358  heurdata->lastsol = NULL;
359  heurdata->usednodes = 0;
360  heurdata->curneighborhoodsize = heurdata->neighborhoodsize;
361  heurdata->curminnodes = heurdata->minnodes;
362  heurdata->emptyneighborhoodsize = 0;
363 
364  return SCIP_OKAY;
365 }
366 
367 
368 /** execution method of primal heuristic */
369 static
370 SCIP_DECL_HEUREXEC(heurExecLocalbranching)
371 { /*lint --e{715}*/
372  SCIP_Longint maxnnodes; /* maximum number of subnodes */
373  SCIP_Longint nsubnodes; /* nodelimit for subscip */
374 
375  SCIP_HEURDATA* heurdata;
376  SCIP* subscip; /* the subproblem created by localbranching */
377  SCIP_VAR** subvars; /* subproblem's variables */
378  SCIP_SOL* bestsol; /* best solution so far */
379  SCIP_EVENTHDLR* eventhdlr; /* event handler for LP events */
380 
381  SCIP_Real timelimit; /* timelimit for subscip (equals remaining time of scip) */
382  SCIP_Real cutoff; /* objective cutoff for the subproblem */
383  SCIP_Real upperbound;
384  SCIP_Real memorylimit;
385 
386  SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
387  SCIP_VAR** vars;
388 
389  int nvars;
390  int i;
391 
392  SCIP_Bool success;
393 
394  SCIP_RETCODE retcode;
395 
396  assert(heur != NULL);
397  assert(scip != NULL);
398  assert(result != NULL);
399 
400  *result = SCIP_DIDNOTRUN;
401 
402  /* get heuristic's data */
403  heurdata = SCIPheurGetData(heur);
404  assert( heurdata != NULL );
405 
406  /* there should be enough binary variables that a local branching constraint makes sense */
407  if( SCIPgetNBinVars(scip) < 2*heurdata->neighborhoodsize )
408  return SCIP_OKAY;
409 
410  *result = SCIP_DELAYED;
411 
412  /* only call heuristic, if an IP solution is at hand */
413  if( SCIPgetNSols(scip) <= 0 )
414  return SCIP_OKAY;
415 
416  bestsol = SCIPgetBestSol(scip);
417  assert(bestsol != NULL);
418 
419  /* only call heuristic, if the best solution comes from transformed problem */
420  if( SCIPsolIsOriginal(bestsol) )
421  return SCIP_OKAY;
422 
423  /* only call heuristic, if enough nodes were processed since last incumbent */
424  if( SCIPgetNNodes(scip) - SCIPgetSolNodenum(scip, bestsol) < heurdata->nwaitingnodes)
425  return SCIP_OKAY;
426 
427  /* only call heuristic, if the best solution does not come from trivial heuristic */
428  if( SCIPsolGetHeur(bestsol) != NULL && strcmp(SCIPheurGetName(SCIPsolGetHeur(bestsol)), "trivial") == 0 )
429  return SCIP_OKAY;
430 
431  /* reset neighborhood and minnodes, if new solution was found */
432  if( heurdata->lastsol != bestsol )
433  {
434  heurdata->curneighborhoodsize = heurdata->neighborhoodsize;
435  heurdata->curminnodes = heurdata->minnodes;
436  heurdata->emptyneighborhoodsize = 0;
437  heurdata->callstatus = EXECUTE;
438  heurdata->lastsol = bestsol;
439  }
440 
441  /* if no new solution was found and local branching also seems to fail, just keep on waiting */
442  if( heurdata->callstatus == WAITFORNEWSOL )
443  return SCIP_OKAY;
444 
445  *result = SCIP_DIDNOTRUN;
446 
447  /* calculate the maximal number of branching nodes until heuristic is aborted */
448  maxnnodes = (SCIP_Longint)(heurdata->nodesquot * SCIPgetNNodes(scip));
449 
450  /* reward local branching if it succeeded often */
451  maxnnodes = (SCIP_Longint)(maxnnodes * (1.0 + 2.0*(SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur)+1.0)));
452  maxnnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-MIP as 100 nodes */
453  maxnnodes += heurdata->nodesofs;
454 
455  /* determine the node limit for the current process */
456  nsubnodes = maxnnodes - heurdata->usednodes;
457  nsubnodes = MIN(nsubnodes, heurdata->maxnodes);
458 
459  /* check whether we have enough nodes left to call sub problem solving */
460  if( nsubnodes < heurdata->curminnodes )
461  return SCIP_OKAY;
462 
463  if( SCIPisStopped(scip) )
464  return SCIP_OKAY;
465 
466  *result = SCIP_DIDNOTFIND;
467 
468  SCIPdebugMessage("running localbranching heuristic ...\n");
469 
470  /* get the data of the variables and the best solution */
471  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
472 
473  /* initializing the subproblem */
474  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
475  SCIP_CALL( SCIPcreate(&subscip) );
476 
477  /* create the variable mapping hash map */
478  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
479  success = FALSE;
480  eventhdlr = NULL;
481 
482  if( heurdata->uselprows )
483  {
484  char probname[SCIP_MAXSTRLEN];
485 
486  /* copy all plugins */
488 
489  /* get name of the original problem and add the string "_localbranchsub" */
490  (void) SCIPsnprintf(probname, SCIP_MAXSTRLEN, "%s_localbranchsub", SCIPgetProbName(scip));
491 
492  /* create the subproblem */
493  SCIP_CALL( SCIPcreateProb(subscip, probname, NULL, NULL, NULL, NULL, NULL, NULL, NULL) );
494 
495  /* copy all variables */
496  SCIP_CALL( SCIPcopyVars(scip, subscip, varmapfw, NULL, TRUE) );
497  }
498  else
499  {
500  SCIP_CALL( SCIPcopy(scip, subscip, varmapfw, NULL, "localbranchsub", TRUE, FALSE, TRUE, &success) );
501 
502  if( heurdata->copycuts )
503  {
504  /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
505  SCIP_CALL( SCIPcopyCuts(scip, subscip, varmapfw, NULL, TRUE, NULL) );
506  }
507 
508  /* create event handler for LP events */
509  SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecLocalbranching, NULL) );
510  if( eventhdlr == NULL )
511  {
512  SCIPerrorMessage("event handler for " HEUR_NAME " heuristic not found.\n");
513  return SCIP_PLUGINNOTFOUND;
514  }
515  }
516  SCIPdebugMessage("Copying the plugins was %ssuccessful.\n", success ? "" : "not ");
517 
518  for (i = 0; i < nvars; ++i)
519  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
520 
521  /* free hash map */
522  SCIPhashmapFree(&varmapfw);
523 
524  /* if the subproblem could not be created, free memory and return */
525  if( !success )
526  {
527  *result = SCIP_DIDNOTRUN;
528  goto TERMINATE;
529  }
530 
531  /* do not abort subproblem on CTRL-C */
532  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
533 
534 #ifndef SCIP_DEBUG
535  /* disable output to console */
536  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
537 #endif
538 
539  /* check whether there is enough time and memory left */
540  SCIP_CALL( SCIPgetRealParam(scip, "limits/time", &timelimit) );
541  if( !SCIPisInfinity(scip, timelimit) )
542  timelimit -= SCIPgetSolvingTime(scip);
543  SCIP_CALL( SCIPgetRealParam(scip, "limits/memory", &memorylimit) );
544 
545  /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
546  if( !SCIPisInfinity(scip, memorylimit) )
547  {
548  memorylimit -= SCIPgetMemUsed(scip)/1048576.0;
549  memorylimit -= SCIPgetMemExternEstim(scip)/1048576.0;
550  }
551 
552  /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
553  if( timelimit <= 0.0 || memorylimit <= 2.0*SCIPgetMemExternEstim(scip)/1048576.0 )
554  goto TERMINATE;
555 
556  /* disable statistic timing inside sub SCIP */
557  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
558 
559  /* set limits for the subproblem */
560  heurdata->nodelimit = nsubnodes;
561  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nsubnodes) );
562  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/stallnodes", MAX(10, nsubnodes/10)) );
563  SCIP_CALL( SCIPsetIntParam(subscip, "limits/bestsol", 3) );
564  SCIP_CALL( SCIPsetRealParam(subscip, "limits/time", timelimit) );
565  SCIP_CALL( SCIPsetRealParam(subscip, "limits/memory", memorylimit) );
566 
567  /* forbid recursive call of heuristics and separators solving subMIPs */
568  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
569 
570  /* disable cutting plane separation */
572 
573  /* disable expensive presolving */
575 
576  /* use best estimate node selection */
577  if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
578  {
579  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/estimate/stdpriority", INT_MAX/4) );
580  }
581 
582  /* use inference branching */
583  if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
584  {
585  SCIP_CALL( SCIPsetIntParam(subscip, "branching/inference/priority", INT_MAX/4) );
586  }
587 
588  /* disable conflict analysis */
589  if( !SCIPisParamFixed(subscip, "conflict/useprop") )
590  {
591  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/useprop", FALSE) );
592  }
593  if( !SCIPisParamFixed(subscip, "conflict/useinflp") )
594  {
595  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/useinflp", FALSE) );
596  }
597  if( !SCIPisParamFixed(subscip, "conflict/useboundlp") )
598  {
599  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/useboundlp", FALSE) );
600  }
601  if( !SCIPisParamFixed(subscip, "conflict/usesb") )
602  {
603  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/usesb", FALSE) );
604  }
605  if( !SCIPisParamFixed(subscip, "conflict/usepseudo") )
606  {
607  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/usepseudo", FALSE) );
608  }
609 
610  /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
611  * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
612  * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
613  * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
614  * made for the original SCIP
615  */
616  if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
617  {
618  SCIP_CALL( SCIPsetIntParam(subscip, "constraints/quadratic/enfolplimit", 500) );
619  }
620 
621  /* copy the original problem and add the local branching constraint */
622  if( heurdata->uselprows )
623  {
624  SCIP_CALL( createSubproblem(scip, subscip, subvars) );
625  }
626  SCIP_CALL( addLocalBranchingConstraint(scip, subscip, subvars, heurdata) );
627 
628  /* add an objective cutoff */
629  cutoff = SCIPinfinity(scip);
631 
632  upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
634  {
635  cutoff = (1-heurdata->minimprove)*SCIPgetUpperbound(scip) + heurdata->minimprove*SCIPgetLowerbound(scip);
636  }
637  else
638  {
639  if( SCIPgetUpperbound ( scip ) >= 0 )
640  cutoff = ( 1 - heurdata->minimprove ) * SCIPgetUpperbound ( scip );
641  else
642  cutoff = ( 1 + heurdata->minimprove ) * SCIPgetUpperbound ( scip );
643  }
644  cutoff = MIN(upperbound, cutoff );
645  SCIP_CALL( SCIPsetObjlimit(subscip, cutoff) );
646 
647  /* catch LP events of sub-SCIP */
648  if( !heurdata->uselprows )
649  {
650  assert(eventhdlr != NULL);
651 
652  SCIP_CALL( SCIPtransformProb(subscip) );
653  SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
654  }
655 
656  /* solve the subproblem */
657  SCIPdebugMessage("solving local branching subproblem with neighborhoodsize %d and maxnodes %" SCIP_LONGINT_FORMAT "\n",
658  heurdata->curneighborhoodsize, nsubnodes);
659  retcode = SCIPsolve(subscip);
660 
661  /* drop LP events of sub-SCIP */
662  if( !heurdata->uselprows )
663  {
664  assert(eventhdlr != NULL);
665 
666  SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
667  }
668 
669  /* Errors in solving the subproblem should not kill the overall solving process
670  * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
671  */
672  if( retcode != SCIP_OKAY )
673  {
674 #ifndef NDEBUG
675  SCIP_CALL( retcode );
676 #endif
677  SCIPwarningMessage(scip, "Error while solving subproblem in local branching heuristic; sub-SCIP terminated with code <%d>\n",retcode);
678  }
679 
680  /* print solving statistics of subproblem if we are in SCIP's debug mode */
682 
683  heurdata->usednodes += SCIPgetNNodes(subscip);
684  SCIPdebugMessage("local branching used %" SCIP_LONGINT_FORMAT "/%" SCIP_LONGINT_FORMAT " nodes\n",
685  SCIPgetNNodes(subscip), nsubnodes);
686 
687  /* check, whether a solution was found */
688  if( SCIPgetNSols(subscip) > 0 )
689  {
690  SCIP_SOL** subsols;
691  int nsubsols;
692 
693  /* check, whether a solution was found;
694  * due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted
695  */
696  nsubsols = SCIPgetNSols(subscip);
697  subsols = SCIPgetSols(subscip);
698  success = FALSE;
699  for( i = 0; i < nsubsols && !success; ++i )
700  {
701  SCIP_CALL( createNewSol(scip, subscip, subvars, heur, subsols[i], &success) );
702  }
703  if( success )
704  {
705  SCIPdebugMessage("-> accepted solution of value %g\n", SCIPgetSolOrigObj(subscip, subsols[i]));
706  *result = SCIP_FOUNDSOL;
707  }
708  }
709 
710  /* check the status of the sub-MIP */
711  switch( SCIPgetStatus(subscip) )
712  {
713  case SCIP_STATUS_OPTIMAL:
715  heurdata->callstatus = WAITFORNEWSOL; /* new solution will immediately be installed at next call */
716  SCIPdebugMessage(" -> found new solution\n");
717  break;
718 
722  heurdata->callstatus = EXECUTE;
723  heurdata->curneighborhoodsize = (heurdata->emptyneighborhoodsize + heurdata->curneighborhoodsize)/2;
724  heurdata->curminnodes *= 2;
725  SCIPdebugMessage(" -> node limit reached: reduced neighborhood to %d, increased minnodes to %d\n",
726  heurdata->curneighborhoodsize, heurdata->curminnodes);
727  if( heurdata->curneighborhoodsize <= heurdata->emptyneighborhoodsize )
728  {
729  heurdata->callstatus = WAITFORNEWSOL;
730  SCIPdebugMessage(" -> new neighborhood was already proven to be empty: wait for new solution\n");
731  }
732  break;
733 
736  heurdata->emptyneighborhoodsize = heurdata->curneighborhoodsize;
737  heurdata->curneighborhoodsize += heurdata->curneighborhoodsize/2;
738  heurdata->curneighborhoodsize = MAX(heurdata->curneighborhoodsize, heurdata->emptyneighborhoodsize + 2);
739  heurdata->callstatus = EXECUTE;
740  SCIPdebugMessage(" -> neighborhood is empty: increased neighborhood to %d\n", heurdata->curneighborhoodsize);
741  break;
742 
743  case SCIP_STATUS_UNKNOWN:
751  default:
752  heurdata->callstatus = WAITFORNEWSOL;
753  SCIPdebugMessage(" -> unexpected sub-MIP status <%d>: waiting for new solution\n", SCIPgetStatus(subscip));
754  break;
755  }
756 
757  TERMINATE:
758  /* free subproblem */
759  SCIPfreeBufferArray(scip, &subvars);
760  SCIP_CALL( SCIPfree(&subscip) );
761 
762  return SCIP_OKAY;
763 }
764 
765 
766 /*
767  * primal heuristic specific interface methods
768  */
769 
770 /** creates the localbranching primal heuristic and includes it in SCIP */
772  SCIP* scip /**< SCIP data structure */
773  )
774 {
775  SCIP_HEURDATA* heurdata;
776 
777  SCIP_HEUR* heur;
778 
779  /* create Localbranching primal heuristic data */
780  SCIP_CALL( SCIPallocMemory(scip, &heurdata) );
781 
782  /* include primal heuristic */
783  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
785  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecLocalbranching, heurdata) );
786 
787  assert(heur != NULL);
788 
789  /* set non-NULL pointers to callback methods */
790  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyLocalbranching) );
791  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeLocalbranching) );
792  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitLocalbranching) );
793 
794  /* add localbranching primal heuristic parameters */
795  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/nodesofs",
796  "number of nodes added to the contingent of the total nodes",
797  &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0, INT_MAX, NULL, NULL) );
798 
799  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/neighborhoodsize",
800  "radius (using Manhattan metric) of the incumbent's neighborhood to be searched",
801  &heurdata->neighborhoodsize, FALSE, DEFAULT_NEIGHBORHOODSIZE, 1, INT_MAX, NULL, NULL) );
802 
803  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/nodesquot",
804  "contingent of sub problem nodes in relation to the number of nodes of the original problem",
805  &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) );
806 
807  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/lplimfac",
808  "factor by which the limit on the number of LP depends on the node limit",
809  &heurdata->lplimfac, TRUE, DEFAULT_LPLIMFAC, 1.0, SCIP_REAL_MAX, NULL, NULL) );
810 
811  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/minnodes",
812  "minimum number of nodes required to start the subproblem",
813  &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) );
814 
815  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxnodes",
816  "maximum number of nodes to regard in the subproblem",
817  &heurdata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) );
818 
819  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/nwaitingnodes",
820  "number of nodes without incumbent change that heuristic should wait",
821  &heurdata->nwaitingnodes, TRUE, DEFAULT_NWAITINGNODES, 0, INT_MAX, NULL, NULL) );
822 
823  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minimprove",
824  "factor by which localbranching should at least improve the incumbent",
825  &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) );
826 
827  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/uselprows",
828  "should subproblem be created out of the rows in the LP rows?",
829  &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) );
830 
831  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/copycuts",
832  "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?",
833  &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
834 
835  return SCIP_OKAY;
836 }
#define DEFAULT_NODESOFS
#define HEUR_DISPCHAR
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
Definition: scip.c:40329
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:5878
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20526
#define SCIP_EVENTTYPE_LPSOLVED
Definition: type_event.h:78
#define DEFAULT_LPLIMFAC
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2252
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip.c:908
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
Definition: scip.c:41648
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1147
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
Definition: heur.c:1273
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip.c:7297
#define DEFAULT_NODESQUOT
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1248
#define SCIP_MAXSTRLEN
Definition: def.h:201
#define HEUR_FREQ
#define NULL
Definition: lpi_spx.cpp:130
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip.c:1125
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:18915
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
Definition: lp.c:18861
static SCIP_RETCODE addLocalBranchingConstraint(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEURDATA *heurdata)
#define EVENTHDLR_NAME
#define WAITFORNEWSOL
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, unsigned int timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: scip.c:7252
#define FALSE
Definition: def.h:56
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip.c:41009
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2057
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip.c:4046
#define DEFAULT_NWAITINGNODES
int SCIPgetNBinVars(SCIP *scip)
Definition: scip.c:10743
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip.c:7778
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:8174
#define TRUE
Definition: def.h:55
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIP_CALL(x)
Definition: def.h:266
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip.c:36299
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip.c:4109
#define HEUR_FREQOFS
static SCIP_DECL_HEURINIT(heurInitLocalbranching)
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
Definition: scip.c:42008
#define SCIPdebugMessage
Definition: pub_message.h:77
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip.c:34983
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2116
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
Definition: lp.c:18881
static SCIP_DECL_HEUREXEC(heurExecLocalbranching)
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip.c:24949
#define DEFAULT_MAXNODES
SCIP_Real SCIPgetLowerbound(SCIP *scip)
Definition: scip.c:38393
#define EXECUTE
static SCIP_RETCODE createSubproblem(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars)
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35066
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip.c:2883
int SCIPgetNSols(SCIP *scip)
Definition: scip.c:35668
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.c:3547
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.c:3573
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip.c:11138
#define DEFAULT_COPYCUTS
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20542
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip.c:15442
SCIP_RETCODE SCIPcopy(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip.c:3254
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:18925
int SCIPcalcHashtableSize(int minsize)
Definition: misc.c:1157
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip.c:34002
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip.c:41353
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41907
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
Definition: lp.c:19024
Local branching heuristic according to Fischetti and Lodi.
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:146
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2075
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:4457
SCIP_RETCODE SCIPincludeHeurLocalbranching(SCIP *scip)
SCIP_RETCODE SCIPcreateProb(SCIP *scip, const char *name, SCIP_DECL_PROBDELORIG((*probdelorig)), SCIP_DECL_PROBTRANS((*probtrans)), SCIP_DECL_PROBDELTRANS((*probdeltrans)), SCIP_DECL_PROBINITSOL((*probinitsol)), SCIP_DECL_PROBEXITSOL((*probexitsol)), SCIP_DECL_PROBCOPY((*probcopy)), SCIP_PROBDATA *probdata)
Definition: scip.c:9019
SCIP_RETCODE SCIPgetLPRowsData(SCIP *scip, SCIP_ROW ***rows, int *nrows)
Definition: scip.c:26750
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:35020
SCIP_Real SCIPinfinity(SCIP *scip)
Definition: scip.c:41637
#define DEFAULT_NEIGHBORHOODSIZE
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip.c:766
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip.c:35717
SCIP_Longint SCIPgetNLPs(SCIP *scip)
Definition: scip.c:37435
const char * SCIProwGetName(SCIP_ROW *row)
Definition: lp.c:18974
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip.c:12623
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1068
#define HEUR_TIMING
SCIP_Real SCIPgetUpperbound(SCIP *scip)
Definition: scip.c:38534
public data structures and miscellaneous methods
#define SCIP_Bool
Definition: def.h:53
SCIP_RETCODE SCIPincludeDefaultPlugins(SCIP *scip)
SCIP_Longint SCIPgetSolNodenum(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35279
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip.c:4001
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip.c:3709
#define DEFAULT_MINIMPROVE
#define HEUR_MAXDEPTH
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip.c:4382
SCIP_RETCODE SCIPcopyVars(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global)
Definition: scip.c:2179
#define MAX(x, y)
Definition: tclique_def.h:75
SCIP_Longint SCIPgetMemUsed(SCIP *scip)
Definition: scip.c:41396
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:4431
Constraint handler for linear constraints in their most general form, .
static SCIP_DECL_HEURFREE(heurFreeLocalbranching)
#define HEUR_NAME
SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2179
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip.c:7329
#define SCIP_REAL_MAX
Definition: def.h:128
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip.c:11477
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip.c:14503
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16608
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1293
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20585
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip.c:692
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip.c:36588
#define HEUR_PRIORITY
static SCIP_DECL_EVENTEXEC(eventExecLocalbranching)
#define HEUR_USESSUBSCIP
SCIP_RETCODE SCIPcreateConsLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs, SCIP_Bool initial, SCIP_Bool separate, SCIP_Bool enforce, SCIP_Bool check, SCIP_Bool propagate, SCIP_Bool local, SCIP_Bool modifiable, SCIP_Bool dynamic, SCIP_Bool removable, SCIP_Bool stickingatnode)
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
Definition: lp.c:18871
#define HEUR_DESC
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:278
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip.c:7313
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:16750
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip.c:8436
#define SCIP_Real
Definition: def.h:127
#define EVENTHDLR_DESC
#define MIN(x, y)
Definition: memory.c:67
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip.c:10194
const char * SCIPgetProbName(SCIP *scip)
Definition: scip.c:9941
#define SCIP_Longint
Definition: def.h:112
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:917
static SCIP_DECL_HEURCOPY(heurCopyLocalbranching)
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip.c:34885
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip.c:3938
int SCIProwGetNNonz(SCIP_ROW *row)
Definition: lp.c:18836
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1058
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip.c:10572
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip.h:20597
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
Definition: scip.c:3797
#define SCIPdebug(x)
Definition: pub_message.h:74
#define DEFAULT_USELPROWS
SCIP_NODESEL * SCIPfindNodesel(SCIP *scip, const char *name)
Definition: scip.c:8124
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:18685
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip.c:35767
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.c:3629
SCIP_Real SCIPsumepsilon(SCIP *scip)
Definition: scip.c:41132
default SCIP plugins
#define DEFAULT_MINNODES
SCIP_Longint SCIPgetNNodes(SCIP *scip)
Definition: scip.c:37372
SCIP callable library.
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip.c:36554
SCIP_Longint SCIPgetMemExternEstim(SCIP *scip)
Definition: scip.c:41409