Scippy

SCIP

Solving Constraint Integer Programs

graph_trans.c File Reference

Detailed Description

Transformation algorithms for Steiner problems.

Author
Daniel Rehfeldt

This includes method for transformations (or reductions) between the different Steiner problem classes.

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

Definition in file graph_trans.c.

#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include "portab.h"
#include "graph.h"

Go to the source code of this file.

Macros

#define TRANS_MAXPRIZESUM   1e09
 

Functions

static SCIP_RETCODE initCostOrgPc (SCIP *scip, GRAPH *g)
 
static SCIP_Bool isNonLeaf_pretransPc (SCIP *scip, const GRAPH *g, int vertex)
 
static void markNonLeafTerms_pretransPc (SCIP *scip, GRAPH *g)
 
static void nwptstpSetRoot (GRAPH *g)
 
SCIP_RETCODE graph_transPc (SCIP *scip, GRAPH *graph)
 
SCIP_RETCODE graph_transPc2Spg (SCIP *scip, PRESOL *presol, GRAPH *graph)
 
SCIP_RETCODE graph_transRpc (SCIP *scip, GRAPH *graph)
 
SCIP_RETCODE graph_transRpc2SpgTrivial (SCIP *scip, GRAPH *g)
 
SCIP_RETCODE graph_transRpc2FixedProper (SCIP *scip, PRESOL *presol, GRAPH *graph)
 
SCIP_RETCODE graph_transMw (SCIP *scip, GRAPH *graph)
 
SCIP_RETCODE graph_transRmw (SCIP *scip, GRAPH *graph)
 
SCIP_RETCODE graph_transPcmw2rooted (SCIP *scip, GRAPH *graph, SCIP_Real fixprize, SCIP_Bool verbose)
 
SCIP_RETCODE graph_transPcGetSap (SCIP *scip, GRAPH *graph, GRAPH **newgraph, SCIP_Real *offset)
 
SCIP_RETCODE graph_transPcGetRsap (SCIP *scip, GRAPH *graph, GRAPH **newgraph, const int *rootcands, int nrootcands, int saproot)
 
SCIP_Bool graph_transRpcToSpgIsStable (const GRAPH *graph, SCIP_Real primalbound)
 
SCIP_RETCODE graph_transRpcGetSpg (SCIP *scip, const GRAPH *graph, SCIP_Real primalbound, SCIP_Real *offset, int **edgemap_new2org, GRAPH **newgraph)
 
void graph_transGstpClean (PRESOL *presol, GRAPH *graph)
 
SCIP_RETCODE graph_transNw2pc (SCIP *scip, PRESOL *presol, GRAPH *g)
 
SCIP_RETCODE graph_transNw2sap (SCIP *scip, PRESOL *presol, GRAPH *g)
 
SCIP_RETCODE graph_transNw (SCIP *scip, PRESOL *presol, GRAPH *g)
 

Macro Definition Documentation

◆ TRANS_MAXPRIZESUM

#define TRANS_MAXPRIZESUM   1e09

Definition at line 35 of file graph_trans.c.

Referenced by graph_transRpcToSpgIsStable().

Function Documentation

◆ initCostOrgPc()

static SCIP_RETCODE initCostOrgPc ( SCIP scip,
GRAPH g 
)
static

initializes cost_org_pc array (call right after transformation to extended has been performed)

Parameters
scipSCIP
gthe graph

Definition at line 40 of file graph_trans.c.

References BMScopyMemoryArray, GRAPH::cost, GRAPH::cost_org_pc, GRAPH::edges, GRAPH::extended, graph_pc_isPc(), SCIP_CALL, SCIP_OKAY, SCIP_Real, and SCIPallocMemoryArray.

Referenced by graph_transPc(), and graph_transRpc().

◆ isNonLeaf_pretransPc()

static SCIP_Bool isNonLeaf_pretransPc ( SCIP scip,
const GRAPH g,
int  vertex 
)
inlinestatic

is vertex a non-leaf (call before graph transformation was performed)

Parameters
scipSCIP
gthe graph
vertexnode check

Definition at line 61 of file graph_trans.c.

References GRAPH::cost, EAT_LAST, FALSE, GRAPH::ieat, GRAPH::inpbeg, GRAPH::prize, SCIP_Real, SCIPisGT(), and TRUE.

Referenced by graph_transRpc2FixedProper(), and markNonLeafTerms_pretransPc().

◆ markNonLeafTerms_pretransPc()

static void markNonLeafTerms_pretransPc ( SCIP scip,
GRAPH g 
)
static

remove non-leaf terminals by edge weight shifting (call before graph transformation was performed, call only from graph transformation method!)

Parameters
scipSCIP
gthe graph

Definition at line 84 of file graph_trans.c.

References graph_knot_chg(), Is_term, isNonLeaf_pretransPc(), GRAPH::knots, nnodes, STP_TERM_NONLEAF, and GRAPH::term.

Referenced by graph_transPc(), and graph_transRpc().

◆ nwptstpSetRoot()

static void nwptstpSetRoot ( GRAPH g)
static

sets root

Parameters
gthe graph

Definition at line 106 of file graph_trans.c.

References GRAPH::grad, graph_get_nNodes(), graph_knotIsNWLeaf(), Is_term, nnodes, GRAPH::source, STP_NWPTSPG, GRAPH::stp_type, GRAPH::term, GRAPH::terms, and UNKNOWN.

Referenced by graph_transNw().

◆ graph_transPc()

◆ graph_transPc2Spg()

SCIP_RETCODE graph_transPc2Spg ( SCIP scip,
PRESOL presol,
GRAPH graph 
)

alters the graph for prize collecting problems and transforms it to an SPG

Parameters
scipSCIP data structure
presolpresolving struct
graphthe graph

Definition at line 257 of file graph_trans.c.

References BLOCKED, GRAPH::edges, EQ, GRAPH::esize, GRAPH::extended, FALSE, FARAWAY, presolve_info::fixed, graph_edge_addBi(), graph_knot_add(), graph_knot_chg(), graph_resize(), Is_term, GRAPH::knots, GRAPH::ksize, GRAPH::prize, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPfreeMemoryArrayNull, SCIPisGE(), SCIPisLT(), GRAPH::source, STP_SPG, STP_TERM, STP_TERM_NONE, GRAPH::stp_type, GRAPH::term, GRAPH::term2edge, and GRAPH::terms.

Referenced by graph_load().

◆ graph_transRpc()

◆ graph_transRpc2SpgTrivial()

SCIP_RETCODE graph_transRpc2SpgTrivial ( SCIP scip,
GRAPH g 
)

alters the graph from rooted prize collecting problems to SPG if there are not potential terminals. NOTE: deletes some PC data, but keeps history, in order to be able to reconstruct original optimal solution.

Parameters
scipSCIP data structure
gthe graph

Definition at line 505 of file graph_trans.c.

References GRAPH::costbudget, graph_pc_2orgcheck(), graph_pc_nNonLeafTerms(), graph_pc_nProperPotentialTerms(), GRAPH::prize, SCIP_ERROR, SCIP_OKAY, SCIPerrorMessage, SCIPfreeMemoryArrayNull, STP_RPCSPG, STP_SPG, GRAPH::stp_type, and GRAPH::term2edge.

Referenced by reduce_redLoopPc().

◆ graph_transRpc2FixedProper()

SCIP_RETCODE graph_transRpc2FixedProper ( SCIP scip,
PRESOL presol,
GRAPH graph 
)

changes the graph for rooted prize collecting problems such that no proper potential terminal are fixed

Parameters
scipSCIP data structure
presolpresolving struct
graphthe graph

Definition at line 531 of file graph_trans.c.

References BLOCKED, GRAPH::edges, GRAPH::esize, GRAPH::extended, FARAWAY, presolve_info::fixed, graph_edge_addBi(), graph_knot_add(), graph_knot_chg(), graph_resize(), graph_transRpc(), Is_term, isNonLeaf_pretransPc(), GRAPH::knots, GRAPH::ksize, nnodes, nterms, GRAPH::prize, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPisEQ(), SCIPisGE(), SCIPisGT(), SCIPisLT(), GRAPH::source, STP_TERM, STP_TERM_NONE, and GRAPH::term.

Referenced by graph_load().

◆ graph_transMw()

SCIP_RETCODE graph_transMw ( SCIP scip,
GRAPH graph 
)

◆ graph_transRmw()

◆ graph_transPcmw2rooted()

◆ graph_transPcGetSap()

◆ graph_transPcGetRsap()

SCIP_RETCODE graph_transPcGetRsap ( SCIP scip,
GRAPH graph,
GRAPH **  newgraph,
const int *  rootcands,
int  nrootcands,
int  saproot 
)

builds new rooted SAP graph for prize-collecting problems (with given root for SAP)

Parameters
scipSCIP data structure
graphthe graph
newgraphthe new graph
rootcandsarray containing all vertices that could be used as root
nrootcandsnumber of all vertices that could be used as root
saprootthe root of the new SAP

Definition at line 1043 of file graph_trans.c.

References GRAPH::cost, EAT_LAST, GRAPH::edges, GRAPH::esize, FALSE, FARAWAY, flipedge, GRAPH::grad, graph_copy(), graph_edge_del(), graph_edge_redirect(), graph_knot_chg(), graph_knot_del(), graph_pc_2transcheck(), graph_pc_initPrizes(), graph_pc_initTerm2Edge(), graph_pc_isPcMw(), graph_pc_isRootedPcMw(), graph_pc_knotToFixedTermProperty(), graph_pc_presolExit(), graph_pc_presolInit(), GRAPH::head, Is_pseudoTerm, Is_term, GRAPH::knots, GRAPH::ksize, GRAPH::mark, nnodes, GRAPH::oeat, GRAPH::outbeg, GRAPH::prize, SCIP_CALL, SCIP_OKAY, GRAPH::source, STP_SAP, STP_TERM, STP_TERM_NONE, GRAPH::stp_type, GRAPH::tail, GRAPH::term, GRAPH::term2edge, TERM2EDGE_FIXEDTERM, TERM2EDGE_NOTERM, and TRUE.

Referenced by reduce_daPcMw().

◆ graph_transRpcToSpgIsStable()

SCIP_Bool graph_transRpcToSpgIsStable ( const GRAPH graph,
SCIP_Real  primalbound 
)

is a transformation stable?

Parameters
graphthe graph
primalboundprimal bound for graph

Definition at line 1188 of file graph_trans.c.

References FALSE, FARAWAY, GE, graph_get_nNodes(), GT, LE, LT, nnodes, GRAPH::prize, SCIP_Real, STP_RPCSPG, GRAPH::stp_type, and TRANS_MAXPRIZESUM.

Referenced by graph_transRpcGetSpg(), and reduce_impliedProfitBasedRpc().

◆ graph_transRpcGetSpg()

SCIP_RETCODE graph_transRpcGetSpg ( SCIP scip,
const GRAPH graph,
SCIP_Real  primalbound,
SCIP_Real offset,
int **  edgemap_new2org,
GRAPH **  newgraph 
)

◆ graph_transGstpClean()

void graph_transGstpClean ( PRESOL presol,
GRAPH graph 
)

cleans up GSTP after transformation todo also compute a better big M than just the trivial one, e.g. by building an SAP and computing bound todo move the whole transformation here from graph_load, quite hacky at the moment

Parameters
presolpresolving struct
graphthe graph

Definition at line 1381 of file graph_trans.c.

References BLOCKED, GRAPH::cost, EQ, presolve_info::fixed, graph_get_nEdges(), GRAPH::head, Is_term, GRAPH::knots, LE, GRAPH::norgmodelknots, GRAPH::norgmodelterms, SCIP_Real, STP_GSTP, GRAPH::stp_type, GRAPH::tail, GRAPH::term, and GRAPH::terms.

Referenced by graph_load().

◆ graph_transNw2pc()

SCIP_RETCODE graph_transNw2pc ( SCIP scip,
PRESOL presol,
GRAPH g 
)

alters the graph for node-weighted Steiner tree problems

Parameters
scipSCIP data structure
presolpresolving struct
gthe graph

Definition at line 1420 of file graph_trans.c.

References BLOCKED, GRAPH::cost, EQ, FARAWAY, presolve_info::fixed, GE, graph_get_nEdges(), graph_get_nNodes(), graph_knot_chg(), graph_transRpc(), GT, Is_term, LT, nnodes, GRAPH::prize, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, GRAPH::source, STP_TERM, GRAPH::term, and GRAPH::terms.

Referenced by graph_transNw().

◆ graph_transNw2sap()

SCIP_RETCODE graph_transNw2sap ( SCIP scip,
PRESOL presol,
GRAPH g 
)

alters the graph for node-weighted Steiner tree problems

Parameters
scipSCIP data structure
presolpresolving struct
gthe graph

Definition at line 1487 of file graph_trans.c.

References GRAPH::cost, EAT_LAST, presolve_info::fixed, graph_get_nNodes(), GRAPH::ieat, GRAPH::inpbeg, Is_term, nnodes, GRAPH::prize, SCIP_OKAY, SCIP_Real, and GRAPH::term.

Referenced by graph_transNw().

◆ graph_transNw()

SCIP_RETCODE graph_transNw ( SCIP scip,
PRESOL presol,
GRAPH g 
)

alters the graph for node-weighted Steiner tree problems

Parameters
scipSCIP data structure
presolpresolving struct
gthe graph

Definition at line 1519 of file graph_trans.c.

References graph_transNw2pc(), graph_transNw2sap(), nwptstpSetRoot(), SCIP_CALL, SCIP_OKAY, STP_NWPTSPG, and GRAPH::stp_type.

Referenced by graph_load().