Scippy

SCIP

Solving Constraint Integer Programs

heur_octane.c File Reference

Detailed Description

octane primal heuristic based on Balas, Ceria, Dawande, Margot, and Pataki

Author
Timo Berthold

Definition in file heur_octane.c.

#include <assert.h>
#include <string.h>
#include <math.h>
#include "scip/heur_octane.h"

Go to the source code of this file.

Macros

#define HEUR_NAME   "octane"
 
#define HEUR_DESC   "octane primal heuristic for pure {0;1}-problems based on Balas et al."
 
#define HEUR_DISPCHAR   'O'
 
#define HEUR_PRIORITY   -1008000
 
#define HEUR_FREQ   -1
 
#define HEUR_FREQOFS   0
 
#define HEUR_MAXDEPTH   -1
 
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE
 
#define HEUR_USESSUBSCIP   FALSE
 
#define DEFAULT_FMAX   100
 
#define DEFAULT_FFIRST   10
 
#define DEFAULT_USEFRACSPACE   TRUE
 

Functions

static void tryToInsert (SCIP *scip, SCIP_Bool **facets, SCIP_Real *lambda, int i, int j, int f_max, int nsubspacevars, SCIP_Real lam, int *nfacets)
 
static SCIP_RETCODE getSolFromFacet (SCIP *scip, SCIP_Bool *facet, SCIP_SOL *sol, SCIP_Bool *sign, SCIP_VAR **subspacevars, int nsubspacevars)
 
static SCIP_RETCODE generateObjectiveRay (SCIP *scip, SCIP_Real *raydirection, SCIP_VAR **subspacevars, int nsubspacevars)
 
static SCIP_RETCODE generateDifferenceRay (SCIP *scip, SCIP_Real *raydirection, SCIP_VAR **subspacevars, int nsubspacevars)
 
static SCIP_RETCODE generateAverageRay (SCIP *scip, SCIP_Real *raydirection, SCIP_VAR **subspacevars, int nsubspacevars, SCIP_Bool weighted)
 
static SCIP_RETCODE generateAverageNBRay (SCIP *scip, SCIP_Real *raydirection, int *fracspace, SCIP_VAR **subspacevars, int nsubspacevars)
 
static SCIP_RETCODE generateStartingPoint (SCIP *scip, SCIP_Real *rayorigin, SCIP_VAR **subspacevars, int nsubspacevars)
 
static void flipCoords (SCIP_Real *rayorigin, SCIP_Real *raydirection, SCIP_Bool *sign, int nsubspacevars)
 
static void generateNeighborFacets (SCIP *scip, SCIP_Bool **facets, SCIP_Real *lambda, SCIP_Real *rayorigin, SCIP_Real *raydirection, SCIP_Real *negquotient, int nsubspacevars, int f_max, int i, int *nfacets)
 
static SCIP_Bool isZero (SCIP *scip, SCIP_Real *raydirection, int nsubspacevars)
 
static SCIP_DECL_HEURCOPY (heurCopyOctane)
 
static SCIP_DECL_HEURFREE (heurFreeOctane)
 
static SCIP_DECL_HEURINIT (heurInitOctane)
 
static SCIP_DECL_HEUREXIT (heurExitOctane)
 
static SCIP_DECL_HEUREXEC (heurExecOctane)
 
SCIP_RETCODE SCIPincludeHeurOctane (SCIP *scip)
 

Macro Definition Documentation

#define HEUR_NAME   "octane"
#define HEUR_DESC   "octane primal heuristic for pure {0;1}-problems based on Balas et al."

Definition at line 29 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_DISPCHAR   'O'

Definition at line 30 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_PRIORITY   -1008000

Definition at line 31 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_FREQ   -1

Definition at line 32 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_FREQOFS   0

Definition at line 33 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_MAXDEPTH   -1

Definition at line 34 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERLPNODE

Definition at line 35 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 36 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define DEFAULT_FMAX   100

{0,1}-points to be checked

Definition at line 38 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define DEFAULT_FFIRST   10

{0,1}-points to be generated at first

Definition at line 39 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

#define DEFAULT_USEFRACSPACE   TRUE

use heuristic for the space of fractional variables or for whole space?

Definition at line 40 of file heur_octane.c.

Referenced by SCIPincludeHeurOctane().

Function Documentation

static void tryToInsert ( SCIP scip,
SCIP_Bool **  facets,
SCIP_Real lambda,
int  i,
int  j,
int  f_max,
int  nsubspacevars,
SCIP_Real  lam,
int *  nfacets 
)
static

tries to insert the facet obtained from facet i flipped in component j into the list of the fmax nearest facets

Parameters
scipSCIP data structure
facetsfacets got so far
lambdadistances of the facets
icurrent facet
jcomponent to flip
f_maxmaximal number of facets to create
nsubspacevarsdimension of the fractional space
lamdistance of the current facet
nfacetsnumber of facets

Definition at line 65 of file heur_octane.c.

References BMScopyMemoryArray, NULL, SCIP_Bool, SCIPisFeasGE(), SCIPisFeasGT(), and SCIPisFeasLE().

Referenced by generateNeighborFacets().

static SCIP_RETCODE getSolFromFacet ( SCIP scip,
SCIP_Bool facet,
SCIP_SOL sol,
SCIP_Bool sign,
SCIP_VAR **  subspacevars,
int  nsubspacevars 
)
static

constructs a solution from a given facet paying attention to the transformations made at the beginning of OCTANE

Parameters
scipSCIP data structure
facetcurrent facet
solsolution to create
signmarker for retransformation
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space

Definition at line 110 of file heur_octane.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIPlinkLPSol(), and SCIPsetSolVal().

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE generateObjectiveRay ( SCIP scip,
SCIP_Real raydirection,
SCIP_VAR **  subspacevars,
int  nsubspacevars 
)
static

generates the direction of the shooting ray as the inner normal of the objective function

Parameters
scipSCIP data structure
raydirectionshooting ray
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space

Definition at line 147 of file heur_octane.c.

References NULL, SCIP_OKAY, and SCIPvarGetObj().

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE generateDifferenceRay ( SCIP scip,
SCIP_Real raydirection,
SCIP_VAR **  subspacevars,
int  nsubspacevars 
)
static

generates the direction of the shooting ray as the difference between the root and the current LP solution

Parameters
scipSCIP data structure
raydirectionshooting ray
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space

Definition at line 167 of file heur_octane.c.

References NULL, SCIP_OKAY, SCIPvarGetLPSol(), and SCIPvarGetRootSol().

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE generateAverageRay ( SCIP scip,
SCIP_Real raydirection,
SCIP_VAR **  subspacevars,
int  nsubspacevars,
SCIP_Bool  weighted 
)
static

generates the direction of the shooting ray as the average of the extreme rays of the basic cone

Parameters
scipSCIP data structure
raydirectionshooting ray
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space
weightedshould the rays be weighted?

Definition at line 189 of file heur_octane.c.

References BMSclearMemoryArray, FALSE, NULL, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_REAL_MAX, SCIP_REAL_MIN, SCIPallocBufferArray, SCIPcolGetLPPos(), SCIPfreeBufferArray, SCIPgetLPBInvACol(), SCIPgetLPRowsData(), SCIPisFeasZero(), SCIProwGetDualsol(), SCIPvarGetCol(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE generateAverageNBRay ( SCIP scip,
SCIP_Real raydirection,
int *  fracspace,
SCIP_VAR **  subspacevars,
int  nsubspacevars 
)
static

generates the direction of the shooting ray as the average of the normalized non-basic vars and rows

Parameters
scipSCIP data structure
raydirectionshooting ray
fracspaceindex set of fractional variables
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space

Definition at line 391 of file heur_octane.c.

References NULL, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIP_REAL_MAX, SCIP_REAL_MIN, SCIPcolGetVar(), SCIPgetLPColsData(), SCIPgetLPRowsData(), SCIPisFeasEQ(), SCIPisFeasNegative(), SCIPisFeasPositive(), SCIPisFeasZero(), SCIProwGetCols(), SCIProwGetDualsol(), SCIProwGetNNonz(), SCIProwGetVals(), SCIPvarGetLbLocal(), SCIPvarGetLPSol(), SCIPvarGetProbindex(), and SCIPvarGetUbLocal().

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_RETCODE generateStartingPoint ( SCIP scip,
SCIP_Real rayorigin,
SCIP_VAR **  subspacevars,
int  nsubspacevars 
)
static

generates the starting point for the shooting ray in original coordinates

Parameters
scipSCIP data structure
rayoriginorigin of the shooting ray
subspacevarspointer to fractional space variables
nsubspacevarsdimension of fractional space

Definition at line 489 of file heur_octane.c.

References NULL, SCIP_OKAY, and SCIPvarGetLPSol().

Referenced by SCIP_DECL_HEUREXEC().

static void flipCoords ( SCIP_Real rayorigin,
SCIP_Real raydirection,
SCIP_Bool sign,
int  nsubspacevars 
)
static

translates the inner point of the LP to an inner point rayorigin of the unit hyper octahedron and transforms raydirection and rayorigin by reflections stored in sign

Parameters
rayoriginorigin of the shooting ray
raydirectiondirection of the shooting ray
signmarker for flipped coordinates
nsubspacevarsdimension of fractional space

Definition at line 512 of file heur_octane.c.

References FALSE, NULL, and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static void generateNeighborFacets ( SCIP scip,
SCIP_Bool **  facets,
SCIP_Real lambda,
SCIP_Real rayorigin,
SCIP_Real raydirection,
SCIP_Real negquotient,
int  nsubspacevars,
int  f_max,
int  i,
int *  nfacets 
)
static

generates all facets, from which facet i could be obtained by a decreasing + to - flip or a nonincreasing - to + flip and tests whether they are among the fmax nearest ones

Parameters
scipSCIP data structure
facetsfacets got so far
lambdadistances of the facets
rayoriginorigin of the shooting ray
raydirectiondirection of the shooting ray
negquotientarray by which coordinates are sorted
nsubspacevarsdimension of fractional space
f_maxmaximal number of facets to create
icurrent facet
nfacetsnumber of facets

Definition at line 543 of file heur_octane.c.

References NULL, SCIP_Real, SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisFeasGT(), SCIPisFeasLE(), SCIPisFeasPositive(), and tryToInsert().

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_Bool isZero ( SCIP scip,
SCIP_Real raydirection,
int  nsubspacevars 
)
static

tests, whether an array is completely zero

Parameters
scipSCIP data structure
raydirectionarray to be checked
nsubspacevarssize of array

Definition at line 636 of file heur_octane.c.

References FALSE, NULL, SCIP_Bool, SCIPisFeasZero(), and TRUE.

Referenced by SCIP_DECL_HEUREXEC().

static SCIP_DECL_HEURCOPY ( heurCopyOctane  )
static

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

Definition at line 665 of file heur_octane.c.

References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPheurGetName(), and SCIPincludeHeurOctane().

static SCIP_DECL_HEURFREE ( heurFreeOctane  )
static

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

Definition at line 679 of file heur_octane.c.

References HEUR_NAME, NULL, SCIP_OKAY, SCIPfreeMemory, SCIPheurGetData(), SCIPheurGetName(), and SCIPheurSetData().

static SCIP_DECL_HEURINIT ( heurInitOctane  )
static

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

Definition at line 699 of file heur_octane.c.

References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPcreateSol(), SCIPheurGetData(), and SCIPheurGetName().

static SCIP_DECL_HEUREXIT ( heurExitOctane  )
static

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

Definition at line 724 of file heur_octane.c.

References HEUR_NAME, NULL, SCIP_CALL, SCIP_OKAY, SCIPfreeSol(), SCIPheurGetData(), and SCIPheurGetName().