Scippy

GCG

Branch-and-Price & Column Generation for Everyone

sepa_basis.c File Reference

Detailed Description

basis separator

Author
Jonas Witt

Definition in file sepa_basis.c.

#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "scip/scip.h"
#include "scip/scipdefplugins.h"
#include "gcg/sepa_basis.h"
#include "gcg/sepa_original.h"
#include "gcg/gcg.h"
#include "gcg/relax_gcg.h"
#include "gcg/pricer_gcg.h"
#include "gcg/pub_gcgvar.h"

Go to the source code of this file.

Data Structures

struct  SCIP_SepaData
 

Macros

#define SEPA_NAME   "basis"
 
#define SEPA_DESC   "separator calculates a basis of the orig problem to generate cuts, which cut off the master lp sol"
 
#define SEPA_PRIORITY   100
 
#define SEPA_FREQ   0
 
#define SEPA_MAXBOUNDDIST   1.0
 
#define SEPA_USESSUBSCIP   FALSE
 
#define SEPA_DELAY   TRUE
 
#define STARTMAXCUTS   50
 
#define sepaCopyBasis   NULL
 
#define sepaExecsolBasis   NULL
 

Functions

static SCIP_RETCODE ensureSizeCuts (SCIP *scip, SCIP_SEPADATA *sepadata, int size)
 
static SCIP_RETCODE ensureSizeNewCuts (SCIP *scip, SCIP_SEPADATA *sepadata, int size)
 
static SCIP_Real exponentiate (SCIP_Real basis, int exponent)
 
static SCIP_RETCODE initProbingObjWithOrigObj (SCIP *origscip, SCIP_Bool enableobj, SCIP_Real objfactor)
 
static SCIP_RETCODE chgProbingObjAddingOrigObj (SCIP *origscip, SCIP_Real objfactor, SCIP_Real objdivisor)
 
static SCIP_RETCODE initProbingObjUsingVarBounds (SCIP *origscip, SCIP_SEPADATA *sepadata, SCIP_SOL *origsol, SCIP_Bool enableobj, SCIP_Real objfactor)
 
static SCIP_RETCODE chgProbingObjUsingRows (SCIP *origscip, SCIP_SEPADATA *sepadata, SCIP_SOL *origsol, SCIP_Real objfactor, SCIP_Real objdivisor)
 
static SCIP_RETCODE addPPObjConss (GCG *gcg, SCIP_SEPA *sepa, int ppnumber, SCIP_Real dualsolconv, SCIP_Bool newcuts, SCIP_Bool probing)
 
static SCIP_DECL_SEPAFREE (sepaFreeBasis)
 
static SCIP_DECL_SEPAINIT (sepaInitBasis)
 
static SCIP_DECL_SEPAEXIT (sepaExitBasis)
 
static SCIP_DECL_SEPAINITSOL (sepaInitsolBasis)
 
static SCIP_DECL_SEPAEXITSOL (sepaExitsolBasis)
 
static SCIP_RETCODE initGenconv (SCIP *origscip, SCIP_SEPADATA *sepadata, SCIP_SOL *origsol, int nbasis, SCIP_Real *convex)
 
static SCIP_RETCODE initConvObj (SCIP *origscip, SCIP_SEPADATA *sepadata, SCIP_SOL *origsol, SCIP_Real convex, SCIP_Bool genericconv)
 
static SCIP_DECL_SEPAEXECLP (sepaExeclpBasis)
 
SCIP_RETCODE GCGincludeSepaBasis (GCG *gcg)
 
SCIP_ROW ** GCGsepaBasisGetOrigcuts (GCG *gcg)
 
int GCGsepaBasisGetNOrigcuts (GCG *gcg)
 
SCIP_ROW ** GCGsepaBasisGetMastercuts (GCG *gcg)
 
int GCGsepaBasisGetNMastercuts (GCG *gcg)
 
SCIP_RETCODE GCGsepaBasisAddPricingCut (GCG *gcg, int ppnumber, SCIP_ROW *cut)
 
SCIP_RETCODE SCIPsepaBasisAddPPObjConss (GCG *gcg, int ppnumber, SCIP_Real dualsolconv, SCIP_Bool newcuts)
 

Macro Definition Documentation

◆ SEPA_NAME

#define SEPA_NAME   "basis"

Definition at line 58 of file sepa_basis.c.

◆ SEPA_DESC

#define SEPA_DESC   "separator calculates a basis of the orig problem to generate cuts, which cut off the master lp sol"

Definition at line 59 of file sepa_basis.c.

◆ SEPA_PRIORITY

#define SEPA_PRIORITY   100

Definition at line 60 of file sepa_basis.c.

◆ SEPA_FREQ

#define SEPA_FREQ   0

Definition at line 61 of file sepa_basis.c.

◆ SEPA_MAXBOUNDDIST

#define SEPA_MAXBOUNDDIST   1.0

Definition at line 62 of file sepa_basis.c.

◆ SEPA_USESSUBSCIP

#define SEPA_USESSUBSCIP   FALSE

does the separator use a secondary SCIP instance?

Definition at line 63 of file sepa_basis.c.

◆ SEPA_DELAY

#define SEPA_DELAY   TRUE

should separation method be delayed, if other separators found cuts?

Definition at line 64 of file sepa_basis.c.

◆ STARTMAXCUTS

#define STARTMAXCUTS   50

maximal cuts used at the beginning

Definition at line 66 of file sepa_basis.c.

◆ sepaCopyBasis

#define sepaCopyBasis   NULL

copy method for separator plugins (called when SCIP copies plugins)

Definition at line 810 of file sepa_basis.c.

◆ sepaExecsolBasis

#define sepaExecsolBasis   NULL

arbitrary primal solution separation method of separator

Definition at line 1601 of file sepa_basis.c.

Function Documentation

◆ ensureSizeCuts()

static SCIP_RETCODE ensureSizeCuts ( SCIP *  scip,
SCIP_SEPADATA *  sepadata,
int  size 
)
static

allocates enough memory to hold more cuts

Parameters
scipSCIP data structure
sepadataseparator data data structure
sizenew size of cut arrays

Definition at line 115 of file sepa_basis.c.

References SCIP_SepaData::mastercuts, SCIP_SepaData::maxcuts, SCIP_SepaData::nmastercuts, SCIP_SepaData::norigcuts, NULL, SCIP_SepaData::origcuts, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by SCIP_DECL_SEPAEXECLP().

◆ ensureSizeNewCuts()

static SCIP_RETCODE ensureSizeNewCuts ( SCIP *  scip,
SCIP_SEPADATA *  sepadata,
int  size 
)
static

allocates enough memory to hold more new cuts

Parameters
scipSCIP data structure
sepadataseparator data data structure
sizenew size of cut arrays

Definition at line 144 of file sepa_basis.c.

References SCIP_SepaData::maxnewcuts, SCIP_SepaData::newcuts, SCIP_SepaData::nnewcuts, NULL, SCIP_CALL, SCIP_OKAY, SCIPcalcMemGrowSize(), and SCIPreallocBlockMemoryArray.

Referenced by addPPObjConss(), GCGsepaBasisAddPricingCut(), and SCIP_DECL_SEPAEXECLP().

◆ exponentiate()

static SCIP_Real exponentiate ( SCIP_Real  basis,
int  exponent 
)
static

returns the result of the exponentiation for given exponent and basis (basis^exponent) Initialize probing objective coefficient for each variable with original objective.

Parameters
basisbasis for exponentiation
exponentexponent for exponentiation

Definition at line 169 of file sepa_basis.c.

References SCIP_Real.

Referenced by chgProbingObjUsingRows(), and initProbingObjUsingVarBounds().

◆ initProbingObjWithOrigObj()

static SCIP_RETCODE initProbingObjWithOrigObj ( SCIP *  origscip,
SCIP_Bool  enableobj,
SCIP_Real  objfactor 
)
static

Change probing objective coefficient for each variable by adding original objective to the probing objective.

Parameters
origsciporig scip problem
enableobjreturns if objective row was added to the lp
objfactorfactor, the objective is multiplied with

Definition at line 190 of file sepa_basis.c.

References SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPchgVarObjProbing(), SCIPgetNVars(), SCIPgetVars(), SCIPinProbing(), and SCIPvarGetObj().

Referenced by initConvObj().

◆ chgProbingObjAddingOrigObj()

static SCIP_RETCODE chgProbingObjAddingOrigObj ( SCIP *  origscip,
SCIP_Real  objfactor,
SCIP_Real  objdivisor 
)
static

Initialize probing objective coefficient for each variable depending on the current origsol.

If variable is at upper bound set objective to -1, if variable is at lower bound set obj to 1,
else set obj to 0.
Additionally, add original objective to the probing objective if this is enabled.
Parameters
origsciporig scip problem
objfactorfactor the additional part of the objective is multiplied with
objdivisorfactor the additional part of the objective is divided with

Definition at line 228 of file sepa_basis.c.

References SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPchgVarObjProbing(), SCIPgetNVars(), SCIPgetVarObjProbing(), SCIPgetVars(), SCIPinProbing(), and SCIPvarGetObj().

Referenced by initConvObj().

◆ initProbingObjUsingVarBounds()

static SCIP_RETCODE initProbingObjUsingVarBounds ( SCIP *  origscip,
SCIP_SEPADATA *  sepadata,
SCIP_SOL *  origsol,
SCIP_Bool  enableobj,
SCIP_Real  objfactor 
)
static

Change probing objective depending on the current origsol.

Loop over all constraints lhs <= sum a_i*x_i <= rhs. If lhs == sum a_i*x_i^* add a_i to objective of variable i and if rhs == sum a_i*x_i^* add -a_i to objective of variable i.

Parameters
origsciporig scip problem
sepadataseparator specific data
origsolorig solution
enableobjreturns if objective row was added to the lp
objfactorfactor the objective is multiplied with

Definition at line 266 of file sepa_basis.c.

References SCIP_SepaData::enableposslack, exponentiate(), MAX, MIN, SCIP_SepaData::posslackexp, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPchgVarObjProbing(), SCIPgetNVars(), SCIPgetSolVal(), SCIPgetVars(), SCIPinfinity(), SCIPisFeasEQ(), SCIPisFeasGE(), SCIPisFeasLE(), SCIPisFeasPositive(), SCIPisGT(), SCIPisLT(), SCIPvarGetLbLocal(), SCIPvarGetObj(), and SCIPvarGetUbLocal().

Referenced by initConvObj().

◆ chgProbingObjUsingRows()

◆ addPPObjConss()

static SCIP_RETCODE addPPObjConss ( GCG *  gcg,
SCIP_SEPA *  sepa,
int  ppnumber,
SCIP_Real  dualsolconv,
SCIP_Bool  newcuts,
SCIP_Bool  probing 
)
static

add cuts based on the last objective function of the pricing problems, which did not yield any new columns (stating that the reduced cost are non-negative)

Parameters
gcgGCG data structure
sepaseparator basis
ppnumbernumber of pricing problem
dualsolconvdual solution corresponding to convexity constraint
newcutsadd cut to newcuts in sepadata? (otherwise add it just to the cutpool)
probingadd cut to probing LP?

Definition at line 711 of file sepa_basis.c.

References ensureSizeNewCuts(), FALSE, GCGgetNIdenticalBlocks(), GCGgetOrigprob(), GCGgetPricingprob(), GCGisPricingprobRelevant(), GCGpricingVarGetOrigvars(), GCGvarIsPricing(), SCIP_SepaData::newcuts, SCIP_SepaData::nnewcuts, NULL, SCIP_CALL, SCIP_MAXSTRLEN, SCIP_OKAY, SCIP_Real, SCIPaddPoolCut(), SCIPaddRowProbing(), SCIPaddVarToRow(), SCIPcaptureRow(), SCIPcreateEmptyRowUnspec(), SCIPdebugMessage, SCIPgetNOrigVars(), SCIPgetOrigVars(), SCIPinfinity(), SCIPisEQ(), SCIPreleaseRow(), SCIPsepaGetData(), SCIPsepaGetNCalls(), SCIPsnprintf(), SCIPvarGetObj(), and TRUE.

Referenced by SCIP_DECL_SEPAEXECLP(), and SCIPsepaBasisAddPPObjConss().

◆ SCIP_DECL_SEPAFREE()

static SCIP_DECL_SEPAFREE ( sepaFreeBasis  )
static

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

Definition at line 814 of file sepa_basis.c.

References NULL, SCIP_OKAY, SCIPfreeBlockMemory, and SCIPsepaGetData().

◆ SCIP_DECL_SEPAINIT()

◆ SCIP_DECL_SEPAEXIT()

◆ SCIP_DECL_SEPAINITSOL()

static SCIP_DECL_SEPAINITSOL ( sepaInitsolBasis  )
static

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

Definition at line 934 of file sepa_basis.c.

References SCIP_SepaData::nmastercuts, NULL, SCIP_OKAY, and SCIPsepaGetData().

◆ SCIP_DECL_SEPAEXITSOL()

static SCIP_DECL_SEPAEXITSOL ( sepaExitsolBasis  )
static

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

Definition at line 949 of file sepa_basis.c.

References SCIP_SepaData::gcg, GCGgetOrigprob(), SCIP_SepaData::mastercuts, SCIP_SepaData::nmastercuts, SCIP_SepaData::norigcuts, NULL, SCIP_CALL, SCIP_OKAY, SCIPreleaseRow(), and SCIPsepaGetData().

◆ initGenconv()

static SCIP_RETCODE initGenconv ( SCIP *  origscip,
SCIP_SEPADATA *  sepadata,
SCIP_SOL *  origsol,
int  nbasis,
SCIP_Real *  convex 
)
static

Initialize generic convex combination coefficient

Parameters
origsciporiginal SCIP data structure
sepadataseparator data structure
origsolcurrent original solution
nbasisrank of constraint matrix
convexpointer to store convex combination coefficient

Definition at line 971 of file sepa_basis.c.

References SCIP_SepaData::objconvex, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and SCIPwarningMessage().

Referenced by SCIP_DECL_SEPAEXECLP().

◆ initConvObj()

static SCIP_RETCODE initConvObj ( SCIP *  origscip,
SCIP_SEPADATA *  sepadata,
SCIP_SOL *  origsol,
SCIP_Real  convex,
SCIP_Bool  genericconv 
)
static

Initialize objective as convex combination of so-called face objective function and original objective function

Parameters
origsciporiginal SCIP data structure
sepadataseparator data structure
origsolcurrent original solution
convexconvex coefficient to initialize objective
genericconvwas convex coefficient calculated generically?

Definition at line 1002 of file sepa_basis.c.

References chgProbingObjAddingOrigObj(), chgProbingObjUsingRows(), SCIP_SepaData::enableobj, FALSE, initProbingObjUsingVarBounds(), initProbingObjWithOrigObj(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPgetObjNorm(), SCIPisEQ(), SCIPisGT(), SCIPisLT(), and TRUE.

Referenced by SCIP_DECL_SEPAEXECLP().

◆ SCIP_DECL_SEPAEXECLP()

static SCIP_DECL_SEPAEXECLP ( sepaExeclpBasis  )
static

LP solution separation method of separator

Definition at line 1049 of file sepa_basis.c.

References addPPObjConss(), SCIP_SepaData::chgobj, SCIP_SepaData::chgobjallways, SCIP_SepaData::currentnodenr, SCIP_SepaData::enable, SCIP_SepaData::enableobj, SCIP_SepaData::enableobjround, SCIP_SepaData::enableposslack, SCIP_SepaData::enableppobjconss, ensureSizeCuts(), ensureSizeNewCuts(), FALSE, SCIP_SepaData::forcecuts, SCIP_SepaData::gcg, GCGgetNPricingprobs(), GCGgetNRelPricingprobs(), GCGgetOrigprob(), GCGrelaxGetCurrentOrigSol(), GCGrelaxIsOrigSolFeasible(), GCGrelaxUpdateCurrentSol(), GCGsepaAddOriginalSepaCuts(), GCGsepaGetNOriginalSepaCuts(), GCGsepaGetOriginalSepaOrigcuts(), GCGsepaOriginalSepaOrigcutExists(), GCGsetPricingObjs(), GCGtransformOrigvalsToMastervals(), GCGvarIsOriginal(), SCIP_SepaData::genobjconvex, initConvObj(), initGenconv(), SCIP_SepaData::mastercuts, SCIP_SepaData::maxrounds, SCIP_SepaData::maxroundsroot, SCIP_SepaData::mincuts, SCIP_SepaData::newcuts, SCIP_SepaData::nmastercuts, SCIP_SepaData::nnewcuts, SCIP_SepaData::norigcuts, NULL, SCIP_SepaData::objconvex, SCIP_SepaData::objrow, SCIP_SepaData::origcuts, SCIP_SepaData::posslackexp, SCIP_SepaData::posslackexpgen, SCIP_SepaData::posslackexpgenfactor, SCIP_SepaData::round, SCIP_Bool, SCIP_CALL, SCIP_CUTOFF, SCIP_DIDNOTFIND, SCIP_DIDNOTRUN, SCIP_Longint, SCIP_LPSOLSTAT_NOTSOLVED, SCIP_LPSOLSTAT_OBJLIMIT, SCIP_LPSOLSTAT_OPTIMAL, SCIP_MAXSTRLEN, SCIP_NEWROUND, SCIP_OKAY, SCIP_PARAMSETTING_OFF, SCIP_Real, SCIP_REAL_MIN, SCIP_ROWORIGINTYPE_SEPA, SCIP_SEPARATED, SCIPaddPoolCut(), SCIPaddRow(), SCIPaddRowProbing(), SCIPaddVarsToRow(), SCIPallocBufferArray, SCIPapplyCutsProbing(), SCIPcaptureRow(), SCIPceil(), SCIPchgRowLhs(), SCIPchgRowRhs(), SCIPclearCuts(), SCIPcolGetVar(), SCIPconstructLP(), SCIPcreateEmptyRowSepa(), SCIPdebugMessage, SCIPendProbing(), SCIPfreeBufferArray, SCIPgetCurrentNode(), SCIPgetCuts(), SCIPgetDelayedGlobalCutpool(), SCIPgetGlobalCutpool(), SCIPgetIntParam(), SCIPgetLPBranchCands(), SCIPgetLPObjval(), SCIPgetLPRows(), SCIPgetLPSolstat(), SCIPgetNCuts(), SCIPgetNLPCols(), SCIPgetNLPRows(), SCIPgetNVars(), SCIPgetRootNode(), SCIPgetSolTransObj(), SCIPgetVars(), SCIPinfinity(), SCIPisCutEfficacious(), SCIPisInfinity(), SCIPisObjIntegral(), SCIPnewProbingNode(), SCIPnodeGetNumber(), SCIPrelDiff(), SCIPreleaseRow(), SCIProwGetCols(), SCIProwGetConstant(), SCIProwGetLhs(), SCIProwGetLPPos(), SCIProwGetName(), SCIProwGetNNonz(), SCIProwGetOrigintype(), SCIProwGetRhs(), SCIProwGetVals(), SCIProwIsLocal(), SCIPsepaGetData(), SCIPseparateSol(), SCIPseparateSolCutpool(), SCIPsetIntParam(), SCIPsetSeparating(), SCIPsnprintf(), SCIPsolveProbingLP(), SCIPstartProbing(), SCIPwarningMessage(), SCIP_SepaData::separationsetting, and TRUE.

◆ GCGincludeSepaBasis()

◆ GCGsepaBasisGetOrigcuts()

SCIP_ROW ** GCGsepaBasisGetOrigcuts ( GCG *  gcg)

returns the array of original cuts saved in the separator data

Parameters
gcgGCG data structure

Definition at line 1702 of file sepa_basis.c.

References GCGgetMasterprob(), NULL, SCIP_SepaData::origcuts, SCIPfindSepa(), SCIPsepaGetData(), and SEPA_NAME.

◆ GCGsepaBasisGetNOrigcuts()

int GCGsepaBasisGetNOrigcuts ( GCG *  gcg)

returns the number of original cuts saved in the separator data

Parameters
gcgGCG data structure

Definition at line 1721 of file sepa_basis.c.

References GCGgetMasterprob(), SCIP_SepaData::norigcuts, NULL, SCIPfindSepa(), SCIPsepaGetData(), and SEPA_NAME.

◆ GCGsepaBasisGetMastercuts()

SCIP_ROW ** GCGsepaBasisGetMastercuts ( GCG *  gcg)

returns the array of master cuts saved in the separator data

Parameters
gcgGCG data structure

Definition at line 1740 of file sepa_basis.c.

References GCGgetMasterprob(), SCIP_SepaData::mastercuts, NULL, SCIPfindSepa(), SCIPsepaGetData(), and SEPA_NAME.

◆ GCGsepaBasisGetNMastercuts()

int GCGsepaBasisGetNMastercuts ( GCG *  gcg)

returns the number of master cuts saved in the separator data

Parameters
gcgGCG data structure

Definition at line 1759 of file sepa_basis.c.

References GCGgetMasterprob(), SCIP_SepaData::nmastercuts, NULL, SCIPfindSepa(), SCIPsepaGetData(), and SEPA_NAME.

◆ GCGsepaBasisAddPricingCut()

◆ SCIPsepaBasisAddPPObjConss()

SCIP_RETCODE SCIPsepaBasisAddPPObjConss ( GCG *  gcg,
int  ppnumber,
SCIP_Real  dualsolconv,
SCIP_Bool  newcuts 
)

add cuts which are due to the latest objective function of the pricing problems (reduced cost non-negative)

Parameters
gcgGCG data structure
ppnumbernumber of pricing problem
dualsolconvdual solution corresponding to convexity constraint
newcutsadd cut to newcuts in sepadata? (otherwise add it just to the cutpool)

Definition at line 1889 of file sepa_basis.c.

References addPPObjConss(), FALSE, GCGgetMasterprob(), NULL, SCIP_CALL, SCIP_OKAY, SCIPerrorMessage, SCIPfindSepa(), and SEPA_NAME.

Referenced by ObjPricerGcg::pricingLoop().