Scippy

SCIP

Solving Constraint Integer Programs

heur_simplerounding.c
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file heur_simplerounding.c
17  * @brief simple and fast LP rounding heuristic
18  * @author Tobias Achterberg
19  * @author Marc Pfetsch
20  *
21  * The heuristic also tries to round relaxation solutions if available.
22  */
23 
24 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
25 
26 #include "blockmemshell/memory.h"
28 #include "scip/pub_heur.h"
29 #include "scip/pub_message.h"
30 #include "scip/pub_var.h"
31 #include "scip/scip_branch.h"
32 #include "scip/scip_heur.h"
33 #include "scip/scip_lp.h"
34 #include "scip/scip_mem.h"
35 #include "scip/scip_message.h"
36 #include "scip/scip_numerics.h"
37 #include "scip/scip_param.h"
38 #include "scip/scip_prob.h"
39 #include "scip/scip_sol.h"
40 #include "scip/scip_solvingstats.h"
41 #include "scip/scip_var.h"
42 #include <string.h>
43 
44 #define HEUR_NAME "simplerounding"
45 #define HEUR_DESC "simple and fast LP rounding heuristic"
46 #define HEUR_DISPCHAR 'r'
47 #define HEUR_PRIORITY 0
48 #define HEUR_FREQ 1
49 #define HEUR_FREQOFS 0
50 #define HEUR_MAXDEPTH -1
51 #define HEUR_TIMING SCIP_HEURTIMING_DURINGLPLOOP | SCIP_HEURTIMING_DURINGPRICINGLOOP
52 #define HEUR_USESSUBSCIP FALSE /**< does the heuristic use a secondary SCIP instance? */
53 
54 #define DEFAULT_ONCEPERNODE FALSE /**< should the heuristic only be called once per node? */
55 
56 /* locally defined heuristic data */
57 struct SCIP_HeurData
58 {
59  SCIP_SOL* sol; /**< working solution */
60  SCIP_Longint lastlp; /**< last LP number where the heuristic was applied */
61  int nroundablevars; /**< number of variables that can be rounded (-1 if not yet calculated) */
62  SCIP_Bool oncepernode; /**< should the heuristic only be called once per node? */
63 };
64 
65 
66 /*
67  * Local methods
68  */
69 
70 /** perform rounding */
71 static
73  SCIP* scip, /**< SCIP main data structure */
74  SCIP_SOL* sol, /**< solution to round */
75  SCIP_VAR** cands, /**< candidate variables */
76  SCIP_Real* candssol, /**< solutions of candidate variables */
77  int ncands, /**< number of candidates */
78  SCIP_RESULT* result /**< pointer to store the result of the heuristic call */
79  )
80 {
81  int c;
82  int nunroundableimplints = 0;
83 
84  /* round all roundable fractional columns in the corresponding direction as long as no unroundable column was found */
85  for (c = 0; c < ncands; ++c)
86  {
87  SCIP_VAR* var;
88  SCIP_Real oldsolval;
89  SCIP_Real newsolval;
90  SCIP_Bool mayrounddown;
91  SCIP_Bool mayroundup;
92 
93  oldsolval = candssol[c];
94  assert( ! SCIPisFeasIntegral(scip, oldsolval) );
95  var = cands[c];
96  assert( SCIPvarGetStatus(var) == SCIP_VARSTATUS_COLUMN );
97  mayrounddown = SCIPvarMayRoundDown(var);
98  mayroundup = SCIPvarMayRoundUp(var);
99  SCIPdebugMsg(scip, "simple rounding heuristic: var <%s>, val=%g, rounddown=%u, roundup=%u\n",
100  SCIPvarGetName(var), oldsolval, mayrounddown, mayroundup);
101 
102  /* choose rounding direction */
103  if ( mayrounddown && mayroundup )
104  {
105  /* we can round in both directions: round in objective function direction */
106  if ( SCIPvarGetObj(var) >= 0.0 )
107  newsolval = SCIPfeasFloor(scip, oldsolval);
108  else
109  newsolval = SCIPfeasCeil(scip, oldsolval);
110  }
111  else if ( mayrounddown )
112  newsolval = SCIPfeasFloor(scip, oldsolval);
113  else if ( mayroundup )
114  newsolval = SCIPfeasCeil(scip, oldsolval);
115  else if( SCIPvarGetType(var) == SCIP_VARTYPE_IMPLINT )
116  {
117  ++nunroundableimplints;
118  continue;
119  }
120  else
121  break;
122 
123  /* store new solution value */
124  SCIP_CALL( SCIPsetSolVal(scip, sol, var, newsolval) );
125  }
126 
127  /* check, if rounding was successful */
128  if( c == ncands )
129  {
130  SCIP_Bool stored;
131  SCIP_Bool checklprows;
132 
133  /* unroundable implicit integers are adjusted. LP rows must be checked afterwards */
134  if( nunroundableimplints > 0 )
135  {
137  checklprows = TRUE;
138  }
139  else
140  checklprows = FALSE;
141 
142  if( SCIPallColsInLP(scip) )
143  {
144  /* check solution for feasibility, and add it to solution store if possible
145  * integrality need not be checked, because all fractional
146  * variables were already moved in feasible direction to the next integer
147  *
148  * feasibility of LP rows must be checked again at the presence of
149  * unroundable, implicit integer variables with fractional LP solution
150  * value
151  */
152  SCIP_CALL( SCIPtrySol(scip, sol, FALSE, FALSE, FALSE, FALSE, checklprows, &stored) );
153  }
154  else
155  {
156  /* if there are variables which are not present in the LP, e.g., for
157  * column generation, we need to check their bounds
158  */
159  SCIP_CALL( SCIPtrySol(scip, sol, FALSE, FALSE, TRUE, FALSE, checklprows, &stored) );
160  }
161 
162  if( stored )
163  {
164 #ifdef SCIP_DEBUG
165  SCIPdebugMsg(scip, "found feasible rounded solution:\n");
166  SCIP_CALL( SCIPprintSol(scip, sol, NULL, FALSE) );
167 #endif
168  *result = SCIP_FOUNDSOL;
169  }
170  }
171  return SCIP_OKAY;
172 }
173 
174 /** perform LP-rounding */
175 static
177  SCIP* scip, /**< SCIP main data structure */
178  SCIP_HEURDATA* heurdata, /**< heuristic data */
179  SCIP_HEURTIMING heurtiming, /**< heuristic timing mask */
180  SCIP_RESULT* result /**< pointer to store the result of the heuristic call */
181  )
182 {
183  SCIP_SOL* sol;
184  SCIP_VAR** lpcands;
185  SCIP_Real* lpcandssol;
186  SCIP_Longint nlps;
187  int nlpcands;
188  int nfracimplvars;
189 
190  /* only call heuristic, if an optimal LP solution is at hand */
192  return SCIP_OKAY;
193 
194  /* only call heuristic, if the LP objective value is smaller than the cutoff bound */
195  if( SCIPisGE(scip, SCIPgetLPObjval(scip), SCIPgetCutoffbound(scip)) )
196  return SCIP_OKAY;
197 
198  /* get fractional variables, that should be integral */
199  SCIP_CALL( SCIPgetLPBranchCands(scip, &lpcands, &lpcandssol, NULL, &nlpcands, NULL, &nfracimplvars) );
200 
201  /* only call heuristic, if LP solution is fractional; except we are called during pricing, in this case we
202  * want to detect a (mixed) integer (LP) solution which is primal feasible
203  */
204  if ( nlpcands == 0 && heurtiming != SCIP_HEURTIMING_DURINGPRICINGLOOP )
205  return SCIP_OKAY;
206 
207  /* don't call heuristic, if there are more fractional variables than roundable ones. We do not consider
208  * fractional implicit integer variables here, because simple rounding may adjust those separately,
209  * even if they aren't roundable
210  */
211  if ( nlpcands > heurdata->nroundablevars )
212  return SCIP_OKAY;
213 
214  /* get the working solution from heuristic's local data */
215  sol = heurdata->sol;
216  assert( sol != NULL );
217 
218  /* copy the current LP solution to the working solution */
219  SCIP_CALL( SCIPlinkLPSol(scip, sol) );
220 
221  /* don't call heuristic, if we have already processed the current LP solution */
222  nlps = SCIPgetNLPs(scip);
223  if( nlps == heurdata->lastlp )
224  return SCIP_OKAY;
225  heurdata->lastlp = nlps;
226 
227  /* perform simple rounding */
228  SCIPdebugMsg(scip, "executing simple LP-rounding heuristic, fractionals: %d + %d\n", nlpcands, nfracimplvars);
229  SCIP_CALL( performSimpleRounding(scip, sol, lpcands, lpcandssol, nlpcands + nfracimplvars, result) );
230 
231  return SCIP_OKAY;
232 }
233 
234 /** perform relaxation solution rounding */
235 static
237  SCIP* scip, /**< SCIP main data structure */
238  SCIP_HEURDATA* heurdata, /**< heuristic data */
239  SCIP_RESULT* result /**< pointer to store the result of the heuristic call */
240  )
241 {
242  SCIP_SOL* sol;
243  SCIP_VAR** vars;
244  SCIP_VAR** relaxcands;
245  SCIP_Real* relaxcandssol;
246  int nrelaxcands = 0;
247  int nbinvars;
248  int nintvars;
249  int nimplvars;
250  int ndiscretevars;
251  int v;
252 
253  /* do not call heuristic if no relaxation solution is available */
254  if ( ! SCIPisRelaxSolValid(scip) )
255  return SCIP_OKAY;
256 
257  /* get variables */
258  SCIP_CALL( SCIPgetVarsData(scip, &vars, NULL, &nbinvars, &nintvars, &nimplvars, NULL) );
259  ndiscretevars = nbinvars + nintvars + nimplvars; /* consider binary, integral, and implicit integer variables */
260 
261  /* get storage */
262  SCIP_CALL( SCIPallocBufferArray(scip, &relaxcands, ndiscretevars) );
263  SCIP_CALL( SCIPallocBufferArray(scip, &relaxcandssol, ndiscretevars) );
264 
265  /* get fractional variables, that should be integral */
266  for (v = 0; v < nbinvars + nintvars; ++v)
267  {
268  SCIP_Real val;
269 
270  val = SCIPgetRelaxSolVal(scip, vars[v]);
271  if ( ! SCIPisFeasIntegral(scip, val) )
272  {
273  relaxcands[nrelaxcands] = vars[v];
274  relaxcandssol[nrelaxcands++] = val;
275  }
276  }
277 
278  /* don't call heuristic, if there are more fractional variables than roundable ones. We explicitly
279  * do not consider implicit integer variables with fractional relaxation solution here
280  * because they may be feasibly adjusted, although they are not roundable
281  */
282  if ( nrelaxcands > heurdata->nroundablevars )
283  {
284  SCIPfreeBufferArray(scip, &relaxcands);
285  SCIPfreeBufferArray(scip, &relaxcandssol);
286  return SCIP_OKAY;
287  }
288 
289  /* collect implicit integer variables with fractional solution value */
290  for( v = nbinvars + nintvars; v < ndiscretevars; ++v )
291  {
292  SCIP_Real val;
293 
294  val = SCIPgetRelaxSolVal(scip, vars[v]);
295  if ( ! SCIPisFeasIntegral(scip, val) )
296  {
297  relaxcands[nrelaxcands] = vars[v];
298  relaxcandssol[nrelaxcands++] = val;
299  }
300  }
301  /* get the working solution from heuristic's local data */
302  sol = heurdata->sol;
303  assert( sol != NULL );
304 
305  /* copy the current relaxation solution to the working solution */
306  SCIP_CALL( SCIPlinkRelaxSol(scip, sol) );
307 
308  /* perform simple rounding */
309  SCIPdebugMsg(scip, "executing simple rounding heuristic on relaxation solution: %d fractionals\n", nrelaxcands);
310  SCIP_CALL( performSimpleRounding(scip, sol, relaxcands, relaxcandssol, nrelaxcands, result) );
311 
312  /* free storage */
313  SCIPfreeBufferArray(scip, &relaxcands);
314  SCIPfreeBufferArray(scip, &relaxcandssol);
315 
316  return SCIP_OKAY;
317 }
318 
319 
320 /*
321  * Callback methods
322  */
323 
324 /** copy method for primal heuristic plugins (called when SCIP copies plugins) */
325 static
326 SCIP_DECL_HEURCOPY(heurCopySimplerounding)
327 { /*lint --e{715}*/
328  assert(scip != NULL);
329  assert(heur != NULL);
330  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
331 
332  /* call inclusion method of primal heuristic */
334 
335  return SCIP_OKAY;
336 }
337 
338 /** destructor of primal heuristic to free user data (called when SCIP is exiting) */
339 static
340 SCIP_DECL_HEURFREE(heurFreeSimplerounding) /*lint --e{715}*/
341 { /*lint --e{715}*/
342  SCIP_HEURDATA* heurdata;
343 
344  assert(heur != NULL);
345  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
346  assert(scip != NULL);
347 
348  /* free heuristic data */
349  heurdata = SCIPheurGetData(heur);
350  assert(heurdata != NULL);
351  SCIPfreeBlockMemory(scip, &heurdata);
352  SCIPheurSetData(heur, NULL);
353 
354  return SCIP_OKAY;
355 }
356 
357 
358 /** initialization method of primal heuristic (called after problem was transformed) */
359 static
360 SCIP_DECL_HEURINIT(heurInitSimplerounding) /*lint --e{715}*/
361 { /*lint --e{715}*/
362  SCIP_HEURDATA* heurdata;
363 
364  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
365  heurdata = SCIPheurGetData(heur);
366  assert(heurdata != NULL);
367 
368  /* create heuristic data */
369  SCIP_CALL( SCIPcreateSol(scip, &heurdata->sol, heur) );
370  heurdata->lastlp = -1;
371  heurdata->nroundablevars = -1;
372 
373  return SCIP_OKAY;
374 }
375 
376 
377 /** deinitialization method of primal heuristic (called before transformed problem is freed) */
378 static
379 SCIP_DECL_HEUREXIT(heurExitSimplerounding) /*lint --e{715}*/
380 { /*lint --e{715}*/
381  SCIP_HEURDATA* heurdata;
382 
383  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
384 
385  /* free heuristic data */
386  heurdata = SCIPheurGetData(heur);
387  assert(heurdata != NULL);
388  SCIP_CALL( SCIPfreeSol(scip, &heurdata->sol) );
389 
390  return SCIP_OKAY;
391 }
392 
393 
394 /** solving process initialization method of primal heuristic (called when branch and bound process is about to begin) */
395 static
396 SCIP_DECL_HEURINITSOL(heurInitsolSimplerounding)
397 {
398  SCIP_HEURDATA* heurdata;
399 
400  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
401 
402  heurdata = SCIPheurGetData(heur);
403  assert(heurdata != NULL);
404  heurdata->lastlp = -1;
405 
406  /* change the heuristic's timingmask, if it should be called only once per node */
407  if( heurdata->oncepernode )
409 
410  return SCIP_OKAY;
411 }
412 
413 
414 /** solving process deinitialization method of primal heuristic (called before branch and bound process data is freed) */
415 static
416 SCIP_DECL_HEUREXITSOL(heurExitsolSimplerounding)
417 {
418  /* reset the timing mask to its default value */
420 
421  return SCIP_OKAY;
422 }
423 
424 
425 /** execution method of primal heuristic */
426 static
427 SCIP_DECL_HEUREXEC(heurExecSimplerounding) /*lint --e{715}*/
428 { /*lint --e{715}*/
429  SCIP_HEURDATA* heurdata;
430 
431  assert(strcmp(SCIPheurGetName(heur), HEUR_NAME) == 0);
432  assert(result != NULL);
433  assert(SCIPhasCurrentNodeLP(scip));
434 
435  *result = SCIP_DIDNOTRUN;
436 
437  /* only call heuristic, if an optimal LP solution is at hand or if relaxation solution is available */
439  return SCIP_OKAY;
440 
441  /* only call heuristic, if the LP objective value is smaller than the cutoff bound */
443  return SCIP_OKAY;
444 
445  /* get heuristic data */
446  heurdata = SCIPheurGetData(heur);
447  assert(heurdata != NULL);
448 
449  /* don't call heuristic, if we have already processed the current LP solution but no relaxation solution is available */
450  if ( SCIPgetNLPs(scip) == heurdata->lastlp && ! SCIPisRelaxSolValid(scip) )
451  return SCIP_OKAY;
452 
453  /* on our first call or after each pricing round, calculate the number of roundable variables */
454  if( heurdata->nroundablevars == -1 || heurtiming == SCIP_HEURTIMING_DURINGPRICINGLOOP )
455  {
456  SCIP_VAR** vars;
457  int nbinintvars;
458  int nroundablevars;
459  int i;
460 
461  vars = SCIPgetVars(scip);
462  nbinintvars = SCIPgetNBinVars(scip) + SCIPgetNIntVars(scip);
463  nroundablevars = 0;
464  for( i = 0; i < nbinintvars; ++i )
465  {
466  if( SCIPvarMayRoundDown(vars[i]) || SCIPvarMayRoundUp(vars[i]) )
467  nroundablevars++;
468  }
469  heurdata->nroundablevars = nroundablevars;
470  }
471 
472  /* don't call heuristic if there are no roundable variables; except we are called during pricing, in this case we
473  * want to detect a (mixed) integer (LP) solution which is primal feasible */
474  if( heurdata->nroundablevars == 0 && heurtiming != SCIP_HEURTIMING_DURINGPRICINGLOOP )
475  return SCIP_OKAY;
476 
477  *result = SCIP_DIDNOTFIND;
478 
479  /* try to round LP solution */
480  SCIP_CALL( performLPSimpleRounding(scip, heurdata, heurtiming, result) );
481 
482  /* try to round relaxation solution */
483  SCIP_CALL( performRelaxSimpleRounding(scip, heurdata, result) );
484 
485  return SCIP_OKAY;
486 }
487 
488 /*
489  * heuristic specific interface methods
490  */
491 
492 /** creates the simple rounding heuristic and includes it in SCIP */
494  SCIP* scip /**< SCIP data structure */
495  )
496 {
497  SCIP_HEURDATA* heurdata;
498  SCIP_HEUR* heur;
499 
500  /* create heuristic data */
501  SCIP_CALL( SCIPallocBlockMemory(scip, &heurdata) );
502 
503  /* include primal heuristic */
504  SCIP_CALL( SCIPincludeHeurBasic(scip, &heur,
506  HEUR_MAXDEPTH, HEUR_TIMING, HEUR_USESSUBSCIP, heurExecSimplerounding, heurdata) );
507  assert(heur != NULL);
508 
509  /* set non-NULL pointers to callback methods */
510  SCIP_CALL( SCIPsetHeurCopy(scip, heur, heurCopySimplerounding) );
511  SCIP_CALL( SCIPsetHeurInit(scip, heur, heurInitSimplerounding) );
512  SCIP_CALL( SCIPsetHeurExit(scip, heur, heurExitSimplerounding) );
513  SCIP_CALL( SCIPsetHeurInitsol(scip, heur, heurInitsolSimplerounding) );
514  SCIP_CALL( SCIPsetHeurExitsol(scip, heur, heurExitsolSimplerounding) );
515  SCIP_CALL( SCIPsetHeurFree(scip, heur, heurFreeSimplerounding) );
516 
517  SCIP_CALL( SCIPaddBoolParam(scip, "heuristics/" HEUR_NAME "/oncepernode",
518  "should the heuristic only be called once per node?",
519  &heurdata->oncepernode, TRUE, DEFAULT_ONCEPERNODE, NULL, NULL) );
520 
521  return SCIP_OKAY;
522 }
enum SCIP_Result SCIP_RESULT
Definition: type_result.h:52
#define HEUR_FREQOFS
SCIP_RETCODE SCIPfreeSol(SCIP *scip, SCIP_SOL **sol)
Definition: scip_sol.c:976
#define NULL
Definition: def.h:253
const char * SCIPheurGetName(SCIP_HEUR *heur)
Definition: heur.c:1254
SCIP_RETCODE SCIPsetSolVal(SCIP *scip, SCIP_SOL *sol, SCIP_VAR *var, SCIP_Real val)
Definition: scip_sol.c:1212
public methods for SCIP parameter handling
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_RETCODE SCIPsetHeurExitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXITSOL((*heurexitsol)))
Definition: scip_heur.c:232
public methods for memory management
SCIP_HEURDATA * SCIPheurGetData(SCIP_HEUR *heur)
Definition: heur.c:1165
static SCIP_RETCODE performSimpleRounding(SCIP *scip, SCIP_SOL *sol, SCIP_VAR **cands, SCIP_Real *candssol, int ncands, SCIP_RESULT *result)
static SCIP_DECL_HEURCOPY(heurCopySimplerounding)
unsigned int SCIP_HEURTIMING
Definition: type_timing.h:97
#define FALSE
Definition: def.h:73
static SCIP_RETCODE performLPSimpleRounding(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_HEURTIMING heurtiming, SCIP_RESULT *result)
SCIP_EXPORT SCIP_Real SCIPvarGetObj(SCIP_VAR *var)
Definition: var.c:17200
#define HEUR_DISPCHAR
SCIP_EXPORT SCIP_VARTYPE SCIPvarGetType(SCIP_VAR *var)
Definition: var.c:16903
#define TRUE
Definition: def.h:72
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPlinkLPSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1017
SCIP_RETCODE SCIPincludeHeurSimplerounding(SCIP *scip)
struct SCIP_HeurData SCIP_HEURDATA
Definition: type_heur.h:51
public methods for problem variables
SCIP_RETCODE SCIPaddBoolParam(SCIP *scip, const char *name, const char *desc, SCIP_Bool *valueptr, SCIP_Bool isadvanced, SCIP_Bool defaultvalue, SCIP_DECL_PARAMCHGD((*paramchgd)), SCIP_PARAMDATA *paramdata)
Definition: scip_param.c:47
#define SCIPfreeBlockMemory(scip, ptr)
Definition: scip_mem.h:95
static SCIP_DECL_HEURFREE(heurFreeSimplerounding)
#define SCIP_HEURTIMING_DURINGPRICINGLOOP
Definition: type_timing.h:85
SCIP_EXPORT SCIP_VARSTATUS SCIPvarGetStatus(SCIP_VAR *var)
Definition: var.c:16857
#define SCIPfreeBufferArray(scip, ptr)
Definition: scip_mem.h:123
#define SCIPallocBlockMemory(scip, ptr)
Definition: scip_mem.h:78
public methods for SCIP variables
SCIP_RETCODE SCIPsetHeurInit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINIT((*heurinit)))
Definition: scip_heur.c:184
SCIP_EXPORT SCIP_Bool SCIPvarMayRoundDown(SCIP_VAR *var)
Definition: var.c:3327
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:3124
#define SCIPdebugMsg
Definition: scip_message.h:69
SCIP_Real SCIPgetCutoffbound(SCIP *scip)
SCIP_Bool SCIPisFeasIntegral(SCIP *scip, SCIP_Real val)
SCIP_LPSOLSTAT SCIPgetLPSolstat(SCIP *scip)
Definition: scip_lp.c:158
SCIP_Bool SCIPhasCurrentNodeLP(SCIP *scip)
Definition: scip_lp.c:73
int SCIPgetNIntVars(SCIP *scip)
Definition: scip_prob.c:2077
public methods for numerical tolerances
SCIP_RETCODE SCIPcreateSol(SCIP *scip, SCIP_SOL **sol, SCIP_HEUR *heur)
Definition: scip_sol.c:319
SCIP_Longint SCIPgetNLPs(SCIP *scip)
static SCIP_DECL_HEUREXEC(heurExecSimplerounding)
public methods for querying solving statistics
SCIP_RETCODE SCIPincludeHeurBasic(SCIP *scip, SCIP_HEUR **heur, const char *name, const char *desc, char dispchar, int priority, int freq, int freqofs, int maxdepth, SCIP_HEURTIMING timingmask, SCIP_Bool usessubscip, SCIP_DECL_HEUREXEC((*heurexec)), SCIP_HEURDATA *heurdata)
Definition: scip_heur.c:107
static SCIP_DECL_HEUREXIT(heurExitSimplerounding)
SCIP_EXPORT const char * SCIPvarGetName(SCIP_VAR *var)
Definition: var.c:16738
SCIP_Bool SCIPallColsInLP(SCIP *scip)
Definition: scip_lp.c:584
#define SCIP_HEURTIMING_AFTERLPNODE
Definition: type_timing.h:73
SCIP_VAR ** SCIPgetVars(SCIP *scip)
Definition: scip_prob.c:1942
#define HEUR_DESC
void SCIPheurSetData(SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
Definition: heur.c:1175
#define HEUR_TIMING
void SCIPheurSetTimingmask(SCIP_HEUR *heur, SCIP_HEURTIMING timingmask)
Definition: heur.c:1294
SCIP_RETCODE SCIPlinkRelaxSol(SCIP *scip, SCIP_SOL *sol)
Definition: scip_sol.c:1075
SCIP_RETCODE SCIPadjustImplicitSolVals(SCIP *scip, SCIP_SOL *sol, SCIP_Bool uselprows)
Definition: scip_sol.c:1723
#define SCIP_CALL(x)
Definition: def.h:365
SCIP_Real SCIPfeasFloor(SCIP *scip, SCIP_Real val)
SCIP_Real SCIPgetLPObjval(SCIP *scip)
Definition: scip_lp.c:237
public methods for primal heuristic plugins and divesets
#define HEUR_NAME
SCIP_EXPORT SCIP_Bool SCIPvarMayRoundUp(SCIP_VAR *var)
Definition: var.c:3338
#define SCIPallocBufferArray(scip, ptr, num)
Definition: scip_mem.h:111
#define SCIP_Bool
Definition: def.h:70
static SCIP_DECL_HEURINITSOL(heurInitsolSimplerounding)
SCIP_RETCODE SCIPsetHeurExit(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEUREXIT((*heurexit)))
Definition: scip_heur.c:200
SCIP_Real SCIPgetRelaxSolVal(SCIP *scip, SCIP_VAR *var)
Definition: scip_var.c:2593
static SCIP_DECL_HEUREXITSOL(heurExitsolSimplerounding)
#define HEUR_PRIORITY
public methods for the LP relaxation, rows and columns
public methods for branching rule plugins and branching
public methods for solutions
SCIP_RETCODE SCIPsetHeurCopy(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURCOPY((*heurcopy)))
Definition: scip_heur.c:152
#define DEFAULT_ONCEPERNODE
public methods for message output
SCIP_RETCODE SCIPgetVarsData(SCIP *scip, SCIP_VAR ***vars, int *nvars, int *nbinvars, int *nintvars, int *nimplvars, int *ncontvars)
Definition: scip_prob.c:1861
SCIP_RETCODE SCIPprintSol(SCIP *scip, SCIP_SOL *sol, FILE *file, SCIP_Bool printzeros)
Definition: scip_sol.c:1766
#define SCIP_Real
Definition: def.h:164
#define HEUR_USESSUBSCIP
SCIP_Bool SCIPisRelaxSolValid(SCIP *scip)
Definition: scip_var.c:2529
public methods for message handling
SCIP_RETCODE SCIPgetLPBranchCands(SCIP *scip, SCIP_VAR ***lpcands, SCIP_Real **lpcandssol, SCIP_Real **lpcandsfrac, int *nlpcands, int *npriolpcands, int *nfracimplvars)
Definition: scip_branch.c:384
Simple and fast LP rounding heuristic.
SCIP_RETCODE SCIPsetHeurInitsol(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURINITSOL((*heurinitsol)))
Definition: scip_heur.c:216
#define SCIP_Longint
Definition: def.h:149
int SCIPgetNBinVars(SCIP *scip)
Definition: scip_prob.c:2032
SCIP_RETCODE SCIPsetHeurFree(SCIP *scip, SCIP_HEUR *heur, SCIP_DECL_HEURFREE((*heurfree)))
Definition: scip_heur.c:168
SCIP_Real SCIPfeasCeil(SCIP *scip, SCIP_Real val)
public methods for primal heuristics
#define HEUR_FREQ
#define HEUR_MAXDEPTH
static SCIP_DECL_HEURINIT(heurInitSimplerounding)
public methods for global and local (sub)problems
static SCIP_RETCODE performRelaxSimpleRounding(SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_RESULT *result)
memory allocation routines