|
|
Go to the documentation of this file. 37 #include "scip/misc.h" 42 SCIP_Real first = (( GNODE*)elem1)->dist; 43 SCIP_Real second = (( GNODE*)elem2)->dist; 44 if( LT(first,second) ) 48 else if( EQ(first, second) ) 68 SCIP_CALL( SCIPallocMemory(scip, node) ); 69 (*node)->index = nodeval; 70 (*node)->parent = (curr); 91 while( curr1-> parent != NULL ) 97 while( curr2 != NULL ) 102 assert(curr3 != NULL); 104 while( curr3 != last ) 109 assert(curr3 != NULL); 111 if( curr3 == last && curr3-> index != curr2-> index ) 114 SCIP_CALL( SCIPallocMemory(scip, & new) ); 121 SCIP_CALL( SCIPallocMemory(scip, node1) ); 128 new->index = curr2-> index; 148 while( curr != NULL ) 151 SCIPfreeMemory(scip, &curr); 154 assert(*node == NULL); 177 assert(v-> parent == NULL); 178 assert(v-> edge == -1); 195 SCIP_Real* nodeweight, 206 assert(scip != NULL); 207 assert(tail != NULL); 208 assert(nodeweight != NULL); 209 assert(stdeg != NULL); 212 while( p-> parent != NULL ) 214 assert(p-> edge >= 0); 215 node = tail[p-> edge]; 217 if( SCIPisLT(scip, nodeweight[node], min) && stdeg[node] == 2 ) 219 min = nodeweight[node]; 232 const SCIP_Real* cost, 240 while( p-> parent != NULL ) 242 assert(p-> edge >= 0); 243 if( SCIPisGE(scip, cost[p-> edge], max) ) 299 if( root1-> key <= root2-> key ) 311 root1-> child = root2; 324 root2-> child = root1; 337 assert(root2 != NULL); 338 assert(root1 != NULL); 340 if( root1-> key <= root2-> key ) 355 root1-> child = root2; 368 root2-> child = root1; 386 if( (*p)->sibling == NULL ) 389 SCIP_CALL( SCIPallocBufferArray(scip, &treearray, size) ); 392 for( nsiblings = 0; (*p) != NULL; nsiblings++ ) 394 assert(size > nsiblings); 395 treearray[nsiblings] = (*p); 396 if( (*p)->prev != NULL ) 400 assert(size > nsiblings); 401 treearray[nsiblings] = NULL; 405 for(i = 1; i < nsiblings; i++) 409 return treearray[nsiblings-1]; 413 for( i = 0; i < nsiblings - 1; i += 2 ) 420 if( j == nsiblings - 3 ) 425 for( ; j >= 2; j -= 2 ) 432 SCIPfreeBufferArray(scip, &treearray); 447 if( (*root) == NULL ) 450 SCIP_CALL( SCIPallocBuffer(scip, root) ); 452 (*root)->element = element; 453 (*root)->child = NULL; 454 (*root)->sibling = NULL; 455 (*root)->prev = NULL; 461 SCIP_CALL( SCIPallocBuffer(scip, &node) ); 481 assert(scip != NULL); 482 if( (*root) == NULL ) 492 assert(size != NULL); 494 *element = (*root)->element; 496 if( (*root)->child != NULL ) 498 newroot = (*root)-> child; 502 SCIPfreeBuffer(scip, root); 518 assert(scip != NULL); 519 assert(root1 != NULL); 520 assert(root2 != NULL); 521 assert(sizeroot1 != NULL); 522 assert(sizeroot2 != NULL); 524 if( *root1 == NULL && *root2 == NULL ) 526 assert(*sizeroot1 == 0); 527 assert(*sizeroot2 == 0); 532 (*sizeroot1) += (*sizeroot2); 543 if( (*root) == NULL ) 547 if( (*root)->sibling != NULL ) 551 if( (*root)->child != NULL ) 556 SCIPfreeBuffer(scip, root); 589 SCIP_CALL( SCIPallocBufferArray(scip, elements, size) ); 608 SCIP_CALL( SCIPallocMemoryArray(scip, &(uf-> parent), length) ); 609 SCIP_CALL( SCIPallocMemoryArray(scip, &(uf-> size), length) ); 610 for( i = 0; i < length; i++ ) { 629 while( root != parent[root] ) 634 while( element != root ) 636 newelement = parent[element]; 637 parent[element] = root; 638 element = newelement; 653 int* size = uf-> size; 665 size[idp] += size[idq]; 669 if( size[idp] < size[idq] ) 672 size[idq] += size[idp]; 677 size[idp] += size[idq]; 692 SCIPfreeMemoryArray(scip, &uf-> parent); 693 SCIPfreeMemoryArray(scip, &uf-> size);
void SCIPunionfindFree(SCIP *scip, UF *uf)
int SCIPunionfindFind(UF *uf, int element)
void SCIPpairheapMeldheaps(SCIP *scip, PHNODE **root1, PHNODE **root2, int *sizeroot1, int *sizeroot2)
struct PHeap_Node * sibling
Problem data for stp problem.
struct PHeap_Node * child
PHNODE * SCIPpairheapAddtoheap(SCIP *scip, PHNODE *root1, PHNODE *root2)
SCIP_RETCODE SCIPpairheapDeletemin(SCIP *scip, int *element, SCIP_Real *key, PHNODE **root, int *size)
void SCIPpairheapFree(SCIP *scip, PHNODE **root)
NODE * SCIPlinkcuttreeFindMax(SCIP *scip, const SCIP_Real *cost, NODE *v)
void SCIPintListNodeFree(SCIP *scip, IDX **node)
static SCIP_RETCODE pairheapCombineSiblings(SCIP *scip, PHNODE **p, int size)
SCIP_DECL_SORTPTRCOMP(GNODECmpByDist)
void SCIPlinkcuttreeInit(NODE *v)
void SCIPlinkcuttreeEvert(NODE *v)
int GNODECmpByDist(void *first_arg, void *second_arg)
SCIP_RETCODE SCIPintListNodeInsert(SCIP *scip, IDX **node, int nodeval)
void SCIPlinkcuttreeLink(NODE *v, NODE *w, int edge)
SCIP_RETCODE SCIPintListNodeAppendCopy(SCIP *scip, IDX **node1, IDX *node2)
void SCIPunionfindUnion(UF *uf, int p, int q, SCIP_Bool compress)
NODE * SCIPlinkcuttreeFindMinMW(SCIP *scip, SCIP_Real *nodeweight, int *tail, int *stdeg, NODE *v)
PHNODE * SCIPpairheapMergeheaps(SCIP *scip, PHNODE *root1, PHNODE *root2)
SCIP_RETCODE SCIPpairheapInsert(SCIP *scip, PHNODE **root, int element, SCIP_Real key, int *size)
void SCIPlinkcuttreeCut(NODE *v)
shortest paths based primal heuristics for Steiner problems
SCIP_RETCODE SCIPunionfindInit(SCIP *scip, UF *uf, int length)
SCIP_RETCODE SCIPpairheapBuffarr(SCIP *scip, PHNODE *root, int size, int **elements)
struct Int_List_Node * parent
static void pairheapRec(PHNODE *p, int **arr, int *n)
|