37 #define STP_UNIFORM_MINRATIO 0.9 38 #define STP_UNIFORM_RANGEMIN 0.9 39 #define STP_UNIFORM_RANGEMAX 1.1 100 assert(e >= 0 && e < g->edges);
117 return (0 <= e && e < g->edges);
138 const int t = g->
tail[e];
139 const int h = g->
head[e];
142 printf(
"e: %d %d->%d (%d->%d) cost:=%f costrev=%f \n", e, t, h, g->
term[t], g->
term[h], g->
cost[e], g->
cost[
flipedge(e)]);
144 printf(
"e: %d %d->%d (%d->%d) cost:=%f costrev=%f \n", e, t, h, g->
term[t], g->
term[h], g->
cost[e], g->
cost[
flipedge(e)]);
146 printf(
"e: %d %d->%d (%d->%d) cost:=%f \n", e, t, h, g->
term[t], g->
term[h], g->
cost[e]);
163 printf(
"node %d: term=%d grad=%d prize=%f (non-leaf terminal) \n", k, g->
term[k], g->
grad[k], g->
prize[k]);
165 printf(
"node %d: term=%d grad=%d prize=%f (fixed terminal) \n", k, g->
term[k], g->
grad[k], g->
prize[k]);
167 printf(
"node %d: term=%d grad=%d prize=%f (standard terminal) \n", k, g->
term[k], g->
grad[k], g->
prize[k]);
169 printf(
"node %d: term=%d grad=%d prize=%f \n", k, g->
term[k], g->
grad[k], g->
prize[k]);
173 printf(
"node %d: term=%d grad=%d \n", k, g->
term[k], g->
grad[k]);
177 printf(
"...%d is the root! \n", k);
180 printf(
"...%d is a leaf-terminal \n", k);
199 for(
int k = 0; k <
nnodes; k++ )
202 for(
int k = 0; k < nnodes && !hasMultiEdges; k++ )
206 const int head = g->
head[e];
208 if( count[head] > 0 )
217 hasMultiEdges =
TRUE;
225 const int head = g->
head[e];
232 return hasMultiEdges;
248 for(
int e = 0; e < nedges; e+= 2 )
254 edgecost = g->
cost[e];
274 for(
int e = 0; e < nedges; e += 2 )
280 edgecost = g->
cost[e];
285 if( edgecost < avg_lower || edgecost > avg_upper )
308 strcpy(type,
"STP_SPG");
311 strcpy(type,
"STP_SAP");
314 strcpy(type,
"STP_PCSPG");
317 strcpy(type,
"STP_RPCSPG");
320 strcpy(type,
"STP_NWSPG");
323 strcpy(type,
"STP_DCSTP");
326 strcpy(type,
"STP_NWPTSPG");
329 strcpy(type,
"STP_RSMT");
332 strcpy(type,
"STP_OARSMT");
335 strcpy(type,
"STP_MWCSP");
338 strcpy(type,
"STP_DHCSTP");
341 strcpy(type,
"STP_GSTP");
344 strcpy(type,
"STP_RMWCSP");
347 strcpy(type,
"STP_BRMWCSP");
350 strcpy(type,
"UNKNOWN");
356 printf(
"nodes=%d, edges=%d, terminals=%d, root=%d, type=%s, isExtended=%d\n", g->
knots, g->
edges, g->
terms, g->
source, type, g->
extended);
366 printf(
"nodes=%d, edges=%d, terminals=%d, root=%d, type=%s \n", g->
knots, g->
edges, g->
terms, g->
source, type);
370 printf(
"budget=%f \n", g->
budget);
385 printf(
"reduced graph stats: ");
389 printf(
"nodes=%d, edges=%d, terminals=%d, root=%d, type=%d, isExtended=%d \n",
401 printf(
"nodes=%d, edges=%d, terminals=%d, root=%d, type=%d \n", nnodes,
414 int* pseudonodecount;
416 int npseudoconflicts;
419 const int nedges = g->
edges;
424 assert(nedgesorg % 2 == 0);
429 for(
int e = 0; e < nedgesorg / 2; e++ )
432 for(
int e = 0; e <
nnodes; e++ )
433 pseudonodecount[e] = 0;
437 npseudoconflicts = 0;
439 for(
int e = 0; e < nedges; e += 2 )
448 assert(curr->index >= 0 && curr->index / 2 < nedgesorg / 2);
449 if( childcount[curr->index / 2] > 0 )
452 childcount[curr->index / 2]++;
455 for(
int k = 0; k < nPseudoAncestors; k++ )
457 const int a = pseudoAncestors[k];
458 assert(a >= 0 && a < nnodes);
460 if( pseudonodecount[a] > 0 )
461 hasPseudoConflict =
TRUE;
463 pseudonodecount[
a]++;
469 assert(hasPseudoConflict);
472 if( hasPseudoConflict )
481 for(
int e = 0; e <
nnodes; e++ )
492 assert(curr->index >= 0 && curr->index / 2 < nedgesorg / 2);
493 if( childcount[curr->index / 2] > 0 )
496 childcount[curr->index / 2]++;
499 for(
int k = 0; k < nPseudoAncestors; k++ )
501 const int a = pseudoAncestors[k];
502 assert(a >= 0 && a < nnodes);
504 if( pseudonodecount[a] > 0 )
505 hasPseudoConflict =
TRUE;
507 pseudonodecount[
a]++;
513 assert(hasPseudoConflict);
516 if( hasPseudoConflict )
522 printf(
"number of edge conflicts %d \n", nconflicts);
523 printf(
"number of pseudo-ancestor conflicts %d \n", npseudoconflicts);
524 printf(
"number of fixed pseudo-ancestors %d \n", npseudofixed);
541 assert(graph->
knots >= 1);
553 assert(graph->
edges >= 0);
583 assert(graph !=
NULL);
587 for(
int k = 0; k < vorg; k++ )
589 if( graph->
grad[k] > 0 )
619 const int vorg = graph->
knots;
623 for(
int k = 0; k < vorg; k++ )
625 if( graph->
grad[k] > 0 )
635 return ((
double) e / v );
int graph_edge_nPseudoAncestors(const GRAPH *, int)
static volatile int nterms
SCIP_Bool graph_typeIsUndirected(const GRAPH *g)
void graph_edge_printInfo(const GRAPH *g, int e)
int graph_pc_nFixedTerms(const GRAPH *)
SCIP_RETCODE graph_printEdgeConflicts(SCIP *scip, const GRAPH *g)
enum SCIP_Retcode SCIP_RETCODE
includes various files containing graph methods used for Steiner tree problems
const int * graph_knot_getPseudoAncestors(const GRAPH *, int)
#define SCIPfreeBufferArray(scip, ptr)
SCIP_Bool graph_edge_isDeleted(const GRAPH *g, int e)
void graph_knot_printInfo(const GRAPH *g, int k)
SCIP_Real graph_get_avgDeg(const GRAPH *graph)
SCIP_Bool graph_knotIsNWLeaf(const GRAPH *, int)
#define STP_UNIFORM_MINRATIO
SCIP_Bool graph_hasMultiEdges(SCIP *scip, const GRAPH *g, SCIP_Bool verbose)
int graph_getNfixpseudonodes(const GRAPH *)
#define STP_UNIFORM_RANGEMAX
int graph_get_nNodes(const GRAPH *graph)
void graph_get_nVET(const GRAPH *graph, int *nnodes, int *nedges, int *nterms)
#define STP_UNIFORM_RANGEMIN
SCIP_Bool graph_typeIsDirected(const GRAPH *g)
SCIP_Bool graph_isAlmostUniform(const GRAPH *g)
SCIP_Bool graph_edge_isInRange(const GRAPH *g, int e)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_Bool graph_edge_isBlocked(const GRAPH *g, int e)
int graph_knot_nPseudoAncestors(const GRAPH *, int)
int graph_pc_nProperPotentialTerms(const GRAPH *)
const int * graph_edge_getPseudoAncestors(const GRAPH *, int)
void graph_printInfo(const GRAPH *g)
SCIP_Bool graph_pc_knotIsNonLeafTerm(const GRAPH *, int)
SCIP_Bool graph_pc_isPc(const GRAPH *)
int graph_pc_nNonLeafTerms(const GRAPH *)
SCIP_Bool graph_pc_knotIsFixedTerm(const GRAPH *, int)
void graph_printInfoReduced(const GRAPH *g)
SCIP_Bool graph_pc_isPcMw(const GRAPH *)
SCIP_Bool graph_typeIsSpgLike(const GRAPH *g)
int graph_get_nTerms(const GRAPH *graph)
#define SCIP_CALL_ABORT(x)
int graph_get_nEdges(const GRAPH *graph)