|
|
Go to the documentation of this file. 35 #include "scip/scip.h" 50 for( k = 0; k < g-> knots; k++ ) 55 if( SCIPisGT(scip, g-> prize[k], max) ) 60 else if( t == i && SCIPisGE(scip, g-> prize[k], max) ) 67 SCIPdebugMessage( "maxprize: %f (from %d) \n", g-> prize[t], t ); 88 assert(count != NULL); 102 SCIPdebugMessage( "Delete (degree 1) terminal %d \n", i); 103 (*offset) += g-> prize[i]; 111 assert(SCIPisGT(scip, g-> prize[i], 0.0 )); 115 if( SCIPisLT(scip, g-> prize[i], -g-> prize[i1]) ) 116 *offset += g-> prize[i]; 118 *offset -= g-> prize[i1]; 122 *offset += g-> cost[iout]; 141 degsum -= g-> grad[i]; 151 if( SCIPisLT(scip, g-> prize[i], 0.0 ) ) 159 else if( g-> source[0] == i1 ) 177 assert(g-> grad[t] == 0); 216 assert(SCIPisLE(scip, g-> prize[i1], 0.0 )); 221 assert(SCIPisGE(scip, g-> prize[i1], 0.0 )); 259 IDX* ancestors = NULL; 260 IDX* revancestors = NULL; 266 assert(scip != NULL); 267 assert(length != NULL); 291 assert(SCIPisLE(scip, g-> prize[k], 0.0)); 321 if( g-> head[e1] == k ) 329 if( SCIPisGE(scip, g-> prize[k], 0.0) ) 333 assert(SCIPisLE(scip, g-> prize[i], 0.0) ); 355 assert(scip != NULL); 359 count = g-> grad[i] + 2; 408 assert(fixed != NULL); 409 assert(nelims != NULL); 413 SCIPdebugMessage( "Degree Test: "); 420 for( i = 0; i < nnodes; i++ ) 422 assert(g-> grad[i] >= 0); 424 if( g-> grad[i] == 1 ) 436 *fixed += g-> cost[e1]; 443 assert(g-> grad[i] == 0); 446 if( g-> grad[i1] == 0 ) 451 if( (i1 < i) && (g-> grad[i1] < 3) ) 456 if( g-> grad[i] == 2 ) 486 if( SCIPisLT(scip, g-> cost[e1], g-> cost[e2]) ) 488 *fixed += g-> cost[e1]; 494 *fixed += g-> cost[e2]; 504 *fixed += g-> cost[e1]; 513 *fixed += g-> cost[e2]; 523 && (((i1 < i) && (g-> grad[i1] < 3)) 524 || ((i2 < i) && (g-> grad[i2] < 3)))) 535 if( SCIPisLT(scip, g-> cost[e1], mincost) ) 537 mincost = g-> cost[e1]; 541 else if( Is_term(g-> term[i1]) && SCIPisLE(scip, g-> cost[e1], mincost) ) 546 if( ett != UNKNOWN && SCIPisLE(scip, g-> cost[ett], mincost) ) 548 *fixed += g-> cost[ett]; 556 SCIPdebugMessage( " %d Knots deleted\n", count); 586 assert(fixed != NULL); 587 assert(count != NULL); 594 SCIPdebugMessage( "Degree Test: "); 601 for( i = 0; i < nnodes; i++ ) 603 assert(g-> grad[i] >= 0); 605 if( g-> grad[i] == 1 ) 618 *fixed += g-> cost[e1]; 626 assert(g-> grad[i] == 0); 628 if ((i1 < i) && (g-> grad[i1] < 3)) 636 if( g-> grad[i] == 2 ) 658 if( ((i1 < i) && (g-> grad[i1] < 3)) 659 || ((i2 < i) && (g-> grad[i2] < 3)) ) 677 SCIP_CALL( SCIPqueueCreate(&queue, nnodes, 2.0) ); 679 for( i = 0; i < nnodes; i++ ) 684 SCIP_CALL( SCIPqueueInsert(queue, &(g-> tail[g-> outbeg[i]])) ); 694 while( !SCIPqueueIsEmpty(queue) ) 696 pnode = (SCIPqueueRemove(queue)); 702 SCIP_CALL( SCIPqueueInsert(queue, &(g-> tail[e])) ); 707 SCIPqueueFree(&queue); 709 for( i = 0; i < nnodes; i++ ) 715 SCIPdebugMessage( "remove edge to node %d \n", i); 724 printf( "remove high cost edge to node %d \n", i); 731 SCIPdebugMessage( "dirdeg %d Knots deleted\n", *count); 757 assert(scip != NULL); 759 assert(fixed != NULL); 760 assert(count != NULL); 766 SCIP_CALL( SCIPallocBufferArray(scip, &dijkdist, nnodes) ); 767 SCIP_CALL( SCIPallocBufferArray(scip, &dijkedge, nnodes) ); 771 for( i = 0; i < nnodes; i++ ) 776 pathcost = dijkdist[i]; 783 if( SCIPisGT(scip, pathcost, g-> cost[e]) ) 792 *fixed += g-> cost[e1]; 795 assert(old - g-> grad[i1] > 0); 796 *count += old - g-> grad[i1]; 797 SCIPdebugMessage( "contract %d\n", old - g-> grad[i] - g-> grad[i1]); 803 SCIPfreeBufferArray(scip, &dijkedge); 804 SCIPfreeBufferArray(scip, &dijkdist); 826 SCIP_Bool rerun = TRUE; 829 assert(fixed != NULL); 830 assert(count != NULL); 836 SCIPdebugMessage( "MW degree test: \n"); 844 for( e = 0; e < nedges; e += 2 ) 850 SCIPdebugMessage( "contract tt %d->%d\n ", i1, i2); 857 for( i = 0; i < nnodes; i++ ) 859 assert(g-> grad[i] >= 0); 860 if( !g-> mark[i] || g-> grad[i] == 0 ) 863 assert( !SCIPisEQ(scip, g-> prize[i], 0.0) ); 868 if( g-> grad[i] == 1 ) 876 assert(SCIPisLE(scip, g-> prize[i], 0.0)); 879 SCIPdebugMessage( "delete negative vertex of degree 1 (%d)\n ", i); 880 assert(g-> grad[i] == 0); 890 if( g-> grad[i] == 2 ) 907 SCIP_CALL( traverseChain(scip, g, &length, &f1, i, i1, i2, e1) ); 908 SCIP_CALL( traverseChain(scip, g, &length, &f2, i, i2, i1, e2) ); 915 else if( length > 0 ) 917 assert(g-> grad[i] <= 2); 934 if( g-> grad[i] == 2 ) 939 SCIPdebugMessage( "delete degree 0 term %d prize: %f count:%d\n ", i, g-> prize[i], *count); 940 (*fixed) += g-> prize[i]; 945 else if( g-> grad[i] == 3 ) 954 SCIP_CALL( trydg1edgepc(scip, g, fixed, count, i, e, &rerun) ); 961 SCIPdebugMessage( "MW basic reduction package has deleted %d edges\n", *count); 980 SCIP_Bool rerun = TRUE; 983 assert(fixed != NULL); 984 assert(count != NULL); 990 SCIPdebugMessage( "basic HC test: \n"); 1005 SCIPdebugMessage( "delete incoming root arc \n"); 1011 SCIPdebugMessage( "delete anti-parallel root arcs \n"); 1019 for( i = 0; i < nnodes; i++ ) 1030 SCIPdebugMessage( "delete anti-parallel terminal arcs \n"); 1041 SCIPdebugMessage( "HC basic reduction package has deleted %d edges\n", *count); 1065 SCIP_Bool rerun = TRUE; 1068 assert(fixed != NULL); 1069 assert(count != NULL); 1078 SCIP_CALL( SCIPallocBufferArray(scip, &edges2, 2) ); 1079 SCIP_CALL( SCIPallocBufferArray(scip, &nodes2, 2) ); 1081 SCIPdebugMessage( "Degree Test: "); 1091 for( i = 0; i < nnodes; i++ ) 1093 assert(g-> grad[i] >= 0); 1094 if( !g-> mark[i] || g-> grad[i] == 0 ) 1099 if( g-> grad[i] == 1 ) 1109 SCIPdebugMessage( "delete NT %d\n ", i); 1110 assert(g-> grad[i] == 0); 1113 if( g-> grad[i1] == 0 ) 1126 if( g-> grad[i] == 2 ) 1142 SCIPdebugMessage( "contract NT %d %d \n ", i2, i); 1155 if( ( (g-> grad[i] == 2 && pc) || (g-> grad[i] == 1 && !pc) ) ) 1160 SCIPdebugMessage( "delete 0 term %d prize: %f count:%d\n ", i, g-> prize[i], *count); 1161 (*fixed) += g-> prize[i]; 1166 else if( ( (g-> grad[i] == 3 && pc) || (g-> grad[i] == 2 && !pc) ) ) 1174 SCIP_CALL( trydg1edgepc(scip, g, fixed, count, i, e, &rerun) ); 1177 else if( ( (g-> grad[i] == 4 && pc) || (g-> grad[i] == 3 && !pc) ) ) 1193 if( SCIPisLE(scip, g-> prize[i], g-> cost[edges2[0]]) && SCIPisLE(scip, g-> prize[i], g-> cost[edges2[1]]) ) 1196 IDX* ancestors = NULL; 1197 IDX* revancestors = NULL; 1205 SCIPdebugMessage( "delete - term - %d\n ", i); 1220 (*fixed) += g-> prize[i]; 1228 if( g-> grad[i] > 0 ) 1238 if( SCIPisLT(scip, g-> cost[e1], mincost) ) 1240 mincost = g-> cost[e1]; 1244 else if( Is_term(g-> term[i1]) && SCIPisLE(scip, g-> cost[e1], mincost) ) 1247 assert(SCIPisEQ(scip, g-> cost[e1], mincost)); 1251 if( ett != UNKNOWN && SCIPisLE(scip, g-> cost[ett], mincost) && SCIPisLE(scip, g-> cost[ett], g-> prize[i]) 1255 SCIPdebugMessage( "contract tt %d->%d\n ", i, i1); 1256 assert(SCIPisLT(scip, mincost, FARAWAY)); 1257 *fixed += g-> cost[ett]; 1268 SCIPdebugMessage( "dirdeg %d Knots deleted\n", *count); 1271 SCIPfreeBufferArray(scip, &nodes2); 1272 SCIPfreeBufferArray(scip, &edges2);
int graph_valid(const GRAPH *)
SCIP_RETCODE graph_knot_contract(SCIP *, GRAPH *, int, int)
static SCIP_Bool maxprize(SCIP *scip, GRAPH *g, int i)
int graph_edge_redirect(SCIP *, GRAPH *, int, int, int, SCIP_Real)
void graph_knot_chg(GRAPH *, int, int)
static SCIP_RETCODE trydg1edgepc(SCIP *scip, GRAPH *g, SCIP_Real *offset, int *count, int i, int iout, SCIP_Bool *rerun)
void SCIPintListNodeFree(SCIP *scip, IDX **node)
void graph_path_execX(SCIP *, const GRAPH *, int, SCIP_Real *, SCIP_Real *, int *)
static SCIP_RETCODE traverseChain(SCIP *scip, GRAPH *g, int *length, int *final, int i, int i1, int i2, int e1)
SCIP_RETCODE rptReduction(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *count)
SCIP_RETCODE degree_test_pc(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *count)
int deleteterm(SCIP *scip, GRAPH *g, int i)
SCIP_RETCODE degree_test(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *nelims)
#define STP_MAX_NODE_WEIGHT
SCIP_RETCODE SCIPintListNodeAppendCopy(SCIP *scip, IDX **node1, IDX *node2)
SCIP_RETCODE degree_test_sap(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *count)
#define STP_PRIZE_COLLECTING
void graph_edge_del(SCIP *, GRAPH *, int, SCIP_Bool)
includes various files containing graph methods used for Steiner problems
#define STP_ROOTED_PRIZE_COLLECTING
SCIP_RETCODE graph_knot_contractpc(SCIP *, GRAPH *, int, int, int)
SCIP_RETCODE degree_test_mw(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *count)
SCIP_RETCODE degree_test_hc(SCIP *scip, GRAPH *g, SCIP_Real *fixed, int *count)
|