SCIP Doxygen Documentation
Loading...
Searching...
No Matches

Detailed Description

simple and fast LP rounding heuristic

Author
Tobias Achterberg
Marc Pfetsch

The heuristic also tries to round relaxation solutions if available.

Definition in file heur_simplerounding.c.

#include "blockmemshell/memory.h"
#include "scip/heur_simplerounding.h"
#include "scip/pub_heur.h"
#include "scip/pub_message.h"
#include "scip/pub_var.h"
#include "scip/scip_branch.h"
#include "scip/scip_heur.h"
#include "scip/scip_lp.h"
#include "scip/scip_mem.h"
#include "scip/scip_message.h"
#include "scip/scip_numerics.h"
#include "scip/scip_param.h"
#include "scip/scip_prob.h"
#include "scip/scip_sol.h"
#include "scip/scip_solvingstats.h"
#include "scip/scip_var.h"
#include <string.h>

Go to the source code of this file.

Macros

#define HEUR_NAME   "simplerounding"
#define HEUR_DESC   "simple and fast LP rounding heuristic"
#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_ROUNDING
#define HEUR_PRIORITY   -30
#define HEUR_FREQ   1
#define HEUR_FREQOFS   0
#define HEUR_MAXDEPTH   -1
#define HEUR_TIMING   SCIP_HEURTIMING_DURINGLPLOOP | SCIP_HEURTIMING_DURINGPRICINGLOOP
#define HEUR_USESSUBSCIP   FALSE
#define DEFAULT_ONCEPERNODE   FALSE

Functions

static SCIP_RETCODE performSimpleRounding (SCIP *scip, SCIP_SOL *sol, SCIP_VAR **cands, SCIP_Real *candssol, int ncands, SCIP_RESULT *result)
static SCIP_RETCODE performLPSimpleRounding (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_HEURTIMING heurtiming, SCIP_RESULT *result)
static SCIP_RETCODE performRelaxSimpleRounding (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_RESULT *result)
static SCIP_DECL_HEURCOPY (heurCopySimplerounding)
static assert (heur !=NULL)
 assert (strcmp(SCIPheurGetName(heur), HEUR_NAME)==0)
 assert (scip !=NULL)
 assert (heurdata !=NULL)
 SCIPfreeBlockMemory (scip, &heurdata)
 SCIPheurSetData (heur, NULL)
 SCIPcreateSol (scip, &heurdata->sol, heur))
 SCIPfreeSol (scip, &heurdata->sol))
static SCIP_DECL_HEURINITSOL (heurInitsolSimplerounding)
static SCIP_DECL_HEUREXITSOL (heurExitsolSimplerounding)
 assert (result !=NULL)
 assert (SCIPhasCurrentNodeLP(scip))
 if (SCIPgetLPSolstat(scip) !=SCIP_LPSOLSTAT_OPTIMAL &&! SCIPisRelaxSolValid(scip))
 if (heurdata->nroundablevars==0 &&heurtiming !=SCIP_HEURTIMING_DURINGPRICINGLOOP) return SCIP_OKAY
 performLPSimpleRounding (scip, heurdata, heurtiming, result))
 performRelaxSimpleRounding (scip, heurdata, result))
SCIP_RETCODE SCIPincludeHeurSimplerounding (SCIP *scip)

Variables

 heurdata = SCIPheurGetData(heur)
return SCIP_OKAY
heurdata lastlp = -1
heurdata nroundablevars = -1
result = SCIP_DIDNOTRUN

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "simplerounding"

Definition at line 54 of file heur_simplerounding.c.

◆ HEUR_DESC

#define HEUR_DESC   "simple and fast LP rounding heuristic"

Definition at line 55 of file heur_simplerounding.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   SCIP_HEURDISPCHAR_ROUNDING

Definition at line 56 of file heur_simplerounding.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   -30

Definition at line 57 of file heur_simplerounding.c.

◆ HEUR_FREQ

#define HEUR_FREQ   1

Definition at line 58 of file heur_simplerounding.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 59 of file heur_simplerounding.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   -1

Definition at line 60 of file heur_simplerounding.c.

◆ HEUR_TIMING

Definition at line 61 of file heur_simplerounding.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 62 of file heur_simplerounding.c.

◆ DEFAULT_ONCEPERNODE

#define DEFAULT_ONCEPERNODE   FALSE

should the heuristic only be called once per node?

Definition at line 64 of file heur_simplerounding.c.

Function Documentation

◆ performSimpleRounding()

SCIP_RETCODE performSimpleRounding ( SCIP * scip,
SCIP_SOL * sol,
SCIP_VAR ** cands,
SCIP_Real * candssol,
int ncands,
SCIP_RESULT * result )
static

perform rounding

Parameters
scipSCIP main data structure
solsolution to round
candscandidate variables
candssolsolutions of candidate variables
ncandsnumber of candidates
resultpointer to store the result of the heuristic call

Definition at line 82 of file heur_simplerounding.c.

References assert(), c, FALSE, mayrounddown, mayroundup, NULL, result, SCIP_Bool, SCIP_CALL, SCIP_FOUNDSOL, SCIP_OKAY, SCIP_Real, SCIP_VARSTATUS_COLUMN, SCIP_VARTYPE_IMPLINT, SCIPadjustImplicitSolVals(), SCIPallColsInLP(), SCIPdebugMsg, SCIPfeasCeil(), SCIPfeasFloor(), SCIPisFeasIntegral(), SCIPprintSol(), SCIPsetSolVal(), SCIPtrySol(), SCIPvarGetName(), SCIPvarGetObj(), SCIPvarGetStatus(), SCIPvarGetType(), SCIPvarMayRoundDown(), SCIPvarMayRoundUp(), sol, TRUE, and var.

Referenced by performLPSimpleRounding(), and performRelaxSimpleRounding().

◆ performLPSimpleRounding() [1/2]

SCIP_RETCODE performLPSimpleRounding ( SCIP * scip,
SCIP_HEURDATA * heurdata,
SCIP_HEURTIMING heurtiming,
SCIP_RESULT * result )
static

perform LP-rounding

Parameters
scipSCIP main data structure
heurdataheuristic data
heurtimingheuristic timing mask
resultpointer to store the result of the heuristic call

Definition at line 186 of file heur_simplerounding.c.

References assert(), heurdata, lpcands, lpcandssol, nlpcands, nlps, NULL, performSimpleRounding(), result, SCIP_CALL, SCIP_HEURTIMING_DURINGPRICINGLOOP, SCIP_Longint, SCIP_LPSOLSTAT_OPTIMAL, SCIP_OKAY, SCIP_Real, SCIPdebugMsg, SCIPgetCutoffbound(), SCIPgetLPBranchCands(), SCIPgetLPObjval(), SCIPgetLPSolstat(), SCIPgetNLPs(), SCIPisGE(), SCIPlinkLPSol(), and sol.

◆ performRelaxSimpleRounding() [1/2]

SCIP_RETCODE performRelaxSimpleRounding ( SCIP * scip,
SCIP_HEURDATA * heurdata,
SCIP_RESULT * result )
static

perform relaxation solution rounding

Parameters
scipSCIP main data structure
heurdataheuristic data
resultpointer to store the result of the heuristic call

Definition at line 246 of file heur_simplerounding.c.

References assert(), heurdata, nbinvars, nintvars, NULL, performSimpleRounding(), result, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMsg, SCIPfreeBufferArray, SCIPgetRelaxSolVal(), SCIPgetVarsData(), SCIPisFeasIntegral(), SCIPisRelaxSolValid(), SCIPlinkRelaxSol(), sol, and vars.

◆ SCIP_DECL_HEURCOPY()

SCIP_DECL_HEURCOPY ( heurCopySimplerounding )
static

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

Definition at line 336 of file heur_simplerounding.c.

References assert(), HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurSimplerounding().

◆ assert() [1/6]

assert ( heur ! = NULL)

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

References NULL.

◆ assert() [2/6]

assert ( strcmp(SCIPheurGetName(heur), HEUR_NAME) = =0)

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

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

execution method of primal heuristic

References HEUR_NAME.

◆ assert() [3/6]

assert ( scip ! = NULL)

References NULL.

◆ assert() [4/6]

assert ( heurdata ! = NULL)

References heurdata, and NULL.

◆ SCIPfreeBlockMemory()

SCIPfreeBlockMemory ( scip ,
& heurdata )

References heurdata.

◆ SCIPheurSetData()

SCIPheurSetData ( heur ,
NULL  )

References NULL.

◆ SCIPcreateSol()

SCIPcreateSol ( scip ,
&heurdata-> sol,
heur  )

References heurdata.

◆ SCIPfreeSol()

SCIPfreeSol ( scip ,
&heurdata-> sol )

References heurdata, and SCIP_OKAY.

◆ SCIP_DECL_HEURINITSOL()

SCIP_DECL_HEURINITSOL ( heurInitsolSimplerounding )
static

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

Definition at line 406 of file heur_simplerounding.c.

References assert(), HEUR_NAME, heurdata, NULL, SCIP_HEURTIMING_AFTERLPNODE, SCIP_OKAY, SCIPheurGetData(), SCIPheurGetName(), and SCIPheurSetTimingmask().

◆ SCIP_DECL_HEUREXITSOL()

SCIP_DECL_HEUREXITSOL ( heurExitsolSimplerounding )
static

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

Definition at line 426 of file heur_simplerounding.c.

References HEUR_TIMING, SCIP_OKAY, and SCIPheurSetTimingmask().

◆ assert() [5/6]

assert ( result ! = NULL)

References NULL, and result.

◆ assert() [6/6]

assert ( SCIPhasCurrentNodeLP(scip) )

◆ if() [1/2]

◆ if() [2/2]

if ( heurdata-> nroundablevars = =0 &&heurtiming !=SCIP_HEURTIMING_DURINGPRICINGLOOP)

Definition at line 521 of file heur_adaptivediving.c.

References findAndStoreDivesets(), heurdata, NULL, and SCIP_CALL.

◆ performLPSimpleRounding() [2/2]

performLPSimpleRounding ( scip ,
heurdata ,
heurtiming ,
result  )

References heurdata, and result.

◆ performRelaxSimpleRounding() [2/2]

performRelaxSimpleRounding ( scip ,
heurdata ,
result  )

References heurdata, result, and SCIP_OKAY.

Variable Documentation

◆ heurdata

heurdata = SCIPheurGetData(heur)

Definition at line 359 of file heur_simplerounding.c.

◆ SCIP_OKAY

return SCIP_OKAY

Definition at line 364 of file heur_simplerounding.c.

◆ lastlp

heurdata lastlp = -1

Definition at line 380 of file heur_simplerounding.c.

◆ nroundablevars

heurdata nroundablevars = -1

Definition at line 381 of file heur_simplerounding.c.

Referenced by if().

◆ result

* result = SCIP_DIDNOTRUN

Definition at line 445 of file heur_simplerounding.c.