Scippy

SCIP

Solving Constraint Integer Programs

cutpool.c File Reference

Detailed Description

methods for storing cuts in a cut pool

Author
Tobias Achterberg
Stefan Heinz
Gerald Gamrath
Marc Pfetsch
Kati Wolter

Definition in file cutpool.c.

#include <assert.h>
#include "scip/def.h"
#include "scip/set.h"
#include "scip/stat.h"
#include "scip/clock.h"
#include "scip/lp.h"
#include "scip/cons.h"
#include "scip/sepa.h"
#include "scip/sepastore.h"
#include "scip/cutpool.h"
#include "scip/pub_message.h"
#include "scip/pub_misc.h"
#include "scip/struct_cutpool.h"

Go to the source code of this file.

Functions

static SCIP_DECL_HASHGETKEY (hashGetKeyCut)
 
static SCIP_DECL_HASHKEYEQ (hashKeyEqCut)
 
static SCIP_DECL_HASHKEYVAL (hashKeyValCut)
 
static SCIP_RETCODE cutpoolEnsureCutsMem (SCIP_CUTPOOL *cutpool, SCIP_SET *set, int num)
 
static SCIP_RETCODE cutCreate (SCIP_CUT **cut, BMS_BLKMEM *blkmem, SCIP_ROW *row)
 
static SCIP_RETCODE cutFree (SCIP_CUT **cut, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp)
 
static SCIP_Bool cutIsAged (SCIP_CUT *cut, int agelimit)
 
SCIP_ROWSCIPcutGetRow (SCIP_CUT *cut)
 
int SCIPcutGetAge (SCIP_CUT *cut)
 
SCIP_Real SCIPcutGetLPActivityQuot (SCIP_CUT *cut)
 
SCIP_RETCODE SCIPcutpoolCreate (SCIP_CUTPOOL **cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, int agelimit, SCIP_Bool globalcutpool)
 
SCIP_RETCODE SCIPcutpoolFree (SCIP_CUTPOOL **cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp)
 
SCIP_RETCODE SCIPcutpoolClear (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_LP *lp)
 
SCIP_RETCODE SCIPcutpoolAddRow (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_ROW *row)
 
SCIP_RETCODE SCIPcutpoolAddNewRow (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_ROW *row)
 
static SCIP_RETCODE cutpoolDelCut (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_CUT *cut)
 
SCIP_RETCODE SCIPcutpoolDelRow (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_LP *lp, SCIP_ROW *row)
 
SCIP_RETCODE SCIPcutpoolSeparate (SCIP_CUTPOOL *cutpool, BMS_BLKMEM *blkmem, SCIP_SET *set, SCIP_STAT *stat, SCIP_EVENTQUEUE *eventqueue, SCIP_EVENTFILTER *eventfilter, SCIP_LP *lp, SCIP_SEPASTORE *sepastore, SCIP_SOL *sol, SCIP_Bool cutpoolisdelayed, SCIP_Bool root, SCIP_RESULT *result)
 
SCIP_CUT ** SCIPcutpoolGetCuts (SCIP_CUTPOOL *cutpool)
 
int SCIPcutpoolGetNCuts (SCIP_CUTPOOL *cutpool)
 
int SCIPcutpoolGetMaxNCuts (SCIP_CUTPOOL *cutpool)
 
SCIP_Real SCIPcutpoolGetTime (SCIP_CUTPOOL *cutpool)
 
SCIP_Longint SCIPcutpoolGetNCalls (SCIP_CUTPOOL *cutpool)
 
SCIP_Longint SCIPcutpoolGetNCutsFound (SCIP_CUTPOOL *cutpool)
 

Function Documentation

static SCIP_DECL_HASHGETKEY ( hashGetKeyCut  )
static

gets the hash key of a cut

Definition at line 51 of file cutpool.c.

References NULL, and SCIP_Cut::row.

static SCIP_DECL_HASHKEYVAL ( hashKeyValCut  )
static
static SCIP_RETCODE cutpoolEnsureCutsMem ( SCIP_CUTPOOL cutpool,
SCIP_SET set,
int  num 
)
static

resizes cuts array to be able to store at least num entries

Parameters
cutpoolcut pool
setglobal SCIP settings
numminimal number of slots in array

Definition at line 269 of file cutpool.c.

References BMSreallocMemoryArray, SCIP_Cutpool::cuts, SCIP_Cutpool::cutssize, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIPsetCalcMemGrowSize().

Referenced by SCIPcutpoolAddNewRow().

static SCIP_RETCODE cutCreate ( SCIP_CUT **  cut,
BMS_BLKMEM blkmem,
SCIP_ROW row 
)
static

creates a cut and captures the row

Parameters
cutpointer to store the cut
blkmemblock memory
rowrow this cut represents

Definition at line 299 of file cutpool.c.

References SCIP_Row::age, BMSallocBlockMemory, NULL, SCIP_ALLOC, SCIP_OKAY, and SCIProwCapture().

Referenced by SCIPcutpoolAddNewRow().

static SCIP_RETCODE cutFree ( SCIP_CUT **  cut,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_LP lp 
)
static

frees a cut and releases the row

Parameters
cutpointer to store the cut
blkmemblock memory
setglobal SCIP settings
lpcurrent LP data

Definition at line 325 of file cutpool.c.

References BMSfreeBlockMemory, NULL, SCIP_CALL, SCIP_OKAY, and SCIProwRelease().

Referenced by cutpoolDelCut(), and SCIPcutpoolClear().

static SCIP_Bool cutIsAged ( SCIP_CUT cut,
int  agelimit 
)
static

returns whether the cut's age exceeds the age limit

Parameters
cutcut to check
agelimitmaximum age a cut can reach before it is deleted from the pool, or -1

Definition at line 348 of file cutpool.c.

References SCIP_Cut::age, and NULL.

Referenced by SCIPcutpoolSeparate().

SCIP_ROW* SCIPcutGetRow ( SCIP_CUT cut)

gets the row of the cut

Parameters
cutcut

Definition at line 359 of file cutpool.c.

References NULL, and SCIP_Cut::row.

Referenced by copyCuts(), and takeCut().

int SCIPcutGetAge ( SCIP_CUT cut)

gets the age of the cut: the number of consecutive cut pool separation rounds where the cut was neither in the LP nor violated

Parameters
cutcut

Definition at line 369 of file cutpool.c.

References SCIP_Cut::age, and NULL.

Referenced by takeCut().

SCIP_Real SCIPcutGetLPActivityQuot ( SCIP_CUT cut)

returns the ratio of LPs where the row belonging to this cut was active in an LP solution, i.e. where the age of its row has not been increased

See also
SCIPcutGetAge() to get the age of a cut
Parameters
cutcut

Definition at line 383 of file cutpool.c.

References NULL, SCIP_Cut::row, SCIP_Longint, SCIP_Real, SCIProwGetActiveLPCount(), and SCIProwGetNLPsAfterCreation().

Referenced by takeCut().

SCIP_RETCODE SCIPcutpoolCreate ( SCIP_CUTPOOL **  cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
int  agelimit,
SCIP_Bool  globalcutpool 
)

creates cut pool

Parameters
cutpoolpointer to store cut pool
blkmemblock memory
setglobal SCIP settings
agelimitmaximum age a cut can reach before it is deleted from the pool
globalcutpoolis this the global cut pool of SCIP?

Definition at line 404 of file cutpool.c.

References BMSallocMemory, NULL, SCIP_ALLOC, SCIP_CALL, SCIP_CLOCKTYPE_DEFAULT, SCIP_HASHSIZE_CUTPOOLS, SCIP_HASHSIZE_CUTPOOLS_SMALL, SCIP_OKAY, SCIPclockCreate(), and SCIPhashtableCreate().

Referenced by initSolve(), and SCIPcreateCutpool().

SCIP_RETCODE SCIPcutpoolFree ( SCIP_CUTPOOL **  cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_LP lp 
)

frees cut pool

Parameters
cutpoolpointer to store cut pool
blkmemblock memory
setglobal SCIP settings
lpcurrent LP data

Definition at line 441 of file cutpool.c.

References BMSfreeMemory, BMSfreeMemoryArrayNull, NULL, SCIP_CALL, SCIP_OKAY, SCIPclockFree(), SCIPcutpoolClear(), and SCIPhashtableFree().

Referenced by freeSolve(), and SCIPfreeCutpool().

SCIP_RETCODE SCIPcutpoolClear ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_LP lp 
)

removes all rows from the cut pool

Parameters
cutpoolcut pool
blkmemblock memory
setglobal SCIP settings
lpcurrent LP data

Definition at line 467 of file cutpool.c.

References cutFree(), SCIP_Cutpool::cuts, FALSE, SCIP_Cutpool::globalcutpool, SCIP_Row::inglobalcutpool, SCIP_Cutpool::ncuts, SCIP_Cutpool::nremovablecuts, NULL, SCIP_Cut::row, SCIP_CALL, SCIP_OKAY, and SCIProwUnlock().

Referenced by freeSolve(), and SCIPcutpoolFree().

SCIP_RETCODE SCIPcutpoolAddRow ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_ROW row 
)

if not already existing, adds row to cut pool and captures it

Parameters
cutpoolcut pool
blkmemblock memory
setglobal SCIP settings
rowcutting plane to add

Definition at line 493 of file cutpool.c.

References SCIP_Cutpool::hashtable, NULL, SCIP_CALL, SCIP_OKAY, SCIPcutpoolAddNewRow(), SCIPhashtableRetrieve(), SCIProwGetMaxidx(), and SCIP_Row::validminmaxidx.

Referenced by SCIPaddDelayedPoolCut(), SCIPaddPoolCut(), and SCIPaddRowCutpool().

SCIP_RETCODE SCIPcutpoolAddNewRow ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_ROW row 
)
static SCIP_RETCODE cutpoolDelCut ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_STAT stat,
SCIP_LP lp,
SCIP_CUT cut 
)
static
SCIP_RETCODE SCIPcutpoolDelRow ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_STAT stat,
SCIP_LP lp,
SCIP_ROW row 
)

removes the LP row from the cut pool

Parameters
cutpoolcut pool
blkmemblock memory
setglobal SCIP settings
statproblem statistics data
lpcurrent LP data
rowrow to remove

Definition at line 641 of file cutpool.c.

References cutpoolDelCut(), SCIP_Cutpool::hashtable, NULL, SCIP_CALL, SCIP_INVALIDDATA, SCIP_OKAY, SCIPerrorMessage, SCIPhashtableRetrieve(), and SCIProwGetName().

Referenced by SCIPdelDelayedPoolCut(), SCIPdelPoolCut(), and SCIPdelRowCutpool().

SCIP_RETCODE SCIPcutpoolSeparate ( SCIP_CUTPOOL cutpool,
BMS_BLKMEM blkmem,
SCIP_SET set,
SCIP_STAT stat,
SCIP_EVENTQUEUE eventqueue,
SCIP_EVENTFILTER eventfilter,
SCIP_LP lp,
SCIP_SEPASTORE sepastore,
SCIP_SOL sol,
SCIP_Bool  cutpoolisdelayed,
SCIP_Bool  root,
SCIP_RESULT result 
)

separates cuts of the cut pool

Parameters
cutpoolcut pool
blkmemblock memory
setglobal SCIP settings
statproblem statistics data
eventqueueevent queue
eventfilterevent filter for global events
lpcurrent LP data
sepastoreseparation storage
solsolution to be separated (or NULL for LP-solution)
cutpoolisdelayedis the cutpool delayed (count cuts found)?
rootare we at the root node?
resultpointer to store the result of the separation call

Definition at line 670 of file cutpool.c.

References SCIP_Cut::age, SCIP_Cutpool::agelimit, cutIsAged(), cutpoolDelCut(), SCIP_Cutpool::cuts, FALSE, SCIP_Cutpool::firstunprocessed, SCIP_Cutpool::firstunprocessedsol, SCIP_Stat::lpcount, SCIP_Cutpool::ncalls, SCIP_Cutpool::ncuts, SCIP_Cutpool::ncutsfound, SCIP_Cutpool::nremovablecuts, NULL, SCIP_Cutpool::poolclock, SCIP_Cut::pos, SCIP_Cut::processedlp, SCIP_Cutpool::processedlp, SCIP_Cut::processedlpsol, SCIP_Cutpool::processedlpsol, SCIP_Cut::row, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_Longint, SCIP_OKAY, SCIP_SEPARATED, SCIPclockStart(), SCIPclockStop(), SCIPconshdlrIncNCutsFound(), SCIPdebugMessage, SCIProwGetLPFeasibility(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetOriginCons(), SCIProwGetOriginSepa(), SCIProwGetSolFeasibility(), SCIProwIsInLP(), SCIProwIsLPEfficacious(), SCIProwIsModifiable(), SCIProwIsSolEfficacious(), SCIPsepaIncNCutsFound(), SCIPsepaIncNCutsFoundAtNode(), SCIPsepastoreAddCut(), SCIPsepastoreGetNCuts(), and TRUE.

Referenced by cutpoolSeparate(), SCIPseparateCutpool(), and SCIPseparateSolCutpool().

SCIP_CUT** SCIPcutpoolGetCuts ( SCIP_CUTPOOL cutpool)

gets array of cuts in the cut pool

Parameters
cutpoolcut pool

Definition at line 844 of file cutpool.c.

References SCIP_Cutpool::cuts, and NULL.

Referenced by SCIPgetDelayedPoolCuts(), and SCIPgetPoolCuts().

int SCIPcutpoolGetNCuts ( SCIP_CUTPOOL cutpool)

gets number of cuts in the cut pool

Parameters
cutpoolcut pool

Definition at line 854 of file cutpool.c.

References SCIP_Cutpool::ncuts, and NULL.

Referenced by SCIPgetNDelayedPoolCuts(), and SCIPgetNPoolCuts().

int SCIPcutpoolGetMaxNCuts ( SCIP_CUTPOOL cutpool)

gets maximum number of cuts that were stored in the cut pool at the same time

Parameters
cutpoolcut pool

Definition at line 864 of file cutpool.c.

References SCIP_Cutpool::maxncuts, and NULL.

Referenced by printSeparatorStatistics().

SCIP_Real SCIPcutpoolGetTime ( SCIP_CUTPOOL cutpool)

gets time in seconds used for separating cuts from the pool

Parameters
cutpoolcut pool

Definition at line 874 of file cutpool.c.

References NULL, SCIP_Cutpool::poolclock, and SCIPclockGetTime().

Referenced by printSeparatorStatistics().

SCIP_Longint SCIPcutpoolGetNCalls ( SCIP_CUTPOOL cutpool)

get number of times, the cut pool was separated

Parameters
cutpoolcut pool

Definition at line 884 of file cutpool.c.

References SCIP_Cutpool::ncalls, and NULL.

Referenced by printSeparatorStatistics().

SCIP_Longint SCIPcutpoolGetNCutsFound ( SCIP_CUTPOOL cutpool)

get total number of cuts that were separated from the cut pool

Parameters
cutpoolcut pool

Definition at line 894 of file cutpool.c.

References SCIP_Cutpool::ncutsfound, and NULL.

Referenced by printSeparatorStatistics().