GCG 4.1.1 (dev)

Generic Column Generation

Loading...
Searching...
No Matches
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

◆ SEPA_DESC

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

◆ SEPA_PRIORITY

#define SEPA_PRIORITY   100

◆ SEPA_FREQ

#define SEPA_FREQ   0

◆ SEPA_MAXBOUNDDIST

#define SEPA_MAXBOUNDDIST   1.0

◆ SEPA_USESSUBSCIP

#define SEPA_USESSUBSCIP   FALSE

does the separator use a secondary SCIP instance?

Definition at line 63 of file sepa_basis.c.

Referenced by GCGincludeSepaBasis(), GCGincludeSepaOriginal(), and SCIPincludeSepaSubsetrow().

◆ 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.

Referenced by GCGincludeSepaBasis(), GCGincludeSepaOriginal(), and SCIPincludeSepaSubsetrow().

◆ 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.

Referenced by GCGincludeSepaBasis().

◆ sepaExecsolBasis

#define sepaExecsolBasis   NULL

arbitrary primal solution separation method of separator

Definition at line 1601 of file sepa_basis.c.

Referenced by GCGincludeSepaBasis().

Function Documentation

◆ ensureSizeCuts()

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 assert(), ensureSizeCuts(), SCIP_SepaData::mastercuts, SCIP_SepaData::maxcuts, SCIP_SepaData::nmastercuts, SCIP_SepaData::norigcuts, SCIP_SepaData::origcuts, and SCIP_CALL().

Referenced by ensureSizeCuts(), ensureSizeCuts(), GCGsepaAddOriginalSepaCuts(), SCIP_DECL_SEPAEXECLP(), and SCIP_DECL_SEPAEXECLP().

◆ ensureSizeNewCuts()

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 assert(), ensureSizeNewCuts(), SCIP_SepaData::maxnewcuts, SCIP_SepaData::newcuts, SCIP_SepaData::nnewcuts, and SCIP_CALL().

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

◆ exponentiate()

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 assert(), exponentiate(), i, and result.

Referenced by chgProbingObjUsingRows(), exponentiate(), and initProbingObjUsingVarBounds().

◆ initProbingObjWithOrigObj()

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 assert(), i, initProbingObjWithOrigObj(), objfactor, and SCIP_CALL().

Referenced by initConvObj(), and initProbingObjWithOrigObj().

◆ chgProbingObjAddingOrigObj()

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 assert(), chgProbingObjAddingOrigObj(), i, objfactor, and SCIP_CALL().

Referenced by chgProbingObjAddingOrigObj(), and initConvObj().

◆ initProbingObjUsingVarBounds()

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 assert(), SCIP_SepaData::enableposslack, exponentiate(), i, initProbingObjUsingVarBounds(), objfactor, SCIP_SepaData::posslackexp, SCIP_CALL(), and solval.

Referenced by initConvObj(), and initProbingObjUsingVarBounds().

◆ chgProbingObjUsingRows()

SCIP_RETCODE chgProbingObjUsingRows ( SCIP * origscip,
SCIP_SEPADATA * sepadata,
SCIP_SOL * origsol,
SCIP_Real objfactor,
SCIP_Real objdivisor )
static
Parameters
origsciporig scip problem
sepadataseparator data
origsolorig solution
objfactorfactor the objective is multiplied with
objdivisorfactor the objective is divided with

Definition at line 364 of file sepa_basis.c.

References assert(), chgProbingObjUsingRows(), SCIP_SepaData::enableposslack, exponentiate(), i, j, nvars, obj, objfactor, SCIP_SepaData::objrow, SCIP_SepaData::posslackexp, SCIP_CALL(), SCIPfreeBufferArray(), and vars.

Referenced by chgProbingObjUsingRows(), and initConvObj().

◆ addPPObjConss()

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 addPPObjConss(), assert(), ensureSizeNewCuts(), GCGgetNIdenticalBlocks(), GCGgetOrigprob(), GCGgetPricingprob(), GCGisPricingprobRelevant(), GCGpricingVarGetOrigvars(), GCGvarIsPricing(), j, SCIP_SepaData::newcuts, SCIP_SepaData::nnewcuts, nvars, origprob, SCIP_CALL(), SCIPdebugMessage(), and var.

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

◆ SCIP_DECL_SEPAFREE()

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 assert(), and SCIP_DECL_SEPAFREE().

Referenced by SCIP_DECL_SEPAFREE(), SCIP_DECL_SEPAFREE(), and SCIP_DECL_SEPAFREE().

◆ SCIP_DECL_SEPAINIT()

◆ SCIP_DECL_SEPAEXIT()

◆ SCIP_DECL_SEPAINITSOL()

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 assert(), SCIP_SepaData::nmastercuts, and SCIP_DECL_SEPAINITSOL().

Referenced by SCIP_DECL_SEPAINITSOL().

◆ SCIP_DECL_SEPAEXITSOL()

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 assert(), SCIP_SepaData::gcg, GCGgetOrigprob(), i, SCIP_SepaData::mastercuts, SCIP_SepaData::nmastercuts, SCIP_SepaData::norigcuts, SCIP_CALL(), and SCIP_DECL_SEPAEXITSOL().

Referenced by SCIP_DECL_SEPAEXITSOL(), and SCIP_DECL_SEPAEXITSOL().

◆ initGenconv()

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 initGenconv(), SCIP_SepaData::objconvex, SCIP_CALL(), and SCIPdebugMessage().

Referenced by initGenconv(), and SCIP_DECL_SEPAEXECLP().

◆ initConvObj()

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, initConvObj(), initProbingObjUsingVarBounds(), initProbingObjWithOrigObj(), and SCIP_CALL().

Referenced by initConvObj(), and SCIP_DECL_SEPAEXECLP().

◆ SCIP_DECL_SEPAEXECLP()

◆ 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 assert(), GCGgetMasterprob(), GCGsepaBasisGetOrigcuts(), SCIP_SepaData::origcuts, and SEPA_NAME.

Referenced by GCGsepaBasisGetOrigcuts().

◆ 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 assert(), GCGgetMasterprob(), GCGsepaBasisGetNOrigcuts(), SCIP_SepaData::norigcuts, and SEPA_NAME.

Referenced by GCGsepaBasisGetNOrigcuts().

◆ 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 assert(), GCGgetMasterprob(), GCGsepaBasisGetMastercuts(), SCIP_SepaData::mastercuts, and SEPA_NAME.

Referenced by GCGsepaBasisGetMastercuts().

◆ 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 assert(), GCGgetMasterprob(), GCGsepaBasisGetNMastercuts(), SCIP_SepaData::nmastercuts, and SEPA_NAME.

Referenced by GCGsepaBasisGetNMastercuts().

◆ GCGsepaBasisAddPricingCut()

SCIP_RETCODE GCGsepaBasisAddPricingCut ( GCG * gcg,
int ppnumber,
SCIP_ROW * cut )

transforms cut in pricing variables to cut in original variables and adds it to newcuts array

Parameters
gcgGCG data structure
ppnumbernumber of pricing problem
cutcut to be added

Definition at line 1778 of file sepa_basis.c.

References assert(), SCIP_SepaData::enableppcuts, ensureSizeNewCuts(), SCIP_SepaData::gcg, GCGgetMasterprob(), GCGgetNIdenticalBlocks(), GCGgetOrigprob(), GCGgetPricingprob(), GCGpricingVarGetOrigvars(), GCGsepaBasisAddPricingCut(), GCGvarIsPricing(), i, j, masterprob, SCIP_SepaData::newcuts, SCIP_SepaData::nnewcuts, nvars, origprob, SCIP_CALL(), SCIPdebugMessage(), SCIPfreeBufferArray(), SEPA_NAME, and var.

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

◆ 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(), GCGgetMasterprob(), SCIP_CALL(), SCIPsepaBasisAddPPObjConss(), and SEPA_NAME.

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