60 heap[1] = heap[(*count)--];
64 if (
LT(path[heap[3]].dist, path[heap[2]].dist))
67 while((c <= (*count)) &&
GT(path[heap[j]].dist, path[heap[c]].dist))
77 if ((c + 1) <= (*count))
78 if (
LT(path[heap[c + 1]].dist, path[heap[c]].dist))
110 heap[1] = heap[(*count)--];
116 if (
LT(pathdist[heap[3]], pathdist[heap[2]]))
119 while((c <= dcount) &&
GT(pathdist[heap[j]], pathdist[heap[c]]))
129 if ((c + 1) <= dcount)
130 if (
LT(pathdist[heap[c + 1]], pathdist[heap[c]]))
163 path[l].
dist = (mode ==
MST_MODE) ? cost : (path[k].dist + cost);
169 heap[++(*count)] = l;
176 while( (j > 1) &&
SCIPisGT(scip, path[heap[c]].dist, path[heap[j]].dist) )
216 pathdist[l] = (pathdist[k] + cost);
223 heap[++(*count)] = l;
232 while( (j > 1) &&
SCIPisGT(scip, pathdist[heap[c]], pathdist[heap[j]]) )
256 heap[++(*count)] = node;
257 state[node] = (*count);
263 while((j > 1) &&
GT(path[heap[c]].dist, path[heap[j]].dist))
288 pathdist[node] = 0.0;
290 heap[++(*count)] = node;
291 state[node] = (*count);
297 while( (j > 1) &&
SCIPisGT(scip, pathdist[heap[c]], pathdist[heap[j]]) )
322 path[node].
dist = 0.0;
324 heap[++(*count)] = node;
325 state[node] = (*count);
331 while( (j > 1) &&
SCIPisGT(scip, path[heap[c]].dist, path[heap[j]].dist) )
371 dist += path[k].
dist;
375 dist += path[k2].
dist;
383 if(
SCIPisLT(scip, dist, path[vbk].dist) )
385 path[vbk].
dist = dist;
399 max =
MIN((l + 1), 3);
401 for( r = 0; r <= max; r++ )
412 t = vbase[k2 + (r *
nnodes)];
414 for( s = 0; s < l; s++ )
415 if( vbase[vbk + s * nnodes] == t )
417 if( s < l || vbk == t )
422 dist += path[k].dist;
424 dist += path[k2 + (r * nnodes)].
dist;
426 if(
SCIPisLT(scip, dist, path[pos].dist) )
428 path[pos].
dist = dist;
506 assert(scip !=
NULL);
509 assert(start < p->knots);
513 assert(path !=
NULL);
514 assert(cost !=
NULL);
524 for(
int i = 0; i <
nnodes; i++ )
543 k =
nearest(heap, state, &count, path);
548 for(
int i = p->
outbeg[k]; i >= 0; i = p->
oeat[i] )
550 const int m = p->
head[i];
558 if( path[m].dist > ((mode ==
MST_MODE) ? cost[i] : (path[k].dist + cost[i])) && p->
mark[m] )
559 correct(scip, heap, state, &count, path, m, k, i, cost[i], mode);
585 const int limit1 = limit / 2;
588 assert(heap !=
NULL);
589 assert(path !=
NULL);
590 assert(cost !=
NULL);
591 assert(nlbl !=
NULL);
592 assert(memlbl !=
NULL);
597 if( g->
grad[tail] == 0 || g->
grad[head] == 0 )
600 assert(g->
mark[head] && g->
mark[tail]);
604 path[tail].
dist = 0.0;
606 memlbl[(*nlbl)++] = tail;
613 const int m = g->
head[e];
615 if( g->
mark[m] && (distlimit >= cost[e]) )
617 assert(
SCIPisGT(scip, path[m].dist, path[tail].dist + cost[e]));
620 memlbl[(*nlbl)++] = m;
621 correct(scip, heap, state, &count, path, m, tail, e, cost[e],
FSP_MODE);
623 if( nchecks++ > limit1 )
629 while( count > 0 && nchecks <= limit )
632 const int k =
nearest(heap, state, &count, path);
638 if(
SCIPisGT(scip, path[k].dist, distlimit) )
648 const int m = g->
head[e];
649 if( state[m] && g->
mark[m] && (distlimit >= cost[e]) && (path[m].
dist > path[k].
dist + cost[e]) )
653 memlbl[(*nlbl)++] = m;
656 if( nchecks++ > limit )
681 const int limit1 = limit / 2;
688 assert(heap !=
NULL);
689 assert(path !=
NULL);
690 assert(cost !=
NULL);
691 assert(nlbl !=
NULL);
692 assert(memlbl !=
NULL);
694 assert(pathmaxnode !=
NULL);
698 if( g->
grad[tail] == 0 || g->
grad[head] == 0 )
701 assert(g->
mark[head] && g->
mark[tail]);
705 path[tail].
dist = 0.0;
707 memlbl[(*nlbl)++] = tail;
714 const int m = g->
head[e];
718 assert(
SCIPisGT(scip, path[m].dist, path[tail].dist + cost[e]));
721 memlbl[(*nlbl)++] = m;
722 correct(scip, heap, state, &count, path, m, tail, e, cost[e],
FSP_MODE);
724 if( nchecks++ > limit1 )
734 const int k =
nearest(heap, state, &count, path);
735 SCIP_Real maxweight = pathmaxnode[k] >= 0 ? g->
prize[pathmaxnode[k]] : 0.0;
738 assert(maxweight >= 0);
739 assert(
SCIPisLE(scip, path[k].dist - maxweight, distlimit));
751 maxweight = g->
prize[k];
755 if( block && stateblock[k] ==
CONNECT )
761 const int m = g->
head[e];
763 if( state[m] && g->
mark[m] && path[m].
dist > (path[k].
dist + cost[e])
764 && distlimit >= (path[k].
dist + cost[e] - maxweight) )
767 memlbl[(*nlbl)++] = m;
769 pathmaxnode[m] = pathmaxnode[k];
772 if( nchecks++ > limit )
800 assert(start < g->knots);
803 assert(pathdist !=
NULL);
804 assert(pathedge !=
NULL);
805 assert(cost !=
NULL);
815 for( i = nnodes - 1; i >= 0; --i )
833 k =
nearestX(heap, state, &count, pathdist);
841 if( state[m] && g->
mark[m] &&
SCIPisGT(scip, pathdist[m], (pathdist[k] + cost[i])) )
842 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, i, cost[i]);
869 assert(start < g->knots);
872 assert(pathdist !=
NULL);
873 assert(pathedge !=
NULL);
874 assert(cost !=
NULL);
885 for( i = nnodes - 1; i >= 0; --i )
905 k =
nearestX(heap, state, &count, pathdist);
910 rootdist = pathdist[k];
911 else if(
SCIPisGT(scip, pathdist[k], rootdist) )
918 if( state[m] && g->
mark[m] &&
SCIPisGT(scip, pathdist[m], (pathdist[k] + cost[i])) )
919 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, i, cost[i]);
945 assert(randnumgen !=
NULL);
946 assert(pathdist !=
NULL);
947 assert(pathedge !=
NULL);
950 assert(start < g->knots);
951 assert(cost !=
NULL);
952 assert(connected !=
NULL);
960 for( k = 0; k <
nnodes; k++ )
965 connected[k] =
FALSE;
986 k =
nearestX(heap, state, &count, pathdist);
992 assert(k == start || !connected[k]);
999 assert(pathedge[k] != - 1);
1001 while( !connected[node = g->
tail[pathedge[node]]] )
1003 assert(pathedge[node] != - 1);
1004 connected[node] =
TRUE;
1005 resetX(scip, pathdist, heap, state, &count, node);
1009 if( ++nterms == g->
terms )
1021 if( !connected[m] && pathdist[m] > (pathdist[k] + cost[e]) && g->
mark[m] )
1022 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, e, cost[e]);
1053 assert(pathdist !=
NULL);
1054 assert(pathedge !=
NULL);
1057 assert(start < g->knots);
1058 assert(cost !=
NULL);
1059 assert(connected !=
NULL);
1070 for( k = nnodes - 1; k >= 0; --k )
1076 connected[k] =
FALSE;
1080 maxprize = g->
prize[k];
1089 connected[k] =
TRUE;
1104 k =
nearestX(heap, state, &count, pathdist);
1110 connected[k] =
TRUE;
1116 assert(pathedge[k] != - 1);
1118 while( !connected[node = g->
tail[pathedge[node]]] )
1120 assert(pathedge[node] != - 1);
1121 connected[node] =
TRUE;
1122 resetX(scip, pathdist, heap, state, &count, node);
1126 if( ++nterms == g->
terms - 1 )
1129 else if(
SCIPisGT(scip, pathdist[k], maxprize) && connected[root] )
1142 if( !connected[m] && pathdist[m] > (pathdist[k] + cost[e]) && g->
mark[m] )
1143 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, e, cost[e]);
1171 assert(pathdist !=
NULL);
1172 assert(pathedge !=
NULL);
1175 assert(start < g->knots);
1176 assert(cost !=
NULL);
1177 assert(connected !=
NULL);
1183 for( k = nnodes - 1; k >= 0; --k )
1189 connected[k] =
FALSE;
1192 maxprize = g->
prize[k];
1198 connected[k] =
TRUE;
1212 k =
nearestX(heap, state, &count, pathdist);
1220 connected[k] =
TRUE;
1225 assert(pathedge[k] != - 1);
1227 while( !connected[node = g->
tail[pathedge[node]]] )
1229 assert(pathedge[node] != - 1);
1230 connected[node] =
TRUE;
1231 resetX(scip, pathdist, heap, state, &count, node);
1232 assert(state[node]);
1236 if( ++nterms == g->
terms - 1 )
1239 else if(
SCIPisGT(scip, pathdist[k], maxprize) )
1245 for(
int e = g->
outbeg[k]; e >= 0; e = g->
oeat[e] )
1247 const int m = g->
head[e];
1252 if( !connected[m] && pathdist[m] > (pathdist[k] + cost[e]) && g->
mark[m] )
1253 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, e, cost[e]);
1274 assert(tmpnodeweight !=
NULL);
1275 assert(result !=
NULL);
1278 assert(start < g->knots);
1279 assert(cost !=
NULL);
1280 assert(connected !=
NULL);
1286 const int head = g->
head[e];
1293 assert(connected[head]);
1295 if(
SCIPisGE(scip, cost[e], tmpnodeweight[head]) )
1297 connected[head] =
FALSE;
1302 tmpnodeweight[start] += tmpnodeweight[head] - cost[e];
1331 assert(pathdist !=
NULL);
1332 assert(pathedge !=
NULL);
1335 assert(start < g->knots);
1336 assert(cost !=
NULL);
1337 assert(connected !=
NULL);
1340 for( k = nnodes - 1; k >= 0; --k )
1346 connected[k] =
FALSE;
1352 connected[k] =
TRUE;
1366 k =
nearestX(heap, state, &count, pathdist);
1372 connected[k] =
TRUE;
1378 assert(pathedge[k] != - 1);
1380 while( !connected[node = g->
tail[pathedge[node]]] )
1382 assert(pathedge[node] != - 1);
1383 connected[node] =
TRUE;
1384 resetX(scip, pathdist, heap, state, &count, node);
1385 assert(state[node]);
1389 if( ++nterms == g->
terms - 1 )
1401 if( !connected[m] && g->
mark[m] &&
SCIPisGT(scip, pathdist[m], (pathdist[k] + cost[e])) )
1402 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, e, cost[e]);
1427 assert(path !=
NULL);
1429 assert(cost !=
NULL);
1430 assert(connected !=
NULL);
1438 *extensions =
FALSE;
1441 for( k = 0; k <
nnodes; k++ )
1444 if( connected[k] && g->
mark[k] )
1462 maxprize = g->
prize[k];
1483 k =
nearest(heap, state, &count, path);
1490 connected[k] =
TRUE;
1495 assert(path[k].edge !=
UNKNOWN);
1497 while( !connected[node = g->
tail[path[node].
edge]] )
1499 assert(path[node].edge !=
UNKNOWN);
1500 connected[node] =
TRUE;
1501 reset(scip, path, heap, state, &count, node);
1502 assert(state[node]);
1506 if( ++nterms == g->
terms - 1 )
1509 else if(
SCIPisGT(scip, path[k].dist, maxprize) )
1515 for(
int e = g->
outbeg[k]; e >= 0; e = g->
oeat[e] )
1517 const int m = g->
head[e];
1524 if( !connected[m] && path[m].dist > (path[k].dist + cost[e]) && g->
mark[m] )
1556 assert(pathdist !=
NULL);
1557 assert(pathedge !=
NULL);
1560 assert(start < g->knots);
1561 assert(cost !=
NULL);
1562 assert(connected !=
NULL);
1572 for( k = 0; k <
nnodes; k++ )
1581 assert(g->
grad[k] == 2);
1585 for( k = 0; k <
nnodes; k++ )
1590 connected[k] =
FALSE;
1597 maxprize = g->
prize[k];
1603 connected[k] =
TRUE;
1610 int rtermscount = 0;
1620 k =
nearestX(heap, state, &count, pathdist);
1627 connected[k] =
TRUE;
1633 assert(pathedge[k] != - 1);
1634 while( !connected[node = g->
tail[pathedge[node]]] )
1636 assert(pathedge[node] != - 1);
1638 connected[node] =
TRUE;
1639 resetX(scip, pathdist, heap, state, &count, node);
1644 if( ++termscount == nterms )
1649 else if(
SCIPisGT(scip, pathdist[k], maxprize) && rtermscount >= nrterms )
1662 if( !connected[m] && g->
mark[m] &&
SCIPisGT(scip, pathdist[m], (pathdist[k] + cost[e])) )
1663 correctX(scip, heap, state, &count, pathdist, pathedge, m, k, e, cost[e]);
1693 int count = countex;
1698 assert(path !=
NULL);
1699 assert(cost !=
NULL);
1701 if( g->
knots == 0 || nneighbterms <= 0 )
1709 while( count > 0 && nneighbterms > 0 )
1711 k =
nearest(heap, state, &count, path);
1713 reachednodes[(*nreachednodes)++] = k;
1714 distarr[k][nodenterms[k]] = path[k].
dist;
1715 edgearr[k][nodenterms[k]] = path[k].
edge;
1716 basearr[k][nodenterms[k]] = base;
1720 if( termsmark[k] ==
TRUE )
1722 termsmark[k] =
FALSE;
1723 if( --nneighbterms == 0 )
1726 reachednodes[(*nreachednodes)++] = heap[count--];
1739 if( (state[m]) && (g->
mark[m]) && (
GT(path[m].dist, (path[k].dist + cost[i]))) )
1744 assert(nneighbterms == 0);
1771 assert(scip !=
NULL);
1772 assert(path !=
NULL);
1773 assert(cost !=
NULL);
1774 assert(costrev !=
NULL);
1786 for( i = 0; i < g->
knots; i++ )
1815 k =
nearest(heap, state, &count, path);
1826 if( (state[m]) &&
SCIPisGT(scip, path[m].dist, path[k].dist + ((vbase[k] == root)? cost[i] : costrev[i])) )
1829 correct(scip, heap, state, &count, path, m, k, i, ((vbase[k] == root)? cost[i] : costrev[i]),
FSP_MODE);
1830 vbase[m] = vbase[k];
1858 assert(path !=
NULL);
1859 assert(cost !=
NULL);
1860 assert(heap !=
NULL);
1861 assert(state !=
NULL);
1862 assert(costrev !=
NULL);
1869 for( i = 0; i <
nnodes; i++ )
1882 for( i = 0; i <
nnodes; i++ )
1891 if( !
Is_term(g->
term[j]) &&
SCIPisGT(scip, path[k].dist, path[i].dist + ((root == vbase[i])? cost[e] : costrev[e])) &&
1892 vbase[i] != vbase[j] && g->
mark[j] )
1894 correct(scip, heap, state, &count, path, k, i, e, ((root == vbase[i])? cost[e] : costrev[e]),
FSP_MODE);
1895 vbase[k] = vbase[i];
1907 k =
nearest(heap, state, &count, path);
1912 assert(k - nnodes >= 0);
1922 if( vbase[j] != vbase[k] &&
SCIPisGT(scip, path[jc].dist, path[k].dist + ((root == vbase[k])? cost[e] : costrev[e])) )
1924 correct(scip, heap, state, &count, path, jc, k, e, (root == vbase[k])? cost[e] : costrev[e],
FSP_MODE);
1925 vbase[jc] = vbase[k];
1957 assert(path !=
NULL);
1958 assert(cost !=
NULL);
1959 assert(heap !=
NULL);
1960 assert(state !=
NULL);
1961 assert(costrev !=
NULL);
1968 for( i = 0; i <
nnodes; i++ )
1979 for( i = 0; i <
nnodes; i++ )
1993 for( l = 0; l < 2; l++ )
1995 if(
SCIPisGT(scip, path[k].dist, path[v].dist + ((root == vbase[v])? cost[e] : costrev[e])) &&
1996 vbase[v] != vbase[j] && vbase[v] != vbase[j + nnodes] )
1998 correct(scip, heap, state, &count, path, k, v, e, ((root == vbase[v])? cost[e] : costrev[e]),
FSP_MODE);
1999 vbase[k] = vbase[v];
2013 k =
nearest(heap, state, &count, path);
2018 assert(k - dnnodes >= 0);
2027 if( vbase[j] != vbase[k] && vbase[j + nnodes] != vbase[k]
2028 &&
SCIPisGT(scip, path[jc].dist, path[k].dist + ((root == vbase[k])? cost[e] : costrev[e])) )
2030 correct(scip, heap, state, &count, path, jc, k, e, (root == vbase[k])? cost[e] : costrev[e],
FSP_MODE);
2031 vbase[jc] = vbase[k];
2065 assert(path !=
NULL);
2066 assert(cost !=
NULL);
2067 assert(heap !=
NULL);
2068 assert(state !=
NULL);
2069 assert(costrev !=
NULL);
2077 for( i = 0; i <
nnodes; i++ )
2088 for( i = 0; i <
nnodes; i++ )
2103 for( l = 0; l < 3; l++ )
2105 if(
SCIPisGT(scip, path[k].dist, path[v].dist + ((root == vbase[v])? cost[e] : costrev[e])) &&
2106 vbase[v] != vbase[j] && vbase[v] != vbase[j + nnodes] && vbase[v] != vbase[j + dnnodes] )
2108 correct(scip, heap, state, &count, path, k, v, e, ((root == vbase[v])? cost[e] : costrev[e]),
FSP_MODE);
2109 vbase[k] = vbase[v];
2123 k =
nearest(heap, state, &count, path);
2128 assert(k - tnnodes >= 0);
2137 if( vbase[j] != vbase[k] && vbase[j + nnodes] != vbase[k] && vbase[j + dnnodes] != vbase[k]
2138 &&
SCIPisGT(scip, path[jc].dist, path[k].dist + ((root == vbase[k])? cost[e] : costrev[e])) )
2140 correct(scip, heap, state, &count, path, jc, k, e, (root == vbase[k])? cost[e] : costrev[e],
FSP_MODE);
2141 vbase[jc] = vbase[k];
2163 assert(path3 !=
NULL);
2164 assert(cost !=
NULL);
2165 assert(costrev !=
NULL);
2166 assert(heap !=
NULL);
2167 assert(state !=
NULL);
2170 for( k = 0; k < g->
knots; k++ )
2177 graph_get2next(scip, g, cost, costrev, path3, vbase, heap, state);
2180 graph_get3next(scip, g, cost, costrev, path3, vbase, heap, state);
2200 assert(path !=
NULL);
2201 assert(cost !=
NULL);
2202 assert(heap !=
NULL);
2203 assert(state !=
NULL);
2204 assert(costrev !=
NULL);
2207 for( k = 0; k < g->
knots; k++ )
2214 graph_get2next(scip, g, cost, costrev, path, vbase, heap, state);
2217 graph_get3next(scip, g, cost, costrev, path, vbase, heap, state);
2220 graph_get4next(scip, g, cost, costrev, path, vbase, heap, state);
2248 assert(path !=
NULL);
2249 assert(cost !=
NULL);
2250 assert(heap !=
NULL);
2251 assert(state !=
NULL);
2259 for( k = 0; k < g->
knots; k++ )
2263 for( k = 0; k <
nnodes; k ++ )
2271 if( !g->
mark[k2] || k2 < k )
2275 if( vbase[k] != vbase[k2] )
2277 boundedges[nboundedges++] = e;
2288 for( l = 0; l < 4; l++ )
2290 for( e = 0; e < nboundedges; e++ )
2292 bedge = boundedges[e];
2294 k2 = g->
head[bedge];
2295 utdist(scip, g, path, cost[bedge], vbase, k, l, k2, shift, nnodes);
2296 utdist(scip, g, path, cost[bedge], vbase, k2, l, k, shift, nnodes);
2324 assert(path !=
NULL);
2325 assert(cost !=
NULL);
2326 assert(heap !=
NULL);
2327 assert(state !=
NULL);
2330 for( i = 0; i < g->
knots; i++ )
2359 k =
nearest(heap, state, &count, path);
2370 if( (state[m]) &&
SCIPisGT(scip, path[m].dist, path[k].dist + cost[i]) && g->
mark[m] )
2373 vbase[m] = vbase[k];
2401 assert(path !=
NULL);
2402 assert(costrev !=
NULL);
2403 assert(heap !=
NULL);
2404 assert(state !=
NULL);
2409 for( i = 0; i <
nnodes; i++ )
2438 k =
nearest(heap, state, &count, path);
2449 if( (state[m]) &&
SCIPisGT(scip, path[m].dist, path[k].dist + costrev[i]) && g->
mark[m] && !
Is_term(g->
term[m]) )
2451 assert(vbase[m] != m);
2452 correct(scip, heap, state, &count, path, m, k, i, costrev[i],
FSP_MODE);
2453 vbase[m] = vbase[k];
2490 assert(path !=
NULL);
2491 assert(cost !=
NULL);
2492 assert(heap !=
NULL);
2493 assert(state !=
NULL);
2494 assert(distance !=
NULL);
2501 for( i = 0; i <
nnodes; i++ )
2504 if( distnode !=
NULL )
2528 for( e = 0; e < g->
edges; e++ )
2529 minedgepred[e] =
FALSE;
2531 for( k = 0; k < nbases; k++ )
2533 minedgepred[minarc[k]] =
TRUE;
2542 k =
nearest(heap, state, &count, path);
2547 prededge = path[k].
edge;
2551 pred = g->
tail[prededge];
2554 assert(vbase[pred] !=
UNKNOWN);
2555 assert(vbase[pred] == vbase[k]);
2556 assert(g->
head[prededge] == k);
2560 assert(path[pred].edge !=
UNKNOWN);
2561 minedgepred[prededge] = minedgepred[path[pred].
edge];
2571 if( state[m] ==
CONNECT && vbase[m] != vbase[k] && g->
mark[m] )
2573 if( minedgepred[i] || (prededge !=
UNKNOWN && minedgepred[prededge] ) )
2576 if(
SCIPisLT(scip,
new, distance[vbase[k]]) )
2578 if( distnode !=
NULL )
2579 distnode[vbase[k]] = vbase[m];
2581 distance[vbase[k]] =
new;
2584 if( minedgepred[
Edge_anti(i)] || (path[m].edge !=
UNKNOWN && minedgepred[path[m].edge] ) )
2587 if(
SCIPisLT(scip,
new, distance[vbase[m]]) )
2589 if( distnode !=
NULL )
2590 distnode[vbase[m]] = vbase[k];
2592 distance[vbase[m]] =
new;
2599 if( state[m] && g->
mark[m] &&
2600 (
SCIPisGT(scip, path[m].dist, path[k].dist + cost[i]) ||
2601 (prededge !=
UNKNOWN && minedgepred[prededge] &&
SCIPisEQ(scip, path[m].dist, path[k].dist + cost[i]))) )
2604 vbase[m] = vbase[k];
2640 assert(graph !=
NULL);
2641 assert(heap !=
NULL);
2642 assert(state !=
NULL);
2643 assert(path !=
NULL);
2644 assert(cost !=
NULL);
2645 assert(costrev !=
NULL);
2646 assert(rad !=
NULL);
2647 assert(vbase !=
NULL);
2649 nnodes = graph->
knots;
2651 if( graph->
terms == 0 )
2661 for( i = 0; i <
nnodes; i++ )
2677 nodesid[i] = nterms++;
2711 k =
nearest(heap, state, &count, path);
2723 if( state[m] ==
CONNECT && vbm != vbk && graph->
mark[m] )
2725 assert(graph->
mark[vbm]);
2726 assert(graph->
mark[vbk]);
2729 if(
SCIPisGT(scip, rad[vbk], path[k].dist) )
2730 rad[vbk] = path[k].
dist;
2731 if(
SCIPisGT(scip, rad[vbm], path[m].dist) )
2732 rad[vbm] = path[m].
dist;
2735 ecost = graph->
prize[vbm] - path[k].
dist;
2737 ecost = graph->
prize[vbk] - path[m].
dist;
2742 if( adjgraph->
head[ne] == nodesid[vbm] )
2749 assert(adjgraph->
head[ne] == nodesid[vbm]);
2750 assert(adjgraph->
tail[ne] == nodesid[vbk]);
2753 adjgraph->
cost[ne] = ecost;
2759 graph_edge_add(scip, adjgraph, nodesid[vbm], nodesid[vbk], ecost, ecost);
2768 c1 = path[m].
dist + costrev[i];
2770 c1 = path[m].
dist + cost[i];
2772 c2 = path[k].
dist + cost[i];
2774 c2 = path[k].
dist + costrev[i];
2783 if(
SCIPisGT(scip, path[m].dist, path[k].dist) )
2784 ecost = path[k].
dist + cost[i];
2786 ecost = path[m].
dist + cost[i];
2793 ecost = graph->
prize[vbm];
2796 ecost = graph->
prize[vbk];
2801 if( adjgraph->
head[ne] == nodesid[vbm] )
2808 assert(adjgraph->
head[ne] == nodesid[vbm]);
2809 assert(adjgraph->
tail[ne] == nodesid[vbk]);
2812 adjgraph->
cost[ne] = ecost;
2823 path[k].dist + ((vbk == root) ? cost[i] : costrev[i])) )
2824 rad[vbk] = path[k].
dist 2825 + ((vbk == root) ? cost[i] : costrev[i]);
2828 path[m].dist + ((vbm == root) ? costrev[i] : cost[i])) )
2829 rad[vbm] = path[m].
dist 2830 + ((vbm == root) ? costrev[i] : cost[i]);
2835 if( state[m] && graph->
mark[m] && !
Is_term(graph->
term[m]) &&
SCIPisGT(scip, path[m].dist, path[k].dist + ((vbk == root)? cost[i] : costrev[i])) )
2837 correct(scip, heap, state, &count, path, m, k, i, ((vbk == root)? cost[i] : costrev[i]),
FSP_MODE);
2873 assert(heap !=
NULL);
2874 assert(state !=
NULL);
2875 assert(path !=
NULL);
2876 assert(cost !=
NULL);
2877 assert(radius !=
NULL);
2878 assert(vbase !=
NULL);
2883 nterms = g->
terms - 1;
2884 nodeweight = g->
prize;
2886 assert(nodeweight !=
NULL);
2888 if( nnodes == 0 || nterms <= 0 )
2894 for( i = 0; i <
nnodes; i++ )
2930 k =
nearest(heap, state, &count, path);
2936 assert(g->
mark[basek]);
2949 if( basem != basek && (state[m] ==
CONNECT || vbase[m] == m ||
2950 SCIPisGE(scip, path[k].dist, nodeweight[basek])) )
2952 if(
SCIPisGT(scip, radius[basek], path[k].dist) )
2953 radius[basek] = path[k].
dist;
2954 if( (state[m] ==
CONNECT || vbase[m] == m) &&
SCIPisGT(scip, radius[basem], path[m].dist) )
2956 assert(g->
mark[basem]);
2957 radius[basem] = path[m].
dist;
2962 if(
SCIPisLT(scip, path[k].dist, nodeweight[basek]) &&
SCIPisLT(scip, path[k].dist, radius[basek]) )
2965 if( (state[m]) &&
SCIPisGT(scip, path[m].dist, path[k].dist + cost[i]) )
2967 assert(vbase[m] != m);
3005 assert(path !=
NULL);
3006 assert(cost !=
NULL);
3020 k =
nearest(heap, state, count, path);
3025 assert(g->
mark[vbase[k]]);
3032 if( (state[m]) && (
SCIPisGT(scip, path[m].dist, path[k].dist + cost[i])) )
3036 vbase[m] = vbase[k];
3044 if( state[m] ==
CONNECT && ((node1 == crucnode) != (node2 == crucnode)) && g->
mark[m] && g->
mark[vbase[m]]
3082 assert(path !=
NULL);
3083 assert(cost !=
NULL);
3091 assert(heap !=
NULL);
3092 assert(state !=
NULL);
3097 while( (*count) > 0 )
3100 k =
nearest(heap, state, count, path);
3114 if( state[m] && (
SCIPisGT(scip,path[m].dist, path[k].dist + cost[i])) )
3117 vbase[m] = vbase[k];
3121 && g->
mark[node1] && g->
mark[node2] && (nodesmark[node1] || nodesmark[node2]) )
3123 boundedges[(*nboundedges)++] = i;
void graph_path_st_pcmw_full(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge, int start, STP_Bool *connected)
SCIP_Bool SCIPisEQ(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void graph_get3nextTerms(SCIP *scip, const GRAPH *g, SCIP_Real *cost, SCIP_Real *costrev, PATH *path3, int *vbase, int *heap, int *state)
static volatile int nterms
SCIP_RETCODE graph_voronoiWithDist(SCIP *scip, const GRAPH *g, SCIP_Real *cost, SCIP_Real *distance, int *minedgepred, int *vbase, int *minarc, int *heap, int *state, int *distnode, PATH *path)
void graph_path_invroot(SCIP *scip, const GRAPH *g, int start, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge)
SCIP_Bool SCIPisGE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
#define SCIPfreeMemoryArray(scip, ptr)
void graph_path_st_rmw(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge, int start, STP_Bool *connected)
#define SCIPallocMemoryArray(scip, ptr, num)
void graph_path_execX(SCIP *scip, const GRAPH *g, int start, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge)
void graph_sdPaths(SCIP *scip, const GRAPH *g, PATH *path, SCIP_Real *cost, SCIP_Real distlimit, int *heap, int *state, int *memlbl, int *nlbl, int tail, int head, int limit)
enum SCIP_Retcode SCIP_RETCODE
static int nearestX(int *heap, int *state, int *count, const SCIP_Real *pathdist)
static void correct(SCIP *scip, int *heap, int *state, int *count, PATH *path, int l, int k, int e, SCIP_Real cost, int mode)
void graph_get3next(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, const SCIP_Real *costrev, PATH *path, int *vbase, int *heap, int *state)
void graph_path_exec(SCIP *scip, const GRAPH *p, const int mode, int start, const SCIP_Real *cost, PATH *path)
void graph_voronoi(SCIP *scip, const GRAPH *g, SCIP_Real *cost, SCIP_Real *costrev, STP_Bool *base, int *vbase, PATH *path)
SCIP_RETCODE graph_voronoiExtend(SCIP *scip, const GRAPH *g, SCIP_Real *cost, PATH *path, SCIP_Real **distarr, int **basearr, int **edgearr, STP_Bool *termsmark, int *reachednodes, int *nreachednodes, int *nodenterms, int nneighbterms, int base, int countex)
void graph_path_st_pcmw(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge, int start, STP_Bool *connected)
#define SCIPfreeBufferArray(scip, ptr)
void graph_path_st_pcmw_extend(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, PATH *path, STP_Bool *connected, SCIP_Bool *extensions)
void graph_voronoiTerms(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, PATH *path, int *vbase, int *heap, int *state)
SCIP_Bool SCIPisLE(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void graph_voronoiRepairMult(SCIP *scip, const GRAPH *g, SCIP_Real *cost, int *count, int *vbase, int *boundedges, int *nboundedges, STP_Bool *nodesmark, UF *uf, PATH *path)
void graph_path_st(SCIP *scip, const GRAPH *g, SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge, int start, SCIP_RANDNUMGEN *randnumgen, STP_Bool *connected)
void graph_get4next(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, const SCIP_Real *costrev, PATH *path, int *vbase, int *heap, int *state)
void graph_path_exit(SCIP *scip, GRAPH *g)
void graph_get4nextTerms(SCIP *scip, const GRAPH *g, SCIP_Real *cost, SCIP_Real *costrev, PATH *path, int *vbase, int *heap, int *state)
void graph_voronoiMw(SCIP *scip, const GRAPH *g, const SCIP_Real *costrev, PATH *path, int *vbase, int *heap, int *state)
void graph_get2next(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, const SCIP_Real *costrev, PATH *path, int *vbase, int *heap, int *state)
static void resetX(SCIP *scip, SCIP_Real *pathdist, int *heap, int *state, int *count, int node)
int SCIPStpunionfindFind(UF *uf, int element)
#define SCIPallocBufferArray(scip, ptr, num)
SCIP_RETCODE graph_voronoiWithRadius(SCIP *scip, const GRAPH *graph, GRAPH *adjgraph, PATH *path, SCIP_Real *rad, SCIP_Real *cost, SCIP_Real *costrev, int *vbase, int *heap, int *state)
static void reset(SCIP *scip, PATH *path, int *heap, int *state, int *count, int node)
void graph_voronoiRepair(SCIP *scip, const GRAPH *g, SCIP_Real *cost, int *count, int *vbase, PATH *path, int *newedge, int crucnode, UF *uf)
void graph_voronoiWithRadiusMw(SCIP *scip, const GRAPH *g, PATH *path, const SCIP_Real *cost, SCIP_Real *radius, int *vbase, int *heap, int *state)
includes various files containing graph methods used for Steiner tree problems
void graph_path_st_rpc(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, SCIP_Real *pathdist, int *pathedge, int start, STP_Bool *connected)
SCIP_RETCODE graph_path_init(SCIP *scip, GRAPH *g)
static void correctX(SCIP *scip, int *heap, int *state, int *count, SCIP_Real *pathdist, int *pathedge, int l, int k, int e, SCIP_Real cost)
void heap_add(int *heap, int *state, int *count, int node, PATH *path)
SCIP_Bool SCIPisLT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
SCIP_Bool SCIPisGT(SCIP *scip, SCIP_Real val1, SCIP_Real val2)
void graph_knot_add(GRAPH *, int)
void graph_path_PcMwSd(SCIP *scip, const GRAPH *g, PATH *path, SCIP_Real *cost, SCIP_Real distlimit, int *pathmaxnode, int *heap, int *state, int *stateblock, int *memlbl, int *nlbl, int tail, int head, int limit)
SCIP_RETCODE graph_get4nextTTerms(SCIP *scip, const GRAPH *g, SCIP_Real *cost, PATH *path, int *vbase, int *heap, int *state)
static void utdist(SCIP *scip, const GRAPH *g, PATH *path, SCIP_Real ecost, int *vbase, int k, int l, int k2, int shift, int nnodes)
static int nearest(int *heap, int *state, int *count, const PATH *path)
void graph_edge_add(SCIP *, GRAPH *, int, int, double, double)
void graph_path_st_pcmw_reduce(SCIP *scip, const GRAPH *g, const SCIP_Real *cost, SCIP_Real *tmpnodeweight, int *result, int start, STP_Bool *connected)