Scippy

SCIP

Solving Constraint Integer Programs

bidecomposition.c File Reference

Detailed Description

several decomposition methods for Steiner tree problems

Author
Daniel Rehfeldt

This file implements bi-connected components decomposition methods for several Steiner problems.

A list of all interface methods can be found in bidecomposition.h.

Definition in file bidecomposition.c.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <assert.h>
#include "bidecomposition.h"
#include "stpvector.h"
#include "portab.h"

Go to the source code of this file.

Data Structures

struct  biconnected_stack_node
 

Functions

static void cutNodesSetDfsRoot (const GRAPH *g, CUTNODES *cutnodes)
 
static void cutNodesProcessComponent (int root, int stack_start, CUTNODES *cutnodes)
 
static void cutNodesProcessNext (const GRAPH *g, CUTNODES *cutnodes)
 
static void cutNodesCompute (const GRAPH *g, CUTNODES *cutnodes)
 
static void cutNodesComputePostProcess (const GRAPH *g, CUTNODES *cutnodes)
 
static SCIP_Bool decomposeCsrIsValid (const CUTNODES *cutnodes, const GRAPH *g, const BIDECOMP *bidecomp)
 
static void decomposeBuildCsr (const CUTNODES *cutnodes, const GRAPH *g, BIDECOMP *bidecomp)
 
static SCIP_RETCODE decomposeGetFirstMarked (SCIP *scip, const GRAPH *orggraph, int *subroot)
 
SCIP_RETCODE bidecomposition_cutnodesInit (SCIP *scip, const GRAPH *g, CUTNODES **cutnodes)
 
void bidecomposition_cutnodesFree (SCIP *scip, CUTNODES **cutnodes)
 
void bidecomposition_cutnodesCompute (const GRAPH *g, CUTNODES *cutnodes)
 
SCIP_RETCODE bidecomposition_init (SCIP *scip, const CUTNODES *cutnodes, const GRAPH *g, BIDECOMP **bidecomposition)
 
SCIP_RETCODE bidecomposition_initSubInOut (SCIP *scip, const GRAPH *g, BIDECOMP *bidecomposition)
 
void bidecomposition_free (SCIP *scip, BIDECOMP **bidecomposition)
 
void bidecomposition_markSub (const BIDECOMP *bidecomp, int compindex, GRAPH *g)
 
SCIP_RETCODE bidecomposition_getMarkedSubRoot (SCIP *scip, const BIDECOMP *bidecomp, const GRAPH *orggraph, const GRAPH *subgraph, int *subroot)
 
SCIP_Bool bidecomposition_componentIsTrivial (const BIDECOMP *bidecomp, int compindex)
 
SCIP_Bool bidecomposition_isPossible (const GRAPH *g)
 
SCIP_Real bidecomposition_getCompNodeRatio (const BIDECOMP *bidecomp, int compindex)
 
SCIP_Real bidecomposition_getMaxcompNodeRatio (const BIDECOMP *bidecomp)
 

Function Documentation

◆ cutNodesSetDfsRoot()

static void cutNodesSetDfsRoot ( const GRAPH g,
CUTNODES cutnodes 
)
inlinestatic

sets root

Parameters
ggraph data structure
cutnodescut nodes

Definition at line 58 of file bidecomposition.c.

References cut_nodes::dfsroot, GRAPH::extended, graph_get_nNodes(), graph_pc_isPcMw(), graph_pc_isRootedPcMw(), graph_pc_knotIsDummyTerm(), Is_term, nnodes, GRAPH::source, and GRAPH::term.

Referenced by bidecomposition_cutnodesInit().

◆ cutNodesProcessComponent()

static void cutNodesProcessComponent ( int  root,
int  stack_start,
CUTNODES cutnodes 
)
static

◆ cutNodesProcessNext()

◆ cutNodesCompute()

static void cutNodesCompute ( const GRAPH g,
CUTNODES cutnodes 
)
static

non-recursive DFS

Parameters
ggraph data structure
cutnodescut nodes

Definition at line 331 of file bidecomposition.c.

References cutNodesProcessNext(), cut_nodes::dfsroot, FALSE, graph_knot_isInRange(), biconnected_stack_node::id, GRAPH::outbeg, SCIPdebugMessage, cut_nodes::stack_nodes, and cut_nodes::stack_size.

Referenced by bidecomposition_cutnodesCompute().

◆ cutNodesComputePostProcess()

static void cutNodesComputePostProcess ( const GRAPH g,
CUTNODES cutnodes 
)
static

post-process

Parameters
ggraph data structure
cutnodescut nodes

Definition at line 351 of file bidecomposition.c.

References cut_nodes::biconn_comproots, cut_nodes::biconn_ncomps, and StpVecGetSize.

Referenced by bidecomposition_cutnodesCompute().

◆ decomposeCsrIsValid()

static SCIP_Bool decomposeCsrIsValid ( const CUTNODES cutnodes,
const GRAPH g,
const BIDECOMP bidecomp 
)
static

builds CSR like arrays for biconnected components

Parameters
cutnodescut nodes
ggraph data structure
bidecompbi-decomposition structure

Definition at line 366 of file bidecomposition.c.

References cut_nodes::biconn_comproots, cut_nodes::biconn_ncomps, cut_nodes::biconn_nodesmark, FALSE, graph_knot_isInRange(), graph_knot_printInfo(), biconnected_component_decomposition::nodes, SCIP_Bool, SCIPdebugMessage, biconnected_component_decomposition::starts, and TRUE.

Referenced by decomposeBuildCsr().

◆ decomposeBuildCsr()

static void decomposeBuildCsr ( const CUTNODES cutnodes,
const GRAPH g,
BIDECOMP bidecomp 
)
static

builds CSR like arrays for biconnected components

Parameters
cutnodescut nodes
ggraph data structure
bidecompbidecomposition data structure

Definition at line 428 of file bidecomposition.c.

References cut_nodes::biconn_comproots, cut_nodes::biconn_ncomps, cut_nodes::biconn_nodesmark, decomposeCsrIsValid(), GRAPH::grad, graph_get_nNodes(), GRAPH::mark, nnodes, biconnected_component_decomposition::nodes, and biconnected_component_decomposition::starts.

Referenced by bidecomposition_init().

◆ decomposeGetFirstMarked()

static SCIP_RETCODE decomposeGetFirstMarked ( SCIP scip,
const GRAPH orggraph,
int *  subroot 
)
static

gets first marked component

Parameters
scipSCIP data structure
orggraphgraph data structure
subrootthe new root (out)

Definition at line 502 of file bidecomposition.c.

References a, EAT_LAST, FALSE, graph_get_nNodes(), graph_knot_isInRange(), GRAPH::head, GRAPH::mark, nnodes, NULL, GRAPH::oeat, GRAPH::outbeg, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIPallocBufferArray, SCIPfreeBufferArray, GRAPH::source, STP_Vectype, StpVecFree, StpVecGetSize, StpVecIsEmpty, StpVecPopBack, StpVecPushBack, and TRUE.

Referenced by bidecomposition_getMarkedSubRoot().

◆ bidecomposition_cutnodesInit()

◆ bidecomposition_cutnodesFree()

void bidecomposition_cutnodesFree ( SCIP scip,
CUTNODES **  cutnodes 
)

◆ bidecomposition_cutnodesCompute()

void bidecomposition_cutnodesCompute ( const GRAPH g,
CUTNODES cutnodes 
)

computes cut-nodes and (implicitly) bi-connected components

Parameters
ggraph data structure
cutnodescut nodes

Definition at line 676 of file bidecomposition.c.

References cut_nodes::biconn_ncomps, cut_nodes::curr_hittime, cut_nodes::curr_lowpoint, cutNodesCompute(), cutNodesComputePostProcess(), cut_nodes::dfsroot, cut_nodes::nrootcomps, SCIPdebugMessage, and StpVecGetSize.

Referenced by initDecompose(), reduce_articulations(), reduce_bidecomposition(), and reduce_bidecompositionExact().

◆ bidecomposition_init()

SCIP_RETCODE bidecomposition_init ( SCIP scip,
const CUTNODES cutnodes,
const GRAPH g,
BIDECOMP **  bidecomposition 
)

◆ bidecomposition_initSubInOut()

SCIP_RETCODE bidecomposition_initSubInOut ( SCIP scip,
const GRAPH g,
BIDECOMP bidecomposition 
)

initializes

Parameters
scipSCIP data structure
ggraph data structure
bidecompositionbidecomposition data structure

Definition at line 743 of file bidecomposition.c.

References graph_subinoutInit(), SCIP_CALL, SCIP_OKAY, and biconnected_component_decomposition::subinout.

Referenced by decomposeExec(), decomposePartialExact(), and decomposeReduce().

◆ bidecomposition_free()

void bidecomposition_free ( SCIP scip,
BIDECOMP **  bidecomposition 
)

frees

Parameters
scipSCIP data structure
bidecompositionbidecomposition data structure

Definition at line 759 of file bidecomposition.c.

References graph_subinoutFree(), biconnected_component_decomposition::nodes, SCIPfreeMemory, SCIPfreeMemoryArray, biconnected_component_decomposition::starts, and biconnected_component_decomposition::subinout.

Referenced by decomposeExec(), decomposeExecExact(), and freeDecompose().

◆ bidecomposition_markSub()

void bidecomposition_markSub ( const BIDECOMP bidecomp,
int  compindex,
GRAPH g 
)

◆ bidecomposition_getMarkedSubRoot()

SCIP_RETCODE bidecomposition_getMarkedSubRoot ( SCIP scip,
const BIDECOMP bidecomp,
const GRAPH orggraph,
const GRAPH subgraph,
int *  subroot 
)

gets root of marked sub-component bidecomposition_markSub needs to be called before!

Parameters
scipSCIP data structure
bidecompall-components storage
orggraphgraph data structure
subgraphgraph data structure
subrootthe new root (out)

Definition at line 830 of file bidecomposition.c.

References decomposeGetFirstMarked(), graph_knot_isInRange(), graph_subinoutGetOrgToSubNodeMap(), Is_term, SCIP_CALL, SCIP_OKAY, biconnected_component_decomposition::subinout, and GRAPH::term.

Referenced by decomposeExactSubTry(), and decomposeGetSubgraph().

◆ bidecomposition_componentIsTrivial()

SCIP_Bool bidecomposition_componentIsTrivial ( const BIDECOMP bidecomp,
int  compindex 
)

component consisting of at most one node?

Parameters
bidecompall-components storage
compindexcomponent index

Definition at line 861 of file bidecomposition.c.

References FALSE, SCIPdebugMessage, biconnected_component_decomposition::starts, and TRUE.

Referenced by decomposeExactSubTry(), decomposeReduceSub(), and decomposeSolveSub().

◆ bidecomposition_isPossible()

SCIP_Bool bidecomposition_isPossible ( const GRAPH g)

checks whether bidecomposition check is possible

Parameters
ggraph data structure

Definition at line 887 of file bidecomposition.c.

References graph_get_nNodes(), graph_isMarked(), GRAPH::mark, nnodes, and TRUE.

Referenced by initDecompose(), reduce_articulations(), reduce_bidecomposition(), and reduce_bidecompositionExact().

◆ bidecomposition_getCompNodeRatio()

SCIP_Real bidecomposition_getCompNodeRatio ( const BIDECOMP bidecomp,
int  compindex 
)

returns nodes ratio of component and the remaining graph

Parameters
bidecompbidecomposition data structure
compindexcomponent index

Definition at line 912 of file bidecomposition.c.

References GE, biconnected_component_decomposition::nbicomps, SCIP_Real, SCIPdebugMessage, and biconnected_component_decomposition::starts.

Referenced by decomposePartialExact().

◆ bidecomposition_getMaxcompNodeRatio()

SCIP_Real bidecomposition_getMaxcompNodeRatio ( const BIDECOMP bidecomp)

returns ratio of nodes of maximum component and the remaining graph

Parameters
bidecompbidecomposition data structure

Definition at line 938 of file bidecomposition.c.

References GT, biconnected_component_decomposition::nbicomps, SCIP_Real, SCIPdebugMessage, and biconnected_component_decomposition::starts.

Referenced by decomposeIsPromising(), and decomposePartialIsPromising().