Scippy

SCIP

Solving Constraint Integer Programs

reduce_bnd.c File Reference

Detailed Description

bound based reductions for Steiner tree problems

Author
Daniel Rehfeldt

This file implements bound-based reduction techniques for several Steiner problems. Most tests can be found in "A Generic Approach to Solving the Steiner Tree Problem and Variants" by Daniel Rehfeldt.

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

Definition in file reduce_bnd.c.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include <assert.h>
#include "graph.h"
#include "reduce.h"
#include "heur_tm.h"
#include "heur_ascendprune.h"
#include "misc_stp.h"
#include "solstp.h"
#include "probdata_stp.h"
#include "prop_stp.h"

Go to the source code of this file.

Macros

#define BND_TMHEUR_NRUNS   20
 

Functions

static SCIP_RETCODE computeSteinerTree (SCIP *scip, GRAPH *graph, SCIP_Real *cost, SCIP_Real *costrev, int *result, STP_Bool *stnode, SCIP_Real *upperbound, SCIP_Bool *success)
 
static SCIP_RETCODE boundPruneHeur (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *radius, SCIP_Real *costrev, SCIP_Real *offset, int *heap, int *state, int *vbase, const int *solnode, const int *soledge, int *nelims, int minelims)
 
static SCIP_RETCODE boundPruneHeurMw (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *radius, SCIP_Real *costrev, SCIP_Real *offset, int *heap, int *state, int *vbase, const int *solnode, const int *soledge, int *nelims, int minelims)
 
SCIP_RETCODE reduce_bound (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *radius, SCIP_Real *offset, SCIP_Real *upperbound, int *heap, int *state, int *vbase, int *nelims)
 
SCIP_RETCODE reduce_boundMw (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *offset, int *heap, int *state, int *vbase, int *result, int *nelims)
 
SCIP_RETCODE reduce_boundPruneHeur (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *radius, SCIP_Real *costrev, SCIP_Real *offset, int *heap, int *state, int *vbase, const int *solnode, const int *soledge, int *nelims, int minelims)
 
SCIP_RETCODE reduce_boundHopDa (SCIP *scip, GRAPH *graph, int *nelims, SCIP_RANDNUMGEN *randnumgen)
 
SCIP_RETCODE reduce_boundHop (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *radius, SCIP_Real *costrev, int *heap, int *state, int *vbase, int *nelims)
 
SCIP_RETCODE reduce_boundHopR (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *costrev, SCIP_Real *pathdist, int *heap, int *state, int *vbase, int *nelims, int *pathedge)
 
SCIP_RETCODE reduce_boundHopRc (SCIP *scip, GRAPH *graph, PATH *vnoi, SCIP_Real *cost, SCIP_Real *costrev, SCIP_Real *pathdist, SCIP_Real objval, int *heap, int *state, int *vbase, int *nelims, int *pathedge, SCIP_Bool fix)
 

Macro Definition Documentation

◆ BND_TMHEUR_NRUNS

#define BND_TMHEUR_NRUNS   20

number of runs of constructive heuristic

Definition at line 46 of file reduce_bnd.c.

Referenced by computeSteinerTree().

Function Documentation

◆ computeSteinerTree()

static SCIP_RETCODE computeSteinerTree ( SCIP scip,
GRAPH graph,
SCIP_Real cost,
SCIP_Real costrev,
int *  result,
STP_Bool stnode,
SCIP_Real upperbound,
SCIP_Bool success 
)
static

bound-based reductions for the (R)PCSTP, the MWCSP and the STP

Parameters
scipSCIP data structure
graphgraph data structure
costedge cost array
costrevreversed edge cost array
resultresult edges
stnoderesult nodes
upperboundpointer to an upper bound
successsuccess?

Definition at line 51 of file reduce_bnd.c.

References BND_TMHEUR_NRUNS, CONNECT, GRAPH::extended, FALSE, FARAWAY, graph_get_nEdges(), graph_get_nNodes(), graph_getEdgeCosts(), graph_pc_2org(), graph_pc_2trans(), graph_pc_isMw(), graph_pc_isPc(), graph_pc_isPcMw(), graph_pc_solGetObj(), GRAPH::head, GRAPH::mark, nnodes, NULL, pcmode_fromheurdata, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPfreeBufferArrayNull, SCIPisEQ(), SCIPStpHeurTMCompStarts(), SCIPStpHeurTMRun(), solstp_getObjBounded(), GRAPH::source, GRAPH::tail, TRUE, and UNKNOWN.

Referenced by reduce_bound().

◆ boundPruneHeur()

static SCIP_RETCODE boundPruneHeur ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real cost,
SCIP_Real radius,
SCIP_Real costrev,
SCIP_Real offset,
int *  heap,
int *  state,
int *  vbase,
const int *  solnode,
const int *  soledge,
int *  nelims,
int  minelims 
)
static

heuristic bound-based reductions for non (R)MWCS

Parameters
scipSCIP data structure
graphgraph data structure
vnoiVoronoi data structure
costedge cost array
radiusradius array
costrevreversed edge cost array
offsetpointer to the offset
heapheap array
statearray to store state of a node during Voronoi computation
vbaseVoronoi base to each node
solnodearray of nodes of current solution that is not to be destroyed
soledgearray of edges of current solution that is not to be destroyed
nelimspointer to store number of eliminated edges
minelimsminimum number of edges to be eliminated

Definition at line 149 of file reduce_bnd.c.

References bound, CONNECT, GRAPH::cost, shortest_path::dist, EAT_LAST, shortest_path::edge, GRAPH::edges, FALSE, FARAWAY, flipedge, GRAPH::grad, graph_add2ndTermPaths(), graph_add3rdTermPaths(), graph_edge_del(), graph_free(), graph_getEdgeCosts(), graph_init(), graph_knot_chg(), graph_knot_delPseudo(), graph_path_exec(), graph_path_exit(), graph_path_init(), graph_pc_isMw(), graph_valid(), graph_voronoiWithRadius(), GRAPH::head, Is_pseudoTerm, Is_term, GRAPH::knots, GRAPH::mark, MST_MODE, nnodes, nterms, NULL, GRAPH::oeat, GRAPH::outbeg, GRAPH::path_state, GRAPH::prize, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPepsilon(), SCIPfreeBufferArray, SCIPisGE(), SCIPisGT(), SCIPisLT(), SCIPsortReal(), GRAPH::source, STP_PCSPG, STP_RPCSPG, GRAPH::stp_type, GRAPH::tail, GRAPH::term, GRAPH::terms, and TRUE.

Referenced by reduce_boundPruneHeur().

◆ boundPruneHeurMw()

static SCIP_RETCODE boundPruneHeurMw ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real cost,
SCIP_Real radius,
SCIP_Real costrev,
SCIP_Real offset,
int *  heap,
int *  state,
int *  vbase,
const int *  solnode,
const int *  soledge,
int *  nelims,
int  minelims 
)
static

heuristic bound-based reductions for (R)MWCS

Parameters
scipSCIP data structure
graphgraph data structure
vnoiVoronoi data structure
costedge cost array
radiusradius array
costrevreversed edge cost array
offsetpointer to the offset
heapheap array
statearray to store state of a node during Voronoi computation
vbaseVoronoi base to each node
solnodearray of nodes of current solution that is not to be destroyed
soledgearray of edges of current solution that is not to be destroyed
nelimspointer to store number of eliminated edges
minelimsminimum number of edges to be eliminated

Definition at line 487 of file reduce_bnd.c.

References CONNECT, GRAPH::cost, shortest_path::dist, EAT_LAST, GRAPH::edges, GRAPH::extended, FALSE, FARAWAY, flipedge, GRAPH::grad, graph_add2ndTermPaths(), graph_edge_del(), graph_getEdgeCosts(), graph_pc_isMw(), graph_valid(), graph_voronoiMw(), GRAPH::head, Is_anyTerm, Is_pseudoTerm, GRAPH::knots, GRAPH::mark, nnodes, nterms, GRAPH::oeat, GRAPH::outbeg, GRAPH::prize, SCIP_Bool, SCIP_OKAY, SCIP_Real, SCIPdebugMessage, SCIPepsilon(), SCIPisGT(), SCIPisLT(), SCIPsortReal(), GRAPH::source, STP_MWCSP, GRAPH::stp_type, GRAPH::tail, GRAPH::term, GRAPH::terms, and TRUE.

Referenced by reduce_boundPruneHeur().

◆ reduce_bound()

SCIP_RETCODE reduce_bound ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real radius,
SCIP_Real offset,
SCIP_Real upperbound,
int *  heap,
int *  state,
int *  vbase,
int *  nelims 
)

bound-based reductions for the (R)PCSTP, the MWCSP and the STP

Parameters
scipSCIP data structure
graphgraph data structure
vnoiVoronoi data structure
radiusradius array
offsetpointer to the offset
upperboundpointer to an upper bound
heapheap array
statearray to store state of a node during Voronoi computation
vbaseVoronoi base to each node
nelimspointer to store number of eliminated edges

Definition at line 655 of file reduce_bnd.c.

References bound, computeSteinerTree(), CONNECT, GRAPH::cost, shortest_path::dist, EAT_LAST, shortest_path::edge, GRAPH::extended, FARAWAY, flipedge, GRAPH::grad, graph_add2ndTermPaths(), graph_add3rdTermPaths(), graph_add4thTermPaths(), graph_edge_del(), graph_free(), graph_get4nextTTerms(), graph_get_nEdges(), graph_get_nNodes(), graph_getEdgeCosts(), graph_init(), graph_knot_chg(), graph_knot_delPseudo(), graph_knot_printInfo(), graph_mark(), graph_path_exec(), graph_path_exit(), graph_path_init(), graph_pc_deleteTerm(), graph_pc_isPc(), graph_pc_isPcMw(), graph_pc_knotIsFixedTerm(), graph_printInfo(), graph_valid(), graph_voronoiWithRadius(), GT, GRAPH::head, Is_pseudoTerm, Is_term, LT, GRAPH::mark, MST_MODE, nnodes, nterms, NULL, GRAPH::oeat, GRAPH::outbeg, GRAPH::path_state, GRAPH::prize, r, SCIP_Bool, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPisGE(), SCIPisGT(), SCIPisLE(), SCIPisLT(), SCIPsortReal(), SCIPsortRealInt(), GRAPH::source, STP_DHCSTP, STP_MWCSP, STP_PCSPG, STP_RMWCSP, STP_RPCSPG, GRAPH::stp_type, GRAPH::tail, GRAPH::term, GRAPH::terms, and TRUE.

Referenced by execPc_BND(), redLoopInnerStp(), and reduce_hc().

◆ reduce_boundMw()

SCIP_RETCODE reduce_boundMw ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real offset,
int *  heap,
int *  state,
int *  vbase,
int *  result,
int *  nelims 
)

Bound-based reduction method for the MWCSP . The reduction method tries to eliminate nodes and vertices by checking whether an upper bound for each solution that contains them is smaller than the best known solution value. The essence of the approach is a decomposition of the graph such that this upper bound is minimized.

Parameters
scipSCIP data structure
graphgraph data structure
vnoiVoronoi data structure (size 3 * nnodes)
offsetpointer to the offset
heapheap array
statearray to store state of a node during Voronoi computation
vbaseVoronoi base to each node
resultsolution array or NULL
nelimspointer to store number of eliminated edges

Definition at line 1058 of file reduce_bnd.c.

References bound, CONNECT, GRAPH::cost, shortest_path::dist, EAT_LAST, GRAPH::edges, FARAWAY, flipedge, GRAPH::grad, graph_add2ndTermPaths(), graph_edge_del(), graph_pc_isRootedPcMw(), graph_voronoiMw(), graph_voronoiWithRadiusMw(), GRAPH::head, Is_term, GRAPH::knots, GRAPH::mark, nnodes, nterms, NULL, GRAPH::outbeg, GRAPH::prize, SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPdebugMessage, SCIPfreeBufferArray, SCIPfreeBufferArrayNull, SCIPisGE(), SCIPisGT(), SCIPisLE(), SCIPisLT(), SCIPsortReal(), GRAPH::source, GRAPH::term, GRAPH::terms, and TRUE.

Referenced by redLoopInnerMw().

◆ reduce_boundPruneHeur()

SCIP_RETCODE reduce_boundPruneHeur ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real cost,
SCIP_Real radius,
SCIP_Real costrev,
SCIP_Real offset,
int *  heap,
int *  state,
int *  vbase,
const int *  solnode,
const int *  soledge,
int *  nelims,
int  minelims 
)

heuristic bound-based reductions for the (R)PCSTP, the MWCSP and the STP; used by prune heuristic

Parameters
scipSCIP data structure
graphgraph data structure
vnoiVoronoi data structure
costedge cost array
radiusradius array
costrevreversed edge cost array
offsetpointer to the offset
heapheap array
statearray to store state of a node during Voronoi computation
vbaseVoronoi base to each node
solnodearray of nodes of current solution that is not to be destroyed
soledgearray of edges of current solution that is not to be destroyed
nelimspointer to store number of eliminated edges
minelimsminimum number of edges to be eliminated

Definition at line 1237 of file reduce_bnd.c.

References boundPruneHeur(), boundPruneHeurMw(), GRAPH::extended, graph_pc_isMw(), graph_valid(), NULL, SCIP_CALL, SCIP_OKAY, SCIPdebugMessage, and GRAPH::source.

Referenced by SCIPStpHeurPruneRun().

◆ reduce_boundHopDa()

SCIP_RETCODE reduce_boundHopDa ( SCIP scip,
GRAPH graph,
int *  nelims,
SCIP_RANDNUMGEN randnumgen 
)

dual ascent based hop reductions for HCDSTP

Parameters
scipSCIP data structure
graphgraph data structure
nelimspointer to store number of reduced edges
randnumgenrandom number generator

Definition at line 1286 of file reduce_bnd.c.

References BMScopyMemoryArray, GRAPH::cost, reduce_costs_reduction_parameters::damode, EQ, extred_none, FALSE, FARAWAY, graph_get_nEdges(), graph_valid(), LT, NULL, reduce_da(), reduce_unconnectedForDirected(), SCIP_CALL, SCIP_OKAY, SCIP_Real, SCIPallocBufferArray, SCIPfreeBufferArray, and STP_DAMODE_HOPS.

Referenced by reduce_hc().

◆ reduce_boundHop()

◆ reduce_boundHopR()

SCIP_RETCODE reduce_boundHopR ( SCIP scip,
GRAPH graph,
PATH vnoi,
SCIP_Real cost,
SCIP_Real costrev,
SCIP_Real pathdist,
int *  heap,
int *  state,
int *  vbase,
int *  nelims,
int *  pathedge 
)

◆ reduce_boundHopRc()