GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
heur_setcover.c File Reference

Detailed Description

set covering primal heuristic according to Caprara, Fischetti, and Toth (1999)

Author
Tobias Oelschlaegel
Christian Puchert

Definition in file heur_setcover.c.

#include <assert.h>
#include <string.h>
#include "gcg/gcg.h"
#include "gcg/pricer_gcg.h"
#include "scip/clock.h"
#include "scip/cons_linear.h"
#include "gcg/heur_setcover.h"

Go to the source code of this file.

Data Structures

struct  PQUEUE
struct  SCP_INSTANCE
struct  SCP_CORE
struct  SCP_Lagrange_Sol
struct  SCIP_HeurData

Macros

#define HEUR_NAME   "setcover"
#define HEUR_DESC   "set covering primal heuristic according to Caprara, Fischetti, and Toth (1999)"
#define HEUR_DISPCHAR   'S'
#define HEUR_PRIORITY   0
#define HEUR_FREQ   0
#define HEUR_FREQOFS   0
#define HEUR_MAXDEPTH   -1
#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE
#define HEUR_USESSUBSCIP   FALSE
#define DEF_CORE_TENT_SIZE   10
#define DEF_LAMBDA_ADJUSTMENTS   TRUE
#define DEF_LAMBDA_P   50
#define DEF_LAMBDA   0.1
#define DEF_STOP_CRIT_ITER   300
#define DEF_STOP_CRIT_DIFF   1.0
#define DEF_STOP_CRIT_RATIO   0.99
#define DEF_PI_MIN   0.3
#define DEF_PI_ALPHA   1.1
#define DEF_BETA   1.025
#define DEF_MAX_ITER   2
#define DEF_MAX_ITER_NO_IMP   1
#define DEF_THREEPHASE_MAX_ITER   10
#define DEF_GREEDY_MAX_ITER   100
#define DEF_MIN_PROB_SIZE   1000
#define DEFAULT_RANDSEED   19

Functions

static SCIP_RETCODE pqueue_init (SCIP *scip, PQUEUE *queue)
static void pqueue_clear (SCIP *scip, PQUEUE *queue)
static void pqueue_destroy (SCIP *scip, PQUEUE *queue)
static SCIP_RETCODE pqueue_insert (SCIP *scip, PQUEUE *queue, SCIP_Real key, int elem, int *position)
static void pqueue_decrease_key (SCIP *scip, PQUEUE *queue, int pos, SCIP_Real key)
static void pqueue_increase_key (SCIP *scip, PQUEUE *queue, int pos, SCIP_Real key)
static void pqueue_get_min (SCIP *scip, PQUEUE *queue, int *elem)
static SCIP_RETCODE allocateMemoryForSolution (SCIP *scip, SCP_CORE *core, SCP_Lagrange_Sol *mult)
static SCIP_Bool isCoreVariable (SCP_CORE *core, SCIP_VAR *var)
static SCIP_Bool isFixedVariable (SCP_INSTANCE *inst, SCIP_VAR *var)
static SCIP_Bool isVarInSolution (SCIP_Bool *solution, SCIP_VAR *var)
static void addVarToCore (SCP_CORE *core, SCIP_VAR *var)
static void fixVariable (SCP_INSTANCE *inst, SCIP_VAR *var)
static void addVarToSolution (SCIP_Bool *solution, SCIP_VAR *var)
static void removeVarsFromCore (SCIP *scip, SCP_CORE *core)
static void removeVarFromSolution (SCIP_Bool *solution, SCIP_VAR *var)
static void clearSolution (SCIP *scip, SCIP_Bool *solution)
static SCIP_Bool isRowCovered (SCP_INSTANCE *inst, int rowpos)
static void markRowAsCovered (SCP_INSTANCE *inst, int rowpos)
static SCIP_RETCODE getVarIndex (SCIP *scip, SCP_CORE *core, SCIP_VAR *variable, int *pos)
static SCIP_RETCODE getConsVars (SCIP *scip, SCP_CORE *core, int pos, SCIP_VAR **vars, int *nvars, SCIP_Bool *success)
static void freeMemoryForSolution (SCIP *scip, SCP_Lagrange_Sol *mult)
static void copySetCoverSolution (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCIP_Bool *dest, SCIP_Real *destcosts, SCIP_Bool *source)
static void copySolution (SCIP *scip, SCP_CORE *core, SCP_Lagrange_Sol *dest, SCP_Lagrange_Sol *source)
static SCIP_RETCODE initInstance (SCIP *scip, SCP_INSTANCE *inst)
static void copyInstance (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *dest, SCP_INSTANCE *source)
static void freeInstance (SCIP *scip, SCP_INSTANCE *inst)
static SCIP_RETCODE initTentativeCore (SCIP *scip, SCP_CORE *core, SCIP_HEURDATA *heurdata)
static void extendSolution (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCIP_Bool *solution)
static SCIP_RETCODE computeCoreRows (SCIP *scip, SCP_CORE *core, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeCoreColumns (SCIP *scip, SCP_CORE *core)
static void freeCore (SCIP *scip, SCP_CORE *core)
static SCIP_RETCODE redefineCore (SCIP *scip, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE markRowsCoveredByFixedVariables (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE checkSetCover (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCIP_Bool *solution, SCIP_Bool *issetcover, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeDelta (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCIP_Real *lagrangiancosts, SCIP_Bool *solution, SCIP_Real pi, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE removeRedundantColumns (SCIP *scip, SCIP_HEURDATA *heurdata, SCIP_Bool *solution, SCIP_Real *solcosts)
static SCIP_RETCODE greedySetCover (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCP_Lagrange_Sol *mult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeLocalLagrangianCosts (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCP_Lagrange_Sol *mult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeGlobalLagrangianCosts (SCIP *scip, SCP_CORE *core, SCP_Lagrange_Sol *mult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeOptimalSolution (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCP_Lagrange_Sol *mult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE subgradientOptimization (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCP_Lagrange_Sol *best_mult_lb, SCIP_Real bestub, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE computeInitialLagrangeMultiplier (SCIP *scip, SCP_CORE *core, SCP_INSTANCE *inst, SCP_Lagrange_Sol *mult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE exploreNeighborhood (SCIP *scip, SCP_Lagrange_Sol *startmult, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE reportSolution (SCIP *scip, SCP_INSTANCE *inst, SCIP_Bool *solution, SCIP_HEUR *heur)
static SCIP_RETCODE threePhase (SCIP *scip, SCIP_HEUR *heur, SCIP_HEURDATA *heurdata)
static SCIP_RETCODE setCoveringHeuristic (SCIP *scip, SCIP_HEUR *heur)
static SCIP_DECL_HEURFREE (heurFreeSetcover)
static SCIP_DECL_HEURINIT (heurInitSetcover)
static SCIP_DECL_HEUREXIT (heurExitSetcover)
static SCIP_DECL_HEUREXEC (heurExecSetcover)
SCIP_RETCODE GCGincludeHeurSetcover (GCG *gcg)

Macro Definition Documentation

◆ HEUR_NAME

#define HEUR_NAME   "setcover"

Definition at line 46 of file heur_setcover.c.

◆ HEUR_DESC

#define HEUR_DESC   "set covering primal heuristic according to Caprara, Fischetti, and Toth (1999)"

Definition at line 47 of file heur_setcover.c.

◆ HEUR_DISPCHAR

#define HEUR_DISPCHAR   'S'

Definition at line 48 of file heur_setcover.c.

◆ HEUR_PRIORITY

#define HEUR_PRIORITY   0

Definition at line 49 of file heur_setcover.c.

◆ HEUR_FREQ

#define HEUR_FREQ   0

Definition at line 50 of file heur_setcover.c.

◆ HEUR_FREQOFS

#define HEUR_FREQOFS   0

Definition at line 51 of file heur_setcover.c.

◆ HEUR_MAXDEPTH

#define HEUR_MAXDEPTH   -1

Definition at line 52 of file heur_setcover.c.

◆ HEUR_TIMING

#define HEUR_TIMING   SCIP_HEURTIMING_AFTERNODE

Definition at line 53 of file heur_setcover.c.

◆ HEUR_USESSUBSCIP

#define HEUR_USESSUBSCIP   FALSE

does the heuristic use a secondary SCIP instance?

Definition at line 54 of file heur_setcover.c.

◆ DEF_CORE_TENT_SIZE

#define DEF_CORE_TENT_SIZE   10

number of columns covering each row that are added to the tentative core at the beginning

Definition at line 56 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_LAMBDA_ADJUSTMENTS

#define DEF_LAMBDA_ADJUSTMENTS   TRUE

adjust step size during the subgradient phase

Definition at line 57 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_LAMBDA_P

#define DEF_LAMBDA_P   50

number of iterations after which lambda is adjusted

Definition at line 58 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_LAMBDA

#define DEF_LAMBDA   0.1

initial step size for the subgradient phase

Definition at line 59 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_STOP_CRIT_ITER

#define DEF_STOP_CRIT_ITER   300

number of iterations of the subgradient phase after which the stopping criterion is tested again

Definition at line 60 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_STOP_CRIT_DIFF

#define DEF_STOP_CRIT_DIFF   1.0

stop if absolute difference between best lower and upper bound is less than SCP_STOP_CRIT_DIFF, and

Definition at line 61 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_STOP_CRIT_RATIO

#define DEF_STOP_CRIT_RATIO   0.99

the relative ratio between best lower and upper bound is less than DEF_STOP_CRIT_RATIO

Definition at line 62 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_PI_MIN

#define DEF_PI_MIN   0.3

percentage of rows to be removed after fixing columns

Definition at line 63 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_PI_ALPHA

#define DEF_PI_ALPHA   1.1

increase of pi when no improvement was made, i.e. more columns will be fixed

Definition at line 64 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_BETA

#define DEF_BETA   1.025

allowed gap between lowerbound and upper bound during the subgradient phase

Definition at line 65 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_MAX_ITER

#define DEF_MAX_ITER   2

maximum number of iterations of three-phase

Definition at line 66 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_MAX_ITER_NO_IMP

#define DEF_MAX_ITER_NO_IMP   1

stop of no improvements during the last X iterations of three-phase

Definition at line 67 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_THREEPHASE_MAX_ITER

#define DEF_THREEPHASE_MAX_ITER   10

maximum number of iterations inside three-phase

Definition at line 68 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_GREEDY_MAX_ITER

#define DEF_GREEDY_MAX_ITER   100

number of multipliers that are used for computing greedy solutions during each iteration

Definition at line 69 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEF_MIN_PROB_SIZE

#define DEF_MIN_PROB_SIZE   1000

minimum number of variables the problem has to contain for the heuristic to start

Definition at line 70 of file heur_setcover.c.

Referenced by GCGincludeHeurSetcover().

◆ DEFAULT_RANDSEED

#define DEFAULT_RANDSEED   19

initial random seed

Definition at line 71 of file heur_setcover.c.

Function Documentation

◆ pqueue_init()

SCIP_RETCODE pqueue_init ( SCIP * scip,
PQUEUE * queue )
static

initializes a priority queue

Parameters
scipmaster SCIP data structure
queuepriority queue instance

Definition at line 198 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, pqueue_init(), PQUEUE::reserved, SCIP_CALL(), and PQUEUE::size.

Referenced by pqueue_init(), and setCoveringHeuristic().

◆ pqueue_clear()

void pqueue_clear ( SCIP * scip,
PQUEUE * queue )
static

removes all elements from a priority queue, but does not release any memory

Parameters
scipmaster SCIP data structure
queuepriority queue instance

Definition at line 215 of file heur_setcover.c.

References pqueue_clear(), and PQUEUE::size.

Referenced by greedySetCover(), and pqueue_clear().

◆ pqueue_destroy()

void pqueue_destroy ( SCIP * scip,
PQUEUE * queue )
static

releases all memory that is used by the priority queue

Parameters
scipmaster SCIP data structure
queuepriority queue instance

Definition at line 225 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, and pqueue_destroy().

Referenced by pqueue_destroy(), and setCoveringHeuristic().

◆ pqueue_insert()

SCIP_RETCODE pqueue_insert ( SCIP * scip,
PQUEUE * queue,
SCIP_Real key,
int elem,
int * position )
static

inserts an element with key 'key' and value 'elem' into the queue. If 'position' is not NULL, the referenced memory location will always contain the internal position of the element

Parameters
scipmaster SCIP data structure
queuepriority queue instance
keykey of the new item
elemvalue of the new item
positionaddress where the items position within the queue is stored

Definition at line 239 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, pqueue_insert(), PQUEUE::reserved, SCIP_CALL(), and PQUEUE::size.

Referenced by greedySetCover(), and pqueue_insert().

◆ pqueue_decrease_key()

void pqueue_decrease_key ( SCIP * scip,
PQUEUE * queue,
int pos,
SCIP_Real key )
static

decreases the key to 'key' of the element that is currently at position 'pos'

Parameters
scipmaster SCIP data structure
queuepriority queue instance
posposition of the item within the queue that is to be changed
keynew key of the item, needs to be greater than the old key

Definition at line 292 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, pqueue_decrease_key(), and PQUEUE::size.

Referenced by greedySetCover(), and pqueue_decrease_key().

◆ pqueue_increase_key()

void pqueue_increase_key ( SCIP * scip,
PQUEUE * queue,
int pos,
SCIP_Real key )
static

increases the key to 'key' of the element that is currently at position 'pos'

Parameters
scipmaster SCIP data structure
queuepriority queue instance
posposition of the item within the queue that is to be changed
keynew key of the item, needs to be smaller than the old one

Definition at line 335 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, pqueue_increase_key(), and PQUEUE::size.

Referenced by greedySetCover(), pqueue_get_min(), and pqueue_increase_key().

◆ pqueue_get_min()

void pqueue_get_min ( SCIP * scip,
PQUEUE * queue,
int * elem )
static

returns the value of a minimum element in 'elem'. Sets 'elem' to -1 if the queue is empty

Parameters
scipmaster SCIP data structure
queuepriority queue instance
elemaddress where the value of a minimum key item will be stored

Definition at line 441 of file heur_setcover.c.

References PQUEUE::data, PQUEUE::keys, PQUEUE::positions, pqueue_get_min(), pqueue_increase_key(), and PQUEUE::size.

Referenced by greedySetCover(), and pqueue_get_min().

◆ allocateMemoryForSolution()

SCIP_RETCODE allocateMemoryForSolution ( SCIP * scip,
SCP_CORE * core,
SCP_Lagrange_Sol * mult )
static

◆ isCoreVariable()

SCIP_Bool isCoreVariable ( SCP_CORE * core,
SCIP_VAR * var )
static

checks if 'var' is a core variable

Parameters
coreinitialized core data structure
varSCIP variable

Definition at line 507 of file heur_setcover.c.

References assert(), isCoreVariable(), var, and SCP_CORE::varincore.

Referenced by computeCoreColumns(), computeCoreRows(), computeInitialLagrangeMultiplier(), computeOptimalSolution(), exploreNeighborhood(), greedySetCover(), initTentativeCore(), isCoreVariable(), and redefineCore().

◆ isFixedVariable()

SCIP_Bool isFixedVariable ( SCP_INSTANCE * inst,
SCIP_VAR * var )
static

checks if 'var' is fixed within instance 'inst'

Parameters
instinstance of the set covering problem
varSCIP variable

Definition at line 525 of file heur_setcover.c.

References assert(), isFixedVariable(), var, and SCP_INSTANCE::varsfixed.

Referenced by computeInitialLagrangeMultiplier(), computeOptimalSolution(), copyInstance(), copySetCoverSolution(), extendSolution(), greedySetCover(), isFixedVariable(), markRowsCoveredByFixedVariables(), and reportSolution().

◆ isVarInSolution()

SCIP_Bool isVarInSolution ( SCIP_Bool * solution,
SCIP_VAR * var )
static

checks if 'variable' is part of 'solution'

Parameters
solutionSCIP hashtable that contains SCIP variables
varSCIP variable

Definition at line 543 of file heur_setcover.c.

References assert(), isVarInSolution(), and var.

Referenced by checkSetCover(), computeDelta(), copySetCoverSolution(), copySolution(), extendSolution(), isVarInSolution(), removeRedundantColumns(), and reportSolution().

◆ addVarToCore()

void addVarToCore ( SCP_CORE * core,
SCIP_VAR * var )
static

adds a variable to the core

Parameters
coreinitialized core data structure
varSCIP variable

Definition at line 561 of file heur_setcover.c.

References addVarToCore(), assert(), SCP_CORE::ncorevariables, var, and SCP_CORE::varincore.

Referenced by addVarToCore(), initTentativeCore(), and redefineCore().

◆ fixVariable()

void fixVariable ( SCP_INSTANCE * inst,
SCIP_VAR * var )
static

fixes 'var' within instance 'inst'

Parameters
instSCP instance where 'variable' is to be fixed
varSCIP variable

Definition at line 581 of file heur_setcover.c.

References assert(), fixVariable(), SCP_INSTANCE::nvarsfixed, var, and SCP_INSTANCE::varsfixed.

Referenced by computeDelta(), copyInstance(), fixVariable(), and threePhase().

◆ addVarToSolution()

void addVarToSolution ( SCIP_Bool * solution,
SCIP_VAR * var )
static

adds variable 'var' to 'solution'

Parameters
solutionsolution represented as a boolean array
varSCIP variable

Definition at line 601 of file heur_setcover.c.

References addVarToSolution(), assert(), and var.

Referenced by addVarToSolution(), copySetCoverSolution(), copySolution(), extendSolution(), and greedySetCover().

◆ removeVarsFromCore()

void removeVarsFromCore ( SCIP * scip,
SCP_CORE * core )
static

removes all variables from the core

Parameters
scipSCIP data structure
coreinitialized core data structure

Definition at line 620 of file heur_setcover.c.

References assert(), i, SCP_CORE::ncorevariables, removeVarsFromCore(), and SCP_CORE::varincore.

Referenced by redefineCore(), and removeVarsFromCore().

◆ removeVarFromSolution()

void removeVarFromSolution ( SCIP_Bool * solution,
SCIP_VAR * var )
static

removes a 'var' from 'solution'

Parameters
solutionsolution represented as a boolean array
varSCIP variable

Definition at line 636 of file heur_setcover.c.

References assert(), removeVarFromSolution(), and var.

Referenced by removeRedundantColumns(), and removeVarFromSolution().

◆ clearSolution()

void clearSolution ( SCIP * scip,
SCIP_Bool * solution )
static

clears a solution

Parameters
scipSCIP data structure
solutionsolution represented as a boolean array

Definition at line 655 of file heur_setcover.c.

References assert(), clearSolution(), and i.

Referenced by clearSolution(), copySetCoverSolution(), copySolution(), and greedySetCover().

◆ isRowCovered()

SCIP_Bool isRowCovered ( SCP_INSTANCE * inst,
int rowpos )
static

checks if the row at position 'rowpos' is covered by fixed variables of 'inst'

Parameters
instSCP instance
rowposposition of the row within 'core'

Definition at line 671 of file heur_setcover.c.

References assert(), isRowCovered(), and SCP_INSTANCE::rowscovered.

Referenced by computeDelta(), computeInitialLagrangeMultiplier(), computeLocalLagrangianCosts(), computeOptimalSolution(), exploreNeighborhood(), greedySetCover(), isRowCovered(), markRowsCoveredByFixedVariables(), and subgradientOptimization().

◆ markRowAsCovered()

void markRowAsCovered ( SCP_INSTANCE * inst,
int rowpos )
static

marks the row at position 'rowpos' as covered within instance 'inst'

Parameters
instSCP instance
rowposposition of the row within 'core'

Definition at line 683 of file heur_setcover.c.

References assert(), markRowAsCovered(), SCP_INSTANCE::nrowscovered, and SCP_INSTANCE::rowscovered.

Referenced by greedySetCover(), markRowAsCovered(), and markRowsCoveredByFixedVariables().

◆ getVarIndex()

SCIP_RETCODE getVarIndex ( SCIP * scip,
SCP_CORE * core,
SCIP_VAR * variable,
int * pos )
static

returns the position of 'variable' within the array core->variables

Parameters
scipmaster SCIP data structure
coreSCP core data structure
variableSCIP variable
posaddress where the position is to be stored

Definition at line 697 of file heur_setcover.c.

References assert(), getVarIndex(), and SCP_CORE::mapvariables.

Referenced by checkSetCover(), computeCoreColumns(), computeCoreRows(), computeDelta(), computeGlobalLagrangianCosts(), computeInitialLagrangeMultiplier(), computeLocalLagrangianCosts(), computeOptimalSolution(), exploreNeighborhood(), getVarIndex(), greedySetCover(), initTentativeCore(), redefineCore(), and removeRedundantColumns().

◆ getConsVars()

SCIP_RETCODE getConsVars ( SCIP * scip,
SCP_CORE * core,
int pos,
SCIP_VAR ** vars,
int * nvars,
SCIP_Bool * success )
static

get all variables that are part of the constraint at position 'pos' (within SCIP) and saves them into 'vars'

Parameters
scipmaster SCIP data structure
coreSCP core data structure
posposition of the constraint within SCIP
varsallocated memory that can hold all variables
nvarsaddress where the number of variables will be stored
successaddress where the result of the operation will be stored

Definition at line 719 of file heur_setcover.c.

References SCP_CORE::conss, getConsVars(), SCP_CORE::maxconstraintvariables, nvars, SCIP_CALL(), success, and vars.

Referenced by checkSetCover(), computeCoreColumns(), computeCoreRows(), computeDelta(), computeGlobalLagrangianCosts(), computeInitialLagrangeMultiplier(), computeLocalLagrangianCosts(), computeOptimalSolution(), exploreNeighborhood(), getConsVars(), greedySetCover(), markRowsCoveredByFixedVariables(), redefineCore(), and removeRedundantColumns().

◆ freeMemoryForSolution()

void freeMemoryForSolution ( SCIP * scip,
SCP_Lagrange_Sol * mult )
static

releases all memory of a lagrange multiplier

Parameters
scipmaster SCIP data structure
multinitialized SCP lagrange multiplier that is to be freed

Definition at line 745 of file heur_setcover.c.

References freeMemoryForSolution(), SCP_Lagrange_Sol::lagrangiancostsglobal, SCP_Lagrange_Sol::lagrangiancostslocal, SCIPfreeBufferArray(), SCP_Lagrange_Sol::subgradient, SCP_Lagrange_Sol::u, and SCP_Lagrange_Sol::xgreedylocal.

Referenced by exploreNeighborhood(), freeMemoryForSolution(), setCoveringHeuristic(), and subgradientOptimization().

◆ copySetCoverSolution()

void copySetCoverSolution ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCIP_Bool * dest,
SCIP_Real * destcosts,
SCIP_Bool * source )
static

creates a set covering solution. Adds all fixed variables of 'inst' and all variables of 'source' to 'dest'. 'destcosts' contains the total costs of the solution.

Parameters
scipmaster SCIP data structure
coreSCP core data structure
instSCP instance
destarray where variables belonging to the solution are inserted
destcostsaddress where the total costs of the solution will be stored
sourceSCP solution to the (reduced) instance 'inst'

Definition at line 761 of file heur_setcover.c.

References addVarToSolution(), clearSolution(), copySetCoverSolution(), i, isFixedVariable(), isVarInSolution(), SCP_CORE::nvariables, and SCP_CORE::variables.

Referenced by copySetCoverSolution(), exploreNeighborhood(), and threePhase().

◆ copySolution()

void copySolution ( SCIP * scip,
SCP_CORE * core,
SCP_Lagrange_Sol * dest,
SCP_Lagrange_Sol * source )
static

copies all data of the lagrange multiplier 'source' to the lagrange multiplier 'dest'

Parameters
scipmaster SCIP data structure
coreSCP core data structure
destSCP lagrange multiplier where data will be copied to
sourceSCP lagrange multiplier where data will be copied from

Definition at line 794 of file heur_setcover.c.

References addVarToSolution(), clearSolution(), copySolution(), i, isVarInSolution(), SCP_Lagrange_Sol::lagrangiancostsglobal, SCP_Lagrange_Sol::lagrangiancostslocal, SCP_Lagrange_Sol::lblagrangeglobal, SCP_Lagrange_Sol::lblagrangelocal, SCP_CORE::nconss, SCP_CORE::nvariables, SCP_Lagrange_Sol::subgradient, SCP_Lagrange_Sol::u, SCP_Lagrange_Sol::ubgreedylocal, SCP_CORE::variables, and SCP_Lagrange_Sol::xgreedylocal.

Referenced by copySolution(), exploreNeighborhood(), subgradientOptimization(), and threePhase().

◆ initInstance()

SCIP_RETCODE initInstance ( SCIP * scip,
SCP_INSTANCE * inst )
static

initializes an instance where no variables are fixed and no rows are covered

Parameters
scipmaster SCIP data structure
instunitialized SCP instance

Definition at line 823 of file heur_setcover.c.

References SCP_INSTANCE::costsfixed, initInstance(), SCP_INSTANCE::nrowscovered, SCP_INSTANCE::nvarsfixed, SCP_INSTANCE::rowscovered, SCIP_CALL(), and SCP_INSTANCE::varsfixed.

Referenced by initInstance(), and setCoveringHeuristic().

◆ copyInstance()

void copyInstance ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * dest,
SCP_INSTANCE * source )
static

copies the fixed variables from 'source' to 'dest', but not the set of covered rows. this must be done separately.

Parameters
scipmaster SCIP data structure
coreSCP core data structure
destinitialized SCP instance
sourceinitialized SCP instance that is to be copied

Definition at line 839 of file heur_setcover.c.

References copyInstance(), SCP_INSTANCE::costsfixed, fixVariable(), i, isFixedVariable(), SCP_INSTANCE::nrowscovered, SCP_CORE::nvariables, SCP_INSTANCE::nvarsfixed, SCP_INSTANCE::rowscovered, SCP_CORE::variables, and SCP_INSTANCE::varsfixed.

Referenced by copyInstance(), and threePhase().

◆ freeInstance()

void freeInstance ( SCIP * scip,
SCP_INSTANCE * inst )
static

releases all memory used by an instance

Parameters
scipmaster SCIP data structure
instinitialized SCP instance that is to be freed

Definition at line 868 of file heur_setcover.c.

References freeInstance(), SCP_INSTANCE::rowscovered, SCIPfreeBufferArray(), and SCP_INSTANCE::varsfixed.

Referenced by freeInstance(), and setCoveringHeuristic().

◆ initTentativeCore()

◆ extendSolution()

void extendSolution ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCIP_Bool * solution )
static

adds all fixed variables of 'inst' to a set covering solution 'solution'

Parameters
scipmaster SCIP data structure
coreSCP core data structure
inst(reduced) SCP instance
solutionSCP solution (a hashtable that contains SCIP variables)

Definition at line 996 of file heur_setcover.c.

References addVarToSolution(), extendSolution(), i, isFixedVariable(), isVarInSolution(), SCP_CORE::nvariables, and SCP_CORE::variables.

Referenced by exploreNeighborhood(), and extendSolution().

◆ computeCoreRows()

SCIP_RETCODE computeCoreRows ( SCIP * scip,
SCP_CORE * core,
SCIP_HEURDATA * heurdata )
static

constructs rows of all constraints, but only includes core variables

Parameters
scipmaster SCIP data structure
coreSCP core data structure
heurdatapointer to the heuristics's data

Definition at line 1018 of file heur_setcover.c.

References assert(), computeCoreRows(), getConsVars(), getVarIndex(), heurdata, i, isCoreVariable(), j, SCP_CORE::maxconstraintvariables, SCP_CORE::nconss, SCP_CORE::nrowvars, nvars, SCP_CORE::rows, SCP_CORE::rowsavailable, SCIP_CALL(), SCIPfreeBufferArray(), success, SCP_CORE::variables, and vars.

Referenced by computeCoreRows(), redefineCore(), and setCoveringHeuristic().

◆ computeCoreColumns()

SCIP_RETCODE computeCoreColumns ( SCIP * scip,
SCP_CORE * core )
static

constructs columns of core variables to provide faster access

Parameters
scipmaster SCIP data structure
coreSCP core data structure

Definition at line 1094 of file heur_setcover.c.

References assert(), SCP_CORE::columns, SCP_CORE::columnsavailable, computeCoreColumns(), getConsVars(), getVarIndex(), i, isCoreVariable(), j, SCP_CORE::maxconstraintvariables, SCP_CORE::nconss, SCP_CORE::nvarconss, SCP_CORE::nvariables, nvars, SCIP_CALL(), SCIPfreeBufferArray(), success, SCP_CORE::variables, and vars.

Referenced by computeCoreColumns(), redefineCore(), and setCoveringHeuristic().

◆ freeCore()

void freeCore ( SCIP * scip,
SCP_CORE * core )
static

releases memory that is used by the core, including rows and columns, if they were computed

Parameters
scipmaster SCIP data structure
coreSCP core data structure that is to be freed

Definition at line 1170 of file heur_setcover.c.

References assert(), SCP_CORE::columns, SCP_CORE::columnsavailable, SCP_CORE::constraintid, SCP_CORE::delta, SCP_CORE::delta_pos, freeCore(), i, SCP_CORE::listcorevariables, SCP_CORE::mapvariables, SCP_CORE::nconss, SCP_CORE::nrowvars, SCP_CORE::nvarconss, SCP_CORE::nvariables, SCP_CORE::rows, SCP_CORE::rowsavailable, SCIPfreeBufferArray(), SCP_CORE::solgreedy, and SCP_CORE::varincore.

Referenced by freeCore(), and setCoveringHeuristic().

◆ redefineCore()

◆ markRowsCoveredByFixedVariables()

SCIP_RETCODE markRowsCoveredByFixedVariables ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCIP_HEURDATA * heurdata )
static

for all rows that are covered by the variables in inst->varsfixed, this function adds their indices to inst->rowscovered

Parameters
scipmaster SCIP data structure
coreSCP core data structure
instinitialized SCP instance where some variables may be fixed
heurdatapointer to the heuristic's data

Definition at line 1382 of file heur_setcover.c.

References SCP_CORE::columns, SCP_CORE::columnsavailable, getConsVars(), heurdata, i, isFixedVariable(), isRowCovered(), j, SCP_CORE::listcorevariables, markRowAsCovered(), markRowsCoveredByFixedVariables(), SCP_CORE::nconss, SCP_CORE::ncorevariables, SCP_INSTANCE::nrowscovered, SCP_CORE::nvarconss, nvars, SCP_INSTANCE::rowscovered, SCIP_CALL(), success, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by markRowsCoveredByFixedVariables(), setCoveringHeuristic(), and threePhase().

◆ checkSetCover()

SCIP_RETCODE checkSetCover ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCIP_Bool * solution,
SCIP_Bool * issetcover,
SCIP_HEURDATA * heurdata )
static

checks whether the given 'solution' is actually a set cover

Parameters
scipmaster SCIP data structure
coreSCP core data structure
instSCP instance
solutionpossible SCP solution
issetcoveraddress where TRUE will be stored if 'solution' is a set cover
heurdatapointer to the heuristic's data

Definition at line 1450 of file heur_setcover.c.

References assert(), checkSetCover(), getConsVars(), getVarIndex(), heurdata, i, isVarInSolution(), j, SCP_CORE::nconss, nvars, SCIP_CALL(), SCIPdebugMessage(), success, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by checkSetCover(), setCoveringHeuristic(), and threePhase().

◆ computeDelta()

SCIP_RETCODE computeDelta ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCIP_Real * lagrangiancosts,
SCIP_Bool * solution,
SCIP_Real pi,
SCIP_HEURDATA * heurdata )
static

computes delta values for variables and fixes new variables within inst, see formula (9) of the paper

Parameters
scipmaster SCIP data structure
coreSCP core data structure
instSCP instance
lagrangiancostsarray with lagrangian costs of the rows
solutionvalid solution to the global SCP instance
pipercentage of rows that need be covered by new fixed variables
heurdatapointer to the heuristic's data

Definition at line 1509 of file heur_setcover.c.

References SCP_CORE::columns, computeDelta(), SCP_CORE::conss, SCP_INSTANCE::costsfixed, SCP_CORE::delta, SCP_CORE::delta_pos, fixVariable(), getConsVars(), getVarIndex(), heurdata, i, isRowCovered(), isVarInSolution(), j, SCP_CORE::nactiveconss, SCP_CORE::nconss, SCP_CORE::nrowvars, SCP_CORE::nvarconss, SCP_CORE::nvariables, nvars, SCP_INSTANCE::nvarsfixed, SCP_CORE::rows, SCP_CORE::rowsavailable, SCIP_CALL(), SCIPfreeBufferArray(), success, SCP_CORE::variables, SCIP_HeurData::vars, vars, and SCP_INSTANCE::varsfixed.

Referenced by computeDelta(), and setCoveringHeuristic().

◆ removeRedundantColumns()

SCIP_RETCODE removeRedundantColumns ( SCIP * scip,
SCIP_HEURDATA * heurdata,
SCIP_Bool * solution,
SCIP_Real * solcosts )
static
Parameters
scipmaster SCIP data structure
heurdatapointer to the heuristic's data
solutionsolution to the global SCP instance
solcostspointer to original costs of 'solution'; contains updated costs

Definition at line 1638 of file heur_setcover.c.

References SCP_CORE::columns, SCP_CORE::columnsavailable, SCP_CORE::conss, SCIP_HeurData::core, getConsVars(), getVarIndex(), heurdata, i, isVarInSolution(), j, SCP_CORE::nconss, SCP_CORE::nrowvars, SCP_CORE::nvarconss, SCP_CORE::nvariables, nvars, removeRedundantColumns(), removeVarFromSolution(), SCP_CORE::rows, SCP_CORE::rowsavailable, SCIP_CALL(), SCIPdebugMessage(), SCIPfreeBufferArray(), success, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by exploreNeighborhood(), removeRedundantColumns(), and threePhase().

◆ greedySetCover()

◆ computeLocalLagrangianCosts()

SCIP_RETCODE computeLocalLagrangianCosts ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCP_Lagrange_Sol * mult,
SCIP_HEURDATA * heurdata )
static

computes lagrangian costs for all columns, only considering rows that are uncovered by fixed variables in 'inst'

Parameters
scipmaster SCIP data structure
coreSCP core data structure
inst(reduced) SCP instance
multlagrange multiplier that is used to compute the lagrangian costs
heurdatapointer to the heuristic's data

Definition at line 1946 of file heur_setcover.c.

References computeLocalLagrangianCosts(), SCP_CORE::conss, getConsVars(), getVarIndex(), heurdata, i, isRowCovered(), j, SCP_Lagrange_Sol::lagrangiancostslocal, SCP_CORE::nconss, SCP_CORE::nrowvars, SCP_CORE::nvariables, nvars, SCP_CORE::rows, SCP_CORE::rowsavailable, SCIP_CALL(), success, SCP_Lagrange_Sol::u, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by computeLocalLagrangianCosts(), and computeOptimalSolution().

◆ computeGlobalLagrangianCosts()

SCIP_RETCODE computeGlobalLagrangianCosts ( SCIP * scip,
SCP_CORE * core,
SCP_Lagrange_Sol * mult,
SCIP_HEURDATA * heurdata )
static

computes lagrangian costs for all columns of the unrestricted instance and a global lower bound.

Parameters
scipmaster SCIP data structure
coreSCP core data structure
multlagrange multiplier that is used to compute the lagrangian costs
heurdatapointer to the heuristic's data

Definition at line 2014 of file heur_setcover.c.

References computeGlobalLagrangianCosts(), getConsVars(), getVarIndex(), heurdata, i, j, SCP_Lagrange_Sol::lagrangiancostsglobal, SCP_Lagrange_Sol::lblagrangeglobal, SCP_CORE::nconss, SCP_CORE::nvariables, nvars, SCIP_CALL(), success, SCP_Lagrange_Sol::u, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by computeGlobalLagrangianCosts(), and computeOptimalSolution().

◆ computeOptimalSolution()

SCIP_RETCODE computeOptimalSolution ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCP_Lagrange_Sol * mult,
SCIP_HEURDATA * heurdata )
static

◆ subgradientOptimization()

SCIP_RETCODE subgradientOptimization ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCP_Lagrange_Sol * best_mult_lb,
SCIP_Real bestub,
SCIP_HEURDATA * heurdata )
static

subgradient method with Held-Karp update of subgradients

Parameters
scipmaster SCIP data structure
coreSCP core data structure
inst(reduced) SCP instance
best_mult_lblagrange multiplier that gives the best lower bound for 'inst'
bestubcosts of the best known solution for 'inst'
heurdatapointer the heuristic's data

Definition at line 2172 of file heur_setcover.c.

References allocateMemoryForSolution(), computeOptimalSolution(), copySolution(), SCP_INSTANCE::costsfixed, freeMemoryForSolution(), heurdata, i, isRowCovered(), SCP_Lagrange_Sol::lblagrangeglobal, SCP_Lagrange_Sol::lblagrangelocal, SCIP_HeurData::multbestlbtotal, SCP_CORE::nconss, SCIP_HeurData::param_lambda, SCIP_HeurData::param_lambda_adjustments, SCIP_HeurData::param_lambda_p, SCIP_HeurData::param_stop_crit_iter, SCIP_HeurData::param_stop_crit_ratio, SCIP_HeurData::randnumgen, SCIP_CALL(), SCIP_HeurData::sglastlb, SCP_Lagrange_Sol::subgradient, subgradientOptimization(), and SCP_Lagrange_Sol::u.

Referenced by subgradientOptimization(), and threePhase().

◆ computeInitialLagrangeMultiplier()

SCIP_RETCODE computeInitialLagrangeMultiplier ( SCIP * scip,
SCP_CORE * core,
SCP_INSTANCE * inst,
SCP_Lagrange_Sol * mult,
SCIP_HEURDATA * heurdata )
static

computes an initial lagrange multiplier, see formula (8) in the paper

Parameters
scipmaster SCIP data structure
coreSCP core data structure
inst(reduced) SCP instance
multinitialized lagrange multiplier were the new one will be stored
heurdatapointer to the heuristic's data

Definition at line 2310 of file heur_setcover.c.

References SCP_CORE::columns, SCP_CORE::columnsavailable, computeInitialLagrangeMultiplier(), SCP_CORE::conss, getConsVars(), getVarIndex(), heurdata, i, isCoreVariable(), isFixedVariable(), isRowCovered(), j, SCP_CORE::nconss, SCP_CORE::nvarconss, SCP_CORE::nvariables, nvars, SCIP_CALL(), SCIPfreeBufferArray(), success, SCP_Lagrange_Sol::u, SCP_CORE::variables, SCIP_HeurData::vars, and vars.

Referenced by computeInitialLagrangeMultiplier(), and threePhase().

◆ exploreNeighborhood()

◆ reportSolution()

SCIP_RETCODE reportSolution ( SCIP * scip,
SCP_INSTANCE * inst,
SCIP_Bool * solution,
SCIP_HEUR * heur )
static
Parameters
scipmaster SCIP data structure
inst(reduced) SCP instance
solutionsolution for 'inst'; will be extended to global solution
heurpointer to the heuristic's data

Definition at line 2601 of file heur_setcover.c.

References assert(), i, isFixedVariable(), isVarInSolution(), j, nvars, reportSolution(), SCIP_CALL(), SCIPdebugMessage(), SCIPfreeBufferArray(), success, and vars.

Referenced by reportSolution(), setCoveringHeuristic(), and threePhase().

◆ threePhase()

SCIP_RETCODE threePhase ( SCIP * scip,
SCIP_HEUR * heur,
SCIP_HEURDATA * heurdata )
static

◆ setCoveringHeuristic()

SCIP_RETCODE setCoveringHeuristic ( SCIP * scip,
SCIP_HEUR * heur )
static

driver for the three-phase procedure

Parameters
scipmaster SCIP data structure
heuroriginal SCIP heuristic data structure

Definition at line 2857 of file heur_setcover.c.

References allocateMemoryForSolution(), assert(), SCIP_HeurData::bestub, SCIP_HeurData::bestubinst_sol, SCIP_HeurData::bestubsol, SCIP_HeurData::bestubsubinstsol, checkSetCover(), computeCoreColumns(), computeCoreRows(), computeDelta(), SCIP_HeurData::core, SCP_INSTANCE::costsfixed, freeCore(), freeInstance(), freeMemoryForSolution(), SCIP_HeurData::greedycolgamma, SCIP_HeurData::greedycolmu, SCIP_HeurData::greedycolpos, SCIP_HeurData::greedycolscore, SCIP_HeurData::greedyinst, SCIP_HeurData::greedyqueue, heurdata, i, initInstance(), initTentativeCore(), SCIP_HeurData::inst, SCP_Lagrange_Sol::lagrangiancostsglobal, SCP_Lagrange_Sol::lblagrangeglobal, markRowsCoveredByFixedVariables(), SCP_CORE::maxconstraintvariables, SCIP_HeurData::multbestlbinst, SCIP_HeurData::multbestlbsubinst, SCIP_HeurData::multbestlbtotal, SCP_CORE::nactiveconss, SCP_INSTANCE::nrowscovered, SCP_CORE::nvariables, SCP_INSTANCE::nvarsfixed, SCIP_HeurData::param_beta, SCIP_HeurData::param_core_tent_size, SCIP_HeurData::param_lambda_p, SCIP_HeurData::param_max_iter, SCIP_HeurData::param_max_iter_no_imp, SCIP_HeurData::param_pi_alpha, SCIP_HeurData::param_pi_min, pqueue_destroy(), pqueue_init(), SCIP_HeurData::rccoldelta, SCIP_HeurData::rccols, redefineCore(), reportSolution(), SCP_INSTANCE::rowscovered, SCIP_CALL(), SCIPdebugMessage(), SCIPfreeBufferArray(), setCoveringHeuristic(), SCIP_HeurData::sglastlb, SCIP_HeurData::subinst, success, threePhase(), SCIP_HeurData::tpmultlbsubinst, SCIP_HeurData::useinitialmultiplier, SCIP_HeurData::vars, and SCP_INSTANCE::varsfixed.

Referenced by SCIP_DECL_HEUREXEC(), and setCoveringHeuristic().

◆ SCIP_DECL_HEURFREE()

SCIP_DECL_HEURFREE ( heurFreeSetcover )
static

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

Definition at line 3062 of file heur_setcover.c.

References assert(), heurdata, and SCIPfreeMemory().

◆ SCIP_DECL_HEURINIT()

SCIP_DECL_HEURINIT ( heurInitSetcover )
static

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

Definition at line 3082 of file heur_setcover.c.

References assert(), DEFAULT_RANDSEED, heurdata, SCIP_HeurData::randnumgen, and SCIP_CALL().

◆ SCIP_DECL_HEUREXIT()

SCIP_DECL_HEUREXIT ( heurExitSetcover )
static

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

Definition at line 3102 of file heur_setcover.c.

References assert(), heurdata, and SCIP_HeurData::randnumgen.

◆ SCIP_DECL_HEUREXEC()

SCIP_DECL_HEUREXEC ( heurExecSetcover )
static

◆ GCGincludeHeurSetcover()