Scippy

SCIP

Solving Constraint Integer Programs

heur_rounding.c File Reference

Detailed Description

LP rounding heuristic that tries to recover from intermediate infeasibilities.

Author
Tobias Achterberg

Definition in file heur_rounding.c.

#include <assert.h>
#include <string.h>
#include "scip/heur_rounding.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "rounding"
 
#define HEUR_DESC   "LP rounding heuristic with infeasibility recovering"
 
#define HEUR_DISPCHAR   'R'
 
#define HEUR_PRIORITY   -1000
 
#define HEUR_FREQ   1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_DURINGLPLOOP
 
#define HEUR_USESSUBSCIP   FALSE
 
#define DEFAULT_SUCCESSFACTOR   100
 
#define DEFAULT_ONCEPERNODE   FALSE
 

Functions

static void updateViolations (SCIP *scip, SCIP_ROW *row, SCIP_ROW **violrows, int *violrowpos, int *nviolrows, SCIP_Real oldactivity, SCIP_Real newactivity)
 
static SCIP_RETCODE updateActivities (SCIP *scip, SCIP_Real *activities, SCIP_ROW **violrows, int *violrowpos, int *nviolrows, int nlprows, SCIP_VAR *var, SCIP_Real oldsolval, SCIP_Real newsolval)
 
static SCIP_RETCODE selectRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, int direction, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
 
static SCIP_RETCODE selectIncreaseRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
 
static SCIP_RETCODE selectDecreaseRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_ROW *row, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
 
static SCIP_RETCODE selectEssentialRounding (SCIP *scip, SCIP_SOL *sol, SCIP_Real minobj, SCIP_VAR **lpcands, int nlpcands, SCIP_VAR **roundvar, SCIP_Real *oldsolval, SCIP_Real *newsolval)
 
static SCIP_DECL_HEURCOPY (heurCopyRounding)
 
static SCIP_DECL_HEURFREE (heurFreeRounding)
 
static SCIP_DECL_HEURINIT (heurInitRounding)
 
static SCIP_DECL_HEUREXIT (heurExitRounding)
 
static SCIP_DECL_HEURINITSOL (heurInitsolRounding)
 
static SCIP_DECL_HEUREXITSOL (heurExitsolRounding)
 
static SCIP_DECL_HEUREXEC (heurExecRounding)
 
SCIP_RETCODE SCIPincludeHeurRounding (SCIP *scip)
 

Macro Definition Documentation

#define HEUR_NAME   "rounding"

Definition at line 29 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_DESC   "LP rounding heuristic with infeasibility recovering"

Definition at line 30 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_DISPCHAR   'R'

Definition at line 31 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_PRIORITY   -1000

Definition at line 32 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_FREQ   1

Definition at line 33 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_FREQOFS   0

Definition at line 34 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_MAXDEPTH   -1

Definition at line 35 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_TIMING   SCIP_HEURTIMING_DURINGLPLOOP

Definition at line 36 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 37 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define DEFAULT_SUCCESSFACTOR   100

number of calls per found solution that are considered as standard success, a higher factor causes the heuristic to be called more often

Definition at line 39 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

#define DEFAULT_ONCEPERNODE   FALSE

should the heuristic only be called once per node?

Definition at line 44 of file heur_rounding.c.

Referenced by SCIPincludeHeurRounding().

Function Documentation

static void updateViolations ( SCIP scip,
SCIP_ROW row,
SCIP_ROW **  violrows,
int *  violrowpos,
int *  nviolrows,
SCIP_Real  oldactivity,
SCIP_Real  newactivity 
)
static

update row violation arrays after a row's activity value changed

Parameters
scipSCIP data structure
rowLP row
violrowsarray with currently violated rows
violrowposposition of LP rows in violrows array
nviolrowspointer to the number of currently violated rows
oldactivityold activity value of LP row
newactivitynew activity value of LP row

Definition at line 64 of file heur_rounding.c.

References NULL, SCIP_Bool, SCIP_Real, SCIPisFeasGT(), SCIPisFeasLT(), SCIProwGetLhs(), SCIProwGetLPPos(), SCIProwGetRhs(), and updateActivities().

Referenced by updateActivities().

static SCIP_RETCODE updateActivities ( SCIP scip,
SCIP_Real activities,
SCIP_ROW **  violrows,
int *  violrowpos,
int *  nviolrows,
int  nlprows,
SCIP_VAR var,
SCIP_Real  oldsolval,
SCIP_Real  newsolval 
)
static

update row activities after a variable's solution value changed

Parameters
scipSCIP data structure
activitiesLP row activities
violrowsarray with currently violated rows
violrowposposition of LP rows in violrows array
nviolrowspointer to the number of currently violated rows
nlprowsnumber of rows in current LP
varvariable that has been changed
oldsolvalold solution value of variable
newsolvalnew solution value of variable

Definition at line 122 of file heur_rounding.c.

References NULL, SCIP_OKAY, SCIP_Real, SCIPcolGetNLPNonz(), SCIPcolGetRows(), SCIPcolGetVals(), SCIPinfinity(), SCIPisInfinity(), SCIProwGetLPPos(), SCIProwIsInLP(), SCIProwIsLocal(), SCIPvarGetCol(), selectRounding(), and updateViolations().

Referenced by updateViolations().

static SCIP_RETCODE selectRounding ( SCIP scip,
SCIP_SOL sol,
SCIP_Real  minobj,
SCIP_ROW row,
int  direction,
SCIP_VAR **  roundvar,
SCIP_Real oldsolval,
SCIP_Real newsolval 
)
static

returns a variable, that pushes activity of the row in the given direction with minimal negative impact on other rows; if variables have equal impact, chooses the one with best objective value improvement in corresponding direction; rounding in a direction is forbidden, if this forces the objective value over the upper bound

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
directionshould the activity be increased (+1) or decreased (-1)?
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalpointer to store old (fractional) solution value of rounding variable
newsolvalpointer to store new (rounded) solution value of rounding variable

Definition at line 193 of file heur_rounding.c.

References NULL, SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPcolGetVar(), SCIPfeasCeil(), SCIPfeasFloor(), SCIPgetCutoffbound(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasIntegral(), SCIProwGetCols(), SCIProwGetNLPNonz(), SCIProwGetVals(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), SCIPvarGetObj(), SCIPvarGetType(), and selectIncreaseRounding().

Referenced by selectDecreaseRounding(), selectIncreaseRounding(), and updateActivities().

static SCIP_RETCODE selectIncreaseRounding ( SCIP scip,
SCIP_SOL sol,
SCIP_Real  minobj,
SCIP_ROW row,
SCIP_VAR **  roundvar,
SCIP_Real oldsolval,
SCIP_Real newsolval 
)
static

returns a variable, that increases the activity of the row

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 295 of file heur_rounding.c.

References selectDecreaseRounding(), and selectRounding().

Referenced by selectRounding().

static SCIP_RETCODE selectDecreaseRounding ( SCIP scip,
SCIP_SOL sol,
SCIP_Real  minobj,
SCIP_ROW row,
SCIP_VAR **  roundvar,
SCIP_Real oldsolval,
SCIP_Real newsolval 
)
static

returns a variable, that decreases the activity of the row

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
rowLP row
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 310 of file heur_rounding.c.

References selectEssentialRounding(), and selectRounding().

Referenced by selectIncreaseRounding().

static SCIP_RETCODE selectEssentialRounding ( SCIP scip,
SCIP_SOL sol,
SCIP_Real  minobj,
SCIP_VAR **  lpcands,
int  nlpcands,
SCIP_VAR **  roundvar,
SCIP_Real oldsolval,
SCIP_Real newsolval 
)
static

returns a fractional variable, that has most impact on rows in opposite direction, i.e. that is most crucial to fix in the other direction; if variables have equal impact, chooses the one with best objective value improvement in corresponding direction; rounding in a direction is forbidden, if this forces the objective value over the upper bound

Parameters
scipSCIP data structure
solprimal solution
minobjminimal objective value possible after rounding remaining fractional vars
lpcandsfractional variables in LP
nlpcandsnumber of fractional variables in LP
roundvarpointer to store the rounding variable, returns NULL if impossible
oldsolvalold (fractional) solution value of rounding variable
newsolvalnew (rounded) solution value of rounding variable

Definition at line 329 of file heur_rounding.c.

References NULL, SCIP_DECL_HEURCOPY(), SCIP_OKAY, SCIP_Real, SCIP_VARTYPE_BINARY, SCIP_VARTYPE_INTEGER, SCIPfeasCeil(), SCIPfeasFloor(), SCIPgetCutoffbound(), SCIPgetSolVal(), SCIPinfinity(), SCIPisFeasIntegral(), SCIPvarGetNLocksDown(), SCIPvarGetNLocksUp(), SCIPvarGetObj(), and SCIPvarGetType().

Referenced by selectDecreaseRounding().

static SCIP_DECL_HEURCOPY ( heurCopyRounding  )
static

copy method for primal heuristic plugins (called when SCIP copies plugins)

Definition at line 412 of file heur_rounding.c.

Referenced by selectEssentialRounding().

static SCIP_DECL_HEURFREE ( heurFreeRounding  )
static

destructor of primal heuristic to free user data (called when SCIP is exiting)

Definition at line 426 of file heur_rounding.c.

static SCIP_DECL_HEURINIT ( heurInitRounding  )
static

initialization method of primal heuristic (called after problem was transformed)

Definition at line 445 of file heur_rounding.c.

static SCIP_DECL_HEUREXIT ( heurExitRounding  )
static

deinitialization method of primal heuristic (called before transformed problem is freed)

Definition at line 463 of file heur_rounding.c.

static SCIP_DECL_HEURINITSOL ( heurInitsolRounding  )
static

solving process initialization method of primal heuristic (called when branch and bound process is about to begin)

Definition at line 479 of file heur_rounding.c.

static SCIP_DECL_HEUREXITSOL ( heurExitsolRounding  )
static

solving process deinitialization method of primal heuristic (called before branch and bound process data is freed)

Definition at line 498 of file heur_rounding.c.

static SCIP_DECL_HEUREXEC ( heurExecRounding  )
static

execution method of primal heuristic

Definition at line 509 of file heur_rounding.c.