GCG 4.1.1 (dev)

Generic Column Generation

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

Detailed Description

methods for storing priced cols (based on SCIP's separation storage)

Author
Jonas Witt
Christian Puchert
Erik Muehmer

Definition in file pricestore_gcg.c.

#include <assert.h>
#include "gcg/pub_gcgcol.h"
#include "gcg/pub_gcgvar.h"
#include "scip/def.h"
#include "scip/set.h"
#include "scip/stat.h"
#include "scip/lp.h"
#include "scip/var.h"
#include "scip/tree.h"
#include "scip/reopt.h"
#include "scip/event.h"
#include "scip/cons.h"
#include "scip/debug.h"
#include "gcg/gcg.h"
#include "gcg/pricestore_gcg.h"
#include "gcg/struct_pricestore_gcg.h"
#include "gcg/pricer_gcg.h"
#include "gcg/struct_gcgcol.h"
#include "gcg/struct_sepagcg.h"

Go to the source code of this file.

Functions

static SCIP_RETCODE pricestoreEnsureColsMem (GCG_PRICESTORE *pricestore, int arrayindex, int num)
static int pricestoreGetArrayIndex (GCG_PRICESTORE *pricestore, GCG_COL *col)
SCIP_RETCODE GCGpricestoreCreate (GCG *gcg, GCG_PRICESTORE **pricestore, SCIP_Real efficiacyfac, SCIP_Real objparalfac, SCIP_Real orthofac, SCIP_Real mincolorth, GCG_EFFICIACYCHOICE efficiacychoice, int hashtablesize)
SCIP_RETCODE GCGpricestoreFree (GCG_PRICESTORE **pricestore)
void GCGpricestoreStartFarkas (GCG_PRICESTORE *pricestore)
void GCGpricestoreEndFarkas (GCG_PRICESTORE *pricestore)
void GCGpricestoreStartForceCols (GCG_PRICESTORE *pricestore)
void GCGpricestoreEndForceCols (GCG_PRICESTORE *pricestore)
static SCIP_RETCODE pricestoreDelCol (GCG_PRICESTORE *pricestore, int arrayindex, int pos, SCIP_Bool freecol)
static int pricestoreFindEqualCol (GCG_PRICESTORE *pricestore, GCG_COL *col)
SCIP_RETCODE GCGpricestoreAddCol (GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Bool forcecol, SCIP_Bool fromcolpool, SCIP_Bool *added)
static SCIP_RETCODE pricestoreUpdateOrthogonalities (GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Real mincolorthogonality)
static SCIP_RETCODE pricestoreApplyCol (GCG_PRICESTORE *pricestore, GCG_COL *col, SCIP_Bool force, SCIP_Real mincolorthogonality, SCIP_Real score, SCIP_Bool *added)
static GCG_COL * pricestoreGetBestCol (GCG_PRICESTORE *pricestore, int *ncolsapplied, int maxpricecolsprob)
static SCIP_RETCODE computeScore (GCG_PRICESTORE *pricestore, int arrayindex, int pos)
SCIP_RETCODE GCGpricestoreApplyCols (GCG_PRICESTORE *pricestore, GCG_COLPOOL *colpool, SCIP_Bool usecolpool, int *nfoundvars)
SCIP_RETCODE GCGpricestoreClearCols (GCG_PRICESTORE *pricestore)
GCG_COL ** GCGpricestoreGetCols (GCG_PRICESTORE *pricestore, int arrayindex)
int GCGpricestoreGetNCols (GCG_PRICESTORE *pricestore, int arrayindex)
int GCGpricestoreGetNColsTotal (GCG_PRICESTORE *pricestore)
int GCGpricestoreGetNColsFound (GCG_PRICESTORE *pricestore)
int GCGpricestoreGetNColsFoundRound (GCG_PRICESTORE *pricestore)
int GCGpricestoreGetNColsApplied (GCG_PRICESTORE *pricestore)

Function Documentation

◆ pricestoreEnsureColsMem()

SCIP_RETCODE pricestoreEnsureColsMem ( GCG_PRICESTORE * pricestore,
int arrayindex,
int num )
static

resizes cols and score arrays to be able to store at least num entries

Parameters
pricestoreprice storage
arrayindexindex of the arrays
numminimal number of slots in array

Definition at line 70 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::cols, GCG_PriceStore::colssize, GCG_SET_LOCK, GCG_UNSET_LOCK, GCG_PriceStore::masterprob, GCG_PriceStore::objparallelisms, GCG_PriceStore::orthogonalities, pricestoreEnsureColsMem(), retcode, SCIP_CALL(), and GCG_PriceStore::scores.

Referenced by GCGpricestoreAddCol(), and pricestoreEnsureColsMem().

◆ pricestoreGetArrayIndex()

int pricestoreGetArrayIndex ( GCG_PRICESTORE * pricestore,
GCG_COL * col )
static

returns the index of the arrays that are used to store data of a column

Parameters
pricestoreprice storage
colcolumn

Definition at line 106 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::narrays, pricestoreGetArrayIndex(), and GCG_Col::probnr.

Referenced by GCGpricestoreAddCol(), GCGpricestoreApplyCols(), pricestoreApplyCol(), and pricestoreGetArrayIndex().

◆ GCGpricestoreCreate()

SCIP_RETCODE GCGpricestoreCreate ( GCG * gcg,
GCG_PRICESTORE ** pricestore,
SCIP_Real redcostfac,
SCIP_Real objparalfac,
SCIP_Real orthofac,
SCIP_Real mincolorth,
GCG_EFFICIACYCHOICE efficiacychoice,
int hashtablesize )

creates price storage

Parameters
gcgGCG data structure
pricestorepointer to store price storage
efficiacyfacfactor of -redcost/norm in score function
objparalfacfactor of objective parallelism in score function
orthofacfactor of orthogonalities in score function
mincolorthminimal orthogonality of columns to add (with respect to columns added in the current round)
efficiacychoicechoice to base efficiacy on
hashtablesizesize of hashtable

Definition at line 117 of file pricestore_gcg.c.

References assert(), GCGgetMasterprob(), GCGgetNPricingprobs(), GCGpricestoreCreate(), i, masterprob, and SCIP_CALL().

Referenced by ObjPricerGcg::createPricestore(), and GCGpricestoreCreate().

◆ GCGpricestoreFree()

SCIP_RETCODE GCGpricestoreFree ( GCG_PRICESTORE ** pricestore)

frees price storage

Parameters
pricestorepointer to store price storage

Definition at line 184 of file pricestore_gcg.c.

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

Referenced by GCGpricestoreFree(), and SCIP_DECL_PRICEREXITSOL().

◆ GCGpricestoreStartFarkas()

void GCGpricestoreStartFarkas ( GCG_PRICESTORE * pricestore)

informs price storage, that Farkas pricing starts now

Parameters
pricestoreprice storage

Definition at line 218 of file pricestore_gcg.c.

References assert(), GCGpricestoreStartFarkas(), GCG_PriceStore::infarkas, and GCG_PriceStore::ncolstotal.

Referenced by GCGpricestoreStartFarkas(), and SCIP_DECL_PRICERFARKAS().

◆ GCGpricestoreEndFarkas()

void GCGpricestoreEndFarkas ( GCG_PRICESTORE * pricestore)

informs price storage, that Farkas pricing is now finished

Parameters
pricestoreprice storage

Definition at line 229 of file pricestore_gcg.c.

References assert(), GCGpricestoreEndFarkas(), GCG_PriceStore::infarkas, and GCG_PriceStore::ncolstotal.

Referenced by GCGpricestoreEndFarkas(), and SCIP_DECL_PRICERREDCOST().

◆ GCGpricestoreStartForceCols()

void GCGpricestoreStartForceCols ( GCG_PRICESTORE * pricestore)

informs price storage, that the following cols should be used in any case

Parameters
pricestoreprice storage

Definition at line 240 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::forcecols, and GCGpricestoreStartForceCols().

Referenced by GCGpricestoreStartForceCols().

◆ GCGpricestoreEndForceCols()

void GCGpricestoreEndForceCols ( GCG_PRICESTORE * pricestore)

informs price storage, that the following cols should no longer be used in any case

Parameters
pricestoreprice storage

Definition at line 251 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::forcecols, and GCGpricestoreEndForceCols().

Referenced by GCGpricestoreEndForceCols().

◆ pricestoreDelCol()

SCIP_RETCODE pricestoreDelCol ( GCG_PRICESTORE * pricestore,
int arrayindex,
int pos,
SCIP_Bool freecol )
static

removes a non-forced col from the price storage

Parameters
pricestoreprice storage
arrayindexindex of the arrays
posposition of col to delete
freecolshould col be freed

Definition at line 263 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::cols, GCGfreeGcgCol(), GCG_PriceStore::hashtable, GCG_PriceStore::ncols, GCG_PriceStore::nforcedcols, GCG_PriceStore::objparallelisms, GCG_PriceStore::orthogonalities, GCG_Col::pos, pricestoreDelCol(), SCIP_CALL(), and GCG_PriceStore::scores.

Referenced by GCGpricestoreApplyCols(), pricestoreApplyCol(), pricestoreDelCol(), and pricestoreUpdateOrthogonalities().

◆ pricestoreFindEqualCol()

int pricestoreFindEqualCol ( GCG_PRICESTORE * pricestore,
GCG_COL * col )
static

for a given column, check if an identical column already exists in the price storage; if one exists, return its position, otherwise, return -1

Parameters
pricestoreprice storage
colcolumn to be checked

Definition at line 298 of file pricestore_gcg.c.

References GCG_PriceStore::hashtable, GCG_Col::pos, and pricestoreFindEqualCol().

Referenced by GCGpricestoreAddCol(), and pricestoreFindEqualCol().

◆ GCGpricestoreAddCol()

SCIP_RETCODE GCGpricestoreAddCol ( GCG_PRICESTORE * pricestore,
GCG_COL * col,
SCIP_Bool forcecol,
SCIP_Bool fromcolpool,
SCIP_Bool * added )

◆ pricestoreUpdateOrthogonalities()

SCIP_RETCODE pricestoreUpdateOrthogonalities ( GCG_PRICESTORE * pricestore,
GCG_COL * col,
SCIP_Real mincolorthogonality )
static

◆ pricestoreApplyCol()

SCIP_RETCODE pricestoreApplyCol ( GCG_PRICESTORE * pricestore,
GCG_COL * col,
SCIP_Bool force,
SCIP_Real mincolorthogonality,
SCIP_Real score,
SCIP_Bool * added )
static

adds the given col to priced vars, updates the orthogonalities and scores of remaining cols, and frees non-forced cols

Parameters
pricestoreprice storage
colcol to apply to the LP
forceforce column
mincolorthogonalityminimal orthogonality of cols to apply to LP
scorescore of column (or -1.0 if not specified)
addedpointer to store whether the column was added

Definition at line 556 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::cols, GCG_PriceStore::gcg, GCGcreateNewMasterVarFromGcgCol(), GCGfreeGcgCol(), GCG_PriceStore::infarkas, GCG_PriceStore::masterprob, GCG_PriceStore::orthofac, GCG_Col::pos, pricestoreApplyCol(), pricestoreDelCol(), pricestoreGetArrayIndex(), pricestoreUpdateOrthogonalities(), and SCIP_CALL().

Referenced by GCGpricestoreApplyCols(), and pricestoreApplyCol().

◆ pricestoreGetBestCol()

GCG_COL * pricestoreGetBestCol ( GCG_PRICESTORE * pricestore,
int * ncolsapplied,
int maxpricecolsprob )
static

returns the position of the best non-forced col in the cols array

Parameters
pricestoreprice storage
ncolsappliednumber of cols applied per array index
maxpricecolsprobmaximum number of cols allowed per array index

Definition at line 594 of file pricestore_gcg.c.

References assert(), bestscore, GCG_PriceStore::cols, i, GCG_PriceStore::narrays, GCG_PriceStore::nforcedcols, pricestoreGetBestCol(), and GCG_PriceStore::scores.

Referenced by GCGpricestoreApplyCols(), and pricestoreGetBestCol().

◆ computeScore()

SCIP_RETCODE computeScore ( GCG_PRICESTORE * pricestore,
int arrayindex,
int pos )
static

◆ GCGpricestoreApplyCols()

◆ GCGpricestoreClearCols()

◆ GCGpricestoreGetCols()

GCG_COL ** GCGpricestoreGetCols ( GCG_PRICESTORE * pricestore,
int arrayindex )

get cols in the price storage

Parameters
pricestoreprice storage
arrayindexindex of the arrays

Definition at line 866 of file pricestore_gcg.c.

References assert(), GCG_PriceStore::cols, and GCGpricestoreGetCols().

Referenced by GCGpricestoreGetCols(), and ObjPricerGcg::getBestCols().

◆ GCGpricestoreGetNCols()

int GCGpricestoreGetNCols ( GCG_PRICESTORE * pricestore,
int arrayindex )

get number of cols in the price storage

Parameters
pricestoreprice storage
arrayindexindex of the arrays

Definition at line 877 of file pricestore_gcg.c.

References assert(), GCGpricestoreGetNCols(), and GCG_PriceStore::ncols.

Referenced by GCGpricestoreGetNCols(), and ObjPricerGcg::getBestCols().

◆ GCGpricestoreGetNColsTotal()

int GCGpricestoreGetNColsTotal ( GCG_PRICESTORE * pricestore)

get number of cols in the price storage

Parameters
pricestoreprice storage

Definition at line 888 of file pricestore_gcg.c.

References assert(), GCGpricestoreGetNColsTotal(), and GCG_PriceStore::ncolstotal.

Referenced by GCGpricestoreGetNColsTotal(), and ObjPricerGcg::pricingLoop().

◆ GCGpricestoreGetNColsFound()

int GCGpricestoreGetNColsFound ( GCG_PRICESTORE * pricestore)

get total number of cols found so far

Parameters
pricestoreprice storage

Definition at line 898 of file pricestore_gcg.c.

References assert(), GCGpricestoreGetNColsFound(), and GCG_PriceStore::ncolsfound.

Referenced by GCGpricestoreGetNColsFound().

◆ GCGpricestoreGetNColsFoundRound()

int GCGpricestoreGetNColsFoundRound ( GCG_PRICESTORE * pricestore)

get number of cols found so far in current price round

Parameters
pricestoreprice storage

Definition at line 908 of file pricestore_gcg.c.

References assert(), GCGpricestoreGetNColsFoundRound(), and GCG_PriceStore::ncolsfoundround.

Referenced by GCGpricestoreGetNColsFoundRound().

◆ GCGpricestoreGetNColsApplied()

int GCGpricestoreGetNColsApplied ( GCG_PRICESTORE * pricestore)

get total number of cols applied to the LPs

Parameters
pricestoreprice storage

Definition at line 918 of file pricestore_gcg.c.

References assert(), GCGpricestoreGetNColsApplied(), and GCG_PriceStore::ncolsapplied.

Referenced by GCGpricestoreGetNColsApplied().