GCG 4.1.1 (dev)

Generic Column Generation

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

Detailed Description

subset row separator for master problem

Author
Chantal Reinartz Groba

Definition in file sepa_subsetrow.c.

#include <assert.h>
#include <scip/cons_linear.h>
#include "gcg/mastersepacut.h"
#include "gcg/pricer_gcg.h"
#include "gcg/relax_gcg.h"
#include "gcg/scip_misc.h"
#include "gcg/sepa_subsetrow.h"
#include "gcg/zerohalf_selector.h"
#include "gcg/struct_sepagcg.h"
#include "gcg/event_mastersepacut.h"

Go to the source code of this file.

Data Structures

struct  SCIP_SepaData

Macros

#define SEPA_NAME   "subsetrow"
#define SEPA_DESC   "subsetrow separator"
#define SEPA_ENABLED   FALSE
#define SEPA_PRIORITY   100
#define SEPA_FREQ   1
#define SEPA_MAXBOUNDDIST   1.0
#define SEPA_USESSUBSCIP   FALSE
#define SEPA_DELAY   TRUE
#define DEFAULT_RANDSEED   71
#define DEFAULT_MAXROUNDS   1
#define DEFAULT_MAXROUNDSROOT   1
#define DEFAULT_MAXCUTCANDS   1000
#define DEFAULT_MAXCUTCANDSROOT   2000
#define DEFAULT_MAXCUTS   100
#define DEFAULT_MINEFFICACY   0.01
#define DEFAULT_ONLYROOT   FALSE
#define DEFAULT_STRATEGY   2
#define DEFAULT_N   3
#define DEFAULT_L   2
#define DEFAULT_ONLYAGGREGATED   TRUE
#define STRATEGY_SR_RANDOM   0
#define STRATEGY_ZEROHALF   1
#define STRATEGY_SR_ENUMERATE   2
#define STRATEGY_MAX   2
#define sepaCopySubsetrow   NULL

Functions

static SCIP_RETCODE selectRandomRows (SCIP_RANDNUMGEN *randnumgen, int nmasterconss, int *selectedmasterconssidx, int n)
static SCIP_RETCODE createSubsetRowCut (SCIP *masterscip, SCIP_ROW **ssrc, SCIP_HASHMAP *mapmastervarxcoeffs, SCIP_Real rhs_ssrc, SCIP_SEPA *sepa, SCIP_Bool local)
static SCIP_RETCODE computeSubsetRowCoefficientsAndRHS (SCIP *masterscip, SCIP_SEPA *sepa, SCIP_CONS **masterconss, int *selectedconssidx, int nselectedconss, SCIP_Real **weights, SCIP_Real *rhs_ssrc, SCIP_HASHMAP *mapmastervarxcoeff, SCIP_Bool *local)
static SCIP_RETCODE computePricingConssCoefficients (GCG *gcg, SCIP_CONS **originalconss, int *selectedconssidx, int nselectedconss, SCIP_Real *weights, SCIP_HASHMAP *mappricingvarxcoeff)
static SCIP_RETCODE selectConstraintsRandom (GCG *gcg, GCG_CUTINDICES ***cutindices, int *ncutindices, int depth, SCIP_SEPADATA *sepadata)
static SCIP_RETCODE selectConstraintsZerohalf (GCG *gcg, GCG_CUTINDICES ***cutindices, int *ncutindices, int ncalls, SCIP_Bool allowlocal, int depth, SCIP_SOL *sol, SCIP_SEPADATA *sepadata)
static SCIP_RETCODE selectConstraintsEnumerate (GCG *gcg, GCG_CUTINDICES ***cutindices, int *ncutindices, int depth, SCIP_SEPADATA *sepadata)
static SCIP_RETCODE createCut (SCIP *masterscip, SCIP_SEPADATA *sepadata, GCG_CUTINDICES *cutindex, SCIP_SEPA *sepa, int nmastervars, SCIP_CONS **masterconss, SCIP_Real **weights, SCIP_ROW **ssrc, SCIP_HASHMAP *mapmastervarxcoeff)
static GCG_EXTENDEDMASTERCONSDATA * createMastercutData (GCG *gcg, SCIP_ROW *ssrc, GCG_MASTERSEPACUT *mastercut, int npricingproblems, SCIP_SEPADATA *sepadata, SCIP_HASHMAP *mappricingvarxcoeff)
static SCIP_DECL_SEPAEXIT (sepaExitSubsetrow)
static SCIP_DECL_SEPAFREE (sepaFreeSubsetrow)
static SCIP_DECL_SEPAEXECLP (sepaExeclpSubsetrow)
static GCG_DECL_SEPAGETCOLCOEFFICIENT (sepaGetColCoefficientSubsetrow)
static GCG_DECL_SEPAMASTERCUTDELETE (sepaMastercutDeleteSubsetrow)
static SCIP_DECL_SEPAINIT (sepaInitSubsetrow)
static SCIP_DECL_PARAMCHGD (sepaParamChgdSubsetrow)
SCIP_RETCODE SCIPincludeSepaSubsetrow (GCG *gcg)

Macro Definition Documentation

◆ SEPA_NAME

#define SEPA_NAME   "subsetrow"

Definition at line 49 of file sepa_subsetrow.c.

◆ SEPA_DESC

#define SEPA_DESC   "subsetrow separator"

Definition at line 50 of file sepa_subsetrow.c.

◆ SEPA_ENABLED

#define SEPA_ENABLED   FALSE

should the separator be enabled by default?

Definition at line 51 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ SEPA_PRIORITY

#define SEPA_PRIORITY   100

Definition at line 52 of file sepa_subsetrow.c.

◆ SEPA_FREQ

#define SEPA_FREQ   1

default frequency: 1 --> callback is executed for subproblems at every level

Definition at line 53 of file sepa_subsetrow.c.

◆ SEPA_MAXBOUNDDIST

#define SEPA_MAXBOUNDDIST   1.0

Definition at line 54 of file sepa_subsetrow.c.

◆ SEPA_USESSUBSCIP

#define SEPA_USESSUBSCIP   FALSE

does the separator use a secondary SCIP instance?

Definition at line 55 of file sepa_subsetrow.c.

◆ SEPA_DELAY

#define SEPA_DELAY   TRUE

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

Definition at line 56 of file sepa_subsetrow.c.

◆ DEFAULT_RANDSEED

#define DEFAULT_RANDSEED   71

initial seed for RandomNumber Generator which picks the constraint indices

Definition at line 58 of file sepa_subsetrow.c.

◆ DEFAULT_MAXROUNDS

#define DEFAULT_MAXROUNDS   1

maximal number of subset row separation rounds per non-root node

Definition at line 59 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_MAXROUNDSROOT

#define DEFAULT_MAXROUNDSROOT   1

maximal number of subset row separation calls in the root node

Definition at line 60 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_MAXCUTCANDS

#define DEFAULT_MAXCUTCANDS   1000

maximal number of subset row cut candidates per call in non-root nodes

Definition at line 61 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_MAXCUTCANDSROOT

#define DEFAULT_MAXCUTCANDSROOT   2000

maximal number of subset row cut candidates per call in root node

Definition at line 62 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_MAXCUTS

#define DEFAULT_MAXCUTS   100

maximal number of subset row cuts in total

Definition at line 63 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_MINEFFICACY

#define DEFAULT_MINEFFICACY   0.01

required minimum cut efficacy

Definition at line 64 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_ONLYROOT

#define DEFAULT_ONLYROOT   FALSE

only apply separator in root node

Definition at line 65 of file sepa_subsetrow.c.

◆ DEFAULT_STRATEGY

#define DEFAULT_STRATEGY   2

strategy which is used to determine which rows to consider for cut computation

Definition at line 66 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_N

#define DEFAULT_N   3

number of rows used to create a new cut

Definition at line 67 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_L

#define DEFAULT_L   2

inverse of weight used for cut generation

Definition at line 68 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ DEFAULT_ONLYAGGREGATED

#define DEFAULT_ONLYAGGREGATED   TRUE

run only on aggregated problems

Definition at line 69 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ STRATEGY_SR_RANDOM

#define STRATEGY_SR_RANDOM   0

randomly select n constraints

Definition at line 71 of file sepa_subsetrow.c.

Referenced by SCIP_DECL_SEPAEXECLP().

◆ STRATEGY_ZEROHALF

#define STRATEGY_ZEROHALF   1

use zerohalf cut separator to select constraints

Definition at line 72 of file sepa_subsetrow.c.

Referenced by computeSubsetRowCoefficientsAndRHS(), and SCIP_DECL_SEPAEXECLP().

◆ STRATEGY_SR_ENUMERATE

#define STRATEGY_SR_ENUMERATE   2

enumerate all subsets of size n

Definition at line 73 of file sepa_subsetrow.c.

Referenced by SCIP_DECL_SEPAEXECLP().

◆ STRATEGY_MAX

#define STRATEGY_MAX   2

maximal strategy value

Definition at line 74 of file sepa_subsetrow.c.

Referenced by SCIPincludeSepaSubsetrow().

◆ sepaCopySubsetrow

#define sepaCopySubsetrow   NULL

Definition at line 788 of file sepa_subsetrow.c.

Function Documentation

◆ selectRandomRows()

SCIP_RETCODE selectRandomRows ( SCIP_RANDNUMGEN * randnumgen,
int nmasterconss,
int * selectedmasterconssidx,
int n )
static

randomly selects n different constraints from the master problem

Parameters
randnumgenrandom number generator
nmasterconssnumber of constraints in the master problem
selectedmasterconssidxpointer to store the indices of the selected constraints
nnumber of constraints to be selected

Definition at line 109 of file sepa_subsetrow.c.

References assert(), i, j, and selectRandomRows().

Referenced by selectConstraintsRandom(), and selectRandomRows().

◆ createSubsetRowCut()

SCIP_RETCODE createSubsetRowCut ( SCIP * masterscip,
SCIP_ROW ** ssrc,
SCIP_HASHMAP * mapmastervarxcoeffs,
SCIP_Real rhs_ssrc,
SCIP_SEPA * sepa,
SCIP_Bool local )
static

create a new row for master problem and fill it with the variables (+ their coefficients) and right-hand side

Parameters
masterscipSCIP data structure (master problem)
ssrcpointer to store subset row cut
mapmastervarxcoeffsmaps master variables to their coefficient in subset-row cut
rhs_ssrcright hand side of subset row cut
sepaseparator which creates subset row cut
localis the cut local?

Definition at line 151 of file sepa_subsetrow.c.

References assert(), createSubsetRowCut(), GCGisMaster(), i, SCIP_SepaData::ngeneratedcut, and SCIP_CALL().

Referenced by createCut(), and createSubsetRowCut().

◆ computeSubsetRowCoefficientsAndRHS()

SCIP_RETCODE computeSubsetRowCoefficientsAndRHS ( SCIP * masterscip,
SCIP_SEPA * sepa,
SCIP_CONS ** masterconss,
int * selectedconssidx,
int nselectedconss,
SCIP_Real ** weights,
SCIP_Real * rhs_ssrc,
SCIP_HASHMAP * mapmastervarxcoeff,
SCIP_Bool * local )
static

computes the rhs (w^Tb) and the coefficient for each variable (w^Ta_p) in the cut (still non-rounded)

Parameters
masterscipSCIP data structure (master problem)
sepaSCIP separator
masterconssconstraints of the master problem
selectedconssidxindices of the selected constraints
nselectedconssnumber of selected constraints
weightspointer to store weights of the selected constraints
rhs_ssrcpointer to store rhs of subset row cut
mapmastervarxcoeffmaps master variable to its coefficient in subset-row cut
localpointer to store if the cut is local

Definition at line 204 of file sepa_subsetrow.c.

References assert(), computeSubsetRowCoefficientsAndRHS(), i, j, SCIP_SepaData::l, SCIP_CALL(), SCIPdebugMessage(), SCIP_SepaData::strategy, STRATEGY_ZEROHALF, and success.

Referenced by computeSubsetRowCoefficientsAndRHS(), and createCut().

◆ computePricingConssCoefficients()

SCIP_RETCODE computePricingConssCoefficients ( GCG * gcg,
SCIP_CONS ** originalconss,
int * selectedconssidx,
int nselectedconss,
SCIP_Real * weights,
SCIP_HASHMAP * mappricingvarxcoeff )
static

computes the (non-rounded) coefficients for the pricing variables used in the pricing constraints

Parameters
gcgGCG data structure
originalconssconstraints in the original problem
selectedconssidxindices of selected constraints
nselectedconssnumber of selected constraints
weightsweights for selected constraints
mappricingvarxcoeffmap to store the coefficient for each pricing variable

Definition at line 318 of file sepa_subsetrow.c.

References assert(), computePricingConssCoefficients(), GCGconsGetNVars(), GCGconsGetVals(), GCGconsGetVars(), GCGgetOrigprob(), GCGisPricingprobRelevant(), GCGoriginalVarGetPricingVar(), GCGvarGetBlock(), GCGvarIsOriginal(), i, j, SCIP_CALL(), and SCIPdebugMessage().

Referenced by computePricingConssCoefficients(), and SCIP_DECL_SEPAEXECLP().

◆ selectConstraintsRandom()

SCIP_RETCODE selectConstraintsRandom ( GCG * gcg,
GCG_CUTINDICES *** cutindices,
int * ncutindices,
int depth,
SCIP_SEPADATA * sepadata )
static

select the indices of constraints to use for construction of cuts randomly

Parameters
gcgGCG data structure
cutindicespointer to store array of constraint indices for cuts
ncutindicespointer to store the number of cuts for which constraint indices were found
depthdepth of current B&B node
sepadatadata of separator

Definition at line 403 of file sepa_subsetrow.c.

References assert(), depth, GCGcreateCutIndicesFromArray(), GCGgetMasterprob(), i, SCIP_SepaData::maxcutcands, SCIP_SepaData::maxcutcandsroot, SCIP_SepaData::n, SCIP_SepaData::nmasterconss, SCIP_SepaData::randnumgen, SCIP_CALL(), selectConstraintsRandom(), and selectRandomRows().

Referenced by SCIP_DECL_SEPAEXECLP(), and selectConstraintsRandom().

◆ selectConstraintsZerohalf()

SCIP_RETCODE selectConstraintsZerohalf ( GCG * gcg,
GCG_CUTINDICES *** cutindices,
int * ncutindices,
int ncalls,
SCIP_Bool allowlocal,
int depth,
SCIP_SOL * sol,
SCIP_SEPADATA * sepadata )
static

select the indices of constraints to use for construction of cuts using strategy devised for zero-half-cuts @to-do: finished implementing alternative strategy

Parameters
gcgGCG data structure
cutindicespointer to store array of constraint indices for cuts
ncutindicespointer to store the number of cuts for which constraint indices were found
ncallsnumber of time separator has bin called at current node
allowlocallocal cuts allowed?
depthdepth of current node
solcurrent best solution, if available (else NULL)
sepadatadata of separator

Definition at line 457 of file sepa_subsetrow.c.

References GCG_ZeroHalfData::densityoffset, depth, GCG_ZeroHalfData::dynamiccuts, GCGgetMasterprob(), GCGselectConstraintsZeroHalf(), GCG_ZeroHalfData::infeasible, GCG_ZeroHalfData::masterconss, SCIP_SepaData::masterconss, SCIP_SepaData::maxcutcands, SCIP_SepaData::maxcutcandsroot, GCG_ZeroHalfData::maxrowdensity, GCG_ZeroHalfData::maxslack, GCG_ZeroHalfData::maxslackroot, GCG_ZeroHalfData::minviol, ncalls, GCG_ZeroHalfData::nmasterconss, SCIP_SepaData::nmasterconss, GCG_ZeroHalfData::nreductions, GCG_ZeroHalfData::origmasterconss, SCIP_SepaData::origmasterconss, SCIP_CALL(), selectConstraintsZerohalf(), and sol.

Referenced by SCIP_DECL_SEPAEXECLP(), and selectConstraintsZerohalf().

◆ selectConstraintsEnumerate()

SCIP_RETCODE selectConstraintsEnumerate ( GCG * gcg,
GCG_CUTINDICES *** cutindices,
int * ncutindices,
int depth,
SCIP_SEPADATA * sepadata )
static

select the indices of constraints to use for construction of cuts randomly

Parameters
gcgGCG data structure
cutindicespointer to store array of constraint indices for cuts
ncutindicespointer to store the number of cuts for which constraint indices were found
depthdepth of current B&B node
sepadatadata of separator

Definition at line 499 of file sepa_subsetrow.c.

References assert(), depth, GCGcreateCutIndicesFromArray(), GCGgetMasterprob(), i, j, SCIP_SepaData::maxcutcands, SCIP_SepaData::maxcutcandsroot, SCIP_SepaData::n, SCIP_SepaData::nmasterconss, SCIP_SepaData::paramschgd, SCIP_CALL(), and selectConstraintsEnumerate().

Referenced by SCIP_DECL_SEPAEXECLP(), and selectConstraintsEnumerate().

◆ createCut()

SCIP_RETCODE createCut ( SCIP * masterscip,
SCIP_SEPADATA * sepadata,
GCG_CUTINDICES * cutindex,
SCIP_SEPA * sepa,
int nmastervars,
SCIP_CONS ** masterconss,
SCIP_Real ** weights,
SCIP_ROW ** ssrc,
SCIP_HASHMAP * mapmastervarxcoeff )
static

creates a subset row cut

Parameters
masterscipSCIP data structure (master problem)
sepadatasepa data
cutindexindices of the master constraints to use for the construction of subset row cut
sepasubset row separator
nmastervarsnumber of variables in the master problem
masterconssconstraints of the master problem
weightssign (1, -1) with which to multiply each selected constraint before adding to cut
ssrcpointer to store subset row cut
mapmastervarxcoefftemporary map to store coefficients

Definition at line 601 of file sepa_subsetrow.c.

References assert(), computeSubsetRowCoefficientsAndRHS(), createCut(), createSubsetRowCut(), i, GCG_CutIndices::indices, SCIP_SepaData::minefficacy, GCG_CutIndices::nindices, nmastervars, and SCIP_CALL().

Referenced by createCut(), and SCIP_DECL_SEPAEXECLP().

◆ createMastercutData()

GCG_EXTENDEDMASTERCONSDATA * createMastercutData ( GCG * gcg,
SCIP_ROW * ssrc,
GCG_MASTERSEPACUT * mastercut,
int npricingproblems,
SCIP_SEPADATA * sepadata,
SCIP_HASHMAP * mappricingvarxcoeff )
static

creates the master cut data for the subset row cut

Parameters
gcgGCG data structure
ssrcsubset row cut
mastercutmaster sepa cut
npricingproblemsnumber of pricing problems
sepadatasubset row separator data
mappricingvarxcoeffmap storing the coefficients for the pricing constraints for subset row cut

Definition at line 663 of file sepa_subsetrow.c.

References assert(), createMastercutData(), GCGcreateInferredPricingVar(), GCGextendedmasterconsCreateForSepamastercut(), GCGgetMasterprob(), GCGgetNRelPricingprobs(), GCGgetPricingprob(), GCGisPricingprobRelevant(), GCGpricingmodificationCreate(), GCGvarIsPricing(), j, SCIP_SepaData::ngeneratedcut, nvars, SCIPdebugMessage(), SCIPfreeBufferArray(), and success.

Referenced by createMastercutData(), and SCIP_DECL_SEPAEXECLP().

◆ SCIP_DECL_SEPAEXIT()

◆ SCIP_DECL_SEPAFREE()

SCIP_DECL_SEPAFREE ( sepaFreeSubsetrow )
static

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

Definition at line 815 of file sepa_subsetrow.c.

References assert(), SCIP_SepaData::randnumgen, SCIP_DECL_SEPAFREE(), and SCIPdebugMessage().

◆ SCIP_DECL_SEPAEXECLP()

◆ GCG_DECL_SEPAGETCOLCOEFFICIENT()

GCG_DECL_SEPAGETCOLCOEFFICIENT ( sepaGetColCoefficientSubsetrow )
static

◆ GCG_DECL_SEPAMASTERCUTDELETE()

GCG_DECL_SEPAMASTERCUTDELETE ( sepaMastercutDeleteSubsetrow )
static

deletes mastersepacutdata

Definition at line 1089 of file sepa_subsetrow.c.

References assert(), GCG_DECL_SEPAMASTERCUTDELETE, GCGfreeChvatalGomoryCutData(), GCGsepaGetScipSeparator(), and SEPA_NAME.

◆ SCIP_DECL_SEPAINIT()

SCIP_DECL_SEPAINIT ( sepaInitSubsetrow )
static

initialization method of separator (called after problem was transformed)

Definition at line 1097 of file sepa_subsetrow.c.

References assert(), GCGisMaster(), SCIP_SepaData::ngeneratedcut, and SCIP_DECL_SEPAINIT().

◆ SCIP_DECL_PARAMCHGD()

SCIP_DECL_PARAMCHGD ( sepaParamChgdSubsetrow )
static

param changed method

Definition at line 1115 of file sepa_subsetrow.c.

References assert(), and SCIP_SepaData::paramschgd.

◆ SCIPincludeSepaSubsetrow()