Scippy

SCIP

Solving Constraint Integer Programs

heur_vbounds.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-2022 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 scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file heur_vbounds.c
17  * @ingroup DEFPLUGINS_HEUR
18  * @brief LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood
19  * @author Timo Berthold
20  * @author Stefan Heinz
21  * @author Jens Schulz
22  * @author Gerald Gamrath
23  *
24  * @todo allow smaller fixing rate for probing LP?
25  * @todo allow smaller fixing rate after presolve if total number of variables is small (<= 1000)?
26  *
27  * More details about the heuristic can be found in@n
28  * Structure-Based Primal Heuristics for Mixed Integer Programming@n
29  * Gerald Gamrath, Timo Berthold, Stefan Heinz, and Michael Winkler@n
30  * Optimization in the Real World, Volume 13 of the series Mathematics for Industry, pp 37-53@n
31  * Preliminary version available as <a href="https://opus4.kobv.de/opus4-zib/frontdoor/index/index/docId/5551">ZIB-Report 15-26</a>.
32  */
33 
34 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
35 
36 #include "blockmemshell/memory.h"
37 #include "scip/heur_locks.h"
38 #include "scip/heur_vbounds.h"
39 #include "scip/pub_heur.h"
40 #include "scip/pub_implics.h"
41 #include "scip/pub_message.h"
42 #include "scip/pub_misc.h"
43 #include "scip/pub_tree.h"
44 #include "scip/pub_var.h"
45 #include "scip/scip_branch.h"
46 #include "scip/scip_cons.h"
47 #include "scip/scip_copy.h"
48 #include "scip/scip_general.h"
49 #include "scip/scip_heur.h"
50 #include "scip/scip_lp.h"
51 #include "scip/scip_mem.h"
52 #include "scip/scip_message.h"
53 #include "scip/scip_numerics.h"
54 #include "scip/scip_param.h"
55 #include "scip/scip_prob.h"
56 #include "scip/scip_probing.h"
57 #include "scip/scip_sol.h"
58 #include "scip/scip_solve.h"
59 #include "scip/scip_solvingstats.h"
60 #include "scip/scip_timing.h"
61 #include "scip/scip_tree.h"
62 #include "scip/scip_var.h"
63 #include <string.h>
64 
65 #ifdef SCIP_STATISTIC
66 #include "scip/clock.h"
67 #endif
68 
69 #define VBOUNDVARIANT_NOOBJ 0x001u
70 #define VBOUNDVARIANT_BESTBOUND 0x002u
71 #define VBOUNDVARIANT_WORSTBOUND 0x004u
72 
73 #define HEUR_NAME "vbounds"
74 #define HEUR_DESC "LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood"
75 #define HEUR_DISPCHAR SCIP_HEURDISPCHAR_PROP
76 #define HEUR_PRIORITY 2500
77 #define HEUR_FREQ 0
78 #define HEUR_FREQOFS 0
79 #define HEUR_MAXDEPTH -1
80 #define HEUR_TIMING SCIP_HEURTIMING_BEFORENODE
81 #define HEUR_USESSUBSCIP TRUE /**< does the heuristic use a secondary SCIP instance? */
82 
83 #define DEFAULT_MAXNODES 5000LL /**< maximum number of nodes to regard in the subproblem */
84 #define DEFAULT_MININTFIXINGRATE 0.65 /**< minimum percentage of integer variables that have to be fixed */
85 #define DEFAULT_MINMIPFIXINGRATE 0.65 /**< minimuskipobjm percentage of variables that have to be fixed within sub-SCIP
86  * (integer and continuous) */
87 #define DEFAULT_MINIMPROVE 0.01 /**< factor by which vbounds heuristic should at least improve the
88  * incumbent */
89 #define DEFAULT_MINNODES 500LL /**< minimum number of nodes to regard in the subproblem */
90 #define DEFAULT_NODESOFS 500LL /**< number of nodes added to the contingent of the total nodes */
91 #define DEFAULT_NODESQUOT 0.1 /**< subproblem nodes in relation to nodes of the original problem */
92 #define DEFAULT_MAXPROPROUNDS 2 /**< maximum number of propagation rounds during probing */
93 #define DEFAULT_MAXBACKTRACKS 10 /**< maximum number of backtracks during the fixing process */
94 #define DEFAULT_COPYCUTS TRUE /**< should all active cuts from the cutpool of the original scip be copied to
95  * constraints of the subscip? */
96 #define DEFAULT_USELOCKFIXINGS FALSE /**< should more variables be fixed based on variable locks if
97  * the fixing rate was not reached?
98  */
99 
100 /** which variants of the vbounds heuristic that try to stay feasible should be called? */
101 #define DEFAULT_FEASVARIANT (VBOUNDVARIANT_BESTBOUND | VBOUNDVARIANT_WORSTBOUND)
102 
103 /** which tightening variants of the vbounds heuristic should be called? */
104 #define DEFAULT_TIGHTENVARIANT (VBOUNDVARIANT_NOOBJ | VBOUNDVARIANT_BESTBOUND | VBOUNDVARIANT_WORSTBOUND)
105 
107 /*
108  * Data structures
109  */
110 
111 /** primal heuristic data */
112 struct SCIP_HeurData
113 {
114  SCIP_VAR** vbvars; /**< topological sorted variables with respect to the variable bounds */
115  SCIP_BOUNDTYPE* vbbounds; /**< topological sorted variables with respect to the variable bounds */
116  int nvbvars; /**< number of variables in variable lower bound array */
117  SCIP_Longint maxnodes; /**< maximum number of nodes to regard in the subproblem */
118  SCIP_Longint minnodes; /**< minimum number of nodes to regard in the subproblem */
119  SCIP_Longint nodesofs; /**< number of nodes added to the contingent of the total nodes */
120  SCIP_Longint usednodes; /**< nodes already used by vbounds heuristic in earlier calls */
121  SCIP_Real minintfixingrate; /**< minimum percentage of integer variables that have to be fixed */
122  SCIP_Real minmipfixingrate; /**< minimum percentage of variables that have to be fixed within sub-SCIP
123  * (integer and continuous) */
124  SCIP_Real minimprove; /**< factor by which vbounds heuristic should at least improve the incumbent */
125  SCIP_Real nodesquot; /**< subproblem nodes in relation to nodes of the original problem */
126  SCIP_Real cutoffbound;
127  int maxproprounds; /**< maximum number of propagation rounds during probing */
128  int maxbacktracks; /**< maximum number of backtracks during the fixing process */
129  int feasvariant; /**< which variants of the vbounds heuristic that try to stay feasible
130  * should be called? */
131  int tightenvariant; /**< which tightening variants of the vbounds heuristic should be called? */
132  SCIP_Bool initialized; /**< is the candidate list initialized? */
133  SCIP_Bool applicable; /**< is the heuristic applicable? */
134  SCIP_Bool copycuts; /**< should all active cuts from cutpool be copied to constraints in
135  * subproblem? */
136  SCIP_Bool uselockfixings; /**< should more variables be fixed based on variable locks if
137  * the fixing rate was not reached? */
138 };
139 
140 /**@name Heuristic defines
141  *
142  * @{
143  *
144  * The heuristic works on indices representing a bound of a variable. This index will be called bound index in the
145  * following. For a given active variable with problem index i (note that active variables have problem indices
146  * between 0 and nactivevariable - 1), the bound index of its lower bound is 2*i, the bound index of its upper
147  * bound is 2*i + 1. The other way around, a given bound index i corresponds to the variable with problem index
148  * i/2 (rounded down), and to the lower bound, if i is even, to the upper bound if i is odd.
149  * The following macros can be used to convert bound index into variable problem index and boundtype and vice versa.
150  */
151 #define getLbIndex(idx) (2*(idx))
152 #define getUbIndex(idx) (2*(idx)+1)
153 #define getVarIndex(idx) ((idx)/2)
154 #define getBoundtype(idx) (((idx) % 2 == 0) ? SCIP_BOUNDTYPE_LOWER : SCIP_BOUNDTYPE_UPPER)
155 #define isIndexLowerbound(idx) ((idx) % 2 == 0)
156 #define getOtherBoundIndex(idx) (((idx) % 2 == 0) ? (idx) + 1 : (idx) - 1)
159 /*
160  * Local methods
161  */
162 
163 /** reset heuristic data structure */
164 static
165 void heurdataReset(
166  SCIP_HEURDATA* heurdata /**< structure containing heurdata */
167  )
168 {
169  heurdata->vbvars = NULL;
170  heurdata->vbbounds = NULL;
171  heurdata->nvbvars = 0;
172  heurdata->initialized = FALSE;
173  heurdata->applicable = FALSE;
174 }
175 
176 
177 /** performs depth-first-search in the implicitly given directed graph from the given start index */
178 static
180  SCIP* scip, /**< SCIP data structure */
181  int startnode, /**< node to start the depth-first-search */
182  SCIP_Shortbool* visited, /**< array to store for each node, whether it was already visited */
183  int* dfsstack, /**< array of size number of nodes to store the stack;
184  * only needed for performance reasons */
185  int* stacknextedge, /**< array of size number of nodes to store the number of adjacent nodes
186  * already visited for each node on the stack; only needed for
187  * performance reasons */
188  int* stacknextcliquevar, /**< array of size number of nodes to store the number of variables
189  * already evaluated for the clique currently being evaluated */
190  int* cliqueexit, /**< exit node when entering a clique */
191  int* dfsnodes, /**< array of nodes that can be reached starting at startnode, in reverse
192  * dfs order */
193  int* ndfsnodes /**< pointer to store number of nodes that can be reached starting at
194  * startnode */
195  )
196 {
197  SCIP_VAR** vars;
198  SCIP_VAR* startvar;
199  SCIP_VAR** vbvars;
200  SCIP_Real* coefs;
201  SCIP_Bool lower;
202  SCIP_Bool found;
203  int maxstacksize;
204  int stacksize;
205  int curridx;
206  int idx;
207  int nvbvars;
208  int i;
209 
210  assert(startnode >= 0);
211  assert(startnode < 2 * SCIPgetNVars(scip));
212  assert(visited != NULL);
213  assert(visited[startnode] == FALSE);
214  assert(dfsstack != NULL);
215  assert(dfsnodes != NULL);
216  assert(ndfsnodes != NULL);
217 
218  vars = SCIPgetVars(scip);
219 
220  /* put start node on the stack */
221  dfsstack[0] = startnode;
222  stacknextcliquevar[0] = 0;
223  stacknextedge[0] = 0;
224  maxstacksize = 1;
225  stacksize = 1;
226  idx = -1;
227 
228  /* we run until no more bounds indices are on the stack */
229  while( stacksize > 0 )
230  {
231  /* get next node from stack */
232  curridx = dfsstack[stacksize - 1];
233 
234  /* mark current node as visited */
235  assert(visited[curridx] == (stacknextedge[stacksize - 1] != 0));
236  visited[curridx] = TRUE;
237  found = FALSE;
238 
239  startvar = vars[getVarIndex(curridx)];
240  lower = isIndexLowerbound(curridx);
241 
242  if( stacknextedge[stacksize - 1] >= 0 )
243  {
244  /* go over edges corresponding to varbounds */
245  if( lower )
246  {
247  vbvars = SCIPvarGetVlbVars(startvar);
248  coefs = SCIPvarGetVlbCoefs(startvar);
249  nvbvars = SCIPvarGetNVlbs(startvar);
250  }
251  else
252  {
253  vbvars = SCIPvarGetVubVars(startvar);
254  coefs = SCIPvarGetVubCoefs(startvar);
255  nvbvars = SCIPvarGetNVubs(startvar);
256  }
257 
258  /* iterate over all vbounds for the given bound */
259  for( i = stacknextedge[stacksize - 1]; i < nvbvars; ++i )
260  {
261  if( !SCIPvarIsActive(vbvars[i]) )
262  continue;
263 
264  idx = (SCIPisPositive(scip, coefs[i]) == lower) ? getLbIndex(SCIPvarGetProbindex(vbvars[i])) : getUbIndex(SCIPvarGetProbindex(vbvars[i]));
265  assert(idx >= 0);
266 
267  /* break when the first unvisited node is reached */
268  if( !visited[idx] )
269  break;
270  }
271 
272  /* we stopped because we found an unhandled node and not because we reached the end of the list */
273  if( i < nvbvars )
274  {
275  assert(!visited[idx]);
276 
277  /* put the adjacent node onto the stack */
278  dfsstack[stacksize] = idx;
279  stacknextedge[stacksize] = 0;
280  stacknextcliquevar[stacksize] = 0;
281  stacknextedge[stacksize - 1] = i + 1;
282  stacksize++;
283  assert(stacksize <= 2* SCIPgetNVars(scip));
284 
285  /* restart while loop, get next index from stack */
286  continue;
287  }
288  }
289 
290  stacknextedge[stacksize - 1] = -1;
291 
292  /* treat cliques */
293  if( SCIPvarIsBinary(startvar) )
294  {
295  SCIP_CLIQUE** cliques = SCIPvarGetCliques(startvar, !lower);
296  int ncliques = SCIPvarGetNCliques(startvar, !lower);
297  int j;
298 
299  /* iterate over all not yet handled cliques and search for an unvisited node */
300  for( j = -stacknextedge[stacksize - 1] - 1; j < ncliques; ++j )
301  {
302  SCIP_VAR** cliquevars;
303  SCIP_Bool* cliquevals;
304  int ncliquevars;
305 
306  /* the first time we evaluate this clique for the current node */
307  if( stacknextcliquevar[stacksize - 1] == 0 )
308  {
309  if( cliqueexit[SCIPcliqueGetIndex(cliques[j])] > 0 )
310  {
311  if( !visited[cliqueexit[SCIPcliqueGetIndex(cliques[j])] - 1] &&
312  cliqueexit[SCIPcliqueGetIndex(cliques[j])] - 1 != curridx )
313  {
314  stacknextedge[stacksize - 1] = -j - 2;
315  stacknextcliquevar[stacksize - 1] = 0;
316  idx = cliqueexit[SCIPcliqueGetIndex(cliques[j])] - 1;
317  cliqueexit[SCIPcliqueGetIndex(cliques[j])] = -1;
318  found = TRUE;
319  }
320  else
321  continue;
322  }
323  else if( cliqueexit[SCIPcliqueGetIndex(cliques[j])] == 0 )
324  {
325  cliqueexit[SCIPcliqueGetIndex(cliques[j])] = getOtherBoundIndex(curridx) + 1;
326  }
327  else
328  continue;
329  }
330  if( !found )
331  {
332  cliquevars = SCIPcliqueGetVars(cliques[j]);
333  cliquevals = SCIPcliqueGetValues(cliques[j]);
334  ncliquevars = SCIPcliqueGetNVars(cliques[j]);
335 
336  for( i = 0; i < ncliquevars; ++i )
337  {
338  if( cliquevars[i] == startvar )
339  continue;
340 
341  if( SCIPvarGetIndex(cliquevars[i]) < 0 )
342  continue;
343 
344  if( cliquevals[i] )
345  idx = getLbIndex(SCIPvarGetProbindex(cliquevars[i]));
346  else
347  idx = getUbIndex(SCIPvarGetProbindex(cliquevars[i]));
348 
349  assert(idx >= 0 && idx < 2 * SCIPgetNVars(scip));
350 
351  /* break when the first unvisited node is reached */
352  if( idx >= 0 && !visited[idx] )
353  {
354  if( i < ncliquevars - 1 )
355  {
356  stacknextedge[stacksize - 1] = -j - 1;
357  stacknextcliquevar[stacksize - 1] = i + 1;
358  }
359  else
360  {
361  stacknextedge[stacksize - 1] = -j - 2;
362  stacknextcliquevar[stacksize - 1] = 0;
363  }
364  found = TRUE;
365  break;
366  }
367  }
368  }
369  if( found )
370  {
371  assert(!visited[idx]);
372 
373  /* put the adjacent node onto the stack */
374  dfsstack[stacksize] = idx;
375  stacknextedge[stacksize] = 0;
376  stacknextcliquevar[stacksize] = 0;
377  stacksize++;
378  assert(stacksize <= 2* SCIPgetNVars(scip));
379 
380  break;
381  }
382  }
383  /* restart while loop, get next index from stack */
384  if( found )
385  continue;
386  }
387 
388  maxstacksize = MAX(maxstacksize, stacksize);
389 
390  /* the current node was completely handled, remove it from the stack */
391  stacksize--;
392 
393  if( (maxstacksize > 1) && SCIPvarGetType(startvar) != SCIP_VARTYPE_CONTINUOUS )
394  {
395  /* store node in the sorted nodes array */
396  dfsnodes[(*ndfsnodes)] = curridx;
397  (*ndfsnodes)++;
398  }
399  else
400  visited[curridx] = FALSE;
401  }
402 
403  return SCIP_OKAY;
404 }
405 
406 
407 /** sort the bounds of variables topologically */
408 static
410  SCIP* scip, /**< SCIP data structure */
411  int* vbvars, /**< array to store variable bounds in topological order */
412  int* nvbvars /**< pointer to store number of variable bounds in the graph */
413  )
414 {
415  int* dfsstack;
416  int* stacknextedge;
417  int* stacknextcliquevar;
418  int* cliqueexit;
419  SCIP_Shortbool* visited;
420  int nbounds;
421  int i;
422 
423  assert(scip != NULL);
424 
425  nbounds = 2 * SCIPgetNVars(scip);
426 
427  SCIP_CALL( SCIPallocBufferArray(scip, &dfsstack, nbounds) );
428  SCIP_CALL( SCIPallocBufferArray(scip, &stacknextedge, nbounds) );
429  SCIP_CALL( SCIPallocBufferArray(scip, &stacknextcliquevar, nbounds) );
430  SCIP_CALL( SCIPallocClearBufferArray(scip, &cliqueexit, SCIPgetNCliques(scip)) );
431  SCIP_CALL( SCIPallocClearBufferArray(scip, &visited, nbounds) );
432 
433  /* while there are unvisited nodes, run dfs on the inverse graph starting from one of these nodes; the dfs orders are
434  * stored in the topoorder array, later dfs calls are just appended after the stacks of previous dfs calls, which
435  * gives us a topological order
436  */
437  for( i = 0; i < nbounds; ++i )
438  {
439  if( !visited[i] )
440  {
441  SCIP_CALL( dfs(scip, i, visited, dfsstack, stacknextedge, stacknextcliquevar, cliqueexit, vbvars, nvbvars) );
442  }
443  }
444  assert(*nvbvars <= nbounds);
445 
446  SCIPfreeBufferArray(scip, &visited);
447  SCIPfreeBufferArray(scip, &cliqueexit);
448  SCIPfreeBufferArray(scip, &stacknextcliquevar);
449  SCIPfreeBufferArray(scip, &stacknextedge);
450  SCIPfreeBufferArray(scip, &dfsstack);
451 
452  return SCIP_OKAY;
453 }
454 
455 /** initialize candidate lists */
456 static
458  SCIP* scip, /**< original SCIP data structure */
459  SCIP_HEURDATA* heurdata /**< structure containing heurdata */
460  )
461 {
462  SCIP_VAR** vars;
463  int* vbs;
464  int nvars;
465  int nvbs;
466  int v;
467 
468  SCIPdebugMsg(scip, "initialize variable bound heuristic (%s)\n", SCIPgetProbName(scip));
469 
470  vars = SCIPgetVars(scip);
471  nvars = SCIPgetNIntVars(scip) + SCIPgetNBinVars(scip) + SCIPgetNImplVars(scip);
472  nvbs = 0;
473 
474  /* initialize data */
475  heurdata->usednodes = 0;
476  heurdata->initialized = TRUE;
477 
478  if( nvars == 0 )
479  return SCIP_OKAY;
480 
481  /* allocate memory for the arrays of the heurdata */
482  SCIP_CALL( SCIPallocBufferArray(scip, &vbs, 2 * nvars) );
483 
484  /* create the topological sorted variable array with respect to the variable bounds */
485  SCIP_CALL( topologicalSort(scip, vbs, &nvbs) );
486 
487  /* check if the candidate list contains enough candidates */
488  if( nvbs > 0 && nvbs >= 0.1 * heurdata->minintfixingrate * nvars )
489  {
490  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &heurdata->vbvars, nvbs) );
491  SCIP_CALL( SCIPallocBlockMemoryArray(scip, &heurdata->vbbounds, nvbs) );
492 
493  /* capture variable candidate list */
494  for( v = 0; v < nvbs; ++v )
495  {
496  heurdata->vbvars[v] = vars[getVarIndex(vbs[v])];
497  heurdata->vbbounds[v] = getBoundtype(vbs[v]);
498  assert(SCIPvarIsIntegral(heurdata->vbvars[v]));
499 
500  SCIP_CALL( SCIPcaptureVar(scip, heurdata->vbvars[v]) );
501  }
502 
503  heurdata->nvbvars = nvbs;
504  heurdata->applicable = TRUE;
505  }
506 
507  /* free buffer arrays */
508  SCIPfreeBufferArray(scip, &vbs);
509 
510  SCIPstatisticMessage("vbvars %.3g (%s)\n",
511  (nvbs * 100.0) / nvars, SCIPgetProbName(scip));
512 
513  /* if there is already a solution, add an objective cutoff */
514  if( SCIPgetNSols(scip) > 0 )
515  {
516  SCIP_Real upperbound;
517  SCIP_Real minimprove;
518  SCIP_Real cutoffbound;
519 
520  minimprove = heurdata->minimprove;
521  assert( !SCIPisInfinity(scip,SCIPgetUpperbound(scip)) );
522 
523  upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
524 
525  if( !SCIPisInfinity(scip, -1.0 * SCIPgetLowerbound(scip)) )
526  {
527  cutoffbound = (1-minimprove) * SCIPgetUpperbound(scip) + minimprove * SCIPgetLowerbound(scip);
528  }
529  else
530  {
531  if( SCIPgetUpperbound ( scip ) >= 0 )
532  cutoffbound = (1 - minimprove) * SCIPgetUpperbound(scip);
533  else
534  cutoffbound = (1 + minimprove) * SCIPgetUpperbound(scip);
535  }
536  heurdata->cutoffbound = MIN(upperbound, cutoffbound);
537  }
538  else
539  heurdata->cutoffbound = SCIPinfinity(scip);
540  return SCIP_OKAY;
541 }
542 
543 /** apply variable bound fixing during probing */
544 static
546  SCIP* scip, /**< original SCIP data structure */
547  SCIP_HEURDATA* heurdata, /**< structure containing heurdata */
548  SCIP_VAR** vars, /**< variables to fix during probing */
549  int nvbvars, /**< number of variables in the variable bound graph */
550  SCIP_Bool tighten, /**< should variables be fixed to cause other fixings? */
551  int obj, /**< should the objective be taken into account? */
552  SCIP_Bool* allobj1, /**< pointer to store whether all variables were fixed according to obj=1 scheme */
553  SCIP_Bool* allobj2, /**< pointer to store whether all variables were fixed according to obj=2 scheme */
554  SCIP_Bool* backtracked, /**< was backtracking performed at least once? */
555  SCIP_Bool* infeasible /**< pointer to store whether propagation detected infeasibility */
556  )
557 {
558  SCIP_VAR* lastvar;
559  SCIP_VAR* var;
560  SCIP_Real lastfixval;
561  SCIP_Bool lastfixedlb;
562  SCIP_Bool fixtolower;
564  int nbacktracks = 0;
565  int v;
566 
567  /* loop over variables in topological order */
568  for( v = 0; v < nvbvars && !(*infeasible); ++v )
569  {
570  var = vars[v];
571  bound = heurdata->vbbounds[v];
572 
573  /*SCIPdebugMsg(scip, "topoorder[%d]: %s(%s) (%s) [%g,%g] (obj=%g)\n", v,
574  bound == SCIP_BOUNDTYPE_UPPER ? "ub" : "lb", SCIPvarGetName(var),
575  SCIPvarGetType(var) == SCIP_VARTYPE_CONTINUOUS ? "c" : "d",
576  SCIPvarGetLbLocal(var), SCIPvarGetUbLocal(var), SCIPvarGetObj(var));*/
577 
578  /* only check integer or binary variables */
580  continue;
581 
582  /* skip variables which are already fixed */
583  if( SCIPvarGetLbLocal(var) + 0.5 > SCIPvarGetUbLocal(var) )
584  continue;
585 
586  /* there are two cases for tighten:
587  * 1) tighten == TRUE: we go through the list of variables and fix variables to force propagation;
588  * this is be obtained by fixing the variable to the other bound (which means
589  * that the current bound is changed and so, much propagation is triggered
590  * since we are starting with the bounds which are most influential).
591  * 2) tighten == FALSE: we fix variables to avoid too much propagation in order to avoid reaching
592  * infeasibility. Therefore, we fix the variable to the current bound, so that
593  * this bound is not changed and does not propagate. The other bound is changed
594  * and propagates, but is later in the order, so less influential.
595  */
596  fixtolower = (tighten == (bound == SCIP_BOUNDTYPE_UPPER));
597 
598  /* if we want to take into account the objective function coefficients, we only perform a fixing if the variable
599  * would be fixed to its best bound; otherwise, we just continue
600  */
601  if( ((SCIPvarGetObj(var) >= 0) != fixtolower) )
602  {
603  if( obj == 1 )
604  continue;
605  else
606  *allobj1 = FALSE;
607  }
608  /* if we want to take into account the objective function coefficients but reverted, we only perform a fixing if the variable
609  * would be fixed to its worst bound; otherwise, we just continue
610  */
611  if( ((SCIPvarGetObj(var) >= 0) == fixtolower) )
612  {
613  if( obj == 2 )
614  continue;
615  else
616  *allobj2 = FALSE;
617  }
618  lastvar = var;
619 
620  /* fix the variable to its bound */
621  if( fixtolower )
622  {
623  /* we cannot fix to infinite bounds */
624  if( SCIPisInfinity(scip, -SCIPvarGetLbLocal(var)) )
625  continue;
626 
627  /* only open a new probing node if we will not exceed the maximal tree depth */
628  if( SCIP_MAXTREEDEPTH > SCIPgetDepth(scip) )
629  {
630  SCIP_CALL( SCIPnewProbingNode(scip) );
631  }
632 
633  /* fix variable to lower bound */
634  SCIP_CALL( SCIPfixVarProbing(scip, var, SCIPvarGetLbLocal(var)) );
635  SCIPdebugMsg(scip, "fixing %d: variable <%s> (obj=%g) to lower bound <%g> (%d pseudo cands)\n",
637  lastfixedlb = TRUE;
638  lastfixval = SCIPvarGetLbLocal(var);
639  }
640  else
641  {
642  /* we cannot fix to infinite bounds */
643  if( SCIPisInfinity(scip, SCIPvarGetUbLocal(var)) )
644  continue;
645 
646  /* only open a new probing node if we will not exceed the maximal tree depth */
647  if( SCIP_MAXTREEDEPTH > SCIPgetDepth(scip) )
648  {
649  SCIP_CALL( SCIPnewProbingNode(scip) );
650  }
651 
652  /* fix variable to upper bound */
653  SCIP_CALL( SCIPfixVarProbing(scip, var, SCIPvarGetUbLocal(var)) );
654  SCIPdebugMsg(scip, "fixing %d: variable <%s> (obj=%g) to upper bound <%g> (%d pseudo cands)\n",
656  lastfixedlb = FALSE;
657  lastfixval = SCIPvarGetUbLocal(var);
658  }
659 
660  /* check if problem is already infeasible */
661  SCIP_CALL( SCIPpropagateProbing(scip, heurdata->maxproprounds, infeasible, NULL) );
662 
663  /* probing detected infeasibility: backtrack */
664  if( *infeasible )
665  {
666  assert(lastvar != NULL);
667 
669  ++nbacktracks;
670  *infeasible = FALSE;
671 
672  /* increase the lower bound of the variable which caused the infeasibility */
673  if( lastfixedlb && lastfixval + 0.5 < SCIPvarGetUbLocal(lastvar) )
674  {
675  if( lastfixval + 0.5 > SCIPvarGetLbLocal(lastvar) )
676  {
677  SCIP_CALL( SCIPchgVarLbProbing(scip, lastvar, lastfixval + 1.0) );
678  }
679  }
680  else if( !lastfixedlb && lastfixval - 0.5 > SCIPvarGetLbLocal(lastvar) )
681  {
682  if( lastfixval - 0.5 < SCIPvarGetUbLocal(lastvar) )
683  {
684  SCIP_CALL( SCIPchgVarUbProbing(scip, lastvar, lastfixval - 1.0) );
685  }
686  }
687  /* because of the limited number of propagation rounds, it may happen that conflict analysis finds a valid
688  * global bound for the last fixed variable that conflicts with applying the reverse bound change after backtracking;
689  * in that case, we ran into a deadend and stop
690  */
691  else
692  {
693  *infeasible = TRUE;
694  }
695  lastvar = NULL;
696 
697  if( !(*infeasible) )
698  {
699  /* propagate fixings */
700  SCIP_CALL( SCIPpropagateProbing(scip, heurdata->maxproprounds, infeasible, NULL) );
701 
702  SCIPdebugMessage("backtrack %d was %sfeasible\n", nbacktracks, (*infeasible ? "in" : ""));
703  }
704 
705  if( *infeasible )
706  {
707  SCIPdebugMsg(scip, "probing was infeasible after %d backtracks\n", nbacktracks);
708 
709  break;
710  }
711  else if( nbacktracks > heurdata->maxbacktracks )
712  {
713  SCIPdebugMsg(scip, "interrupt probing after %d backtracks\n", nbacktracks);
714  break;
715  }
716  }
717  }
718 
719  *backtracked = (nbacktracks > 0);
720 
721  return SCIP_OKAY;
722 }
723 
724 /** copy problem to sub-SCIP, solve it, and add solutions */
725 static
727  SCIP* scip, /**< original SCIP data structure */
728  SCIP* subscip, /**< SCIP structure of the subproblem */
729  SCIP_HEUR* heur, /**< heuristic */
730  SCIP_VAR** vars, /**< variables of the main SCIP */
731  int nvars, /**< number of variables of the main SCIP */
732  SCIP_Longint nstallnodes, /**< stalling node limit for the sub-SCIP */
733  SCIP_Real lowerbound, /**< lower bound of the main SCIP / current subproblem */
734  int* nprevars, /**< pointer to store the number of presolved variables */
735  SCIP_Bool* wasfeas, /**< pointer to store if a feasible solution was found */
736  SCIP_RESULT* result /**< pointer to store the result */
737  )
738 {
739  SCIP_HEURDATA* heurdata;
740  SCIP_VAR** subvars;
741  SCIP_HASHMAP* varmap;
742  int i;
743 
744  assert(scip != NULL);
745  assert(subscip != NULL);
746  assert(heur != NULL);
747 
748  heurdata = SCIPheurGetData(heur);
749  assert(heurdata != NULL);
750 
751  /* create the variable mapping hash map */
752  SCIP_CALL( SCIPhashmapCreate(&varmap, SCIPblkmem(subscip), nvars) );
753 
754  SCIP_CALL( SCIPcopyConsCompression(scip, subscip, varmap, NULL, "_vbounds", NULL, NULL, 0, FALSE, FALSE, FALSE,
755  TRUE, NULL) );
756 
757  if( heurdata->copycuts )
758  {
759  /* copies all active cuts from cutpool of sourcescip to linear constraints in targetscip */
760  SCIP_CALL( SCIPcopyCuts(scip, subscip, varmap, NULL, FALSE, NULL) );
761  }
762 
763  SCIP_CALL( SCIPallocBufferArray(scip, &subvars, nvars) );
764 
765  for( i = 0; i < nvars; i++ )
766  subvars[i] = (SCIP_VAR*) SCIPhashmapGetImage(varmap, vars[i]);
767 
768  /* free hash map */
769  SCIPhashmapFree(&varmap);
770 
771  /* do not abort subproblem on CTRL-C */
772  SCIP_CALL( SCIPsetBoolParam(subscip, "misc/catchctrlc", FALSE) );
773 
774 #ifdef SCIP_DEBUG
775  /* for debugging, enable full output */
776  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 5) );
777  SCIP_CALL( SCIPsetIntParam(subscip, "display/freq", 100000000) );
778 #else
779  /* disable statistic timing inside sub SCIP and output to console */
780  SCIP_CALL( SCIPsetIntParam(subscip, "display/verblevel", 0) );
781  SCIP_CALL( SCIPsetBoolParam(subscip, "timing/statistictiming", FALSE) );
782 #endif
783 
784  /* set limits for the subproblem */
785  SCIP_CALL( SCIPcopyLimits(scip, subscip) );
786  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/stallnodes", nstallnodes) );
787  SCIP_CALL( SCIPsetLongintParam(subscip, "limits/nodes", heurdata->maxnodes) );
788 
789  /* speed up sub-SCIP by not checking dual LP feasibility */
790  SCIP_CALL( SCIPsetBoolParam(subscip, "lp/checkdualfeas", FALSE) );
791 
792  /* forbid call of heuristics and separators solving sub-CIPs */
793  SCIP_CALL( SCIPsetSubscipsOff(subscip, TRUE) );
794 
795  /* disable cutting plane separation */
797 
798  /* disable expensive presolving */
800 
801  /* use inference branching */
802  if( SCIPfindBranchrule(subscip, "inference") != NULL && !SCIPisParamFixed(subscip, "branching/inference/priority") )
803  {
804  SCIP_CALL( SCIPsetIntParam(subscip, "branching/inference/priority", INT_MAX/4) );
805  }
806 
807  /* set a cutoff bound */
808  if( SCIPgetNSols(scip) > 0 )
809  {
810  SCIP_Real upperbound;
811  SCIP_Real minimprove;
812  SCIP_Real cutoffbound;
813 
814  minimprove = heurdata->minimprove;
815  assert( !SCIPisInfinity(scip,SCIPgetUpperbound(scip)) );
816 
817  upperbound = SCIPgetUpperbound(scip) - SCIPsumepsilon(scip);
818 
819  if( !SCIPisInfinity(scip, -1.0 * lowerbound) )
820  {
821  cutoffbound = (1-minimprove) * SCIPgetUpperbound(scip) + minimprove * lowerbound;
822  }
823  else
824  {
825  if( SCIPgetUpperbound ( scip ) >= 0 )
826  cutoffbound = (1 - minimprove) * SCIPgetUpperbound(scip);
827  else
828  cutoffbound = (1 + minimprove) * SCIPgetUpperbound(scip);
829  }
830  heurdata->cutoffbound = MIN(upperbound, cutoffbound);
831  }
832 
833  if( !SCIPisInfinity(scip, heurdata->cutoffbound) )
834  {
835  SCIP_CALL( SCIPsetObjlimit(subscip, heurdata->cutoffbound) );
836  SCIPdebugMsg(scip, "setting objlimit for subscip to %g\n", heurdata->cutoffbound);
837  }
838 
839  SCIPdebugMsg(scip, "starting solving vbound-submip at time %g\n", SCIPgetSolvingTime(scip));
840 
841  /* solve the subproblem */
842  /* Errors in the LP solver should not kill the overall solving process, if the LP is just needed for a heuristic.
843  * Hence in optimized mode, the return code is caught and a warning is printed, only in debug mode, SCIP will stop.
844  */
845  SCIP_CALL_ABORT( SCIPpresolve(subscip) );
846 
847  SCIPdebugMsg(scip, "vbounds heuristic presolved subproblem at time %g : %d vars, %d cons; fixing value = %g\n",
848  SCIPgetSolvingTime(scip), SCIPgetNVars(subscip), SCIPgetNConss(subscip),
849  ((nvars - SCIPgetNVars(subscip)) / (SCIP_Real)nvars));
850 
851  *nprevars = SCIPgetNVars(subscip);
852 
853  /* after presolving, we should have at least reached a certain fixing rate over ALL variables (including continuous)
854  * to ensure that not only the MIP but also the LP relaxation is easy enough
855  */
856  if( ((nvars - SCIPgetNVars(subscip)) / (SCIP_Real)nvars) >= heurdata->minmipfixingrate )
857  {
858  SCIPdebugMsg(scip, "solving subproblem: nstallnodes=%" SCIP_LONGINT_FORMAT ", maxnodes=%" SCIP_LONGINT_FORMAT "\n", nstallnodes, heurdata->maxnodes);
859 
860  SCIP_CALL_ABORT( SCIPsolve(subscip) );
861 
862  SCIPdebugMsg(scip, "ending solving vbounds-submip at time %g, status = %d\n", SCIPgetSolvingTime(scip), SCIPgetStatus(subscip));
863 
864  /* check, whether a solution was found; due to numerics, it might happen that not all solutions are feasible ->
865  * try all solutions until one was accepted
866  */
867  SCIP_CALL( SCIPtranslateSubSols(scip, subscip, heur, subvars, wasfeas, NULL) );
868  if( (*wasfeas) )
869  {
870  SCIPdebugMsg(scip, "found feasible solution in sub-MIP\n");
871  *result = SCIP_FOUNDSOL;
872  }
873  }
874 
875 #ifdef SCIP_DEBUG
876  SCIP_CALL( SCIPprintStatistics(subscip, NULL) );
877 #endif
878 
879  /* free subproblem */
880  SCIPfreeBufferArray(scip, &subvars);
881 
882  return SCIP_OKAY;
883 }
884 
885 /** main procedure of the vbounds heuristic */
886 static
888  SCIP* scip, /**< original SCIP data structure */
889  SCIP_HEUR* heur, /**< heuristic */
890  SCIP_HEURDATA* heurdata, /**< heuristic data structure */
891  SCIP_VAR** vbvars, /**< variables to fix during probing */
892  int nvbvars, /**< number of variables to fix */
893  SCIP_Bool tighten, /**< should variables be fixed to cause other fixings? */
894  int obj, /**< should the objective be taken into account? */
895  SCIP_Bool* skipobj1, /**< pointer to store whether the run with obj=1 can be skipped, or NULL */
896  SCIP_Bool* skipobj2, /**< pointer to store whether the run with obj=2 can be skipped, or NULL */
897  SCIP_RESULT* result /**< pointer to store the result */
898  )
899 {
900  SCIPstatistic( SCIP_CLOCK* clock; )
901  SCIP_VAR** vars;
902  SCIP_Longint nstallnodes;
903  SCIP_LPSOLSTAT lpstatus;
904  SCIP_Real lowerbound;
905  SCIP_Bool wasfeas = FALSE;
906  SCIP_Bool cutoff;
907  SCIP_Bool lperror;
908  SCIP_Bool solvelp;
909  SCIP_Bool allobj1 = TRUE;
910  SCIP_Bool allobj2 = TRUE;
911  SCIP_Bool backtracked = TRUE;
912  int oldnpscands;
913  int npscands;
914  int nvars;
915  int nprevars;
916 
917  assert(heur != NULL);
918  assert(heurdata != NULL);
919  assert(nvbvars > 0);
920 
921  /* initialize default values */
922  cutoff = FALSE;
923 
924  if( skipobj1 != NULL )
925  *skipobj1 = FALSE;
926  if( skipobj2 != NULL )
927  *skipobj2 = FALSE;
928 
929  if( nvbvars < SCIPgetNVars(scip) * heurdata->minintfixingrate )
930  return SCIP_OKAY;
931 
932  if( *result == SCIP_DIDNOTRUN )
933  *result = SCIP_DIDNOTFIND;
934 
935  lowerbound = SCIPgetLowerbound(scip);
936 
937  oldnpscands = SCIPgetNPseudoBranchCands(scip);
938 
939  /* calculate the maximal number of branching nodes until heuristic is aborted */
940  nstallnodes = (SCIP_Longint)(heurdata->nodesquot * SCIPgetNNodes(scip));
941 
942  /* reward variable bounds heuristic if it succeeded often */
943  nstallnodes = (SCIP_Longint)(nstallnodes * 3.0 * (SCIPheurGetNBestSolsFound(heur)+1.0)/(SCIPheurGetNCalls(heur) + 1.0));
944  nstallnodes -= 100 * SCIPheurGetNCalls(heur); /* count the setup costs for the sub-MIP as 100 nodes */
945  nstallnodes += heurdata->nodesofs;
946 
947  /* determine the node limit for the current process */
948  nstallnodes -= heurdata->usednodes;
949  nstallnodes = MIN(nstallnodes, heurdata->maxnodes);
950 
951  SCIPdebugMsg(scip, "apply variable bounds heuristic at node %lld on %d variable bounds, tighten: %u obj: %d\n",
952  SCIPnodeGetNumber(SCIPgetCurrentNode(scip)), nvbvars, tighten, obj);
953 
954  /* check whether we have enough nodes left to call subproblem solving */
955  if( nstallnodes < heurdata->minnodes )
956  {
957  SCIPdebugMsg(scip, "skipping " HEUR_NAME ": nstallnodes=%" SCIP_LONGINT_FORMAT ", minnodes=%" SCIP_LONGINT_FORMAT "\n", nstallnodes, heurdata->minnodes);
958  return SCIP_OKAY;
959  }
960 
961  if( SCIPisStopped(scip) )
962  return SCIP_OKAY;
963 
964  SCIPstatistic( SCIP_CALL( SCIPcreateClock(scip, &clock) ) );
965  SCIPstatistic( SCIP_CALL( SCIPstartClock(scip, clock) ) );
966 
967  /* check whether the LP should be solved at the current node in the tree to determine whether the heuristic
968  * is allowed to solve an LP
969  */
970  solvelp = SCIPhasCurrentNodeLP(scip);
971 
972  if( !SCIPisLPConstructed(scip) && solvelp )
973  {
974  SCIP_CALL( SCIPconstructLP(scip, &cutoff) );
975 
976  /* manually cut off the node if the LP construction detected infeasibility (heuristics cannot return such a result) */
977  if( cutoff )
978  {
980  goto TERMINATE;
981  }
982 
983  SCIP_CALL( SCIPflushLP(scip) );
984  }
985 
986  /* get variable data of original problem */
987  SCIP_CALL( SCIPgetVarsData(scip, &vars, &nvars, NULL, NULL, NULL, NULL) );
988 
989  SCIPstatistic( nprevars = nvars; )
990 
991  /* start probing */
992  SCIP_CALL( SCIPstartProbing(scip) );
993 
994 #ifdef COLLECTSTATISTICS
995  SCIPenableVarHistory(scip);
996 #endif
997 
998  /* apply the variable fixings */
999  SCIP_CALL( applyVboundsFixings(scip, heurdata, vbvars, nvbvars, tighten, obj, &allobj1, &allobj2, &backtracked, &cutoff) );
1000 
1001  if( skipobj1 != NULL )
1002  *skipobj1 = allobj1;
1003 
1004  if( skipobj2 != NULL )
1005  *skipobj2 = allobj2;
1006 
1007  if( cutoff || SCIPisStopped(scip) )
1008  goto TERMINATE;
1009 
1010  /* check that we had enough fixings */
1011  npscands = SCIPgetNPseudoBranchCands(scip);
1012 
1013  SCIPdebugMsg(scip, "npscands=%d, oldnpscands=%d, heurdata->minintfixingrate=%g\n", npscands, oldnpscands, heurdata->minintfixingrate);
1014 
1015  /* check fixing rate */
1016  if( npscands > oldnpscands * (1.0 - heurdata->minintfixingrate) )
1017  {
1018  if( heurdata->uselockfixings && npscands <= 2.0 * oldnpscands * (1.0 - heurdata->minintfixingrate) )
1019  {
1020  SCIP_Bool allrowsfulfilled = FALSE;
1021 
1022  SCIP_CALL( SCIPapplyLockFixings(scip, NULL, &cutoff, &allrowsfulfilled) );
1023 
1024  if( cutoff || SCIPisStopped(scip) )
1025  {
1026  SCIPdebugMsg(scip, "cutoff or timeout in locks fixing\n");
1027  goto TERMINATE;
1028  }
1029 
1030  npscands = SCIPgetNPseudoBranchCands(scip);
1031 
1032  SCIPdebugMsg(scip, "after lockfixings: npscands=%d, oldnpscands=%d, allrowsfulfilled=%u, heurdata->minintfixingrate=%g\n",
1033  npscands, oldnpscands, allrowsfulfilled, heurdata->minintfixingrate);
1034 
1035  if( !allrowsfulfilled && npscands > oldnpscands * (1 - heurdata->minintfixingrate) )
1036  {
1037  SCIPdebugMsg(scip, "--> too few fixings\n");
1038 
1039  goto TERMINATE;
1040  }
1041  }
1042  else
1043  {
1044  SCIPdebugMsg(scip, "--> too few fixings\n");
1045 
1046  goto TERMINATE;
1047  }
1048  }
1049 
1050  assert(!cutoff);
1051 
1052  /*************************** Probing LP Solving ***************************/
1053  lpstatus = SCIP_LPSOLSTAT_ERROR;
1054  lperror = FALSE;
1055  /* solve lp only if the problem is still feasible */
1056  if( solvelp )
1057  {
1058  char strbuf[SCIP_MAXSTRLEN];
1059  int ncols;
1060 
1061  /* print message if relatively large LP is solved from scratch, since this could lead to a longer period during
1062  * which the user sees no output; more detailed probing stats only in debug mode */
1063  ncols = SCIPgetNLPCols(scip);
1064  if( !SCIPisLPSolBasic(scip) && ncols > 1000 )
1065  {
1066  int nunfixedcols = SCIPgetNUnfixedLPCols(scip);
1067 
1068  if( nunfixedcols > 0.5 * ncols )
1069  {
1071  "Heuristic " HEUR_NAME " solving LP from scratch with %.1f %% unfixed columns (%d of %d) ...\n",
1072  100.0 * (nunfixedcols / (SCIP_Real)ncols), nunfixedcols, ncols);
1073  }
1074  }
1075  SCIPdebugMsg(scip, "Heuristic " HEUR_NAME " probing LP: %s\n",
1076  SCIPsnprintfProbingStats(scip, strbuf, SCIP_MAXSTRLEN));
1077 
1078  /* solve LP; errors in the LP solver should not kill the overall solving process, if the LP is just needed for a
1079  * heuristic. hence in optimized mode, the return code is caught and a warning is printed, only in debug mode,
1080  * SCIP will stop.
1081  */
1082  SCIPdebugMsg(scip, "starting solving vbound-lp at time %g\n", SCIPgetSolvingTime(scip));
1083 #ifdef NDEBUG
1084  {
1085  SCIP_Bool retstat;
1086  retstat = SCIPsolveProbingLP(scip, -1, &lperror, NULL);
1087  if( retstat != SCIP_OKAY )
1088  {
1089  SCIPwarningMessage(scip, "Error while solving LP in vbound heuristic; LP solve terminated with code <%d>\n",
1090  retstat);
1091  }
1092  }
1093 #else
1094  SCIP_CALL( SCIPsolveProbingLP(scip, -1, &lperror, NULL) );
1095 #endif
1096  SCIPdebugMsg(scip, "ending solving vbound-lp at time %g\n", SCIPgetSolvingTime(scip));
1097 
1098  lpstatus = SCIPgetLPSolstat(scip);
1099 
1100  SCIPdebugMsg(scip, " -> new LP iterations: %" SCIP_LONGINT_FORMAT "\n", SCIPgetNLPIterations(scip));
1101  SCIPdebugMsg(scip, " -> error=%u, status=%d\n", lperror, lpstatus);
1102  }
1103 
1104  /* check if this is a feasible solution */
1105  if( lpstatus == SCIP_LPSOLSTAT_OPTIMAL && !lperror )
1106  {
1107  SCIP_Bool stored;
1108  SCIP_Bool success;
1109  SCIP_SOL* sol;
1110 
1111  lowerbound = SCIPgetLPObjval(scip);
1112 
1113  /* copy the current LP solution to the working solution */
1114  SCIP_CALL( SCIPcreateSol(scip, &sol, heur) );
1115  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
1116 
1117  SCIP_CALL( SCIProundSol(scip, sol, &success) );
1118 
1119  if( success )
1120  {
1121  SCIPdebugMsg(scip, "vbound heuristic found roundable primal solution: obj=%g\n",
1122  SCIPgetSolOrigObj(scip, sol));
1123 
1124  /* check solution for feasibility, and add it to solution store if possible.
1125  * Neither integrality nor feasibility of LP rows have to be checked, because they
1126  * are guaranteed by the heuristic at this stage.
1127  */
1128 #ifdef SCIP_DEBUG
1129  SCIP_CALL( SCIPtrySol(scip, sol, TRUE, TRUE, TRUE, TRUE, TRUE, &stored) );
1130 #else
1131  SCIP_CALL( SCIPtrySol(scip, sol, FALSE, FALSE, TRUE, FALSE, FALSE, &stored) );
1132 #endif
1133 
1134 #ifdef SCIP_DEBUG
1135  SCIP_CALL( SCIPcheckSol(scip, sol, FALSE, FALSE, TRUE, TRUE, TRUE, &wasfeas) );
1136  assert(wasfeas);
1137  SCIPdebugMsg(scip, "found feasible solution by LP rounding: %16.9g\n", SCIPgetSolOrigObj(scip, sol));
1138 #endif
1139 
1140  if( stored )
1141  *result = SCIP_FOUNDSOL;
1142 
1143  SCIP_CALL( SCIPfreeSol(scip, &sol) );
1144 
1145  /* we found a solution, so we are done */
1146  goto TERMINATE;
1147  }
1148 
1149  SCIP_CALL( SCIPfreeSol(scip, &sol) );
1150  }
1151  /*************************** END Probing LP Solving ***************************/
1152 
1153  /*************************** Start Subscip Solving ***************************/
1154  /* if no solution has been found --> fix all other variables by subscip if necessary */
1155  if( !lperror && lpstatus != SCIP_LPSOLSTAT_INFEASIBLE && lpstatus != SCIP_LPSOLSTAT_OBJLIMIT )
1156  {
1157  SCIP* subscip;
1158  SCIP_RETCODE retcode;
1159  SCIP_Bool valid;
1160 
1161  /* check whether there is enough time and memory left */
1162  SCIP_CALL( SCIPcheckCopyLimits(scip, &valid) );
1163 
1164  if( !valid )
1165  goto TERMINATE;
1166 
1167  /* create subproblem */
1168  SCIP_CALL( SCIPcreate(&subscip) );
1169 
1170  retcode = setupAndSolveSubscip(scip, subscip, heur, vars, nvars, nstallnodes, lowerbound,
1171  &nprevars, &wasfeas, result);
1172 
1173  SCIP_CALL( SCIPfree(&subscip) );
1174 
1175  SCIP_CALL( retcode );
1176  }
1177 
1178  /*************************** End Subscip Solving ***************************/
1179 
1180  TERMINATE:
1181 #ifdef SCIP_STATISTIC
1182  SCIP_CALL( SCIPstopClock(scip, clock) );
1183  SCIPstatisticMessage("vbound: tighten=%u obj=%d nvars=%d presolnvars=%d ratio=%.2f infeas=%u found=%d time=%.4f\n",
1184  tighten, obj, nvars, nprevars, (nvars - nprevars) / (SCIP_Real)nvars, cutoff,
1185  wasfeas ? 1 : 0, SCIPclockGetTime(clock) );
1186 #endif
1187 
1188  SCIPstatistic( SCIP_CALL( SCIPfreeClock(scip, &clock) ) );
1189 
1190  /* exit probing mode */
1191  if( SCIPinProbing(scip) )
1192  {
1193  SCIP_CALL( SCIPendProbing(scip) );
1194  }
1195 
1196  return SCIP_OKAY; /*lint !e438*/
1197 }
1198 
1199 
1200 /*
1201  * Callback methods of primal heuristic
1202  */
1203 
1204 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
1205 static
1206 SCIP_DECL_HEURCOPY(heurCopyVbounds)
1207 { /*lint --e{715}*/
1208  assert(scip != NULL);
1209  assert(heur != NULL);
1210  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
1212  /* call inclusion method of heuristic */
1214 
1215  return SCIP_OKAY;
1216 }
1217 
1218 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
1219 static
1220 SCIP_DECL_HEURFREE(heurFreeVbounds)
1221 { /*lint --e{715}*/
1222  SCIP_HEURDATA* heurdata;
1223 
1224  /* free heuristic data */
1225  heurdata = SCIPheurGetData(heur);
1226 
1227  SCIPfreeBlockMemory(scip, &heurdata);
1228  SCIPheurSetData(heur, NULL);
1229 
1230  return SCIP_OKAY;
1231 }
1232 
1233 
1234 /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
1235 static
1236 SCIP_DECL_HEUREXITSOL(heurExitsolVbounds)
1237 { /*lint --e{715}*/
1238  SCIP_HEURDATA* heurdata;
1239  int v;
1240 
1241  heurdata = SCIPheurGetData(heur);
1242  assert(heurdata != NULL);
1243 
1244  /* release all variables */
1245  for( v = 0; v < heurdata->nvbvars; ++v )
1246  {
1247  SCIP_CALL( SCIPreleaseVar(scip, &heurdata->vbvars[v]) );
1248  }
1249 
1250  /* free varbounds array */
1251  SCIPfreeBlockMemoryArrayNull(scip, &heurdata->vbbounds, heurdata->nvbvars);
1252  SCIPfreeBlockMemoryArrayNull(scip, &heurdata->vbvars, heurdata->nvbvars);
1253 
1254  /* reset heuristic data structure */
1255  heurdataReset(heurdata);
1256 
1257  return SCIP_OKAY;
1258 }
1259 
1260 /** execution method of primal heuristic */
1261 static
1262 SCIP_DECL_HEUREXEC(heurExecVbounds)
1263 { /*lint --e{715}*/
1264  SCIP_HEURDATA* heurdata;
1265  SCIP_Bool skipobj1;
1266  SCIP_Bool skipobj2;
1267 #ifdef NOCONFLICT
1268  SCIP_Bool enabledconflicts;
1269 #endif
1270 
1271  assert( heur != NULL );
1272  assert( scip != NULL );
1273  assert( result != NULL );
1274 
1275  *result = SCIP_DIDNOTRUN;
1276 
1277  if( SCIPgetNPseudoBranchCands(scip) == 0 )
1278  return SCIP_OKAY;
1279 
1280  heurdata = SCIPheurGetData(heur);
1281  assert(heurdata != NULL);
1282 
1283  if( !heurdata->initialized )
1284  {
1285  SCIP_CALL( initializeCandsLists(scip, heurdata) );
1286  }
1287 
1288  if( !heurdata->applicable )
1289  return SCIP_OKAY;
1290 
1291 #ifdef NOCONFLICT
1292  /* disable conflict analysis */
1293  SCIP_CALL( SCIPgetBoolParam(scip, "conflict/enable", &enabledconflicts) );
1294 
1295  if( !SCIPisParamFixed(scip, "conflict/enable") )
1296  {
1297  SCIP_CALL( SCIPsetBoolParam(scip, "conflict/enable", FALSE) );
1298  }
1299 #endif
1300 
1301  /* try variable bounds */
1302  skipobj1 = FALSE;
1303  skipobj2 = FALSE;
1304  if( ((unsigned)heurdata->feasvariant & VBOUNDVARIANT_NOOBJ) != 0 )
1305  {
1306  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, FALSE, 0,
1307  &skipobj1, &skipobj2, result) );
1308  }
1309  if( !skipobj1 && ((unsigned) heurdata->feasvariant & VBOUNDVARIANT_BESTBOUND) != 0)
1310  {
1311  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, FALSE, 1, NULL, NULL, result) );
1312  }
1313  if( !skipobj2 && ((unsigned) heurdata->feasvariant & VBOUNDVARIANT_WORSTBOUND) != 0)
1314  {
1315  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, FALSE, 2, NULL, NULL, result) );
1316  }
1317 
1318  skipobj1 = FALSE;
1319  skipobj2 = FALSE;
1320  if( ((unsigned) heurdata->tightenvariant & VBOUNDVARIANT_NOOBJ) != 0 )
1321  {
1322  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, TRUE, 0,
1323  &skipobj1, &skipobj2, result) );
1324  }
1325  if( !skipobj1 && ((unsigned) heurdata->tightenvariant & VBOUNDVARIANT_BESTBOUND) != 0)
1326  {
1327  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, TRUE, 1, NULL, NULL, result) );
1328  }
1329  if( !skipobj2 && ((unsigned) heurdata->tightenvariant & VBOUNDVARIANT_WORSTBOUND) != 0)
1330  {
1331  SCIP_CALL( applyVbounds(scip, heur, heurdata, heurdata->vbvars, heurdata->nvbvars, TRUE, 2, NULL, NULL, result) );
1332  }
1333 
1334 #ifdef NOCONFLICT
1335  /* reset the conflict analysis */
1336  if( !SCIPisParamFixed(scip, "conflict/enable") )
1337  {
1338  SCIP_CALL( SCIPsetBoolParam(scip, "conflict/enable", enabledconflicts) );
1339  }
1340 #endif
1341 
1342  return SCIP_OKAY;
1343 }
1344 
1345 /*
1346  * primal heuristic specific interface methods
1347  */
1348 
1349 /** creates the vbounds primal heuristic and includes it in SCIP */
1351  SCIP* scip /**< SCIP data structure */
1352  )
1353 {
1354  SCIP_HEURDATA* heurdata;
1355  SCIP_HEUR* heur;
1356 
1357  /* create vbounds primal heuristic data */
1358  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
1359  heurdataReset(heurdata);
1360 
1361  /* include primal heuristic */
1362  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
1364  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecVbounds, heurdata) );
1365 
1366  assert(heur != NULL);
1367 
1368  /* set non-NULL pointers to callback methods */
1369  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopyVbounds) );
1370  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeVbounds) );
1371  SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolVbounds) );
1372 
1373  /* add variable bounds primal heuristic parameters */
1374  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minintfixingrate",
1375  "minimum percentage of integer variables that have to be fixed",
1376  &heurdata->minintfixingrate, FALSE, DEFAULT_MININTFIXINGRATE, 0.0, 1.0, NULL, NULL) );
1377 
1378  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minmipfixingrate",
1379  "minimum percentage of variables that have to be fixed within sub-SCIP (integer and continuous)",
1380  &heurdata->minmipfixingrate, FALSE, DEFAULT_MINMIPFIXINGRATE, 0.0, 1.0, NULL, NULL) );
1381 
1382  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/maxnodes",
1383  "maximum number of nodes to regard in the subproblem",
1384  &heurdata->maxnodes, TRUE,DEFAULT_MAXNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1385 
1386  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/nodesofs",
1387  "number of nodes added to the contingent of the total nodes",
1388  &heurdata->nodesofs, FALSE, DEFAULT_NODESOFS, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1389 
1390  SCIP_CALL( SCIPaddLongintParam(scip, "heuristics/" HEUR_NAME "/minnodes",
1391  "minimum number of nodes required to start the subproblem",
1392  &heurdata->minnodes, TRUE, DEFAULT_MINNODES, 0LL, SCIP_LONGINT_MAX, NULL, NULL) );
1393 
1394  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/nodesquot",
1395  "contingent of sub problem nodes in relation to the number of nodes of the original problem",
1396  &heurdata->nodesquot, FALSE, DEFAULT_NODESQUOT, 0.0, 1.0, NULL, NULL) );
1397 
1398  SCIP_CALL( SCIPaddRealParam(scip, "heuristics/" HEUR_NAME "/minimprove",
1399  "factor by which " HEUR_NAME " heuristic should at least improve the incumbent",
1400  &heurdata->minimprove, TRUE, DEFAULT_MINIMPROVE, 0.0, 1.0, NULL, NULL) );
1401 
1402  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxproprounds",
1403  "maximum number of propagation rounds during probing (-1 infinity)",
1404  &heurdata->maxproprounds, TRUE, DEFAULT_MAXPROPROUNDS, -1, INT_MAX/4, NULL, NULL) );
1405 
1406  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/copycuts",
1407  "should all active cuts from cutpool be copied to constraints in subproblem?",
1408  &heurdata->copycuts, TRUE, DEFAULT_COPYCUTS, NULL, NULL) );
1409 
1410  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/uselockfixings",
1411  "should more variables be fixed based on variable locks if the fixing rate was not reached?",
1412  &heurdata->uselockfixings, TRUE, DEFAULT_USELOCKFIXINGS, NULL, NULL) );
1413 
1414  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/maxbacktracks",
1415  "maximum number of backtracks during the fixing process",
1416  &heurdata->maxbacktracks, TRUE, DEFAULT_MAXBACKTRACKS, -1, INT_MAX/4, NULL, NULL) );
1417 
1418  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/feasvariant",
1419  "which variants of the vbounds heuristic that try to stay feasible should be called? (0: off, 1: w/o looking at obj, 2: only fix to best bound, 4: only fix to worst bound",
1420  &heurdata->feasvariant, TRUE, (int) DEFAULT_FEASVARIANT, 0, 7, NULL, NULL) );
1421 
1422  SCIP_CALL( SCIPaddIntParam(scip, "heuristics/" HEUR_NAME "/tightenvariant",
1423  "which tightening variants of the vbounds heuristic should be called? (0: off, 1: w/o looking at obj, 2: only fix to best bound, 4: only fix to worst bound",
1424  &heurdata->tightenvariant, TRUE, (int) DEFAULT_TIGHTENVARIANT, 0, 7, NULL, NULL) );
1425 
1426  return SCIP_OKAY;
1427 }
1428 
1429 /**@} */
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
Definition: scip_heur.c:233
#define HEUR_TIMING
Definition: heur_vbounds.c:80
enum SCIP_BoundType SCIP_BOUNDTYPE
Definition: type_lp.h:50
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2081
#define DEFAULT_NODESQUOT
Definition: heur_vbounds.c:93
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1017
SCIP_Real SCIPgetSolvingTime(SCIP *scip)
Definition: scip_timing.c:369
SCIP_RETCODE SCIPsetSeparating(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:949
SCIP_Real * SCIPvarGetVlbCoefs(SCIP_VAR *var)
Definition: var.c:18124
#define HEUR_USESSUBSCIP
Definition: heur_vbounds.c:81
SCIP_VAR ** SCIPcliqueGetVars(SCIP_CLIQUE *clique)
Definition: implics.c:3368
#define SCIPallocBlockMemoryArray(scip, ptr, num)
Definition: scip_mem.h:84
#define DEFAULT_NODESOFS
Definition: heur_vbounds.c:92
#define getVarIndex(idx)
Definition: heur_vbounds.c:158
public methods for SCIP parameter handling
SCIP_NODE * SCIPgetCurrentNode(SCIP *scip)
Definition: scip_tree.c:82
public methods for branch and bound tree
SCIP_RETCODE SCIPbacktrackProbing(SCIP *scip, int probingdepth)
Definition: scip_probing.c:216
SCIP_Longint SCIPgetNLPIterations(SCIP *scip)
SCIP_RETCODE SCIPincludeHeurVbounds(SCIP *scip)
#define DEFAULT_MININTFIXINGRATE
Definition: heur_vbounds.c:84
public methods for memory management
int SCIPgetProbingDepth(SCIP *scip)
Definition: scip_probing.c:189
#define SCIPallocClearBufferArray(scip, ptr, num)
Definition: scip_mem.h:117
int SCIPvarGetNVlbs(SCIP_VAR *var)
Definition: var.c:18102
static void heurdataReset(SCIP_HEURDATA *heurdata)
Definition: heur_vbounds.c:170
public methods for implications, variable bounds, and cliques
#define SCIP_MAXSTRLEN
Definition: def.h:293
SCIP_Longint SCIPheurGetNBestSolsFound(SCIP_HEUR *heur)
Definition: heur.c:1587
internal methods for clocks and timing issues
static long bound
SCIP_Bool SCIPisPositive(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPvarGetLbLocal(SCIP_VAR *var)
Definition: var.c:17966
int SCIPgetNPseudoBranchCands(SCIP *scip)
Definition: scip_branch.c:749
SCIP_CLIQUE ** SCIPvarGetCliques(SCIP_VAR *var, SCIP_Bool varfixing)
Definition: var.c:18273
public solving methods
public methods for timing
#define VBOUNDVARIANT_BESTBOUND
Definition: heur_vbounds.c:70
#define getOtherBoundIndex(idx)
Definition: heur_vbounds.c:161
SCIP_RETCODE SCIPreleaseVar(SCIP *scip, SCIP_VAR **var)
Definition: scip_var.c:1245
SCIP_Bool SCIPvarIsBinary(SCIP_VAR *var)
Definition: var.c:17431
SCIP_RETCODE SCIPstopClock(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:169
#define isIndexLowerbound(idx)
Definition: heur_vbounds.c:160
static SCIP_RETCODE initializeCandsLists(SCIP *scip, SCIP_HEURDATA *heurdata)
Definition: heur_vbounds.c:462
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1865
int SCIPcliqueGetIndex(SCIP_CLIQUE *clique)
Definition: implics.c:3404
#define VBOUNDVARIANT_WORSTBOUND
Definition: heur_vbounds.c:71
#define FALSE
Definition: def.h:87
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3014
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_param.c:102
SCIP_RETCODE SCIPcopyLimits(SCIP *sourcescip, SCIP *targetscip)
Definition: scip_copy.c:3278
SCIP_RETCODE SCIPcutoffNode(SCIP *scip, SCIP_NODE *node)
Definition: scip_tree.c:425
SCIP_Real SCIPinfinity(SCIP *scip)
#define TRUE
Definition: def.h:86
SCIP_RETCODE SCIPapplyLockFixings(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_Bool *cutoff, SCIP_Bool *allrowsfulfilled)
Definition: heur_locks.c:187
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
static SCIP_RETCODE applyVboundsFixings(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_VAR **vars, int nvbvars, SCIP_Bool tighten, int obj, SCIP_Bool *allobj1, SCIP_Bool *allobj2, SCIP_Bool *backtracked, SCIP_Bool *infeasible)
Definition: heur_vbounds.c:550
#define SCIPstatisticMessage
Definition: pub_message.h:114
int SCIPvarGetNVubs(SCIP_VAR *var)
Definition: var.c:18144
SCIP_RETCODE SCIPsetPresolving(SCIP *scip, SCIP_PARAMSETTING paramsetting, SCIP_Bool quiet)
Definition: scip_param.c:923
SCIP_BRANCHRULE * SCIPfindBranchrule(SCIP *scip, const char *name)
Definition: scip_branch.c:288
#define DEFAULT_MINIMPROVE
Definition: heur_vbounds.c:88
int SCIPvarGetProbindex(SCIP_VAR *var)
Definition: var.c:17600
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:67
public methods for problem variables
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:99
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:108
#define SCIPdebugMessage
Definition: pub_message.h:87
SCIP_RETCODE SCIPtranslateSubSols(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **subvars, SCIP_Bool *success, int *solindex)
Definition: scip_copy.c:1439
SCIP_RETCODE SCIPchgVarLbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_probing.c:292
SCIP_VAR ** SCIPvarGetVlbVars(SCIP_VAR *var)
Definition: var.c:18114
#define DEFAULT_MAXNODES
Definition: heur_vbounds.c:83
SCIP_RETCODE SCIPfreeClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:118
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3201
SCIP_RETCODE SCIPconstructLP(SCIP *scip, SCIP_Bool *cutoff)
Definition: scip_lp.c:115
#define DEFAULT_MAXBACKTRACKS
Definition: heur_vbounds.c:95
#define SCIP_LONGINT_MAX
Definition: def.h:163
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:127
enum SCIP_LPSolStat SCIP_LPSOLSTAT
Definition: type_lp.h:42
SCIP_RETCODE SCIPcreate(SCIP **scip)
Definition: scip_general.c:283
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1362
public methods for SCIP variables
void SCIPwarningMessage(SCIP *scip, const char *formatstr,...)
Definition: scip_message.c:111
#define SCIPdebugMsg
Definition: scip_message.h:69
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:74
SCIP_RETCODE SCIPprintStatistics(SCIP *scip, FILE *file)
int SCIPvarGetNCliques(SCIP_VAR *var, SCIP_Bool varfixing)
Definition: var.c:18262
#define HEUR_NAME
Definition: heur_vbounds.c:73
#define DEFAULT_FEASVARIANT
Definition: heur_vbounds.c:106
public methods for numerical tolerances
#define getUbIndex(idx)
Definition: heur_vbounds.c:157
public methods for querying solving statistics
const char * SCIPgetProbName(SCIP *scip)
Definition: scip_prob.c:1066
#define HEUR_PRIORITY
Definition: heur_vbounds.c:76
public methods for the branch-and-bound tree
SCIP_Bool SCIPisLPConstructed(SCIP *scip)
Definition: scip_lp.c:92
SCIP_Longint SCIPnodeGetNumber(SCIP_NODE *node)
Definition: tree.c:7434
SCIP_Bool SCIPisLPSolBasic(SCIP *scip)
Definition: scip_lp.c:658
SCIP_RETCODE SCIPsolve(SCIP *scip)
Definition: scip_solve.c:2613
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1441
SCIP_RETCODE SCIPcreateClock(SCIP *scip, SCIP_CLOCK **clck)
Definition: scip_timing.c:67
static SCIP_RETCODE topologicalSort(SCIP *scip, int *vbvars, int *nvbvars)
Definition: heur_vbounds.c:414
SCIP_Bool SCIPisParamFixed(SCIP *scip, const char *name)
Definition: scip_param.c:210
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:169
SCIP_RETCODE SCIPpropagateProbing(SCIP *scip, int maxproprounds, SCIP_Bool *cutoff, SCIP_Longint *ndomredsfound)
Definition: scip_probing.c:571
SCIP_RETCODE SCIPfixVarProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real fixedval)
Definition: scip_probing.c:409
#define HEUR_DESC
Definition: heur_vbounds.c:74
SCIP_RETCODE SCIPsetBoolParam(SCIP *scip, const char *name, SCIP_Bool value)
Definition: scip_param.c:420
SCIP_STATUS SCIPgetStatus(SCIP *scip)
Definition: scip_general.c:474
SCIP_RETCODE SCIPpresolve(SCIP *scip)
Definition: scip_solve.c:2443
SCIP_RETCODE SCIPcopyCuts(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, SCIP_Bool global, int *ncutsadded)
Definition: scip_copy.c:2116
BMS_BLKMEM * SCIPblkmem(SCIP *scip)
Definition: scip_mem.c:48
static SCIP_DECL_HEURCOPY(heurCopyVbounds)
SCIP_RETCODE SCIPendProbing(SCIP *scip)
Definition: scip_probing.c:251
const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:17251
SCIP_Real SCIPclockGetTime(SCIP_CLOCK *clck)
Definition: clock.c:429
char * SCIPsnprintfProbingStats(SCIP *scip, char *strbuf, int len)
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3048
SCIP_RETCODE SCIPgetBoolParam(SCIP *scip, const char *name, SCIP_Bool *value)
Definition: scip_param.c:241
#define NULL
Definition: lpi_spx1.cpp:155
#define SCIP_Shortbool
Definition: def.h:92
#define HEUR_FREQ
Definition: heur_vbounds.c:77
public methods for problem copies
#define DEFAULT_MINMIPFIXINGRATE
Definition: heur_vbounds.c:85
int SCIPgetNUnfixedLPCols(SCIP *scip)
Definition: scip_lp.c:539
#define SCIP_CALL(x)
Definition: def.h:384
SCIP_Real SCIPgetLowerbound(SCIP *scip)
SCIP_RETCODE SCIPsolveProbingLP(SCIP *scip, int itlim, SCIP_Bool *lperror, SCIP_Bool *cutoff)
Definition: scip_probing.c:810
void SCIPverbMessage(SCIP *scip, SCIP_VERBLEVEL msgverblevel, FILE *file, const char *formatstr,...)
Definition: scip_message.c:216
static SCIP_RETCODE setupAndSolveSubscip(SCIP *scip, SCIP *subscip, SCIP_HEUR *heur, SCIP_VAR **vars, int nvars, SCIP_Longint nstallnodes, SCIP_Real lowerbound, int *nprevars, SCIP_Bool *wasfeas, SCIP_RESULT *result)
Definition: heur_vbounds.c:731
static SCIP_RETCODE dfs(SCIP *scip, int startnode, SCIP_Shortbool *visited, int *dfsstack, int *stacknextedge, int *stacknextcliquevar, int *cliqueexit, int *dfsnodes, int *ndfsnodes)
Definition: heur_vbounds.c:184
SCIP_Real * SCIPvarGetVubCoefs(SCIP_VAR *var)
Definition: var.c:18166
#define DEFAULT_MINNODES
Definition: heur_vbounds.c:91
SCIP_Longint SCIPheurGetNCalls(SCIP_HEUR *heur)
Definition: heur.c:1567
static SCIP_DECL_HEUREXEC(heurExecVbounds)
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
Definition: scip_lp.c:74
public methods for primal heuristic plugins and divesets
public methods for constraint handler plugins and constraints
#define DEFAULT_TIGHTENVARIANT
Definition: heur_vbounds.c:109
SCIP_RETCODE SCIPcopyConsCompression(SCIP *sourcescip, SCIP *targetscip, SCIP_HASHMAP *varmap, SCIP_HASHMAP *consmap, const char *suffix, SCIP_VAR **fixedvars, SCIP_Real *fixedvals, int nfixedvars, SCIP_Bool global, SCIP_Bool enablepricing, SCIP_Bool threadsafe, SCIP_Bool passmessagehdlr, SCIP_Bool *valid)
Definition: scip_copy.c:2951
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:115
#define DEFAULT_COPYCUTS
Definition: heur_vbounds.c:96
public data structures and miscellaneous methods
SCIP_RETCODE SCIPcheckSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool printreason, SCIP_Bool completely, SCIP_Bool checkbounds, SCIP_Bool checkintegrality, SCIP_Bool checklprows, SCIP_Bool *feasible)
Definition: scip_sol.c:3440
#define SCIP_Bool
Definition: def.h:84
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip_lp.c:159
int SCIPgetNImplVars(SCIP *scip)
Definition: scip_prob.c:2126
static SCIP_DECL_HEUREXITSOL(heurExitsolVbounds)
SCIP_RETCODE SCIProundSol(SCIP *scip, SCIP_SOL *sol, SCIP_Bool *success)
Definition: scip_sol.c:2446
SCIP_RETCODE SCIPsetObjlimit(SCIP *scip, SCIP_Real objlimit)
Definition: scip_prob.c:1421
int SCIPgetDepth(SCIP *scip)
Definition: scip_tree.c:661
#define MAX(x, y)
Definition: tclique_def.h:83
SCIP_Bool * SCIPcliqueGetValues(SCIP_CLIQUE *clique)
Definition: implics.c:3380
SCIP_RETCODE SCIPsetIntParam(SCIP *scip, const char *name, int value)
Definition: scip_param.c:478
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip_sol.c:976
void SCIPenableVarHistory(SCIP *scip)
Definition: scip_var.c:8738
SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17758
LNS heuristic uses the variable lower and upper bounds to determine the search neighborhood.
int SCIPgetNSols(SCIP *scip)
Definition: scip_sol.c:2205
SCIP_Real SCIPgetSolOrigObj(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1435
SCIP_RETCODE SCIPflushLP(SCIP *scip)
Definition: scip_lp.c:139
locks primal heuristic
SCIP_Bool SCIPisInfinity(SCIP *scip, SCIP_Real val)
#define getLbIndex(idx)
Definition: heur_vbounds.c:156
SCIP_RETCODE SCIPtrySol(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:3125
#define SCIP_MAXTREEDEPTH
Definition: def.h:320
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2036
SCIP_Bool SCIPinProbing(SCIP *scip)
Definition: scip_probing.c:88
public methods for the LP relaxation, rows and columns
int SCIPgetNVars(SCIP *scip)
Definition: scip_prob.c:1991
public methods for branching rule plugins and branching
#define getBoundtype(idx)
Definition: heur_vbounds.c:159
#define HEUR_FREQOFS
Definition: heur_vbounds.c:78
general public methods
SCIP_Real SCIPgetLPObjval(SCIP *scip)
Definition: scip_lp.c:238
public methods for solutions
#define HEUR_MAXDEPTH
Definition: heur_vbounds.c:79
int SCIPgetNConss(SCIP *scip)
Definition: scip_prob.c:3041
#define DEFAULT_USELOCKFIXINGS
Definition: heur_vbounds.c:99
public methods for the probing mode
public methods for message output
int SCIPgetNCliques(SCIP *scip)
Definition: scip_var.c:7572
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1946
#define SCIPstatistic(x)
Definition: pub_message.h:111
SCIP_RETCODE SCIPcaptureVar(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:1211
#define SCIP_Real
Definition: def.h:177
SCIP_Bool SCIPisStopped(SCIP *scip)
Definition: scip_general.c:694
public methods for message handling
SCIP_VAR ** SCIPvarGetVubVars(SCIP_VAR *var)
Definition: var.c:18156
#define SCIP_Longint
Definition: def.h:162
int SCIPvarGetIndex(SCIP_VAR *var)
Definition: var.c:17590
SCIP_RETCODE SCIPcheckCopyLimits(SCIP *sourcescip, SCIP_Bool *success)
Definition: scip_copy.c:3235
SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:17416
int SCIPgetNLPCols(SCIP *scip)
Definition: scip_lp.c:518
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip_heur.c:153
SCIP_Real SCIPvarGetUbLocal(SCIP_VAR *var)
Definition: var.c:17976
#define SCIPfreeBlockMemoryArrayNull(scip, ptr, num)
Definition: scip_mem.h:102
SCIP_RETCODE SCIPnewProbingNode(SCIP *scip)
Definition: scip_probing.c:156
int SCIPcliqueGetNVars(SCIP_CLIQUE *clique)
Definition: implics.c:3358
SCIP_Real SCIPsumepsilon(SCIP *scip)
SCIP_Real SCIPgetUpperbound(SCIP *scip)
SCIP_RETCODE SCIPstartProbing(SCIP *scip)
Definition: scip_probing.c:110
public methods for primal heuristics
SCIPallocBlockMemory(scip, subsol))
#define SCIP_CALL_ABORT(x)
Definition: def.h:363
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1352
static SCIP_DECL_HEURFREE(heurFreeVbounds)
SCIP_Longint SCIPgetNNodes(SCIP *scip)
#define VBOUNDVARIANT_NOOBJ
Definition: heur_vbounds.c:69
public methods for global and local (sub)problems
SCIP_Bool SCIPvarIsIntegral(SCIP_VAR *var)
Definition: var.c:17442
SCIP_RETCODE SCIPchgVarUbProbing(SCIP *scip, SCIP_VAR *var, SCIP_Real newbound)
Definition: scip_probing.c:336
SCIP_RETCODE SCIPstartClock(SCIP *scip, SCIP_CLOCK *clck)
Definition: scip_timing.c:152
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:130
SCIP_RETCODE SCIPsetSubscipsOff(SCIP *scip, SCIP_Bool quiet)
Definition: scip_param.c:874
SCIP_RETCODE SCIPsetLongintParam(SCIP *scip, const char *name, SCIP_Longint value)
Definition: scip_param.c:536
#define HEUR_DISPCHAR
Definition: heur_vbounds.c:75
static SCIP_RETCODE applyVbounds(SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata, SCIP_VAR **vbvars, int nvbvars, SCIP_Bool tighten, int obj, SCIP_Bool *skipobj1, SCIP_Bool *skipobj2, SCIP_RESULT *result)
Definition: heur_vbounds.c:892
#define DEFAULT_MAXPROPROUNDS
Definition: heur_vbounds.c:94
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:48
SCIP_Bool SCIPvarIsActive(SCIP_VAR *var)
Definition: var.c:17580
SCIP_RETCODE SCIPfree(SCIP **scip)
Definition: scip_general.c:315
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
memory allocation routines