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-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_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 "blockmemshell/memory.h"
25 #include "scip/cons_linear.h"
26 #include "scip/heuristics.h"
28 #include "scip/pub_event.h"
29 #include "scip/pub_heur.h"
30 #include "scip/pub_message.h"
31 #include "scip/pub_misc.h"
32 #include "scip/pub_sol.h"
33 #include "scip/pub_var.h"
34 #include "scip/scip_branch.h"
35 #include "scip/scip_cons.h"
36 #include "scip/scip_copy.h"
37 #include "scip/scip_event.h"
38 #include "scip/scip_general.h"
39 #include "scip/scip_heur.h"
40 #include "scip/scip_mem.h"
41 #include "scip/scip_message.h"
42 #include "scip/scip_nodesel.h"
43 #include "scip/scip_numerics.h"
44 #include "scip/scip_param.h"
45 #include "scip/scip_prob.h"
46 #include "scip/scip_sol.h"
47 #include "scip/scip_solve.h"
48 #include "scip/scip_solvingstats.h"
49 #include <string.h>
50 
51 #define HEUR_NAME "localbranching"
52 #define HEUR_DESC "local branching heuristic by Fischetti and Lodi"
53 #define HEUR_DISPCHAR 'L'
54 #define HEUR_PRIORITY -1102000
55 #define HEUR_FREQ -1
56 #define HEUR_FREQOFS 0
57 #define HEUR_MAXDEPTH -1
58 #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE
59 #define HEUR_USESSUBSCIP TRUE /**< does the heuristic use a secondary SCIP instance? */
60 
61 #define DEFAULT_NEIGHBORHOODSIZE 18 /* radius of the incumbents neighborhood to be searched */
62 #define DEFAULT_NODESOFS 1000 /* number of nodes added to the contingent of the total nodes */
63 #define DEFAULT_MAXNODES 10000 /* maximum number of nodes to regard in the subproblem */
64 #define DEFAULT_MINIMPROVE 0.01 /* factor by which localbranching should at least improve the incumbent */
65 #define DEFAULT_MINNODES 1000 /* minimum number of nodes required to start the subproblem */
66 #define DEFAULT_NODESQUOT 0.05 /* contingent of sub problem nodes in relation to original nodes */
67 #define DEFAULT_LPLIMFAC 1.5 /* factor by which the limit on the number of LP depends on the node limit */
68 #define DEFAULT_NWAITINGNODES 200 /* number of nodes without incumbent change that heuristic should wait */
69 #define DEFAULT_USELPROWS FALSE /* should subproblem be created out of the rows in the LP rows,
70  * otherwise, the copy constructors of the constraints handlers are used */
71 #define DEFAULT_COPYCUTS TRUE /* if DEFAULT_USELPROWS is FALSE, then should all active cuts from the cutpool
72  * of the original scip be copied to constraints of the subscip
73  */
74 #define DEFAULT_BESTSOLLIMIT 3 /* limit on number of improving incumbent solutions in sub-CIP */
75 #define DEFAULT_USEUCT FALSE /* should uct node selection be used at the beginning of the search? */
76 
77 /* event handler properties */
78 #define EVENTHDLR_NAME "Localbranching"
79 #define EVENTHDLR_DESC "LP event handler for " HEUR_NAME " heuristic"
80 
81 
82 #define EXECUTE 0
83 #define WAITFORNEWSOL 1
84 
85 
86 /*
87  * Data structures
88  */
89 
90 /** primal heuristic data */
91 struct SCIP_HeurData
92 {
93  int nwaitingnodes; /**< number of nodes without incumbent change that heuristic should wait */
94  int nodesofs; /**< number of nodes added to the contingent of the total nodes */
95  int minnodes; /**< minimum number of nodes required to start the subproblem */
96  int maxnodes; /**< maximum number of nodes to regard in the subproblem */
97  SCIP_Longint usednodes; /**< amount of nodes local branching used during all calls */
98  SCIP_Real nodesquot; /**< contingent of sub problem nodes in relation to original nodes */
99  SCIP_Real minimprove; /**< factor by which localbranching should at least improve the incumbent */
100  SCIP_Real nodelimit; /**< the nodelimit employed in the current sub-SCIP, for the event handler*/
101  SCIP_Real lplimfac; /**< factor by which the limit on the number of LP depends on the node limit */
102  int neighborhoodsize; /**< radius of the incumbent's neighborhood to be searched */
103  int callstatus; /**< current status of localbranching heuristic */
104  SCIP_SOL* lastsol; /**< the last incumbent localbranching used as reference point */
105  int curneighborhoodsize;/**< current neighborhoodsize */
106  int curminnodes; /**< current minimal number of nodes required to start the subproblem */
107  int emptyneighborhoodsize;/**< size of neighborhood that was proven to be empty */
108  SCIP_Bool uselprows; /**< should subproblem be created out of the rows in the LP rows? */
109  SCIP_Bool copycuts; /**< if uselprows == FALSE, should all active cuts from cutpool be copied
110  * to constraints in subproblem?
111  */
112  int bestsollimit; /**< limit on number of improving incumbent solutions in sub-CIP */
113  SCIP_Bool useuct; /**< should uct node selection be used at the beginning of the search? */
114 };
115 
116 
117 /*
118  * Local methods
119  */
120 
121 /** create the extra constraint of local branching and add it to subscip */
122 static
124  SCIP* scip, /**< SCIP data structure of the original problem */
125  SCIP* subscip, /**< SCIP data structure of the subproblem */
126  SCIP_VAR** subvars, /**< variables of the subproblem */
127  SCIP_HEURDATA* heurdata /**< heuristic's data structure */
128  )
129 {
130  SCIP_CONS* cons; /* local branching constraint to create */
131  SCIP_VAR** consvars;
132  SCIP_VAR** vars;
133  SCIP_SOL* bestsol;
134 
135  int nbinvars;
136  int i;
137  SCIP_Real lhs;
138  SCIP_Real rhs;
139  SCIP_Real* consvals;
140  char consname[SCIP_MAXSTRLEN];
141 
142  (void) SCIPsnprintf(consname, SCIP_MAXSTRLEN, "%s_localbranchcons", SCIPgetProbName(scip));
143 
144  /* get the data of the variables and the best solution */
145  SCIP_CALL( SCIPgetVarsData(scip, &vars, NULL, &nbinvars, NULL, NULL, NULL) );
146  bestsol = SCIPgetBestSol(scip);
147  assert( bestsol != NULL );
148 
149  /* memory allocation */
150  SCIP_CALL( SCIPallocBufferArray(scip, &consvars, nbinvars) );
151  SCIP_CALL( SCIPallocBufferArray(scip, &consvals, nbinvars) );
152 
153  /* set initial left and right hand sides of local branching constraint */
154  lhs = (SCIP_Real)heurdata->emptyneighborhoodsize + 1.0;
155  rhs = (SCIP_Real)heurdata->curneighborhoodsize;
156 
157  /* create the distance (to incumbent) function of the binary variables */
158  for( i = 0; i < nbinvars; i++ )
159  {
160  SCIP_Real solval;
161 
162  solval = SCIPgetSolVal(scip, bestsol, vars[i]);
163  assert( SCIPisFeasIntegral(scip,solval) );
164 
165  /* is variable i part of the binary support of bestsol? */
166  if( SCIPisFeasEQ(scip,solval,1.0) )
167  {
168  consvals[i] = -1.0;
169  rhs -= 1.0;
170  lhs -= 1.0;
171  }
172  else
173  consvals[i] = 1.0;
174  consvars[i] = subvars[i];
175  assert( SCIPvarGetType(consvars[i]) == SCIP_VARTYPE_BINARY );
176  }
177 
178  /* creates localbranching constraint and adds it to subscip */
179  SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, consname, nbinvars, consvars, consvals,
180  lhs, rhs, TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
181  SCIP_CALL( SCIPaddCons(subscip, cons) );
182  SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
183 
184  /* free local memory */
185  SCIPfreeBufferArray(scip, &consvals);
186  SCIPfreeBufferArray(scip, &consvars);
187 
188  return SCIP_OKAY;
189 }
190 
191 
192 /** creates a new solution for the original problem by copying the solution of the subproblem */
193 static
195  SCIP* scip, /**< SCIP data structure of the original problem */
196  SCIP* subscip, /**< SCIP data structure of the subproblem */
197  SCIP_VAR** subvars, /**< the variables of the subproblem */
198  SCIP_HEUR* heur, /**< the Localbranching heuristic */
199  SCIP_SOL* subsol, /**< solution of the subproblem */
200  SCIP_Bool* success /**< pointer to store, whether new solution was found */
201  )
202 {
203  SCIP_VAR** vars;
204  int nvars;
205  SCIP_SOL* newsol;
206  SCIP_Real* subsolvals;
207 
208  assert( scip != NULL );
209  assert( subscip != NULL );
210  assert( subvars != NULL );
211  assert( subsol != NULL );
212 
213  /* copy the solution */
214  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
215  /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
216  * since constraint copying may have required the copy of variables that are fixed in the main SCIP
217  */
218  assert(nvars <= SCIPgetNOrigVars(subscip));
219 
220  SCIP_CALL( SCIPallocBufferArray(scip, &subsolvals, nvars) );
221 
222  /* copy the solution */
223  SCIP_CALL( SCIPgetSolVals(subscip, subsol, nvars, subvars, subsolvals) );
224 
225  /* create new solution for the original problem */
226  SCIP_CALL( SCIPcreateSol(scip, &newsol, heur) );
227  SCIP_CALL( SCIPsetSolVals(scip, newsol, nvars, vars, subsolvals) );
228 
229  SCIP_CALL( SCIPtrySolFree(scip, &newsol, FALSE, FALSE, TRUE, TRUE, TRUE, success) );
230 
231  SCIPfreeBufferArray(scip, &subsolvals);
232 
233  return SCIP_OKAY;
234 }
235 
236 
237 /* ---------------- Callback methods of event handler ---------------- */
238 
239 /* exec the event handler
240  *
241  * we interrupt the solution process
242  */
243 static
244 SCIP_DECL_EVENTEXEC(eventExecLocalbranching)
245 {
246  SCIP_HEURDATA* heurdata;
247 
248  assert(eventhdlr != NULL);
249  assert(eventdata != NULL);
250  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
251  assert(event != NULL);
252  assert(SCIPeventGetType(event) & SCIP_EVENTTYPE_LPSOLVED);
253 
254  heurdata = (SCIP_HEURDATA*)eventdata;
255  assert(heurdata != NULL);
256 
257  /* interrupt solution process of sub-SCIP */
258  if( SCIPgetNLPs(scip) > heurdata->lplimfac * heurdata->nodelimit )
259  {
260  SCIPdebugMsg(scip, "interrupt after %" SCIP_LONGINT_FORMAT " LPs\n",SCIPgetNLPs(scip));
262  }
263 
264  return SCIP_OKAY;
265 }
266 
267 
268 /*
269  * Callback methods of primal heuristic
270  */
271 
272 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
273 static
274 SCIP_DECL_HEURCOPY(heurCopyLocalbranching)
275 { /*lint --e{715}*/
276  assert(scip != NULL);
277  assert(heur != NULL);
278  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
279 
280  /* call inclusion method of primal heuristic */
282 
283  return SCIP_OKAY;
284 }
285 
286 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
287 static
288 SCIP_DECL_HEURFREE(heurFreeLocalbranching)
289 { /*lint --e{715}*/
290  SCIP_HEURDATA* heurdata;
291 
292  assert( heur != NULL );
293  assert( scip != NULL );
294 
295  /* get heuristic data */
296  heurdata = SCIPheurGetData(heur);
297  assert( heurdata != NULL );
298 
299  /* free heuristic data */
300  SCIPfreeBlockMemory(scip, &heurdata);
301  SCIPheurSetData(heur, NULL);
302 
303  return SCIP_OKAY;
304 }
305 
306 
307 /** initialization method of primal heuristic (called after problem was transformed) */
308 static
309 SCIP_DECL_HEURINIT(heurInitLocalbranching)
310 { /*lint --e{715}*/
311  SCIP_HEURDATA* heurdata;
312 
313  assert( heur != NULL );
314  assert( scip != NULL );
315 
316  /* get heuristic's data */
317  heurdata = SCIPheurGetData(heur);
318  assert( heurdata != NULL );
319 
320  /* with a little abuse we initialize the heurdata as if localbranching would have finished its last step regularly */
321  heurdata->callstatus = WAITFORNEWSOL;
322  heurdata->lastsol = NULL;
323  heurdata->usednodes = 0;
324  heurdata->curneighborhoodsize = heurdata->neighborhoodsize;
325  heurdata->curminnodes = heurdata->minnodes;
326  heurdata->emptyneighborhoodsize = 0;
327 
328  return SCIP_OKAY;
329 }
330 
331 /** todo setup And Solve Subscip */
332 static
334  SCIP* scip, /**< SCIP data structure */
335  SCIP* subscip, /**< the subproblem created by localbranching */
336  SCIP_HEUR* heur, /**< localbranching heuristic */
337  SCIP_Longint nsubnodes, /**< nodelimit for subscip */
338  SCIP_RESULT* result /**< result pointer */
339  )
340 {
341  SCIP_VAR** subvars; /* subproblem's variables */
342  SCIP_EVENTHDLR* eventhdlr; /* event handler for LP events */
343  SCIP_HEURDATA* heurdata;
344  SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
345  SCIP_VAR** vars;
346 
347  SCIP_Real cutoff; /* objective cutoff for the subproblem */
348  SCIP_Real upperbound;
349 
350  int nvars;
351  int i;
352 
353  SCIP_Bool success;
354 
355  assert(scip != NULL);
356  assert(subscip != NULL);
357  assert(heur != NULL);
358 
359  heurdata = SCIPheurGetData(heur);
360  assert(heurdata != NULL);
361 
362  /* get the data of the variables and the best solution */
363  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
364 
365  /* create the variable mapping hash map */
366  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), nvars) );
367  success = FALSE;
368 
369  /* create a problem copy as sub SCIP */
370  SCIP_CALL( SCIPcopyLargeNeighborhoodSearch(scip, subscip, varmapfw, "localbranching", NULL, NULL, 0, heurdata->uselprows,
371  heurdata->copycuts, &success, NULL) );
372 
373  SCIPdebugMsg(scip, "Copying SCIP was %ssuccessful.\n", success ? "" : "not ");
374 
375  /* if the subproblem could not be created, free memory and return */
376  if( !success )
377  {
378  *result = SCIP_DIDNOTRUN;
379  goto TERMINATE;
380  }
381 
382  /* create event handler for LP events */
383  eventhdlr = NULL;
384  SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecLocalbranching, NULL) );
385  if( eventhdlr == NULL )
386  {
387  /* free hash map */
388  SCIPhashmapFree(&varmapfw);
389 
390  SCIPerrorMessage("event handler for " HEUR_NAME " heuristic not found.\n");
391  return SCIP_PLUGINNOTFOUND;
392  }
393 
394  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
395  for (i = 0; i < nvars; ++i)
396  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
397 
398  /* free hash map */
399  SCIPhashmapFree(&varmapfw);
400 
401  /* do not abort subproblem on CTRL-C */
402  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
403 
404 #ifdef SCIP_DEBUG
405  /* for debugging, enable full output */
406  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
407  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
408 #else
409  /* disable statistic timing inside sub SCIP and output to console */
410  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
411  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
412 #endif
413 
414  /* set limits for the subproblem */
415  SCIP_CALL( SCIPcopyLimits(scip, subscip) );
416  heurdata->nodelimit = nsubnodes;
417  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nsubnodes) );
418  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/stallnodes", MAX(10, nsubnodes/10)) );
419  SCIP_CALL( SCIPsetIntParam(subscip, "limits/bestsol", heurdata->bestsollimit) );
420 
421  /* forbid recursive call of heuristics and separators solving subMIPs */
422  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
423 
424  /* disable cutting plane separation */
426 
427  /* disable expensive presolving */
429 
430  /* use best estimate node selection */
431  if( SCIPfindNodesel(subscip, "estimate") != NULL && !SCIPisParamFixed(subscip, "nodeselection/estimate/stdpriority") )
432  {
433  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/estimate/stdpriority", INT_MAX/4) );
434  }
435 
436  /* activate uct node selection at the top of the tree */
437  if( heurdata->useuct && SCIPfindNodesel(subscip, "uct") != NULL && !SCIPisParamFixed(subscip, "nodeselection/uct/stdpriority") )
438  {
439  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/uct/stdpriority", INT_MAX/2) );
440  }
441 
442  /* use inference branching */
443  if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
444  {
445  SCIP_CALL( SCIPsetIntParam(subscip, "branching/inference/priority", INT_MAX/4) );
446  }
447 
448  /* enable conflict analysis, disable analysis of boundexceeding LPs, and restrict conflict pool */
449  if( !SCIPisParamFixed(subscip, "conflict/enable") )
450  {
451  SCIP_CALL( SCIPsetBoolParam(subscip, "conflict/enable", TRUE) );
452  }
453  if( !SCIPisParamFixed(subscip, "conflict/useboundlp") )
454  {
455  SCIP_CALL( SCIPsetCharParam(subscip, "conflict/useboundlp", 'o') );
456  }
457  if( !SCIPisParamFixed(subscip, "conflict/maxstoresize") )
458  {
459  SCIP_CALL( SCIPsetIntParam(subscip, "conflict/maxstoresize", 100) );
460  }
461 
462  /* speed up sub-SCIP by not checking dual LP feasibility */
463  SCIP_CALL( SCIPsetBoolParam(subscip, "lp/checkdualfeas", FALSE) );
464 
465  /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
466  * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
467  * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
468  * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
469  * made for the original SCIP
470  */
471  if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
472  {
473  SCIP_CALL( SCIPsetIntParam(subscip, "constraints/quadratic/enfolplimit", 500) );
474  }
475 
476  SCIP_CALL( addLocalBranchingConstraint(scip, subscip, subvars, heurdata) );
477 
478  /* add an objective cutoff */
479  assert( !SCIPisInfinity(scip,SCIPgetUpperbound(scip)) );
480 
481  upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
482  if( !SCIPisInfinity(scip,-1.0*SCIPgetLowerbound(scip)) )
483  {
484  cutoff = (1-heurdata->minimprove)*SCIPgetUpperbound(scip) + heurdata->minimprove*SCIPgetLowerbound(scip);
485  }
486  else
487  {
488  if( SCIPgetUpperbound ( scip ) >= 0 )
489  cutoff = ( 1 - heurdata->minimprove ) * SCIPgetUpperbound ( scip );
490  else
491  cutoff = ( 1 + heurdata->minimprove ) * SCIPgetUpperbound ( scip );
492  }
493  cutoff = MIN(upperbound, cutoff );
494  SCIP_CALL( SCIPsetObjlimit(subscip, cutoff) );
495 
496  /* catch LP events of sub-SCIP */
497  if( !heurdata->uselprows )
498  {
499  assert(eventhdlr != NULL);
500 
501  SCIP_CALL( SCIPtransformProb(subscip) );
502  SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
503  }
504 
505  /* solve the subproblem */
506  SCIPdebugMsg(scip, "solving local branching subproblem with neighborhoodsize %d and maxnodes %" SCIP_LONGINT_FORMAT "\n",
507  heurdata->curneighborhoodsize, nsubnodes);
508 
509  /* Errors in solving the subproblem should not kill the overall solving process
510  * Hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
511  */
512  SCIP_CALL_ABORT( SCIPsolve(subscip) );
513 
514  /* drop LP events of sub-SCIP */
515  if( !heurdata->uselprows )
516  {
517  assert(eventhdlr != NULL);
518 
519  SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_LPSOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
520  }
521 
522  /* print solving statistics of subproblem if we are in SCIP's debug mode */
524 
525  heurdata->usednodes += SCIPgetNNodes(subscip);
526  SCIPdebugMsg(scip, "local branching used %" SCIP_LONGINT_FORMAT "/%" SCIP_LONGINT_FORMAT " nodes\n",
527  SCIPgetNNodes(subscip), nsubnodes);
528 
529  /* check, whether a solution was found */
530  if( SCIPgetNSols(subscip) > 0 )
531  {
532  SCIP_SOL** subsols;
533  int nsubsols;
534 
535  /* check, whether a solution was found;
536  * due to numerics, it might happen that not all solutions are feasible -> try all solutions until one was accepted
537  */
538  nsubsols = SCIPgetNSols(subscip);
539  subsols = SCIPgetSols(subscip);
540  success = FALSE;
541  for( i = 0; i < nsubsols && !success; ++i )
542  {
543  SCIP_CALL( createNewSol(scip, subscip, subvars, heur, subsols[i], &success) );
544  }
545  if( success )
546  {
547  SCIPdebugMsg(scip, "-> accepted solution of value %g\n", SCIPgetSolOrigObj(subscip, subsols[i]));
548  *result = SCIP_FOUNDSOL;
549  }
550  }
551 
552  /* check the status of the sub-MIP */
553  switch( SCIPgetStatus(subscip) )
554  {
555  case SCIP_STATUS_OPTIMAL:
557  heurdata->callstatus = WAITFORNEWSOL; /* new solution will immediately be installed at next call */
558  SCIPdebugMsg(scip, " -> found new solution\n");
559  break;
560 
564  heurdata->callstatus = EXECUTE;
565  heurdata->curneighborhoodsize = (heurdata->emptyneighborhoodsize + heurdata->curneighborhoodsize)/2;
566  heurdata->curminnodes *= 2;
567  SCIPdebugMsg(scip, " -> node limit reached: reduced neighborhood to %d, increased minnodes to %d\n",
568  heurdata->curneighborhoodsize, heurdata->curminnodes);
569  if( heurdata->curneighborhoodsize <= heurdata->emptyneighborhoodsize )
570  {
571  heurdata->callstatus = WAITFORNEWSOL;
572  SCIPdebugMsg(scip, " -> new neighborhood was already proven to be empty: wait for new solution\n");
573  }
574  break;
575 
578  heurdata->emptyneighborhoodsize = heurdata->curneighborhoodsize;
579  heurdata->curneighborhoodsize += heurdata->curneighborhoodsize/2;
580  heurdata->curneighborhoodsize = MAX(heurdata->curneighborhoodsize, heurdata->emptyneighborhoodsize + 2);
581  heurdata->callstatus = EXECUTE;
582  SCIPdebugMsg(scip, " -> neighborhood is empty: increased neighborhood to %d\n", heurdata->curneighborhoodsize);
583  break;
584 
585  case SCIP_STATUS_UNKNOWN:
594  default:
595  heurdata->callstatus = WAITFORNEWSOL;
596  SCIPdebugMsg(scip, " -> unexpected sub-MIP status <%d>: waiting for new solution\n", SCIPgetStatus(subscip));
597  break;
598  }
599 
600  TERMINATE:
601  /* free subproblem */
602  SCIPfreeBufferArray(scip, &subvars);
603 
604  return SCIP_OKAY;
605 }
606 
607 
608 /** execution method of primal heuristic */
609 static
610 SCIP_DECL_HEUREXEC(heurExecLocalbranching)
611 { /*lint --e{715}*/
612  SCIP_Longint maxnnodes; /* maximum number of subnodes */
613  SCIP_Longint nsubnodes; /* nodelimit for subscip */
614 
615  SCIP_HEURDATA* heurdata;
616  SCIP* subscip; /* the subproblem created by localbranching */
617 
618  SCIP_SOL* bestsol; /* best solution so far */
619 
620  SCIP_Bool success;
621  SCIP_RETCODE retcode;
622 
623  assert(heur != NULL);
624  assert(scip != NULL);
625  assert(result != NULL);
626 
627  *result = SCIP_DIDNOTRUN;
628 
629  /* get heuristic's data */
630  heurdata = SCIPheurGetData(heur);
631  assert( heurdata != NULL );
632 
633  /* there should be enough binary variables that a local branching constraint makes sense */
634  if( SCIPgetNBinVars(scip) < 2*heurdata->neighborhoodsize )
635  return SCIP_OKAY;
636 
637  *result = SCIP_DELAYED;
638 
639  /* only call heuristic, if an IP solution is at hand */
640  if( SCIPgetNSols(scip) <= 0 )
641  return SCIP_OKAY;
642 
643  bestsol = SCIPgetBestSol(scip);
644  assert(bestsol != NULL);
645 
646  /* only call heuristic, if the best solution comes from transformed problem */
647  if( SCIPsolIsOriginal(bestsol) )
648  return SCIP_OKAY;
649 
650  /* only call heuristic, if enough nodes were processed since last incumbent */
651  if( SCIPgetNNodes(scip) - SCIPgetSolNodenum(scip, bestsol) < heurdata->nwaitingnodes)
652  return SCIP_OKAY;
653 
654  /* only call heuristic, if the best solution does not come from trivial heuristic */
655  if( SCIPsolGetHeur(bestsol) != NULL && strcmp(SCIPheurGetName(SCIPsolGetHeur(bestsol)), "trivial") == 0 )
656  return SCIP_OKAY;
657 
658  /* reset neighborhood and minnodes, if new solution was found */
659  if( heurdata->lastsol != bestsol )
660  {
661  heurdata->curneighborhoodsize = heurdata->neighborhoodsize;
662  heurdata->curminnodes = heurdata->minnodes;
663  heurdata->emptyneighborhoodsize = 0;
664  heurdata->callstatus = EXECUTE;
665  heurdata->lastsol = bestsol;
666  }
667 
668  /* if no new solution was found and local branching also seems to fail, just keep on waiting */
669  if( heurdata->callstatus == WAITFORNEWSOL )
670  return SCIP_OKAY;
671 
672  *result = SCIP_DIDNOTRUN;
673 
674  /* calculate the maximal number of branching nodes until heuristic is aborted */
675  maxnnodes = (SCIP_Longint)(heurdata->nodesquot * SCIPgetNNodes(scip));
676 
677  /* reward local branching if it succeeded often */
678  maxnnodes = (SCIP_Longint)(maxnnodes * (1.0 + 2.0*(SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur)+1.0)));
679  maxnnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-MIP as 100 nodes */
680  maxnnodes += heurdata->nodesofs;
681 
682  /* determine the node limit for the current process */
683  nsubnodes = maxnnodes - heurdata->usednodes;
684  nsubnodes = MIN(nsubnodes, heurdata->maxnodes);
685 
686  /* check whether we have enough nodes left to call sub problem solving */
687  if( nsubnodes < heurdata->curminnodes )
688  return SCIP_OKAY;
689 
690  if( SCIPisStopped(scip) )
691  return SCIP_OKAY;
692 
693  /* check whether there is enough time and memory left */
694  SCIP_CALL( SCIPcheckCopyLimits(scip, &success) );
695 
696  /* abort if no time is left or not enough memory to create a copy of SCIP */
697  if( !success )
698  return SCIP_OKAY;
699 
700  *result = SCIP_DIDNOTFIND;
701 
702  SCIPdebugMsg(scip, "running localbranching heuristic ...\n");
703 
704  SCIP_CALL( SCIPcreate(&subscip) );
705 
706  retcode = setupAndSolveSubscipLocalbranching(scip, subscip, heur, nsubnodes, result);
707 
708  SCIP_CALL( SCIPfree(&subscip) );
709 
710  return retcode;
711 }
712 
713 
714 /*
715  * primal heuristic specific interface methods
716  */
717 
718 /** creates the localbranching primal heuristic and includes it in SCIP */
720  SCIP* scip /**< SCIP data structure */
721  )
722 {
723  SCIP_HEURDATA* heurdata;
724  SCIP_HEUR* heur;
725 
726  /* create Localbranching primal heuristic data */
727  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
728 
729  /* include primal heuristic */
730  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
732  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecLocalbranching, heurdata) );
733 
734  assert(heur != NULL);
735 
736  /* set non-NULL pointers to callback methods */
737  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyLocalbranching) );
738  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeLocalbranching) );
739  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitLocalbranching) );
740 
741  /* add localbranching primal heuristic parameters */
742  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/nodesofs",
743  "number of nodes added to the contingent of the total nodes",
744  &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0, INT_MAX, NULL, NULL) );
745 
746  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/neighborhoodsize",
747  "radius (using Manhattan metric) of the incumbent's neighborhood to be searched",
748  &heurdata->neighborhoodsize, FALSE, DEFAULT_NEIGHBORHOODSIZE, 1, INT_MAX, NULL, NULL) );
749 
750  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/nodesquot",
751  "contingent of sub problem nodes in relation to the number of nodes of the original problem",
752  &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) );
753 
754  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/lplimfac",
755  "factor by which the limit on the number of LP depends on the node limit",
756  &heurdata->lplimfac, TRUE, DEFAULT_LPLIMFAC, 1.0, SCIP_REAL_MAX, NULL, NULL) );
757 
758  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/minnodes",
759  "minimum number of nodes required to start the subproblem",
760  &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0, INT_MAX, NULL, NULL) );
761 
762  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxnodes",
763  "maximum number of nodes to regard in the subproblem",
764  &heurdata->maxnodes, TRUE, DEFAULT_MAXNODES, 0, INT_MAX, NULL, NULL) );
765 
766  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/nwaitingnodes",
767  "number of nodes without incumbent change that heuristic should wait",
768  &heurdata->nwaitingnodes, TRUE, DEFAULT_NWAITINGNODES, 0, INT_MAX, NULL, NULL) );
769 
770  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minimprove",
771  "factor by which localbranching should at least improve the incumbent",
772  &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) );
773 
774  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/uselprows",
775  "should subproblem be created out of the rows in the LP rows?",
776  &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) );
777 
778  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/copycuts",
779  "if uselprows == FALSE, should all active cuts from cutpool be copied to constraints in subproblem?",
780  &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
781 
782  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/bestsollimit",
783  "limit on number of improving incumbent solutions in sub-CIP",
784  &heurdata->bestsollimit, FALSE, DEFAULT_BESTSOLLIMIT, -1, INT_MAX, NULL, NULL) );
785 
786  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/useuct",
787  "should uct node selection be used at the beginning of the search?",
788  &heurdata->useuct, TRUE, DEFAULT_USEUCT, NULL, NULL) );
789 
790  return SCIP_OKAY;
791 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define DEFAULT_NODESOFS
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
Definition: heur.c:1380
#define HEUR_DISPCHAR
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)
#define SCIP_EVENTTYPE_LPSOLVED
Definition: type_event.h:84
#define NULL
Definition: def.h:253
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:686
SCIP_Real SCIPsumepsilon(SCIP *scip)
#define DEFAULT_LPLIMFAC
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip_cons.c:876
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1254
public methods for SCIP parameter handling
public methods for node selector plugins
public methods for memory management
#define DEFAULT_NODESQUOT
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1165
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:466
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip_solve.c:3399
#define SCIP_MAXSTRLEN
Definition: def.h:274
SCIP_EXPORT SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2470
#define HEUR_FREQ
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip_sol.c:1352
static SCIP_RETCODE addLocalBranchingConstraint(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEURDATA *heurdata)
public solving methods
#define EVENTHDLR_NAME
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip_solve.c:354
#define WAITFORNEWSOL
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:314
#define FALSE
Definition: def.h:73
#define DEFAULT_NWAITINGNODES
SCIP_EXPORT SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2553
SCIP_EXPORT SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16903
#define TRUE
Definition: def.h:72
#define SCIPdebug(x)
Definition: pub_message.h:74
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
methods commonly used by primal heuristics
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2535
#define HEUR_FREQOFS
static SCIP_DECL_HEURINIT(heurInitLocalbranching)
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3078
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
public methods for problem variables
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:47
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:95
#define DEFAULT_BESTSOLLIMIT
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip_param.c:891
SCIP_Real SCIPgetUpperbound(SCIP *scip)
static SCIP_DECL_HEUREXEC(heurExecLocalbranching)
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
#define DEFAULT_MAXNODES
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:78
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip_heur.c:184
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:2911
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1400
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define EXECUTE
public methods for numerical tolerances
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
SCIP_Longint SCIPgetNLPs(SCIP *scip)
SCIP_RETCODE SCIPcopyLargeNeighborhoodSearch(SCIP *sourcescip, SCIP *subscip, SCIP_HASHMAP *varmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool uselprows, SCIP_Bool copycuts, SCIP_Bool *success, SCIP_Bool *valid)
Definition: heuristics.c:895
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip_prob.c:1421
public methods for querying solving statistics
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2205
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:107
SCIP_Longint SCIPgetNNodes(SCIP *scip)
#define DEFAULT_COPYCUTS
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:282
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip_branch.c:286
public methods for event handler plugins and event handlers
SCIP_Bool SCIPisFeasEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip_event.c:276
static SCIP_RETCODE setupAndSolveSubscipLocalbranching(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_Longint nsubnodes, SCIP_RESULT *result)
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:47
Local branching heuristic according to Fischetti and Lodi.
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:155
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1175
public methods for problem copies
public methods for primal CIP solutions
SCIP_NODESEL * SCIPfindNodesel(SCIP *scip, const char *name)
Definition: scip_nodesel.c:224
#define SCIP_CALL(x)
Definition: def.h:365
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:940
#define DEFAULT_NEIGHBORHOODSIZE
SCIP_RETCODE SCIPsetCharParam(SCIP *scip, const char *name, char value)
Definition: scip_param.c:670
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:995
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip_prob.c:2427
#define HEUR_TIMING
public methods for primal heuristic plugins and divesets
public methods for constraint handler plugins and constraints
SCIP_Longint SCIPgetSolNodenum(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1648
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
public data structures and miscellaneous methods
SCIP_RETCODE SCIPsetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1254
#define SCIP_Bool
Definition: def.h:70
const char * SCIPgetProbName(SCIP *scip)
Definition: scip_prob.c:1066
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2891
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool *success)
#define DEFAULT_MINIMPROVE
#define HEUR_MAXDEPTH
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip_param.c:209
#define MIN(x, y)
Definition: def.h:223
#define DEFAULT_USEUCT
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
SCIP_RETCODE SCIPincludeHeurLocalbranching(SCIP *scip)
Constraint handler for linear constraints in their most general form, .
static SCIP_DECL_HEURFREE(heurFreeLocalbranching)
#define HEUR_NAME
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:2947
SCIP_RETCODE SCIPincludeEventhdlrBasic(SCIP *scip, SCIP_EVENTHDLR **eventhdlrptr, const char *name, const char *desc, SCIP_DECL_EVENTEXEC((*eventexec)), SCIP_EVENTHDLRDATA *eventhdlrdata)
Definition: scip_event.c:94
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:129
#define SCIP_REAL_MAX
Definition: def.h:165
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip_param.c:554
SCIP_RETCODE SCIPgetSolVals(SCIP *scip, SCIP_SOL *sol, int nvars, SCIP_VAR **vars, SCIP_Real *vals)
Definition: scip_sol.c:1389
#define SCIP_LONGINT_FORMAT
Definition: def.h:156
public methods for branching rule plugins and branching
public methods for managing events
general public methods
#define MAX(x, y)
Definition: def.h:222
#define HEUR_PRIORITY
static SCIP_DECL_EVENTEXEC(eventExecLocalbranching)
public methods for solutions
SCIP_SOL ** SCIPgetSols(SCIP *scip)
Definition: scip_sol.c:2254
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip_event.c:310
#define HEUR_USESSUBSCIP
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip_heur.c:152
#define HEUR_DESC
public methods for message output
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1861
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10263
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:73
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2925
#define SCIP_Real
Definition: def.h:164
#define EVENTHDLR_DESC
public methods for message handling
#define SCIP_Longint
Definition: def.h:149
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip_param.c:438
static SCIP_DECL_HEURCOPY(heurCopyLocalbranching)
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2032
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:168
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip_prob.c:2765
#define DEFAULT_USELPROWS
public methods for primal heuristics
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:314
#define SCIP_CALL_ABORT(x)
Definition: def.h:344
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip_cons.c:1109
SCIP_RETCODE SCIPtrySolFree(SCIP *scip, SCIP_SOL **sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip_sol.c:3218
public methods for global and local (sub)problems
#define DEFAULT_MINNODES
SCIP_SOL * SCIPgetBestSol(SCIP *scip)
Definition: scip_sol.c:2304
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:496
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:966
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435
memory allocation routines