Scippy

SCIP

Solving Constraint Integer Programs

heur_proximity.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_proximity.c
17  * @brief improvement heuristic which uses an auxiliary objective instead of the original objective function which
18  * is itself added as a constraint to a sub-SCIP instance. The heuristic was presented by Matteo Fischetti
19  * and Michele Monaci
20  *
21  *
22  * @author Gregor Hendel
23  */
24 
25 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
26 
27 #include <assert.h>
28 #include <string.h>
29 
30 #include "scip/heur_proximity.h"
31 #include "scip/cons_linear.h"
32 
33 #define HEUR_NAME "proximity"
34 #define HEUR_DESC "heuristic trying to improve the incumbent by an auxiliary proximity objective function"
35 #define HEUR_DISPCHAR 'P'
36 #define HEUR_PRIORITY -2000000
37 #define HEUR_FREQ -1
38 #define HEUR_FREQOFS 0
39 #define HEUR_MAXDEPTH -1
40 #define HEUR_TIMING SCIP_HEURTIMING_AFTERNODE
41 #define HEUR_USESSUBSCIP TRUE /**< does the heuristic use a secondary SCIP instance? */
42 
43 /* event handler properties */
44 #define EVENTHDLR_NAME "Proximity"
45 #define EVENTHDLR_DESC "LP event handler for " HEUR_NAME " heuristic"
46 
47 /* default values for proximity-specific parameters */
48 /* todo refine these values */
49 #define DEFAULT_MAXNODES 10000LL /* maximum number of nodes to regard in the subproblem */
50 #define DEFAULT_MINIMPROVE 0.02 /* factor by which proximity should at least improve the incumbent */
51 #define DEFAULT_MINGAP 0.01 /* minimum primal-dual gap for which the heuristic is executed */
52 #define DEFAULT_MINNODES 1LL /* minimum number of nodes to regard in the subproblem */
53 #define DEFAULT_MINLPITERS 200LL /* minimum number of LP iterations to perform in one sub-mip */
54 #define DEFAULT_MAXLPITERS 100000LL /* maximum number of LP iterations to be performed in the subproblem */
55 #define DEFAULT_NODESOFS 50LL /* number of nodes added to the contingent of the total nodes */
56 #define DEFAULT_WAITINGNODES 100LL /* default waiting nodes since last incumbent before heuristic is executed */
57 #define DEFAULT_NODESQUOT 0.1 /* default quotient of sub-MIP nodes with respect to number of processed nodes*/
58 #define DEFAULT_USELPROWS FALSE /* should subproblem be constructed based on LP row information? */
59 #define DEFAULT_BINVARQUOT 0.1 /* default threshold for percentage of binary variables required to start */
60 #define DEFAULT_RESTART TRUE /* should the heuristic immediately run again on its newly found solution? */
61 #define DEFAULT_USEFINALLP FALSE /* should the heuristic solve a final LP in case of continuous objective variables? */
62 #define DEFAULT_LPITERSQUOT 0.2 /* default quotient of sub-MIP LP iterations with respect to LP iterations so far */
63 
64 /*
65  * Data structures
66  */
67 
68 /** primal heuristic data */
69 struct SCIP_HeurData
70 {
71  SCIP_Longint maxnodes; /**< maximum number of nodes to regard in the subproblem */
72  SCIP_Longint minnodes; /**< minimum number of nodes to regard in the subproblem */
73  SCIP_Longint maxlpiters; /**< maximum number of LP iterations to be performed in the subproblem */
74  SCIP_Longint nusedlpiters; /**< number of actually performed LP iterations */
75  SCIP_Longint minlpiters; /**< minimum number of LP iterations to perform in one sub-mip */
76  SCIP_Longint nodesofs; /**< number of nodes added to the contingent of the total nodes */
77  SCIP_Longint usednodes; /**< nodes already used by proximity in earlier calls */
78  SCIP_Longint waitingnodes; /**< waiting nodes since last incumbent before heuristic is executed */
79  SCIP_Real lpitersquot; /**< quotient of sub-MIP LP iterations with respect to LP iterations so far */
80  SCIP_Real minimprove; /**< factor by which proximity should at least improve the incumbent */
81  SCIP_Real mingap; /**< minimum primal-dual gap for which the heuristic is executed */
82  SCIP_Real nodesquot; /**< quotient of sub-MIP nodes with respect to number of processed nodes */
83  SCIP_Real binvarquot; /**< threshold for percantage of binary variables required to start */
84 
85  SCIP* subscip; /**< the subscip used by the heuristic */
86  SCIP_HASHMAP* varmapfw; /**< map between scip variables and subscip variables */
87  SCIP_VAR** subvars; /**< variables in subscip */
88  SCIP_CONS* objcons; /**< the objective cutoff constraint of the subproblem */
89 
90  int nsubvars; /**< the number of subvars */
91  int lastsolidx; /**< index of last solution on which the heuristic was processed */
92  int subprobidx; /**< counter for the subproblem index to be solved by proximity */
93 
94  SCIP_Bool uselprows; /**< should subproblem be constructed based on LP row information? */
95  SCIP_Bool restart; /* should the heuristic immediately run again on its newly found solution? */
96  SCIP_Bool usefinallp; /* should the heuristic solve a final LP in case of continuous objective variables? */
97 };
98 
99 
100 /*
101  * Local methods
102  */
103 
104 /** optimizes the continuous variables in an LP diving by fixing all integer variables to the given solution values */
105 static
107  SCIP* scip, /**< SCIP data structure */
108  SCIP_SOL* sol, /**< candidate solution for which continuous variables should be optimized */
109  SCIP_Bool* success /**< was the dive successful? */
110  )
111 {
112  SCIP_VAR** vars;
113  SCIP_RETCODE retstat;
114 
115  int v;
116  int nvars;
117  int ncontvars;
118  int nintvars;
119 
120  SCIP_Bool lperror;
121  SCIP_Bool requiresnlp;
122 
123  assert(success != NULL);
124 
125  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, &ncontvars) );
126 
127  nintvars = nvars - ncontvars;
128 
129  /**@todo in case of an MINLP, if SCIPisNLPConstructed() is TRUE rather solve the NLP instead of the LP */
130  requiresnlp = SCIPisNLPConstructed(scip);
131  if( requiresnlp || ncontvars == 0 )
132  return SCIP_OKAY;
133 
134  /* start diving to calculate the LP relaxation */
135  SCIP_CALL( SCIPstartDive(scip) );
136 
137  /* set the bounds of the variables: fixed for integers, global bounds for continuous */
138  for( v = 0; v < nvars; ++v )
139  {
140  if( SCIPvarGetStatus(vars[v]) == SCIP_VARSTATUS_COLUMN )
141  {
142  SCIP_CALL( SCIPchgVarLbDive(scip, vars[v], SCIPvarGetLbGlobal(vars[v])) );
143  SCIP_CALL( SCIPchgVarUbDive(scip, vars[v], SCIPvarGetUbGlobal(vars[v])) );
144  }
145  }
146  /* apply this after global bounds to not cause an error with intermediate empty domains */
147  for( v = 0; v < nintvars; ++v )
148  {
149  if( SCIPvarGetStatus(vars[v]) == SCIP_VARSTATUS_COLUMN )
150  {
151  SCIP_Real solval;
152 
153  solval = SCIPgetSolVal(scip, sol, vars[v]);
154  SCIP_CALL( SCIPchgVarLbDive(scip, vars[v], solval) );
155  SCIP_CALL( SCIPchgVarUbDive(scip, vars[v], solval) );
156  }
157  }
158 
159  /* solve LP */
160  SCIPdebugMessage(" -> old LP iterations: %" SCIP_LONGINT_FORMAT "\n", SCIPgetNLPIterations(scip));
161 
162  /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a heuristic.
163  * Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
164  */
165  retstat = SCIPsolveDiveLP(scip, -1, &lperror, NULL);
166  if( retstat != SCIP_OKAY )
167  {
168 #ifdef NDEBUG
169  SCIPwarningMessage(scip, "Error while solving LP in Proximity heuristic; LP solve terminated with code <%d>\n",retstat);
170 #else
171  SCIP_CALL( retstat );
172 #endif
173  }
174 
175  SCIPdebugMessage(" -> new LP iterations: %" SCIP_LONGINT_FORMAT "\n", SCIPgetNLPIterations(scip));
176  SCIPdebugMessage(" -> error=%u, status=%d\n", lperror, SCIPgetLPSolstat(scip));
177  if( !lperror && SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_OPTIMAL )
178  {
179  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
180  SCIP_CALL( SCIPtrySol(scip, sol, FALSE, TRUE, TRUE, TRUE, success) );
181  }
182 
183  /* terminate diving mode */
184  SCIP_CALL( SCIPendDive(scip) );
185 
186  return SCIP_OKAY;
187 }
188 
189 /** creates a new solution for the original problem by copying the solution of the subproblem */
190 static
192  SCIP* scip, /**< original SCIP data structure */
193  SCIP* subscip, /**< SCIP structure of the subproblem */
194  SCIP_VAR** subvars, /**< the variables of the subproblem */
195  SCIP_HEUR* heur, /**< proximity heuristic structure */
196  SCIP_SOL* subsol, /**< solution of the subproblem */
197  SCIP_Bool usefinallp, /**< should continuous variables be optimized by a final LP */
198  SCIP_Bool* success /**< used to store whether new solution was found or not */
199  )
200 {
201  SCIP_VAR** vars; /* the original problem's variables */
202  int nvars; /* the original problem's number of variables */
203  int ncontvars; /* the original problem's number of continuous variables */
204  SCIP_Real* subsolvals; /* solution values of the subproblem */
205  SCIP_SOL* newsol; /* solution to be created for the original problem */
206 
207  assert(scip != NULL);
208  assert(subscip != NULL);
209  assert(subvars != NULL);
210  assert(subsol != NULL);
211  assert(success != NULL);
212 
213  /* get variables' data */
214  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, &ncontvars) );
215 
216  /* sub-SCIP may have more variables than the number of active (transformed) variables in the main SCIP
217  * since constraint copying may have required the copy of variables that are fixed in the main SCIP
218  */
219  assert(nvars <= SCIPgetNOrigVars(subscip));
220 
221  SCIP_CALL( SCIPallocBufferArray(scip, &subsolvals, nvars) );
222 
223  /* copy the solution */
224  SCIP_CALL( SCIPgetSolVals(subscip, subsol, nvars, subvars, subsolvals) );
225 
226  /* create new solution for the original problem */
227  SCIP_CALL( SCIPcreateSol(scip, &newsol, heur) );
228  SCIP_CALL( SCIPsetSolVals(scip, newsol, nvars, vars, subsolvals) );
229 
230  *success = FALSE;
231  /* solve an LP with all integer variables fixed to improve solution quality */
232  if( ncontvars > 0 && usefinallp && SCIPisLPConstructed(scip) )
233  {
234  int v;
235  int ncontobjvars; /* does the problem instance have continuous variables with nonzero objective coefficients? */
236  SCIP_Real sumofobjsquares;
237 
238  /* check if continuous variables with nonzero objective coefficient are present */
239  ncontobjvars = 0;
240  sumofobjsquares = 0.0;
241  for( v = nvars - 1; v >= nvars - ncontvars; --v )
242  {
243  SCIP_VAR* var;
244 
245  var = vars[v];
246  assert(vars[v] != NULL);
247  assert(!SCIPvarIsIntegral(var));
248 
249  if( SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN && !SCIPisZero(scip, SCIPvarGetObj(var)) )
250  {
251  ++ncontobjvars;
252  sumofobjsquares += SCIPvarGetObj(var) * SCIPvarGetObj(var);
253  }
254  }
255 
256  SCIPstatisticMessage(" Continuous Objective variables: %d, Euclidean OBJ: %g total, %g continuous\n", ncontobjvars, SCIPgetObjNorm(scip), sumofobjsquares);
257  /* solve a final LP to optimize solution values of continuous problem variables */
258  SCIPstatisticMessage("Solution Value before LP resolve: %g\n", SCIPgetSolOrigObj(scip, newsol));
259  SCIP_CALL( solveLp(scip, newsol, success) );
260 
261  /* if the LP solve was not successful, reset the solution */
262  if( !*success )
263  {
264  for( v = nvars - 1; v >= nvars - ncontvars; --v )
265  {
266  SCIP_CALL( SCIPsetSolVal(scip, newsol, vars[v], subsolvals[v]) );
267  }
268 
269  }
270  }
271 
272  /* try to add new solution to SCIP and free it immediately */
273  if( !*success )
274  {
275  SCIP_CALL( SCIPtrySol(scip, newsol, FALSE, TRUE, TRUE, TRUE, success) );
276  }
277  SCIP_CALL( SCIPfreeSol(scip, &newsol) );
278 
279  SCIPfreeBufferArray(scip, &subsolvals);
280 
281  return SCIP_OKAY;
282 }
283 
284 /** sets solving parameters for the subproblem created by the heuristic */
285 static
287  SCIP* subscip /**< copied SCIP data structure */
288  )
289 {
290  assert(subscip != NULL);
291 
292  /* do not abort subproblem on CTRL-C */
293  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
294 
295  /* disable output to console */
296  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
297 
298  /* forbid recursive call of heuristics and separators solving sub-SCIPs */
299  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
300 
301  /* use best dfs node selection */
302  if( SCIPfindNodesel(subscip, "dfs") != NULL && !SCIPisParamFixed(subscip, "nodeselection/dfs/stdpriority") )
303  {
304  SCIP_CALL( SCIPsetIntParam(subscip, "nodeselection/dfs/stdpriority", INT_MAX/4) );
305  }
306 
307  /* disable expensive presolving
308  * todo maybe presolving can be entirely turned off here - parameter???
309  */
311 
312  /* SCIP_CALL( SCIPsetPresolving(scip, SCIP_PARAMSETTING_OFF, TRUE) ); */
313  if( !SCIPisParamFixed(subscip, "presolving/maxrounds") )
314  {
315  SCIP_CALL( SCIPsetIntParam(subscip, "presolving/maxrounds", 50) );
316  }
317 
318  /* disable cutting plane separation */
320 
321 
322  /* todo: check branching rule in sub-SCIP */
323  if( SCIPfindBranchrule(subscip, "leastinf") != NULL && !SCIPisParamFixed(subscip, "branching/leastinf/priority") )
324  {
325  SCIP_CALL( SCIPsetIntParam(subscip, "branching/leastinf/priority", INT_MAX/4) );
326  }
327 
328  /* disable feasibility pump and fractional diving */
329  if( !SCIPisParamFixed(subscip, "heuristics/feaspump/freq") )
330  {
331  SCIP_CALL( SCIPsetIntParam(subscip, "heuristics/feaspump/freq", -1) );
332  }
333  if( !SCIPisParamFixed(subscip, "heuristics/fracdiving/freq") )
334  {
335  SCIP_CALL( SCIPsetIntParam(subscip, "heuristics/fracdiving/freq", -1) );
336  }
337 
338  /* employ a limit on the number of enforcement rounds in the quadratic constraint handler; this fixes the issue that
339  * sometimes the quadratic constraint handler needs hundreds or thousands of enforcement rounds to determine the
340  * feasibility status of a single node without fractional branching candidates by separation (namely for uflquad
341  * instances); however, the solution status of the sub-SCIP might get corrupted by this; hence no deductions shall be
342  * made for the original SCIP
343  */
344  if( SCIPfindConshdlr(subscip, "quadratic") != NULL && !SCIPisParamFixed(subscip, "constraints/quadratic/enfolplimit") )
345  {
346  SCIP_CALL( SCIPsetIntParam(subscip, "constraints/quadratic/enfolplimit", 500) );
347  }
348 
349  /* todo check if
350  * SCIP_CALL( SCIPsetEmphasis(subscip, SCIP_PARAMEMPHASIS_FEASIBILITY, TRUE) );
351  * improves performance */
352 
353 #ifdef SCIP_DEBUG
354  /* for debugging proximity, enable MIP output */
355  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
356  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
357 #endif
358 
359  return SCIP_OKAY;
360 }
361 
362 /** creates the rows of the subproblem */
363 static
365  SCIP* scip, /**< original SCIP data structure */
366  SCIP* subscip, /**< SCIP data structure for the subproblem */
367  SCIP_VAR** subvars /**< the variables of the subproblem */
368  )
369 {
370  SCIP_ROW** rows; /* original scip rows */
371  SCIP_CONS* cons; /* new constraint */
372  SCIP_VAR** consvars; /* new constraint's variables */
373  SCIP_COL** cols; /* original row's columns */
374 
375  SCIP_Real constant; /* constant added to the row */
376  SCIP_Real lhs; /* left hand side of the row */
377  SCIP_Real rhs; /* left right side of the row */
378  SCIP_Real* vals; /* variables' coefficient values of the row */
379 
380  int nrows;
381  int nnonz;
382  int i;
383  int j;
384 
385  /* get the rows and their number */
386  SCIP_CALL( SCIPgetLPRowsData(scip, &rows, &nrows) );
387 
388  /* copy all rows to linear constraints */
389  for( i = 0; i < nrows; i++ )
390  {
391  /* ignore rows that are only locally valid */
392  if( SCIProwIsLocal(rows[i]) )
393  continue;
394 
395  /* get the row's data */
396  constant = SCIProwGetConstant(rows[i]);
397  lhs = SCIProwGetLhs(rows[i]) - constant;
398  rhs = SCIProwGetRhs(rows[i]) - constant;
399  vals = SCIProwGetVals(rows[i]);
400  nnonz = SCIProwGetNNonz(rows[i]);
401  cols = SCIProwGetCols(rows[i]);
402 
403  assert(lhs <= rhs);
404 
405  /* allocate memory array to be filled with the corresponding subproblem variables */
406  SCIP_CALL( SCIPallocBufferArray(scip, &consvars, nnonz) );
407  for( j = 0; j < nnonz; j++ )
408  consvars[j] = subvars[SCIPvarGetProbindex(SCIPcolGetVar(cols[j]))];
409 
410  /* create a new linear constraint and add it to the subproblem */
411  SCIP_CALL( SCIPcreateConsLinear(subscip, &cons, SCIProwGetName(rows[i]), nnonz, consvars, vals, lhs, rhs,
412  TRUE, TRUE, TRUE, TRUE, TRUE, FALSE, FALSE, TRUE, TRUE, FALSE) );
413  SCIP_CALL( SCIPaddCons(subscip, cons) );
414  SCIP_CALL( SCIPreleaseCons(subscip, &cons) );
415 
416  /* free temporary memory */
417  SCIPfreeBufferArray(scip, &consvars);
418  }
419 
420  return SCIP_OKAY;
421 }
422 
423 /** frees the subproblem */
424 static
426  SCIP* scip, /**< SCIP data structure */
427  SCIP_HEURDATA* heurdata /**< heuristic data */
428  )
429 {
430  /* free remaining memory from heuristic execution */
431  if( heurdata->subscip != NULL )
432  {
433 
434  assert(heurdata->varmapfw != NULL);
435  assert(heurdata->subvars != NULL);
436  assert(heurdata->objcons != NULL);
437 
438  SCIPdebugMessage("Freeing subproblem of proximity heuristic\n");
439  SCIPfreeBlockMemoryArray(scip, &heurdata->subvars, heurdata->nsubvars);
440  SCIPhashmapFree(&heurdata->varmapfw);
441  SCIP_CALL( SCIPreleaseCons(heurdata->subscip, &heurdata->objcons) );
442  SCIP_CALL( SCIPfree(&heurdata->subscip) );
443 
444  heurdata->subscip = NULL;
445  heurdata->varmapfw = NULL;
446  heurdata->subvars = NULL;
447  heurdata->objcons = NULL;
448  }
449  return SCIP_OKAY;
450 }
451 
452 /* ---------------- Callback methods of event handler ---------------- */
453 
454 /* exec the event handler
455  *
456  * we interrupt the solution process
457  */
458 static
459 SCIP_DECL_EVENTEXEC(eventExecProximity)
460 {
461  SCIP_HEURDATA* heurdata;
462 
463  assert(eventhdlr != NULL);
464  assert(eventdata != NULL);
465  assert(strcmp(SCIPeventhdlrGetName(eventhdlr), EVENTHDLR_NAME) == 0);
466  assert(event != NULL);
468 
469  heurdata = (SCIP_HEURDATA*)eventdata;
470  assert(heurdata != NULL);
471 
472  /* interrupt solution process of sub-SCIP
473  * todo adjust interruption limit */
474  if( SCIPgetLPSolstat(scip) == SCIP_LPSOLSTAT_ITERLIMIT || SCIPgetNLPIterations(scip) >= heurdata->maxlpiters )
475  {
477  }
478 
479  return SCIP_OKAY;
480 }
481 /* ---------------- Callback methods of primal heuristic ---------------- */
482 
483 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
484 static
485 SCIP_DECL_HEURCOPY(heurCopyProximity)
486 { /*lint --e{715}*/
487  assert(scip != NULL);
488  assert(heur != NULL);
489  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
490 
491  /* call inclusion method of primal heuristic */
493 
494  return SCIP_OKAY;
495 }
496 
497 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
498 static
499 SCIP_DECL_HEURFREE(heurFreeProximity)
500 { /*lint --e{715}*/
501  SCIP_HEURDATA* heurdata;
502 
503  assert( heur != NULL );
504  assert( scip != NULL );
505 
506  /* get heuristic data */
507  heurdata = SCIPheurGetData(heur);
508  assert( heurdata != NULL );
509 
510  /* free heuristic data */
511  SCIPfreeMemory(scip, &heurdata);
512  SCIPheurSetData(heur, NULL);
513 
514  return SCIP_OKAY;
515 }
516 
517 
518 /** initialization method of primal heuristic (called after problem was transformed) */
519 static
520 SCIP_DECL_HEURINIT(heurInitProximity)
521 { /*lint --e{715}*/
522  SCIP_HEURDATA* heurdata;
523 
524  assert( heur != NULL );
525  assert( scip != NULL );
526 
527  /* get heuristic data */
528  heurdata = SCIPheurGetData(heur);
529  assert( heurdata != NULL );
530 
531  /* initialize data */
532  heurdata->usednodes = 0LL;
533  heurdata->lastsolidx = -1;
534  heurdata->nusedlpiters = 0LL;
535  heurdata->subprobidx = 0;
536 
537  heurdata->subscip = NULL;
538  heurdata->varmapfw = NULL;
539  heurdata->subvars = NULL;
540  heurdata->objcons = NULL;
541 
542  heurdata->nsubvars = 0;
543 
544  return SCIP_OKAY;
545 }
546 
547 /* solution process exiting method of proximity heuristic */
548 static
549 SCIP_DECL_HEUREXITSOL(heurExitsolProximity)
550 {
551  SCIP_HEURDATA* heurdata;
552 
553  assert( heur != NULL );
554  assert( scip != NULL );
555 
556  /* get heuristic data */
557  heurdata = SCIPheurGetData(heur);
558  assert( heurdata != NULL );
559 
560  SCIP_CALL( deleteSubproblem(scip, heurdata) );
561 
562  assert(heurdata->subscip == NULL && heurdata->varmapfw == NULL
563  && heurdata->subvars == NULL && heurdata->objcons == NULL);
564 
565  return SCIP_OKAY;
566 }
567 
568 /** execution method of primal heuristic */
569 static
570 SCIP_DECL_HEUREXEC(heurExecProximity)
571 { /*lint --e{715}*/
572 
573  SCIP_HEURDATA* heurdata; /* heuristic's data */
574  SCIP_Longint nnodes; /* number of stalling nodes for the subproblem */
575  SCIP_Longint nlpiters; /* lp iteration limit for the subproblem */
576  SCIP_Bool foundsol;
577 
578  assert(heur != NULL);
579  assert(scip != NULL);
580  assert(result != NULL);
581 
582  *result = SCIP_DIDNOTRUN;
583 
584  /* get heuristic data */
585  heurdata = SCIPheurGetData(heur);
586  assert(heurdata != NULL);
587 
588  /* do not run heuristic when there are only few binary varables */
589  if( SCIPgetNBinVars(scip) < heurdata->binvarquot * SCIPgetNVars(scip) )
590  return SCIP_OKAY;
591 
592  /* calculate branching node limit for sub problem */
593  /* todo maybe treat root node differently */
594  nnodes = (SCIP_Longint) (heurdata->nodesquot * SCIPgetNNodes(scip));
595  nnodes += heurdata->nodesofs;
596 
597  /* determine the node and LP iteration limit for the solve of the sub-SCIP */
598  nnodes -= heurdata->usednodes;
599  nnodes = MIN(nnodes, heurdata->maxnodes);
600 
601  nlpiters = (SCIP_Longint) heurdata->lpitersquot * SCIPgetNRootFirstLPIterations(scip);
602  nlpiters = MIN(nlpiters, heurdata->maxlpiters);
603 
604  /* check whether we have enough nodes left to call subproblem solving */
605  if( nnodes < heurdata->minnodes )
606  {
607  SCIPdebugMessage("skipping proximity: nnodes=%" SCIP_LONGINT_FORMAT ", minnodes=%" SCIP_LONGINT_FORMAT "\n", nnodes, heurdata->minnodes);
608  return SCIP_OKAY;
609  }
610 
611  /* do not run proximity, if the problem does not have an objective function anyway */
612  if( SCIPgetNObjVars(scip) == 0 )
613  {
614  SCIPdebugMessage("skipping proximity: pure feasibility problem anyway\n");
615  return SCIP_OKAY;
616  }
617 
618  foundsol = FALSE;
619 
620  do
621  {
622  /* main loop of proximity: in every iteration, a new subproblem is set up and solved until no improved solution
623  * is found or one of the heuristic limits on nodes or LP iterations is hit
624  * heuristic performs only one iteration if restart parameter is set to FALSE
625  */
626  SCIP_Longint nusednodes;
627  SCIP_Longint nusedlpiters;
628 
629  nusednodes = 0LL;
630  nusedlpiters = 0LL;
631 
632  nlpiters = MAX(nlpiters, heurdata->minlpiters);
633 
634  /* define and solve the proximity subproblem */
635  SCIP_CALL( SCIPapplyProximity(scip, heur, result, heurdata->minimprove, nnodes, nlpiters, &nusednodes, &nusedlpiters, FALSE) );
636 
637  /* adjust node limit and LP iteration limit for future iterations */
638  assert(nusednodes <= nnodes);
639  heurdata->usednodes += nusednodes;
640  nnodes -= nusednodes;
641 
642  nlpiters -= nusedlpiters;
643  heurdata->nusedlpiters += nusedlpiters;
644 
645  /* memorize if a new solution has been found in at least one iteration */
646  if( *result == SCIP_FOUNDSOL )
647  foundsol = TRUE;
648  }
649  while( *result == SCIP_FOUNDSOL && heurdata->restart && !SCIPisStopped(scip) && nnodes > 0 );
650 
651  /* reset result pointer if solution has been found in previous iteration */
652  if( foundsol )
653  *result = SCIP_FOUNDSOL;
654 
655  /* free the occupied memory */
656  if( heurdata->subscip != NULL )
657  {
658 /* just for testing the library method, in debug mode, we call the wrapper method for the actual delete method */
659 #ifndef NDEBUG
661 #else
662  SCIP_CALL( deleteSubproblem(scip, heurdata) );
663 #endif
664  }
665  return SCIP_OKAY;
666 }
667 
668 
669 /*
670  * primal heuristic specific interface methods
671  */
672 
673 /** frees the sub-MIP created by proximity */
675  SCIP* scip /** SCIP data structure */
676  )
677 {
678  SCIP_HEUR* heur;
679  SCIP_HEURDATA* heurdata;
680 
681  assert(scip != NULL);
682 
683  heur = SCIPfindHeur(scip, HEUR_NAME);
684  assert(heur != NULL);
685 
686  heurdata = SCIPheurGetData(heur);
687  if( heurdata != NULL )
688  {
689  SCIP_CALL( deleteSubproblem(scip, heurdata) );
690  }
691 
692  return SCIP_OKAY;
693 }
694 
695 /** main procedure of the proximity heuristic, creates and solves a sub-SCIP
696  *
697  * @note the method can be applied in an iterative way, keeping the same subscip in between. If the @p freesubscip
698  * parameter is set to FALSE, the heuristic will keep the subscip data structures. Always set this parameter
699  * to TRUE, or call SCIPdeleteSubproblemProximity() afterwards
700  */
702  SCIP* scip, /**< original SCIP data structure */
703  SCIP_HEUR* heur, /**< heuristic data structure */
704  SCIP_RESULT* result, /**< result data structure */
705  SCIP_Real minimprove, /**< factor by which proximity should at least improve the incumbent */
706  SCIP_Longint nnodes, /**< node limit for the subproblem */
707  SCIP_Longint nlpiters, /**< LP iteration limit for the subproblem */
708  SCIP_Longint* nusednodes, /**< pointer to store number of used nodes in subscip */
709  SCIP_Longint* nusedlpiters, /**< pointer to store number of used LP iterations in subscip */
710  SCIP_Bool freesubscip /**< should the created sub-MIP be freed at the end of the method? */
711  )
712 {
713  SCIP* subscip; /* the subproblem created by proximity */
714  SCIP_HASHMAP* varmapfw; /* mapping of SCIP variables to sub-SCIP variables */
715  SCIP_VAR** vars; /* original problem's variables */
716  SCIP_VAR** subvars; /* subproblem's variables */
717  SCIP_HEURDATA* heurdata; /* heuristic's private data structure */
718  SCIP_EVENTHDLR* eventhdlr; /* event handler for LP events */
719 
720  SCIP_SOL* incumbent;
721  SCIP_CONS* objcons;
722  SCIP_RETCODE retcode;
723  SCIP_Longint iterlim;
724 
725  SCIP_Real timelimit; /* time limit for proximity subproblem */
726  SCIP_Real memorylimit; /* memory limit for proximity subproblem */
727 
728  SCIP_Real large;
729  SCIP_Real inf;
730 
731  SCIP_Real bestobj;
732  SCIP_Real objcutoff;
733  SCIP_Real lowerbound;
734 
735  int nvars; /* number of original problem's variables */
736  int nfixedvars;
737  int nsubsols;
738  int solidx;
739  int i;
740 
741  SCIP_Bool valid;
742 
743  assert(scip != NULL);
744  assert(heur != NULL);
745  assert(result != NULL);
746 
747  assert(nnodes >= 0);
748  assert(0.0 <= minimprove && minimprove <= 1.0);
749 
750  *result = SCIP_DIDNOTRUN;
751 
752  /* get heuristic data */
753  heurdata = SCIPheurGetData(heur);
754  assert(heurdata != NULL);
755 
756  /* only call the heuristic if we have an incumbent */
757  if( SCIPgetNSolsFound(scip) == 0 )
758  return SCIP_OKAY;
759 
760  /* do not use heuristic on problems without binary variables */
761  if( SCIPgetNBinVars(scip) == 0 )
762  return SCIP_OKAY;
763 
764  incumbent = SCIPgetBestSol(scip);
765  assert(incumbent != NULL);
766 
767  /* make sure that the incumbent is valid for the transformed space, otherwise terminate */
768  if( SCIPsolIsOriginal(incumbent) )
769  return SCIP_OKAY;
770 
771  solidx = SCIPsolGetIndex(incumbent);
772 
773  if( heurdata->lastsolidx == solidx )
774  return SCIP_OKAY;
775 
776  /* only call heuristic, if the best solution does not come from trivial heuristic */
777  if( SCIPsolGetHeur(incumbent) != NULL && strcmp(SCIPheurGetName(SCIPsolGetHeur(incumbent)), "trivial") == 0 )
778  return SCIP_OKAY;
779 
780  /* waitingnodes parameter defines the minimum number of nodes to wait before a new incumbent is processed */
781  if( SCIPgetNNodes(scip) > 1 && SCIPgetNNodes(scip) - SCIPsolGetNodenum(incumbent) < heurdata->waitingnodes )
782  return SCIP_OKAY;
783 
784  bestobj = SCIPgetSolTransObj(scip, incumbent);
785  lowerbound = SCIPgetLowerbound(scip);
786 
787  /* use knowledge about integrality of objective to round up lower bound */
788  if( SCIPisObjIntegral(scip) )
789  {
790  SCIPdebugMessage(" Rounding up lower bound: %f --> %f \n", lowerbound, SCIPfeasCeil(scip, lowerbound));
791  lowerbound = SCIPfeasCeil(scip, lowerbound);
792  }
793 
794  /* do not trigger heuristic if primal and dual bound are already close together */
795  if( SCIPisFeasLE(scip, bestobj, lowerbound) || SCIPgetGap(scip) <= heurdata->mingap )
796  return SCIP_OKAY;
797 
798  /* calculate the minimum improvement for a heuristic solution in terms of the distance between incumbent objective
799  * and the lower bound
800  */
801  objcutoff = lowerbound + (1 - minimprove) * (bestobj - lowerbound);
802 
803  /* use integrality of the objective function to round down (and thus strengthen) the objective cutoff */
804  if( SCIPisObjIntegral(scip) )
805  objcutoff = SCIPfeasFloor(scip, objcutoff);
806 
807  if( SCIPisFeasLT(scip, objcutoff, lowerbound) )
808  objcutoff = lowerbound;
809 
810  /* exit execution if the right hand side of the objective constraint does not change (suggests that the heuristic
811  * was not successful in a previous iteration) */
812  if( heurdata->objcons != NULL && SCIPisFeasEQ(scip, SCIPgetRhsLinear(heurdata->subscip, heurdata->objcons), objcutoff) )
813  return SCIP_OKAY;
814 
815  /* check whether there is enough time and memory left */
816  timelimit = 0.0;
817  memorylimit = 0.0;
818  SCIP_CALL( SCIPgetRealParam(scip, "limits/time", &timelimit) );
819  if( !SCIPisInfinity(scip, timelimit) )
820  timelimit -= SCIPgetSolvingTime(scip);
821  SCIP_CALL( SCIPgetRealParam(scip, "limits/memory", &memorylimit) );
822 
823  /* substract the memory already used by the main SCIP and the estimated memory usage of external software */
824  if( !SCIPisInfinity(scip, memorylimit) )
825  {
826  memorylimit -= SCIPgetMemUsed(scip)/1048576.0;
827  memorylimit -= SCIPgetMemExternEstim(scip)/1048576.0;
828  }
829 
830  /* abort if no time is left or not enough memory to create a copy of SCIP, including external memory usage */
831  if( timelimit <= 0.0 || memorylimit <= 2.0 * SCIPgetMemExternEstim(scip) / 1048576.0 )
832  return SCIP_OKAY;
833 
834  *result = SCIP_DIDNOTFIND;
835 
836  heurdata->lastsolidx = solidx;
837 
838  /* get variable data */
839  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
840 
841  /* create a subscip and copy the original scip instance into it */
842  if( heurdata->subscip == NULL )
843  {
844  assert(heurdata->varmapfw == NULL);
845  assert(heurdata->objcons == NULL);
846 
847  /* initialize the subproblem */
848  SCIP_CALL( SCIPcreate(&subscip) );
849 
850  /* create the variable mapping hash map */
851  SCIP_CALL( SCIPhashmapCreate(&varmapfw, SCIPblkmem(subscip), SCIPcalcHashtableSize(5 * nvars)) );
852  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &subvars, nvars) );
853 
854  /* copy complete SCIP instance */
855  valid = FALSE;
856  if( !heurdata->uselprows )
857  {
858  SCIP_CALL( SCIPcopy(scip, subscip, varmapfw, NULL, "proximity", TRUE, FALSE, TRUE, &valid) );
859  }
860  else
861  {
862  /* create the subproblem step by step, adding plugins and variables first, and finally creating
863  * linear constraints based on current LP rows */
864  SCIP_CALL( SCIPcopyPlugins(scip, subscip, FALSE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE,
865  TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, &valid) );
866  SCIP_CALL( SCIPcreateProbBasic(subscip, "proximitysub") );
867 
868  SCIP_CALL( SCIPcopyVars(scip, subscip, varmapfw, NULL, TRUE) );
869  for( i = 0; i < nvars; i++ )
870  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
871 
872  SCIP_CALL( createRows(scip, subscip, subvars) );
873  }
874  SCIPdebugMessage("Copying the SCIP instance was %s complete.\n", valid ? "" : "not ");
875 
876  /* create event handler for LP events */
877  eventhdlr = NULL;
878  SCIP_CALL( SCIPincludeEventhdlrBasic(subscip, &eventhdlr, EVENTHDLR_NAME, EVENTHDLR_DESC, eventExecProximity, NULL) );
879  if( eventhdlr == NULL )
880  {
881  SCIPerrorMessage("event handler for " HEUR_NAME " heuristic not found.\n");
882  return SCIP_PLUGINNOTFOUND;
883  }
884 
885  /* set up parameters for the copied instance */
886  SCIP_CALL( setupSubproblem(subscip) );
887 
888  /* create the objective constraint in the sub scip, first without variables and values which will be added later */
889  SCIP_CALL( SCIPcreateConsBasicLinear(subscip, &objcons, "objbound_of_origscip", 0, NULL, NULL, -SCIPinfinity(subscip), SCIPinfinity(subscip)) );
890 
891  /* determine large value to set variable bounds to, safe-guard to avoid fixings to infinite values */
892  large = SCIPinfinity(scip);
893  if( !SCIPisInfinity(scip, 0.1 / SCIPfeastol(scip)) )
894  large = 0.1 / SCIPfeastol(scip);
895  inf = SCIPinfinity(subscip);
896 
897  /* get variable image and change objective to proximity function (Manhattan distance) in sub-SCIP */
898  for( i = 0; i < nvars; i++ )
899  {
900  SCIP_Real adjustedbound;
901  SCIP_Real lb;
902  SCIP_Real ub;
903 
904  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmapfw, vars[i]);
905 
906  SCIP_CALL( SCIPchgVarObj(subscip, subvars[i], 0.0) );
907 
908  lb = SCIPvarGetLbGlobal(subvars[i]);
909  ub = SCIPvarGetUbGlobal(subvars[i]);
910 
911  /* adjust infinite bounds in order to avoid that variables with non-zero objective
912  * get fixed to infinite value in proximity subproblem
913  */
914  if( SCIPisInfinity(subscip, ub ) )
915  {
916  adjustedbound = MAX(large, lb+large);
917  adjustedbound = MIN(adjustedbound, inf);
918  SCIP_CALL( SCIPchgVarUbGlobal(subscip, subvars[i], adjustedbound) );
919  }
920  if( SCIPisInfinity(subscip, -lb ) )
921  {
922  adjustedbound = MIN(-large, ub-large);
923  adjustedbound = MAX(adjustedbound, -inf);
924  SCIP_CALL( SCIPchgVarLbGlobal(subscip, subvars[i], adjustedbound) );
925  }
926 
927  /* add all nonzero objective coefficients to the objective constraint */
928  if( !SCIPisFeasZero(subscip, SCIPvarGetObj(vars[i])) )
929  {
930  SCIP_CALL( SCIPaddCoefLinear(subscip, objcons, subvars[i], SCIPvarGetObj(vars[i])) );
931  }
932  }
933 
934  /* add objective constraint to the subscip */
935  SCIP_CALL( SCIPaddCons(subscip, objcons) );
936  }
937  else
938  {
939  /* the instance, event handler, hash map and variable array were already copied in a previous iteration
940  * and stored in heuristic data
941  */
942  assert(heurdata->varmapfw != NULL);
943  assert(heurdata->subvars != NULL);
944  assert(heurdata->objcons != NULL);
945 
946  subscip = heurdata->subscip;
947  varmapfw = heurdata->varmapfw;
948  subvars = heurdata->subvars;
949  objcons = heurdata->objcons;
950 
951  eventhdlr = SCIPfindEventhdlr(subscip, EVENTHDLR_NAME);
952  assert(eventhdlr != NULL);
953  }
954 
955  SCIP_CALL( SCIPchgRhsLinear(subscip, objcons, objcutoff) );
956 
957  for( i = 0; i < SCIPgetNBinVars(scip); ++i )
958  {
959  SCIP_Real solval;
960 
961  /* objective coefficients are only set for binary variables of the problem */
962  assert(SCIPvarIsBinary(subvars[i]));
963 
964  solval = SCIPgetSolVal(scip, incumbent, vars[i]);
965  assert(SCIPisFeasEQ(scip, solval, 1.0) || SCIPisFeasEQ(scip, solval, 0.0));
966 
967  if( solval < 0.5 )
968  {
969  SCIP_CALL( SCIPchgVarObj(subscip, subvars[i], 1.0) );
970  }
971  else
972  {
973  SCIP_CALL( SCIPchgVarObj(subscip, subvars[i], -1.0) );
974  }
975  }
976 
977  /* disable statistic timing inside sub SCIP */
978  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
979 
980  /* set limits for the subproblem */
981  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", nnodes) );
982  SCIP_CALL( SCIPsetIntParam(subscip, "limits/solutions", 1) );
983  SCIP_CALL( SCIPsetRealParam(subscip, "limits/time", timelimit) );
984  SCIP_CALL( SCIPsetRealParam(subscip, "limits/memory", memorylimit) );
985 
986  /* restrict LP iterations */
987  /*todo set iterations limit depending on the number of iterations of the original problem root */
988  iterlim = nlpiters;
989  SCIP_CALL( SCIPsetLongintParam(subscip, "lp/iterlim", MAX(1, iterlim / MIN(10, nnodes))) );
990  SCIP_CALL( SCIPsetLongintParam(subscip, "lp/rootiterlim", iterlim) );
991 
992  /* catch LP events of sub-SCIP */
993  SCIP_CALL( SCIPtransformProb(subscip) );
994  SCIP_CALL( SCIPcatchEvent(subscip, SCIP_EVENTTYPE_NODESOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, NULL) );
995 
996  SCIPstatisticMessage("solving subproblem at Node: %" SCIP_LONGINT_FORMAT " "
997  "nnodes: %" SCIP_LONGINT_FORMAT " "
998  "iterlim: %" SCIP_LONGINT_FORMAT "\n", SCIPgetNNodes(scip), nnodes, iterlim);
999 
1000  /* solve the subproblem with all previously adjusted parameters */
1001  nfixedvars = SCIPgetNFixedVars(subscip);
1002 
1003  SCIP_CALL( SCIPpresolve(subscip) );
1004 
1005  nfixedvars = SCIPgetNFixedVars(subscip) - nfixedvars;
1006  assert(nfixedvars >= 0);
1007  SCIPstatisticMessage("presolve fixings %d: %d\n", ++(heurdata->subprobidx), nfixedvars);
1008  retcode = SCIPsolve(subscip);
1009 
1010  SCIPstatisticMessage("solve of subscip %d:"
1011  "usednodes: %" SCIP_LONGINT_FORMAT " "
1012  "lp iters: %" SCIP_LONGINT_FORMAT " "
1013  "root iters: %" SCIP_LONGINT_FORMAT " "
1014  "Presolving Time: %.2f\n", heurdata->subprobidx,
1015  SCIPgetNNodes(subscip), SCIPgetNLPIterations(subscip), SCIPgetNRootLPIterations(subscip), SCIPgetPresolvingTime(subscip));
1016 
1017  SCIPstatisticMessage("Solving Time %d: %.2f\n", heurdata->subprobidx, SCIPgetSolvingTime(subscip) );
1018  /* drop LP events of sub-SCIP */
1019  SCIP_CALL( SCIPdropEvent(subscip, SCIP_EVENTTYPE_NODESOLVED, eventhdlr, (SCIP_EVENTDATA*) heurdata, -1) );
1020 
1021  /* errors in solving the subproblem should not kill the overall solving process;
1022  * hence, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
1023  */
1024  if( retcode != SCIP_OKAY )
1025  {
1026 #ifndef NDEBUG
1027  SCIP_CALL( retcode );
1028 #endif
1029  SCIPwarningMessage(scip, "Error while solving subproblem in proximity heuristic; sub-SCIP terminated with code <%d>\n",retcode);
1030  }
1031 
1032  /* print solving statistics of subproblem if we are in SCIP's debug mode */
1033  SCIPdebug( SCIP_CALL( SCIPprintStatistics(subscip, NULL) ) );
1034 
1035  /* keep track of relevant information for future runs of heuristic */
1036  if( nusednodes != NULL )
1037  *nusednodes = SCIPgetNNodes(subscip);
1038  if( nusedlpiters != NULL )
1039  *nusedlpiters = SCIPgetNLPIterations(subscip);
1040 
1041  /* check whether a solution was found */
1042  nsubsols = SCIPgetNSols(subscip);
1043  incumbent = SCIPgetBestSol(subscip);
1044  assert(nsubsols == 0 || incumbent != NULL);
1045 
1046  SCIPstatisticMessage("primal bound before subproblem %d: %g\n", heurdata->subprobidx, SCIPgetPrimalbound(scip));
1047  if( nsubsols > 0 )
1048  {
1049  /* try to translate the sub problem solution to the original scip instance */
1050  SCIP_Bool success;
1051 
1052  success = FALSE;
1053  SCIP_CALL( createNewSol(scip, subscip, subvars, heur, incumbent, heurdata->usefinallp, &success) );
1054 
1055  if( success )
1056  *result = SCIP_FOUNDSOL;
1057  }
1058  SCIPstatisticMessage("primal bound after subproblem %d: %g\n", heurdata->subprobidx, SCIPgetPrimalbound(scip));
1059 
1060  /* free the transformed subproblem data */
1061  SCIP_CALL( SCIPfreeTransform(subscip) );
1062 
1063  /* save subproblem in heuristic data for subsequent runs if it has been successful, otherwise free subproblem */
1064  heurdata->subscip = subscip;
1065  heurdata->varmapfw = varmapfw;
1066  heurdata->subvars = subvars;
1067  heurdata->objcons = objcons;
1068  heurdata->nsubvars = nvars;
1069 
1070  /* delete the sub problem */
1071  if( freesubscip )
1072  {
1073  SCIP_CALL( deleteSubproblem(scip, heurdata) );
1074  }
1075 
1076  return SCIP_OKAY;
1077 }
1078 
1079 
1080 /** creates the proximity primal heuristic and includes it in SCIP */
1082  SCIP* scip /**< SCIP data structure */
1083  )
1084 {
1085  SCIP_HEURDATA* heurdata;
1086  SCIP_HEUR* heur;
1087 
1088  /* create heuristic data */
1089  SCIP_CALL( SCIPallocMemory(scip, &heurdata) );
1090 
1091  /* include primal heuristic */
1092  heur = NULL;
1093  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
1095  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecProximity, heurdata) );
1096  assert(heur != NULL);
1097 
1098  /* set non-NULL pointers to callback methods */
1099  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyProximity) );
1100  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeProximity) );
1101  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitProximity) );
1102  SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolProximity) );
1103 
1104  /* add proximity primal heuristic parameters */
1105  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/uselprows", "should subproblem be constructed based on LP row information?",
1106  &heurdata->uselprows, TRUE, DEFAULT_USELPROWS, NULL, NULL) );
1107 
1108  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/restart", "should the heuristic immediately run again on its newly found solution?",
1109  &heurdata->restart, TRUE, DEFAULT_RESTART, NULL, NULL) );
1110 
1111  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/usefinallp", "should the heuristic solve a final LP in case of continuous objective variables?",
1112  &heurdata->usefinallp, TRUE, DEFAULT_USEFINALLP, NULL, NULL) );
1113 
1114  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/maxnodes",
1115  "maximum number of nodes to regard in the subproblem",
1116  &heurdata->maxnodes, TRUE,DEFAULT_MAXNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1117 
1118  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/nodesofs",
1119  "number of nodes added to the contingent of the total nodes",
1120  &heurdata->nodesofs, TRUE, DEFAULT_NODESOFS, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1121 
1122  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/minnodes",
1123  "minimum number of nodes required to start the subproblem",
1124  &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1125 
1126  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/maxlpiters",
1127  "maximum number of LP iterations to be performed in the subproblem",
1128  &heurdata->maxlpiters, TRUE, DEFAULT_MAXLPITERS, -1LL, SCIP_LONGINT_MAX, NULL, NULL) );
1129 
1130  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/minlpiters", "minimum number of LP iterations performed in "
1131  "subproblem", &heurdata->minlpiters, TRUE, DEFAULT_MINLPITERS, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1132 
1133  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/waitingnodes",
1134  "waiting nodes since last incumbent before heuristic is executed", &heurdata->waitingnodes, TRUE, DEFAULT_WAITINGNODES,
1135  0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1136 
1137  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minimprove",
1138  "factor by which proximity should at least improve the incumbent",
1139  &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) );
1140 
1141  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/nodesquot", "sub-MIP node limit w.r.t number of original nodes",
1142  &heurdata->nodesquot, TRUE, DEFAULT_NODESQUOT, 0.0, SCIPinfinity(scip), NULL, NULL) );
1143 
1144  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/binvarquot",
1145  "threshold for percentage of binary variables required to start",
1146  &heurdata->binvarquot, TRUE, DEFAULT_BINVARQUOT, 0.0, 1.0, NULL, NULL) );
1147 
1148  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/lpitersquot",
1149  "quotient of sub-MIP LP iterations with respect to LP iterations so far",
1150  &heurdata->lpitersquot, TRUE, DEFAULT_LPITERSQUOT, 0.0, 1.0, NULL, NULL) );
1151 
1152  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/mingap",
1153  "minimum primal-dual gap for which the heuristic is executed",
1154  &heurdata->mingap, TRUE, DEFAULT_MINGAP, 0.0, SCIPinfinity(scip), NULL, NULL) );
1155 
1156  return SCIP_OKAY;
1157 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:51
SCIP_RETCODE SCIPcreateConsBasicLinear(SCIP *scip, SCIP_CONS **cons, const char *name, int nvars, SCIP_VAR **vars, SCIP_Real *vals, SCIP_Real lhs, SCIP_Real rhs)
#define DEFAULT_USELPROWS
SCIP_Bool SCIPisZero(SCIP *scip, SCIP_Real val)
Definition: scip.c:41685
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
Definition: scip.c:40329
int SCIPgetNVars(SCIP *scip)
Definition: scip.c:10698
SCIP_CONSHDLR * SCIPfindConshdlr(SCIP *scip, const char *name)
Definition: scip.c:5878
#define SCIPallocMemory(scip, ptr)
Definition: scip.h:20526
SCIP_HEUR * SCIPsolGetHeur(SCIP_SOL *sol)
Definition: sol.c:2252
#define DEFAULT_MINIMPROVE
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
Definition: scip.c:41648
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1147
SCIP_RETCODE SCIPincludeHeurProximity(SCIP *scip)
#define SCIPfreeBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20573
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip.c:7297
SCIP_Real SCIPgetObjNorm(SCIP *scip)
Definition: scip.c:10351
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:16623
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip.c:1248
SCIP_Longint SCIPgetNRootLPIterations(SCIP *scip)
Definition: scip.c:37472
static SCIP_DECL_EVENTEXEC(eventExecProximity)
SCIP_Bool SCIPisFeasLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41920
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
Definition: scip.c:37454
#define EVENTHDLR_DESC
static SCIP_DECL_HEURCOPY(heurCopyProximity)
#define NULL
Definition: lpi_spx.cpp:130
static SCIP_RETCODE solveLp(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *success)
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip.c:1125
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
Definition: scip.c:42032
SCIP_Real SCIProwGetLhs(SCIP_ROW *row)
Definition: lp.c:18915
SCIP_COL ** SCIProwGetCols(SCIP_ROW *row)
Definition: lp.c:18861
SCIP_Real SCIPvarGetUbGlobal(SCIP_VAR *var)
Definition: var.c:17067
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip.c:34843
static SCIP_DECL_HEURINIT(heurInitProximity)
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 DEFAULT_BINVARQUOT
SCIP_RETCODE SCIPchgVarUbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:31772
static SCIP_RETCODE deleteSubproblem(SCIP *scip, SCIP_HEURDATA *heurdata)
SCIP_HEUR * SCIPfindHeur(SCIP *scip, const char *name)
Definition: scip.c:7393
#define FALSE
Definition: def.h:56
SCIP_Real SCIPgetSolTransObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35113
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2057
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip.c:41009
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip.c:4046
static SCIP_RETCODE createRows(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars)
#define HEUR_MAXDEPTH
#define DEFAULT_USEFINALLP
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
#define TRUE
Definition: def.h:55
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
#define SCIPstatisticMessage
Definition: pub_message.h:104
#define SCIP_CALL(x)
Definition: def.h:266
SCIP_Bool SCIPisFeasZero(SCIP *scip, SCIP_Real val)
Definition: scip.c:41972
SCIP_RETCODE SCIPsetRealParam(SCIP *scip, const char *name, SCIP_Real value)
Definition: scip.c:4109
SCIP_RETCODE SCIPchgVarObj(SCIP *scip, SCIP_VAR *var, SCIP_Real newobj)
Definition: scip.c:19590
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip.h:20556
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip.c:26439
SCIP_RETCODE SCIPfreeTransform(SCIP *scip)
Definition: scip.c:15373
SCIP_RETCODE SCIPaddLongintParam(SCIP *scip, const char *name, const char *desc, SCIP_Longint *valueptr, SCIP_Bool isadvanced, SCIP_Longint defaultvalue, SCIP_Longint minvalue, SCIP_Longint maxvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip.c:3601
#define SCIPdebugMessage
Definition: pub_message.h:77
SCIP_Real SCIPgetGap(SCIP *scip)
Definition: scip.c:38643
SCIP_Real SCIPgetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var)
Definition: scip.c:34983
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:16905
#define HEUR_FREQ
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2116
SCIP_Real SCIProwGetConstant(SCIP_ROW *row)
Definition: lp.c:18881
#define SCIP_LONGINT_MAX
Definition: def.h:113
SCIP_RETCODE SCIPreleaseCons(SCIP *scip, SCIP_CONS **cons)
Definition: scip.c:24949
#define HEUR_PRIORITY
SCIP_RETCODE SCIPstartDive(SCIP *scip)
Definition: scip.c:31575
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
Definition: scip.c:42044
SCIP_Real SCIPgetLowerbound(SCIP *scip)
Definition: scip.c:38393
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:35066
SCIP_EVENTHDLR * SCIPfindEventhdlr(SCIP *scip, const char *name)
Definition: scip.c:7908
SCIP_RETCODE SCIPchgVarLbDive(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:31740
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_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16562
SCIP_RETCODE SCIPapplyProximity(SCIP *scip, SCIP_HEUR *heur, SCIP_RESULT *result, SCIP_Real minimprove, SCIP_Longint nnodes, SCIP_Longint nlpiters, SCIP_Longint *nusednodes, SCIP_Longint *nusedlpiters, SCIP_Bool freesubscip)
SCIP_RETCODE SCIPcreateProbBasic(SCIP *scip, const char *name)
Definition: scip.c:9077
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
Definition: var.c:16634
int SCIPgetNOrigVars(SCIP *scip)
Definition: scip.c:11138
SCIP_Bool SCIPisLPConstructed(SCIP *scip)
Definition: scip.c:26372
#define SCIPfreeMemory(scip, ptr)
Definition: scip.h:20542
#define HEUR_NAME
SCIP_RETCODE SCIPinterruptSolve(SCIP *scip)
Definition: scip.c:15442
#define DEFAULT_MINLPITERS
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 DEFAULT_LPITERSQUOT
SCIP_RETCODE SCIPchgVarUbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:20049
#define SCIPerrorMessage
Definition: pub_message.h:45
SCIP_Real SCIProwGetRhs(SCIP_ROW *row)
Definition: lp.c:18925
#define HEUR_FREQOFS
SCIP_Bool SCIPisObjIntegral(SCIP *scip)
Definition: scip.c:10310
#define HEUR_TIMING
int SCIPcalcHashtableSize(int minsize)
Definition: misc.c:1157
SCIP_Bool SCIPisNLPConstructed(SCIP *scip)
Definition: scip.c:28407
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
static SCIP_RETCODE createNewSol(SCIP *scip, SCIP *subscip, SCIP_VAR **subvars, SCIP_HEUR *heur, SCIP_SOL *subsol, SCIP_Bool usefinallp, SCIP_Bool *success)
SCIP_Bool SCIProwIsLocal(SCIP_ROW *row)
Definition: lp.c:19024
struct SCIP_EventData SCIP_EVENTDATA
Definition: type_event.h:146
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2075
SCIP_Real SCIPgetRhsLinear(SCIP *scip, SCIP_CONS *cons)
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip.c:4457
#define DEFAULT_MAXNODES
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
static SCIP_RETCODE setupSubproblem(SCIP *subscip)
SCIP_Real SCIPinfinity(SCIP *scip)
Definition: scip.c:41637
#define EVENTHDLR_NAME
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip.c:14342
static SCIP_DECL_HEUREXEC(heurExecProximity)
#define DEFAULT_NODESOFS
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip.c:766
const char * SCIProwGetName(SCIP_ROW *row)
Definition: lp.c:18974
#define DEFAULT_NODESQUOT
SCIP_RETCODE SCIPtransformProb(SCIP *scip)
Definition: scip.c:12623
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1068
#define DEFAULT_MAXLPITERS
#define DEFAULT_MINGAP
#define SCIP_Bool
Definition: def.h:53
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip.c:4001
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip.c:3709
SCIP_Longint SCIPsolGetNodenum(SCIP_SOL *sol)
Definition: sol.c:2232
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
#define DEFAULT_MINNODES
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
Definition: scip.c:7377
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, .
int SCIPsolGetIndex(SCIP_SOL *sol)
Definition: sol.c:2283
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip.c:34648
SCIP_Bool SCIPsolIsOriginal(SCIP_SOL *sol)
Definition: sol.c:2179
#define SCIP_EVENTTYPE_NODESOLVED
Definition: type_event.h:110
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip.c:7329
SCIP_RETCODE SCIPaddCoefLinear(SCIP *scip, SCIP_CONS *cons, SCIP_VAR *var, SCIP_Real val)
SCIP_RETCODE SCIPaddCons(SCIP *scip, SCIP_CONS *cons)
Definition: scip.c:11477
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip.c:14503
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip.h:20585
SCIP_Real SCIPvarGetLbGlobal(SCIP_VAR *var)
Definition: var.c:17057
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip.c:692
#define HEUR_DESC
SCIP_RETCODE SCIPdropEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int filterpos)
Definition: scip.c:36588
int SCIPgetNFixedVars(SCIP *scip)
Definition: scip.c:11015
#define DEFAULT_WAITINGNODES
SCIP_Longint SCIPgetNSolsFound(SCIP *scip)
Definition: scip.c:38746
static SCIP_DECL_HEURFREE(heurFreeProximity)
SCIP_RETCODE SCIPendDive(SCIP *scip)
Definition: scip.c:31618
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 SCIPgetPrimalbound(SCIP *scip)
Definition: scip.c:38510
SCIP_Real * SCIProwGetVals(SCIP_ROW *row)
Definition: lp.c:18871
const char * SCIPeventhdlrGetName(SCIP_EVENTHDLR *eventhdlr)
Definition: event.c:278
SCIP_Bool SCIPisFeasLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
Definition: scip.c:41933
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
SCIP_RETCODE SCIPdeleteSubproblemProximity(SCIP *scip)
#define SCIP_Real
Definition: def.h:127
#define MIN(x, y)
Definition: memory.c:67
SCIP_RETCODE SCIPchgRhsLinear(SCIP *scip, SCIP_CONS *cons, SCIP_Real rhs)
SCIP_RETCODE SCIPchgVarLbGlobal(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip.c:19972
SCIP_Real SCIPfeastol(SCIP *scip)
Definition: scip.c:41146
static SCIP_DECL_HEUREXITSOL(heurExitsolProximity)
#define SCIP_Longint
Definition: def.h:112
SCIP_EVENTTYPE SCIPeventGetType(SCIP_EVENT *event)
Definition: event.c:917
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 SCIPcopyPlugins(SCIP *sourcescip, SCIP *targetscip, SCIP_Bool copyreaders, SCIP_Bool copypricers, SCIP_Bool copyconshdlrs, SCIP_Bool copyconflicthdlrs, SCIP_Bool copypresolvers, SCIP_Bool copyrelaxators, SCIP_Bool copyseparators, SCIP_Bool copypropagators, SCIP_Bool copyheuristics, SCIP_Bool copyeventhdlrs, SCIP_Bool copynodeselectors, SCIP_Bool copybranchrules, SCIP_Bool copydisplays, SCIP_Bool copydialogs, SCIP_Bool copynlpis, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip.c:1510
SCIP_RETCODE SCIPgetRealParam(SCIP *scip, const char *name, SCIP_Real *value)
Definition: scip.c:3797
int SCIPgetNObjVars(SCIP *scip)
Definition: scip.c:10926
#define SCIPdebug(x)
Definition: pub_message.h:74
#define HEUR_DISPCHAR
SCIP_NODESEL * SCIPfindNodesel(SCIP *scip, const char *name)
Definition: scip.c:8124
SCIP_VAR * SCIPcolGetVar(SCIP_COL *col)
Definition: lp.c:18685
SCIP_RETCODE SCIPsolveDiveLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition: scip.c:31999
SCIP_Longint SCIPgetNRootFirstLPIterations(SCIP *scip)
Definition: scip.c:37491
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
#define HEUR_USESSUBSCIP
#define DEFAULT_RESTART
SCIP_Real SCIPgetPresolvingTime(SCIP *scip)
Definition: scip.c:41073
improvement heuristic which uses an auxiliary objective instead of the original objective function wh...
SCIP_RETCODE SCIPtrySol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *stored)
Definition: scip.c:36217
SCIP_Longint SCIPgetNNodes(SCIP *scip)
Definition: scip.c:37372
SCIP_RETCODE SCIPcatchEvent(SCIP *scip, SCIP_EVENTTYPE eventtype, SCIP_EVENTHDLR *eventhdlr, SCIP_EVENTDATA *eventdata, int *filterpos)
Definition: scip.c:36554
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip.c:34607
SCIP_Longint SCIPgetMemExternEstim(SCIP *scip)
Definition: scip.c:41409