Scippy

SCIP

Solving Constraint Integer Programs

dpterms_base.c File Reference

Detailed Description

Dynamic programming solver for Steiner tree (sub-) problems with small number of terminals.

Author
Daniel Rehfeldt

Definition in file dpterms_base.c.

#include "scip/scipdefplugins.h"
#include "scip/rbtree.h"
#include "dpterms.h"
#include "dptermsinterns.h"
#include "stpbitset.h"
#include "stpvector.h"
#include "stpprioqueue.h"
#include "solstp.h"

Go to the source code of this file.

Macros

#define PROMISING_FULL_MAXNTERMS   20
 
#define PROMISING_FULL_MAXNTERMS_LARGE   15
 
#define PROMISING_PARTLY_MAXDENSITY   2.2
 
#define PROMISING_PARTLY_SMALL_MAXNTERMS   45
 
#define PROMISING_PARTLY_SMALL_MINNEDGES   1100
 
#define PROMISING_PARTLY_MEDIUM_MAXNTERMS   55
 
#define PROMISING_PARTLY_MEDIUM_MINNEDGES   1500
 
#define PROMISING_PARTLY_LARGE_MAXNTERMS   65
 
#define PROMISING_PARTLY_LARGE_MINNEDGES   3000
 
#define PROMISING_FULL_LARGE_MINNEDGES   100000
 
#define PROMISING_FULL_MAXAVGDEG   5.0
 

Functions

static SCIP_RETCODE dpgraphInit (SCIP *scip, const GRAPH *graph, DPGRAPH **dpgraph)
 
static void dpgraphFree (SCIP *scip, DPGRAPH **dpgraph)
 
static SCIP_RETCODE dpmiscInit (SCIP *scip, const GRAPH *graph, DPMISC **dpmisc)
 
static void dpmiscFree (SCIP *scip, DPMISC **dpmisc)
 
static SCIP_RETCODE dpsolverInitData (SCIP *scip, GRAPH *graph, DPSOLVER *dpsolver)
 
static void dpsolverFreeData (SCIP *scip, DPSOLVER *dpsolver)
 
static SCIP_RETCODE dpsolverSolve (SCIP *scip, GRAPH *g, DPSOLVER *dpsolver, SCIP_Bool *wasSolved)
 
static SCIP_RETCODE dpsolverGetSolution (SCIP *scip, GRAPH *graph, DPSOLVER *dpsolver, int *solution)
 
static SCIP_RETCODE dpsolverInit (SCIP *scip, GRAPH *graph, DPSOLVER **dpsolver)
 
static void dpsolverFree (SCIP *scip, DPSOLVER **dpsolver)
 
SCIP_RETCODE dpterms_solve (SCIP *scip, GRAPH *graph, int *solution, SCIP_Bool *wasSolved)
 
SCIP_Bool dpterms_isPromisingPartly (const GRAPH *graph)
 
SCIP_Bool dpterms_isPromisingEmbarrassingly (const GRAPH *graph)
 
SCIP_Bool dpterms_isPromisingFully (const GRAPH *graph)
 

Macro Definition Documentation

◆ PROMISING_FULL_MAXNTERMS

#define PROMISING_FULL_MAXNTERMS   20

Definition at line 39 of file dpterms_base.c.

Referenced by dpterms_isPromisingFully().

◆ PROMISING_FULL_MAXNTERMS_LARGE

#define PROMISING_FULL_MAXNTERMS_LARGE   15

Definition at line 40 of file dpterms_base.c.

Referenced by dpterms_isPromisingFully().

◆ PROMISING_PARTLY_MAXDENSITY

#define PROMISING_PARTLY_MAXDENSITY   2.2

Definition at line 41 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_SMALL_MAXNTERMS

#define PROMISING_PARTLY_SMALL_MAXNTERMS   45

Definition at line 42 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_SMALL_MINNEDGES

#define PROMISING_PARTLY_SMALL_MINNEDGES   1100

Definition at line 43 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_MEDIUM_MAXNTERMS

#define PROMISING_PARTLY_MEDIUM_MAXNTERMS   55

Definition at line 44 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_MEDIUM_MINNEDGES

#define PROMISING_PARTLY_MEDIUM_MINNEDGES   1500

Definition at line 45 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_LARGE_MAXNTERMS

#define PROMISING_PARTLY_LARGE_MAXNTERMS   65

Definition at line 46 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_PARTLY_LARGE_MINNEDGES

#define PROMISING_PARTLY_LARGE_MINNEDGES   3000

Definition at line 47 of file dpterms_base.c.

Referenced by dpterms_isPromisingPartly().

◆ PROMISING_FULL_LARGE_MINNEDGES

#define PROMISING_FULL_LARGE_MINNEDGES   100000

Definition at line 48 of file dpterms_base.c.

Referenced by dpterms_isPromisingFully().

◆ PROMISING_FULL_MAXAVGDEG

#define PROMISING_FULL_MAXAVGDEG   5.0

Definition at line 49 of file dpterms_base.c.

Referenced by dpterms_isPromisingFully().

Function Documentation

◆ dpgraphInit()

◆ dpgraphFree()

static void dpgraphFree ( SCIP scip,
DPGRAPH **  dpgraph 
)
static

frees

Parameters
scipSCIP data structure
dpgraphDP graph

Definition at line 217 of file dpterms_base.c.

References dynamic_programming_graph::nodes_termId, SCIPfreeMemory, SCIPfreeMemoryArray, and dynamic_programming_graph::terminals.

Referenced by dpsolverFreeData().

◆ dpmiscInit()

static SCIP_RETCODE dpmiscInit ( SCIP scip,
const GRAPH graph,
DPMISC **  dpmisc 
)
static

initializes

Parameters
scipSCIP data structure
graphoriginal graph
dpmiscto initialize

Definition at line 236 of file dpterms_base.c.

References FARAWAY, dynamic_programming_misc::global_size, NULL, dynamic_programming_misc::opt_obj, dynamic_programming_misc::opt_prev, dynamic_programming_misc::opt_root, SCIP_CALL, SCIP_OKAY, SCIPallocMemory, and StpVecPushBack.

Referenced by dpsolverInitData().

◆ dpmiscFree()

static void dpmiscFree ( SCIP scip,
DPMISC **  dpmisc 
)
static

frees

Parameters
scipSCIP data structure
dpmiscto free

Definition at line 264 of file dpterms_base.c.

References SCIPfreeMemory, stpbitset_free(), StpVecFree, and StpVecGetSize.

Referenced by dpsolverFreeData().

◆ dpsolverInitData()

◆ dpsolverFreeData()

◆ dpsolverSolve()

static SCIP_RETCODE dpsolverSolve ( SCIP scip,
GRAPH g,
DPSOLVER dpsolver,
SCIP_Bool wasSolved 
)
static

solve problem

Parameters
scipSCIP data structure
ggraph of sub-problem
dpsolversolver
wasSolvedwas problem solved to optimality?

Definition at line 408 of file dpterms_base.c.

References dpterms_coreSolve(), SCIP_CALL, and SCIP_OKAY.

Referenced by dpterms_solve().

◆ dpsolverGetSolution()

static SCIP_RETCODE dpsolverGetSolution ( SCIP scip,
GRAPH graph,
DPSOLVER dpsolver,
int *  solution 
)
static

gets optimal solution

Parameters
scipSCIP data structure
graphgraph of sub-problem
dpsolverthe solver
solutionto store solution

Definition at line 423 of file dpterms_base.c.

References graph_knot_isInRange(), GRAPH::knots, SCIP_CALL, SCIP_OKAY, SCIPallocClearBufferArray, SCIPfreeBufferArray, solstp_pruneFromNodes(), STP_Vectype, StpVecGetSize, and TRUE.

Referenced by dpterms_solve().

◆ dpsolverInit()

static SCIP_RETCODE dpsolverInit ( SCIP scip,
GRAPH graph,
DPSOLVER **  dpsolver 
)
static

initializes

Parameters
scipSCIP data structure
graphgraph of sub-problem
dpsolversolver

Definition at line 456 of file dpterms_base.c.

References dpsolverInitData(), SCIP_CALL, SCIP_OKAY, and SCIPallocMemory.

Referenced by dpterms_solve().

◆ dpsolverFree()

static void dpsolverFree ( SCIP scip,
DPSOLVER **  dpsolver 
)
static

frees

Parameters
scipSCIP data structure
dpsolversolver

Definition at line 472 of file dpterms_base.c.

References dpsolverFreeData(), and SCIPfreeMemory.

Referenced by dpterms_solve().

◆ dpterms_solve()

SCIP_RETCODE dpterms_solve ( SCIP scip,
GRAPH graph,
int *  solution,
SCIP_Bool wasSolved 
)

solves problem given by graph

Parameters
scipSCIP data structure
graphgraph of sub-problem
solutionoptimal solution (out)
wasSolvedwas problem solved to optimality?

Definition at line 489 of file dpterms_base.c.

References dpsolverFree(), dpsolverGetSolution(), dpsolverInit(), dpsolverSolve(), graph_free_csr(), graph_init_csrWithEdgeId(), SCIP_CALL, SCIP_OKAY, and solstp_isValid().

Referenced by solveWithDpTerms(), and substpsolver_solve().

◆ dpterms_isPromisingPartly()

◆ dpterms_isPromisingEmbarrassingly()

SCIP_Bool dpterms_isPromisingEmbarrassingly ( const GRAPH graph)

is DP embarrassingly promising?

Parameters
graphgraph

Definition at line 554 of file dpterms_base.c.

References GRAPH::terms.

◆ dpterms_isPromisingFully()

SCIP_Bool dpterms_isPromisingFully ( const GRAPH graph)