extreduce_core.c
Go to the documentation of this file.
20 * This file implements the core algorithms for the extended reduction techniques, namely for the tree search.
21 * Starting from a given component (e.g. a single edge), a number of possible extensions are checked to be able
28 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
48 /** gets next subset of given size, returns FALSE if no further subset possible, otherwise TRUE */
167 if( newstacksize_upper > extdata->extstack_maxsize || newncomponents_upper >= extdata->extstack_maxncomponents )
201 assert(datasize + (extedgesstart[nextendable_leaves] - extedgesstart[0]) <= extdata->extstack_maxsize);
247 for( int i = extstack_start[extdata->extstack_ncomponents]; i < extstack_start[stackpos + 1]; i++ )
444 const int genstar_centerhead = (extdata->genstar_centeredge == -1) ? -1 : graph->head[extdata->genstar_centeredge];
559 graph_pseudoAncestors_hashEdgeDirty(graph->pseudoancestors, edge, TRUE, conflict, pseudoancestor_mark);
667 if( graph_pseudoAncestors_edgeIsHashed(graph->pseudoancestors, edge, reddata->pseudoancestor_mark) )
762 * NOTE: If tree cannot be ruled-out, the current component will be put into the MST storage 'reddata->msts' */
777 /* if we have a singleton edge, we first check whether the edge is redundant in all extension components
841 /** Stores extensions of tree from current (expanded and marked) stack top that cannot be ruled-out. */
861 assert(graph && extdata && extedgesstart && extedges && nextensions && nextendableleaves && with_ruledout_leaf);
886 if( extIsAtInitialStar(extdata) && extdata->extcomp->nextleaves == 1 && extdata->extcomp->extleaves[0] != leaf )
935 if( extdata->extstack_state[stackposition] == EXT_STATE_EXPANDED && !extStackTopIsWrapped(extdata) )
1047 /* the MST level associated top component cannot be used anymore, because the next component is not a sibling */
1058 assert(extstack_state[stackpos] == EXT_STATE_EXPANDED || extstack_state[stackpos] == EXT_STATE_MARKED);
1062 /* the MST level associated with top component cannot be used anymore, because siblings will be removed */
1072 assert(extstack_state[stackpos] == EXT_STATE_NONE || extstack_state[stackpos] == EXT_STATE_MARKED);
1127 // todo since single extensions are used first, might make sense to also have a special bottleneck test for this case!
1271 /* NOTE: in case of star component we want to skip the root edge for the horizontal SD computation */
1314 const int comproot = graph->tail[extdata->extstack_data[extdata->extstack_start[stackpos] + 1]];
1422 /* computes the SDs from 'leaf' to all tree leaves in 'sds_vertical', unless the edge is ruled out */
1442 const STP_Vectype(int) implications = extdata->reddata->nodes_implications[extdata->tree_starcenter];
1448 if( extensionHasImplicationConflict(graph, implications, extdata->tree_deg, extdata->tree_root,
1489 /* use the just collected edges 'extedges' to build singleton components and add them to the stack */
1674 const int stacksize_new = extstack_start[stackpos + 1] + (extedgesstart[nextendable_leaves] - extedgesstart[0]);
1720 SCIPdebugMessage("...initial edge %d: %d->%d \n\n", edge, graph->tail[edge], graph->head[edge]);
2110 assert(extreduce_extCompFullIsPromising(graph, extpermanent, extcomp) || (extcomp->ncompedges > 1));
2132 SCIP_CALL( SCIPallocCleanBufferArray(scip, &pseudoancestor_mark, graph_pseudoAncestorsGetHashArraySize(graph->pseudoancestors)) );
2139 PCDATA pcdata = { .pcSdToNode = extpermanent->pcSdToNode, .pcSdCands = pcSdCands, .nPcSdCands = -1,
2145 .sdsbias_horizontal = extpermanent->sdsbias_horizontal, .sdsbias_vertical = extpermanent->sdsbias_vertical,
2155 .tree_bottleneckDistNode = extpermanent->bottleneckDistNode, .tree_parentNode = tree_parentNode,
2157 .tree_nDelUpArcs = 0, .tree_root = -1, .tree_starcenter = -1, .tree_nedges = 0, .tree_depth = 0,
2160 .sdeq_resetStack = NULL, .sdeq_edgesIsForbidden = sdeq_edgesIsForbidden, .sdeq_hasForbiddenEdges = FALSE,
static void extStackTopProcessInitialEdges(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *initialRuleOut)
Definition: extreduce_core.c:1393
void extreduce_mstLevelClose(SCIP *, const GRAPH *, int, EXTDATA *)
Definition: extreduce_extmst.c:2126
void graph_pseudoAncestors_unhashEdge(const PSEUDOANS *, int, int *)
Definition: graph_history.c:854
void extreduce_extendInitDebug(int *, int *)
Definition: extreduce_dbg.c:1196
static SCIP_Bool ksubsetGetNext(int k, int n, SCIP_Bool isFirstSubset, int *ksubset)
Definition: extreduce_core.c:50
static void extPreprocessInitialEdge(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata)
Definition: extreduce_core.c:1705
static void extStackTopExpandInitial(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *initialRuleOut)
Definition: extreduce_core.c:1589
static SCIP_Bool extInitialCompIsGenStar(const EXTDATA *extdata)
Definition: extreducedefs.h:293
void extreduce_mstLevelVerticalRemove(REDDATA *)
Definition: extreduce_extmst.c:2105
static SCIP_Bool extTreeRuleOutEdgeSimple(const GRAPH *graph, EXTDATA *extdata, int edge)
Definition: extreduce_core.c:647
static void extPreprocessInitialComponent(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata)
Definition: extreduce_core.c:1843
Definition: graphdefs.h:184
static void extStackTopExpand(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *success)
Definition: extreduce_core.c:1573
Definition: extreducedefs.h:187
static int extLeafFindPos(const EXTDATA *extdata, int leaf)
Definition: extreducedefs.h:462
Definition: extreducedefs.h:161
Definition: struct_scip.h:59
SCIP_Bool extreduce_treeIsFlawed(SCIP *, const GRAPH *, const EXTDATA *)
Definition: extreduce_dbg.c:939
MLDISTS * sdsbias_horizontal
Definition: extreducedefs.h:115
static void extBacktrack(SCIP *scip, const GRAPH *graph, SCIP_Bool success, SCIP_Bool ancestor_conflict, EXTDATA *extdata)
Definition: extreduce_core.c:1019
SCIP_Bool extreduce_extCompIsPromising(const GRAPH *, const EXTPERMA *, const EXTCOMP *)
Definition: extreduce_util.c:93
static void extStackAddCompInitialExpanded(SCIP *scip, const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_core.c:1260
static SCIP_Bool extTreeRuleOutPeriph(SCIP *scip, const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_core.c:764
static SCIP_Bool extIsAtInitialStar(const EXTDATA *extdata)
Definition: extreducedefs.h:305
static SCIP_Bool extTreeRuleOutSingletonImplied(SCIP *scip, const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_core.c:739
const int extstack_maxncomponents
Definition: extreducedefs.h:220
static SCIP_Bool extStackTopIsWrapped(const EXTDATA *extdata)
Definition: extreducedefs.h:426
static void extTreeStackTopRemove(const GRAPH *graph, SCIP_Bool ancestor_conflict, EXTDATA *extdata)
Definition: extreduce_core.c:590
int graph_pseudoAncestorsGetHashArraySize(const PSEUDOANS *)
Definition: graph_history.c:1321
int extreduce_getMaxStackNcomponents(const GRAPH *)
Definition: extreduce_base.c:2069
SCIP_Bool extreduce_contractionRuleOutPeriph(SCIP *, const GRAPH *, EXTDATA *)
Definition: extreduce_contract.c:609
Definition: extreducedefs.h:101
static void extInnerNodeRemoveTop(const GRAPH *graph, int innernode, EXTDATA *extdata)
Definition: extreduce_core.c:393
DISTDATA * distdata_default
Definition: extreducedefs.h:106
void extreduce_mstLevelVerticalReopen(EXTDATA *)
Definition: extreduce_extmst.c:1985
SCIP_Bool extreduce_extCompFullIsPromising(const GRAPH *, const EXTPERMA *, const EXTCOMP *)
Definition: extreduce_util.c:124
includes various files containing graph methods used for Steiner tree problems
static SCIP_Bool extInitialCompIsEdge(const EXTDATA *extdata)
Definition: extreducedefs.h:264
SCIP_Bool extreduce_treeIsHashed(const GRAPH *, const EXTDATA *)
Definition: extreduce_dbg.c:987
void extreduce_mstLevelVerticalAddEmpty(const GRAPH *, EXTDATA *)
Definition: extreduce_extmst.c:1959
static void extStackAddCompsExpandedSing(SCIP *scip, const GRAPH *graph, int nextedges, const int *extedges, EXTDATA *extdata, SCIP_Bool *success, SCIP_Bool *ruledOut)
Definition: extreduce_core.c:1189
static int extStackGetTopOutEdgesStart(const EXTDATA *extdata, int stackpos)
Definition: extreducedefs.h:398
void SCIPsortDownIntInt(int *intarray1, int *intarray2, int len)
static SCIP_Bool extStackTopIsSingleton(const EXTDATA *extdata)
Definition: extreducedefs.h:448
SCIP_Bool extreduce_redcostRuleOutPeriph(const GRAPH *, EXTDATA *)
Definition: extreduce_redcosts.c:665
static SCIP_Bool extInitialCompIsStar(const EXTDATA *extdata)
Definition: extreducedefs.h:279
static int extStackGetTopOutEdgesEnd(const EXTDATA *extdata, int stackpos)
Definition: extreducedefs.h:412
static int extStackGetPosition(const EXTDATA *extdata)
Definition: extreducedefs.h:325
static void extStackTopCollectExtEdges(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, int *extedges, int *nextedges)
Definition: extreduce_core.c:1303
void extreduce_mstLevelHorizontalAdd(SCIP *, const GRAPH *, int, const int *, EXTDATA *)
Definition: extreduce_extmst.c:2037
#define SCIPallocCleanBufferArray(scip, ptr, num)
Definition: scip_mem.h:133
SCIP_RETCODE extreduce_checkComponent(SCIP *scip, const GRAPH *graph, const REDCOST *redcostdata, EXTCOMP *extcomp, EXTPERMA *extpermanent, SCIP_Bool *compIsDeletable)
Definition: extreduce_core.c:2081
static void extTreeFindExtensions(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, int *extedgesstart, int *extedges, int *nextensions, int *nextendableleaves, SCIP_Bool *with_ruledout_leaf)
Definition: extreduce_core.c:843
This file implements extended reduction techniques for several Steiner problems.
void extreduce_redcostAddEdge(const GRAPH *, int, REDDATA *, EXTDATA *)
Definition: extreduce_redcosts.c:571
static void extInnerNodeAdd(const GRAPH *graph, int innernode, EXTDATA *extdata)
Definition: extreduce_core.c:369
static int extStackGetPrevMarked(const EXTDATA *extdata)
Definition: extreduce_core.c:136
void extreduce_mstLevelVerticalAddLeaf(SCIP *, const GRAPH *, int, EXTDATA *, SCIP_Bool *)
Definition: extreduce_extmst.c:1882
void extreduce_printStack(const GRAPH *, const EXTDATA *)
Definition: extreduce_dbg.c:1031
static SCIP_Bool extStackIsExtendable(int nextedges, int nnewcomps, int stack_datasize, const EXTDATA *extdata)
Definition: extreduce_core.c:157
void extreduce_mstLevelHorizontalAddEmpty(const GRAPH *, EXTDATA *)
Definition: extreduce_extmst.c:2065
void extreduce_mstAddRootLevel(SCIP *, int, EXTDATA *)
Definition: extreduce_extmst.c:1814
static void extUnhashInitialComponent(const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata)
Definition: extreduce_core.c:1900
static SCIP_Bool extIsAtInitialComp(const EXTDATA *extdata)
Definition: extreducedefs.h:251
static SCIP_Bool extTruncate(const GRAPH *graph, const EXTDATA *extdata)
Definition: extreduce_core.c:959
SCIP_Real * bottleneckDistNode
Definition: extreducedefs.h:119
static SCIP_Bool extensionHasImplicationConflict(const GRAPH *graph, const STP_Vectype(int) implications, const int *tree_deg, int tree_root, const int *extedges, int nextedges)
Definition: extreduce_core.c:88
void extreduce_treeRecompCosts(SCIP *, const GRAPH *, EXTDATA *)
Definition: extreduce_base.c:1998
void extreduce_mstCompRemove(const GRAPH *, EXTDATA *)
Definition: extreduce_extmst.c:1829
void extreduce_redcostInitExpansion(const GRAPH *, EXTDATA *)
Definition: extreduce_redcosts.c:548
static void extTreeStackTopAdd(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *conflict)
Definition: extreduce_core.c:521
Definition: type_retcode.h:33
static int extStackGetOutEdgesEnd(const EXTDATA *extdata, int stackpos)
Definition: extreducedefs.h:384
static void extProcessInitialComponent(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata, SCIP_Bool *ruledOut, SCIP_Bool *isExtendable)
Definition: extreduce_core.c:1930
void extreduce_mstLevelHorizontalRemove(REDDATA *)
Definition: extreduce_extmst.c:2090
SCIP_Bool redcostEqualAllow
Definition: extreducedefs.h:128
static int extStackTopGetInitalDataStart(const EXTDATA *extdata)
Definition: extreduce_core.c:1370
SCIP_Bool extreduce_extdataIsClean(const GRAPH *, const EXTDATA *)
Definition: extreduce_data.c:475
static int extStackGetOutEdgesStart(const EXTDATA *extdata, int stackpos)
Definition: extreducedefs.h:355
static SCIP_Bool extTreeRuleOutSingletonFull(SCIP *scip, const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_core.c:699
Definition: extreducedefs.h:174
void extreduce_mstLevelInitialInit(REDDATA *, EXTDATA *)
Definition: extreduce_extmst.c:1849
includes extended reductions definitions and inline methods used for Steiner tree problems ...
static void extStackAddCompsNonExpanded(const GRAPH *graph, const int *extedgesstart, const int *extedges, int nextendable_leaves, EXTDATA *extdata)
Definition: extreduce_core.c:183
void extreduce_mstLevelVerticalClose(REDDATA *)
Definition: extreduce_extmst.c:2008
SCIP_Real *const redcost_treenodeswaps
Definition: extreducedefs.h:153
SCIP_Bool extreduce_pcdataIsClean(const GRAPH *, const PCDATA *)
Definition: extreduce_data.c:605
static void extStackAddCompsExpanded(SCIP *scip, const GRAPH *graph, int nextedges, const int *extedges, EXTDATA *extdata, SCIP_Bool *success, SCIP_Bool *ruledOut)
Definition: extreduce_core.c:1085
SCIP_Bool extreduce_extPermaIsClean(const GRAPH *, const EXTPERMA *)
Definition: extreduce_data.c:305
static void extTreeSyncWithStack(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *conflict)
Definition: extreduce_core.c:918
static void extExtend(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *success)
Definition: extreduce_core.c:1634
Portable definitions.
static void extPreprocessInitialStar(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata)
Definition: extreduce_core.c:1730
Definition: extreducedefs.h:138
int extreduce_mldistsTopLevel(const MLDISTS *)
Definition: extreduce_mldists.c:790
SCIP_Bool extreduce_reddataIsClean(const GRAPH *, const REDDATA *)
Definition: extreduce_data.c:572
void extreduce_redcostRemoveEdge(int, const REDDATA *, EXTDATA *)
Definition: extreduce_redcosts.c:635
int genstar_centeredge
Definition: extreducedefs.h:181
static SCIP_Bool ruledOut(SCIP *scip, const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_contract.c:446
static void extStackTopExpandSingletons(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *success)
Definition: extreduce_core.c:1461
SCIP_Bool extreduce_mldistsLevelContainsBase(const MLDISTS *, int, int)
Definition: extreduce_mldists.c:814
void graph_pseudoAncestors_hashEdgeDirty(const PSEUDOANS *, int, SCIP_Bool, SCIP_Bool *, int *)
Definition: graph_history.c:884
Definition: graph_history.c:52
static void extTreeAddEdge(const GRAPH *graph, int edge, EXTDATA *extdata)
Definition: extreduce_core.c:431
SCIP_Bool extreduce_mstRuleOutPeriph(SCIP *, const GRAPH *, EXTDATA *)
Definition: extreduce_extmst.c:1783
static void extStackTopCollectExtEdgesSing(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, int *extedges, int *nextedges)
Definition: extreduce_core.c:1337
Definition: redcosts.c:34
SCIP_Bool extreduce_mstTopCompInSync(SCIP *, const GRAPH *, EXTDATA *)
Definition: extreduce_dbg.c:1505
static int extStackGetTopRoot(const GRAPH *graph, const EXTDATA *extdata)
Definition: extreducedefs.h:338
static void extPreprocessInitialGenStar(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata)
Definition: extreduce_core.c:1778
Definition: objbenders.h:33
SCIP_Bool graph_pseudoAncestors_edgeIsHashed(const PSEUDOANS *, int, const int *)
Definition: graph_history.c:948
void extreduce_mstLevelVerticalAddLeafInitial(SCIP *, const GRAPH *, int, EXTDATA *, SCIP_Bool *)
Definition: extreduce_extmst.c:1929
static void extStackTopExpandWrapped(SCIP *scip, const GRAPH *graph, EXTDATA *extdata, SCIP_Bool *success)
Definition: extreduce_core.c:1505
void extreduce_extdataCleanArraysDbg(const GRAPH *, EXTDATA *)
Definition: extreduce_dbg.c:881
void extreduce_extCompRevert(const GRAPH *, const EXTPERMA *, EXTCOMP *)
Definition: extreduce_util.c:52
void extreduce_extCompClean(SCIP *, const GRAPH *, const EXTCOMP *, SCIP_Bool, EXTDATA *)
Definition: extreduce_data.c:76
static void extProcessComponent(SCIP *scip, const GRAPH *graph, const EXTCOMP *extcomp, EXTDATA *extdata, SCIP_Bool *deletable)
Definition: extreduce_core.c:1993
static void extTreeStackTopRootRemove(const GRAPH *graph, EXTDATA *extdata)
Definition: extreduce_core.c:472
static void extLeafRemoveTop(const GRAPH *graph, int topsize, int toproot, EXTDATA *extdata)
Definition: extreduce_core.c:304
static SCIP_Bool extLeafIsExtendable(const GRAPH *graph, const SCIP_Bool *isterm, int leaf)
Definition: extreducedefs.h:488
SCIP_Real *const tree_parentEdgeCost
Definition: extreducedefs.h:199