60 #define SQRTOFTWO 1.4142136 77 1.000, 2.414, 3.078, 6.314, 12.706,
78 0.816, 1.604, 1.886, 2.920, 4.303,
79 0.765, 1.423, 1.638, 2.353, 3.182,
80 0.741, 1.344, 1.533, 2.132, 2.776,
81 0.727, 1.301, 1.476, 2.015, 2.571,
82 0.718, 1.273, 1.440, 1.943, 2.447,
83 0.711, 1.254, 1.415, 1.895, 2.365,
84 0.706, 1.240, 1.397, 1.860, 2.306,
85 0.703, 1.230, 1.383, 1.833, 2.262,
86 0.700, 1.221, 1.372, 1.812, 2.228,
87 0.697, 1.214, 1.363, 1.796, 2.201,
88 0.695, 1.209, 1.356, 1.782, 2.179,
89 0.694, 1.204, 1.350, 1.771, 2.160,
90 0.692, 1.200, 1.345, 1.761, 2.145,
91 0.691, 1.197, 1.341, 1.753, 2.131
98 0.674, 1.150, 1.282, 1.645, 1.960
135 if( countx < 1.9 || county < 1.9 )
139 pooledvariance = (countx - 1) * variancex + (county - 1) * variancey;
140 pooledvariance /= (countx + county - 2);
143 pooledvariance =
MAX(pooledvariance, 1e-9);
148 tresult = (meanx - meany) / SQRT(pooledvariance);
149 tresult *= SQRT(countx * county / (countx + county));
159 #if defined(_WIN32) || defined(_WIN64) 170 sign = (x >= 0) ? 1 : -1;
174 y = 1.0 - (((((a5*t + a4)*t) + a3)*t + a2)*t + a1)*t*exp(-x*x);
205 assert(variance >= -1e-9);
206 if( variance < 1e-9 )
209 std = sqrt(variance);
214 if( value < mean + 1e-9 )
219 assert( std != 0.0 );
222 normvalue = (value - mean)/(std *
SQRTOFTWO);
224 SCIPdebugMessage(
" Normalized value %g = ( %g - %g ) / (%g * 1.4142136)\n", normvalue, value, mean, std);
229 if( normvalue < 1e-9 && normvalue > -1e-9 )
231 else if( normvalue > 0 )
235 erfresult =
SCIPerf(normvalue);
236 return erfresult / 2.0 + 0.5;
242 erfresult =
SCIPerf(-normvalue);
244 return 0.5 - erfresult / 2.0;
257 assert(regression !=
NULL);
267 assert(regression !=
NULL);
269 return regression->
slope;
277 assert(regression !=
NULL);
298 regression->
slope = 0.0;
332 assert(meanptr !=
NULL);
333 assert(sumvarptr !=
NULL);
334 assert(nobservations > 0 || add);
336 addfactor = add ? 1.0 : -1.0;
339 *meanptr = oldmean + addfactor * (value - oldmean)/(
SCIP_Real)nobservations;
340 *sumvarptr += addfactor * (value - oldmean) * (value - (*meanptr));
343 assert(*sumvarptr >= -1e-4);
344 *sumvarptr =
MAX(0.0, *sumvarptr);
354 assert(regression !=
NULL);
372 regression->
sumxy -= (x *
y);
387 assert(regression !=
NULL);
393 regression->
sumxy += x *
y;
406 regression->
meanx = 0;
408 regression->
sumxy = 0;
409 regression->
meany = 0;
419 assert(regression !=
NULL);
448 assert(initsize >= 0);
449 assert(growfac >= 1.0);
453 size =
MAX(initsize, num);
459 initsize =
MAX(initsize, 4);
464 while( size < num && size > oldsize )
467 size = (int)(growfac * size + initsize);
471 if( size <= oldsize )
475 assert(size >= initsize);
486 #define GMLNODEWIDTH 120.0 487 #define GMLNODEHEIGTH 30.0 488 #define GMLFONTSIZE 13 489 #define GMLNODETYPE "rectangle" 490 #define GMLNODEFILLCOLOR "#ff0000" 491 #define GMLEDGECOLOR "black" 492 #define GMLNODEBORDERCOLOR "#000000" 500 const char* nodetype,
501 const char* fillcolor,
502 const char* bordercolor
505 assert(file !=
NULL);
506 assert(label !=
NULL);
508 fprintf(file,
" node\n");
509 fprintf(file,
" [\n");
510 fprintf(file,
" id %u\n",
id);
511 fprintf(file,
" label \"%s\"\n", label);
512 fprintf(file,
" graphics\n");
513 fprintf(file,
" [\n");
517 if( nodetype !=
NULL )
518 fprintf(file,
" type \"%s\"\n", nodetype);
522 if( fillcolor !=
NULL )
523 fprintf(file,
" fill \"%s\"\n", fillcolor);
527 if( bordercolor !=
NULL )
528 fprintf(file,
" outline \"%s\"\n", bordercolor);
532 fprintf(file,
" ]\n");
533 fprintf(file,
" LabelGraphics\n");
534 fprintf(file,
" [\n");
535 fprintf(file,
" text \"%s\"\n", label);
537 fprintf(file,
" fontName \"Dialog\"\n");
538 fprintf(file,
" anchor \"c\"\n");
539 fprintf(file,
" ]\n");
540 fprintf(file,
" ]\n");
548 const char* nodetype,
549 const char* fillcolor,
550 const char* bordercolor,
554 assert(file !=
NULL);
555 assert(label !=
NULL);
557 fprintf(file,
" node\n");
558 fprintf(file,
" [\n");
559 fprintf(file,
" id %u\n",
id);
560 fprintf(file,
" label \"%s\"\n", label);
561 fprintf(file,
" weight %g\n", weight);
562 fprintf(file,
" graphics\n");
563 fprintf(file,
" [\n");
567 if( nodetype !=
NULL )
568 fprintf(file,
" type \"%s\"\n", nodetype);
572 if( fillcolor !=
NULL )
573 fprintf(file,
" fill \"%s\"\n", fillcolor);
577 if( bordercolor !=
NULL )
578 fprintf(file,
" outline \"%s\"\n", bordercolor);
582 fprintf(file,
" ]\n");
583 fprintf(file,
" LabelGraphics\n");
584 fprintf(file,
" [\n");
585 fprintf(file,
" text \"%s\"\n", label);
587 fprintf(file,
" fontName \"Dialog\"\n");
588 fprintf(file,
" anchor \"c\"\n");
589 fprintf(file,
" ]\n");
590 fprintf(file,
" ]\n");
602 assert(file !=
NULL);
604 fprintf(file,
" edge\n");
605 fprintf(file,
" [\n");
606 fprintf(file,
" source %u\n", source);
607 fprintf(file,
" target %u\n", target);
610 fprintf(file,
" label \"%s\"\n", label);
612 fprintf(file,
" graphics\n");
613 fprintf(file,
" [\n");
616 fprintf(file,
" fill \"%s\"\n", color);
621 fprintf(file,
" ]\n");
625 fprintf(file,
" LabelGraphics\n");
626 fprintf(file,
" [\n");
627 fprintf(file,
" text \"%s\"\n", label);
629 fprintf(file,
" fontName \"Dialog\"\n");
630 fprintf(file,
" anchor \"c\"\n");
631 fprintf(file,
" ]\n");
634 fprintf(file,
" ]\n");
646 assert(file !=
NULL);
648 fprintf(file,
" edge\n");
649 fprintf(file,
" [\n");
650 fprintf(file,
" source %u\n", source);
651 fprintf(file,
" target %u\n", target);
654 fprintf(file,
" label \"%s\"\n", label);
656 fprintf(file,
" graphics\n");
657 fprintf(file,
" [\n");
660 fprintf(file,
" fill \"%s\"\n", color);
664 fprintf(file,
" targetArrow \"standard\"\n");
665 fprintf(file,
" ]\n");
669 fprintf(file,
" LabelGraphics\n");
670 fprintf(file,
" [\n");
671 fprintf(file,
" text \"%s\"\n", label);
673 fprintf(file,
" fontName \"Dialog\"\n");
674 fprintf(file,
" anchor \"c\"\n");
675 fprintf(file,
" ]\n");
678 fprintf(file,
" ]\n");
687 assert(file !=
NULL);
689 fprintf(file,
"graph\n");
690 fprintf(file,
"[\n");
691 fprintf(file,
" hierarchic 1\n");
694 fprintf(file,
" directed 1\n");
702 assert(file !=
NULL);
704 fprintf(file,
"]\n");
726 assert(sparsesol !=
NULL);
727 assert(vars !=
NULL);
736 for( v = nvars - 1; v >= 0; --v )
738 assert(vars[v] !=
NULL);
759 (*sparsesol)->nvars = nvars;
769 assert(sparsesol !=
NULL);
770 assert(*sparsesol !=
NULL);
783 assert(sparsesol !=
NULL);
785 return sparsesol->
vars;
793 assert(sparsesol !=
NULL);
795 return sparsesol->
nvars;
803 assert(sparsesol !=
NULL);
813 assert(sparsesol !=
NULL);
828 assert(sparsesol !=
NULL);
833 assert(lbvalues !=
NULL);
836 for( v = 0; v < nvars; ++v )
837 sol[v] = lbvalues[v];
856 assert(sparsesol !=
NULL);
867 assert(lbvalues !=
NULL);
868 assert(ubvalues !=
NULL);
873 for( v = 0; v < nvars; ++v )
875 lbvalue = lbvalues[v];
876 ubvalue = ubvalues[v];
878 if( lbvalue < ubvalue )
882 if( carryflag ==
FALSE )
884 if( sol[v] < ubvalue )
892 assert(sol[v] == ubvalue);
899 if( sol[v] < ubvalue )
907 assert(sol[v] == ubvalue);
914 return (!carryflag && !singular);
929 assert(queue !=
NULL);
932 if( minsize <= queue->size )
949 assert(queue !=
NULL);
951 initsize =
MAX(1, initsize);
952 sizefac =
MAX(1.0, sizefac);
955 (*queue)->firstfree = 0;
956 (*queue)->firstused = -1;
958 (*queue)->sizefac = sizefac;
959 (*queue)->slots =
NULL;
971 assert(queue !=
NULL);
982 assert(queue !=
NULL);
997 int oldsize = queue->
size;
1000 assert(oldsize < queue->size);
1002 sizediff = queue->
size - oldsize;
1034 assert(queue !=
NULL);
1039 assert(elem !=
NULL);
1060 assert(queue !=
NULL);
1086 assert(queue !=
NULL);
1120 assert(queue !=
NULL);
1152 assert(queue !=
NULL);
1170 assert(queue !=
NULL);
1188 assert(queue !=
NULL);
1201 assert(queue !=
NULL);
1221 #define PQ_PARENT(q) (((q)+1)/2-1) 1222 #define PQ_LEFTCHILD(p) (2*(p)+1) 1223 #define PQ_RIGHTCHILD(p) (2*(p)+2) 1233 assert(pqueue !=
NULL);
1235 if( minsize <= pqueue->size )
1253 assert(pqueue !=
NULL);
1254 assert(ptrcomp !=
NULL);
1256 initsize =
MAX(1, initsize);
1257 sizefac =
MAX(1.0, sizefac);
1261 (*pqueue)->size = 0;
1262 (*pqueue)->sizefac = sizefac;
1263 (*pqueue)->slots =
NULL;
1264 (*pqueue)->ptrcomp = ptrcomp;
1265 (*pqueue)->elemchgpos = elemchgpos;
1276 assert(pqueue !=
NULL);
1287 assert(pqueue !=
NULL);
1301 pqueue->
slots[newpos] = elem;
1304 if( pqueue->elemchgpos !=
NULL )
1306 pqueue->elemchgpos(elem, oldpos, newpos);
1310 #ifdef SCIP_MORE_DEBUG 1333 if( pqueue->ptrcomp(pqueue->
slots[i], pqueue->
slots[leftchild]) > 0 )
1352 assert(pqueue !=
NULL);
1353 assert(pqueue->
len >= 0);
1354 assert(elem !=
NULL);
1362 while( pos > 0 && (*pqueue->ptrcomp)(elem, pqueue->
slots[parentpos]) < 0 )
1364 assert((*pqueue->ptrcomp)(pqueue->
slots[parentpos], elem) >= 0);
1374 #ifdef SCIP_MORE_DEBUG 1375 assert(pqueueHasHeapProperty(pqueue));
1390 assert(pqueue !=
NULL);
1400 if( pos == pqueue->
len )
1408 while( pos > 0 && (*pqueue->ptrcomp)(last, pqueue->
slots[
PQ_PARENT(pos)]) < 0 )
1420 if( brotherpos < pqueue->len && (*pqueue->ptrcomp)(pqueue->
slots[brotherpos], pqueue->
slots[childpos]) < 0 )
1421 childpos = brotherpos;
1423 if( (*pqueue->ptrcomp)(last, pqueue->
slots[childpos]) <= 0 )
1433 assert(pos <= pqueue->len - 1);
1437 #ifdef SCIP_MORE_DEBUG 1438 assert(pqueueHasHeapProperty(pqueue));
1449 assert(pqueue !=
NULL);
1450 assert(pqueue->
len >= 0);
1452 if( pqueue->
len == 0 )
1455 root = pqueue->
slots[0];
1467 assert(pqueue !=
NULL);
1468 assert(pqueue->
len >= 0);
1470 if( pqueue->
len == 0 )
1473 return pqueue->
slots[0];
1481 assert(pqueue !=
NULL);
1482 assert(pqueue->
len >= 0);
1492 assert(pqueue !=
NULL);
1493 assert(pqueue->
len >= 0);
1495 return pqueue->
slots;
1508 if( pqueue->
slots[pos] == elem )
1583 return ( (uint32_t) ((UINT64_C(0x9e3779b97f4a7c15) * input)>>32) ) | 1u;
1594 assert(0 <= pos && pos < primetablesize);
1596 return primetable[pos];
1609 assert(multihashlist !=
NULL);
1610 assert(blkmem !=
NULL);
1611 assert(element !=
NULL);
1615 newlist->
next = *multihashlist;
1616 *multihashlist = newlist;
1631 assert(multihashlist !=
NULL);
1632 assert(blkmem !=
NULL);
1634 list = *multihashlist;
1635 while( list !=
NULL )
1637 nextlist = list->
next;
1642 *multihashlist =
NULL;
1657 uint64_t currentkeyval;
1660 assert(hashkeyeq !=
NULL);
1661 assert(key !=
NULL);
1663 while( multihashlist !=
NULL )
1665 currentkey = hashgetkey(userptr, multihashlist->
element);
1666 currentkeyval = hashkeyval(userptr, currentkey);
1667 if( currentkeyval == keyval && hashkeyeq(userptr, currentkey, key) )
1668 return multihashlist;
1670 multihashlist = multihashlist->
next;
1691 h =
multihashlistFind(multihashlist, hashgetkey, hashkeyeq, hashkeyval, userptr, keyval, key);
1706 key1 = hashgetkey(userptr, h->
element);
1707 key2 = hashgetkey(userptr, h2->
element);
1708 assert(hashkeyval(userptr, key1) == hashkeyval(userptr, key2));
1710 if( hashkeyeq(userptr, key1, key2) )
1712 SCIPerrorMessage(
"WARNING: hashkey with same value exists multiple times (e.g. duplicate constraint/variable names), so the return value is maybe not correct\n");
1741 assert(multihashlist !=
NULL);
1744 h =
multihashlistFind(*multihashlist, hashgetkey, hashkeyeq, hashkeyval, userptr, keyval, key);
1749 *multihashlist = h->
next;
1754 *multihashlist =
NULL;
1769 assert(multihashlist !=
NULL);
1770 assert(blkmem !=
NULL);
1771 assert(element !=
NULL);
1773 while( *multihashlist !=
NULL && (*multihashlist)->element != element )
1774 multihashlist = &(*multihashlist)->
next;
1776 if( *multihashlist !=
NULL )
1778 nextlist = (*multihashlist)->
next;
1780 *multihashlist = nextlist;
1788 #define SCIP_MULTIHASH_MAXSIZE 33554431 1789 #define SCIP_MULTIHASH_RESIZE_PERCENTAGE 65 1790 #define SCIP_MULTIHASH_GROW_FACTOR 1.31 1804 assert(multihash !=
NULL);
1806 assert(multihash->
nlists > 0);
1807 assert(multihash->hashgetkey !=
NULL);
1808 assert(multihash->hashkeyeq !=
NULL);
1809 assert(multihash->hashkeyval !=
NULL);
1813 nnewlists =
MAX(nnewlists, multihash->
nlists);
1817 if( nnewlists > multihash->
nlists )
1822 unsigned int hashval;
1827 for( l = multihash->
nlists - 1; l >= 0; --l )
1829 multihashlist = multihash->
lists[l];
1833 while( multihashlist !=
NULL )
1836 key = multihash->hashgetkey(multihash->
userptr, multihashlist->
element);
1837 keyval = multihash->hashkeyval(multihash->
userptr, key);
1838 hashval = (
unsigned int) (keyval % (
unsigned) nnewlists);
1843 if( multihashlist->
next ==
NULL && onlyone )
1846 if( newlists[hashval] ==
NULL )
1847 newlists[hashval] = multihashlist;
1854 while( next !=
NULL )
1860 lastnext->
next = multihashlist;
1872 multihashlist = multihashlist->
next;
1884 multihash->
lists = newlists;
1885 multihash->
nlists = nnewlists;
1888 #ifdef SCIP_MORE_DEBUG 1892 for( l = 0; l < multihash->
nlists; ++l )
1894 multihashlist = multihash->
lists[l];
1895 while( multihashlist !=
NULL )
1898 multihashlist = multihashlist->
next;
1901 assert(sumslotsize == multihash->
nelements);
1923 assert(tablesize >= 0);
1924 assert(multihash !=
NULL);
1925 assert(hashgetkey !=
NULL);
1926 assert(hashkeyeq !=
NULL);
1927 assert(hashkeyval !=
NULL);
1931 (*multihash)->blkmem = blkmem;
1932 (*multihash)->nlists = tablesize;
1933 (*multihash)->hashgetkey = hashgetkey;
1934 (*multihash)->hashkeyeq = hashkeyeq;
1935 (*multihash)->hashkeyval = hashkeyval;
1936 (*multihash)->userptr = userptr;
1937 (*multihash)->nelements = 0;
1952 assert(multihash !=
NULL);
1953 assert(*multihash !=
NULL);
1955 table = (*multihash);
1957 lists = table->
lists;
1960 for( i = table->
nlists - 1; i >= 0; --i )
1981 unsigned int hashval;
1983 assert(multihash !=
NULL);
1985 assert(multihash->
nlists > 0);
1986 assert(multihash->hashgetkey !=
NULL);
1987 assert(multihash->hashkeyeq !=
NULL);
1988 assert(multihash->hashkeyval !=
NULL);
1989 assert(element !=
NULL);
1998 key = multihash->hashgetkey(multihash->
userptr, element);
1999 keyval = multihash->hashkeyval(multihash->
userptr, key);
2000 hashval = (
unsigned int) (keyval % (
unsigned) multihash->
nlists);
2020 assert(multihash !=
NULL);
2021 assert(multihash->hashgetkey !=
NULL);
2040 unsigned int hashval;
2042 assert(multihash !=
NULL);
2044 assert(multihash->
nlists > 0);
2045 assert(multihash->hashgetkey !=
NULL);
2046 assert(multihash->hashkeyeq !=
NULL);
2047 assert(multihash->hashkeyval !=
NULL);
2048 assert(key !=
NULL);
2051 keyval = multihash->hashkeyval(multihash->
userptr, key);
2052 hashval = (
unsigned int) (keyval % (
unsigned) multihash->
nlists);
2055 multihash->hashkeyval, multihash->
userptr, keyval, key);
2073 assert(multihash !=
NULL);
2075 assert(multihash->
nlists > 0);
2076 assert(multihash->hashgetkey !=
NULL);
2077 assert(multihash->hashkeyeq !=
NULL);
2078 assert(multihash->hashkeyval !=
NULL);
2079 assert(multihashlist !=
NULL);
2080 assert(key !=
NULL);
2082 keyval = multihash->hashkeyval(multihash->
userptr, key);
2084 if( *multihashlist ==
NULL )
2086 unsigned int hashval;
2089 hashval = (
unsigned int) (keyval % (
unsigned) multihash->
nlists);
2091 *multihashlist = multihash->
lists[hashval];
2095 multihash->hashkeyval, multihash->
userptr, keyval, key);
2106 unsigned int hashval;
2108 assert(multihash !=
NULL);
2110 assert(multihash->
nlists > 0);
2111 assert(multihash->hashgetkey !=
NULL);
2112 assert(multihash->hashkeyeq !=
NULL);
2113 assert(multihash->hashkeyval !=
NULL);
2114 assert(element !=
NULL);
2117 key = multihash->hashgetkey(multihash->
userptr, element);
2118 keyval = multihash->hashkeyval(multihash->
userptr, key);
2119 hashval = (
unsigned int) (keyval % (
unsigned) multihash->
nlists);
2122 multihash->hashkeyval, multihash->
userptr, keyval, key) !=
NULL);
2133 unsigned int hashval;
2135 assert(multihash !=
NULL);
2137 assert(multihash->
nlists > 0);
2138 assert(multihash->hashgetkey !=
NULL);
2139 assert(multihash->hashkeyeq !=
NULL);
2140 assert(multihash->hashkeyval !=
NULL);
2141 assert(element !=
NULL);
2144 key = multihash->hashgetkey(multihash->
userptr, element);
2145 keyval = multihash->hashkeyval(multihash->
userptr, key);
2146 hashval = (
unsigned int) (keyval % (
unsigned) multihash->
nlists);
2168 assert(multihash !=
NULL);
2170 blkmem = multihash->
blkmem;
2171 lists = multihash->
lists;
2174 for( i = multihash->
nlists - 1; i >= 0; --i )
2185 assert(multihash !=
NULL);
2195 assert(multihash !=
NULL);
2213 assert(multihash !=
NULL);
2218 for( i = 0; i < multihash->
nlists; ++i )
2220 multihashlist = multihash->
lists[i];
2221 if( multihashlist !=
NULL )
2225 while( multihashlist !=
NULL )
2228 multihashlist = multihashlist->
next;
2230 maxslotsize =
MAX(maxslotsize, slotsize);
2231 sumslotsize += slotsize;
2234 assert(sumslotsize == multihash->
nelements);
2236 SCIPmessagePrintInfo(messagehdlr,
"%" SCIP_LONGINT_FORMAT
" multihash entries, used %d/%d slots (%.1f%%)",
2255 unsigned int nslots;
2260 assert(tablesize >= 0);
2261 assert(hashtable !=
NULL);
2262 assert(hashgetkey !=
NULL);
2263 assert(hashkeyeq !=
NULL);
2264 assert(hashkeyval !=
NULL);
2265 assert(blkmem !=
NULL);
2274 (*hashtable)->shift = 32;
2275 (*hashtable)->shift -= (
unsigned int)ceil(LOG2(
MAX(32.0, tablesize / 0.9)));
2278 nslots = 1u << (32 - (*hashtable)->shift);
2281 (*hashtable)->mask = nslots - 1;
2284 (*hashtable)->blkmem = blkmem;
2285 (*hashtable)->hashgetkey = hashgetkey;
2286 (*hashtable)->hashkeyeq = hashkeyeq;
2287 (*hashtable)->hashkeyval = hashkeyval;
2288 (*hashtable)->userptr = userptr;
2289 (*hashtable)->nelements = 0;
2302 assert(hashtable !=
NULL);
2303 assert(*hashtable !=
NULL);
2305 nslots = (*hashtable)->
mask + 1;
2308 uint32_t maxprobelen = 0;
2309 uint64_t probelensum = 0;
2312 assert(table !=
NULL);
2314 for( i = 0; i < nslots; ++i )
2316 if( table->
hashes[i] != 0 )
2318 uint32_t probelen = ((i + table->
mask + 1 - (table->
hashes[i]>>(table->
shift))) & table->
mask) + 1;
2319 probelensum += probelen;
2320 maxprobelen =
MAX(probelen, maxprobelen);
2325 (
unsigned int)table->
nelements, (
unsigned int)table->
nelements, (
unsigned int)nslots,
2355 #define ELEM_DISTANCE(pos) (((pos) + hashtable->mask + 1 - (hashtable->hashes[(pos)]>>(hashtable->shift))) & hashtable->mask) 2367 uint32_t elemdistance;
2373 assert(hashtable !=
NULL);
2376 assert(hashtable->
mask > 0);
2377 assert(hashtable->hashgetkey !=
NULL);
2378 assert(hashtable->hashkeyeq !=
NULL);
2379 assert(hashtable->hashkeyval !=
NULL);
2380 assert(element !=
NULL);
2382 pos = hashval>>(hashtable->
shift);
2389 if( hashtable->
hashes[pos] == 0 )
2391 hashtable->
slots[pos] = element;
2392 hashtable->
hashes[pos] = hashval;
2397 if( hashtable->
hashes[pos] == hashval && hashtable->hashkeyeq(hashtable->
userptr,
2398 hashtable->hashgetkey(hashtable->
userptr, hashtable->
slots[pos]), key) )
2405 hashtable->
slots[pos] = element;
2406 hashtable->
hashes[pos] = hashval;
2417 if( distance < elemdistance )
2422 elemdistance = distance;
2425 hashval = hashtable->
hashes[pos];
2426 hashtable->
hashes[pos] = tmp;
2427 key = hashtable->hashgetkey(hashtable->
userptr, element);
2436 pos = (pos + 1) & hashtable->
mask;
2447 assert(hashtable !=
NULL);
2448 assert(hashtable->
shift < 32);
2451 if( ((((uint64_t)hashtable->
nelements)<<10)>>(32-hashtable->
shift) > 921) )
2460 nslots = hashtable->
mask + 1;
2461 newnslots = 2*nslots;
2462 hashtable->
mask = newnslots-1;
2474 for( i = 0; i < nslots; ++i )
2479 if( hashes[i] != 0 )
2505 assert(hashtable !=
NULL);
2508 assert(hashtable->
mask > 0);
2509 assert(hashtable->hashgetkey !=
NULL);
2510 assert(hashtable->hashkeyeq !=
NULL);
2511 assert(hashtable->hashkeyval !=
NULL);
2512 assert(element !=
NULL);
2517 key = hashtable->hashgetkey(hashtable->
userptr, element);
2518 keyval = hashtable->hashkeyval(hashtable->
userptr, key);
2537 assert(hashtable !=
NULL);
2540 assert(hashtable->
mask > 0);
2541 assert(hashtable->hashgetkey !=
NULL);
2542 assert(hashtable->hashkeyeq !=
NULL);
2543 assert(hashtable->hashkeyval !=
NULL);
2544 assert(element !=
NULL);
2549 key = hashtable->hashgetkey(hashtable->
userptr, element);
2550 keyval = hashtable->hashkeyval(hashtable->
userptr, key);
2565 uint32_t elemdistance;
2567 assert(hashtable !=
NULL);
2570 assert(hashtable->
mask > 0);
2571 assert(hashtable->hashgetkey !=
NULL);
2572 assert(hashtable->hashkeyeq !=
NULL);
2573 assert(hashtable->hashkeyval !=
NULL);
2574 assert(key !=
NULL);
2577 keyval = hashtable->hashkeyval(hashtable->
userptr, key);
2580 pos = hashval>>(hashtable->
shift);
2588 if( hashtable->
hashes[pos] == 0 )
2594 if( elemdistance > distance )
2598 if( hashtable->
hashes[pos] == hashval && hashtable->hashkeyeq(hashtable->
userptr,
2599 hashtable->hashgetkey(hashtable->
userptr, hashtable->
slots[pos]), key) )
2600 return hashtable->
slots[pos];
2602 pos = (pos + 1) & hashtable->
mask;
2613 assert(hashtable !=
NULL);
2616 assert(hashtable->
mask > 0);
2617 assert(hashtable->hashgetkey !=
NULL);
2618 assert(hashtable->hashkeyeq !=
NULL);
2619 assert(hashtable->hashkeyval !=
NULL);
2620 assert(element !=
NULL);
2634 uint32_t elemdistance;
2638 assert(hashtable !=
NULL);
2641 assert(hashtable->
mask > 0);
2642 assert(hashtable->hashgetkey !=
NULL);
2643 assert(hashtable->hashkeyeq !=
NULL);
2644 assert(hashtable->hashkeyval !=
NULL);
2645 assert(element !=
NULL);
2648 key = hashtable->hashgetkey(hashtable->
userptr, element);
2649 keyval = hashtable->hashkeyval(hashtable->
userptr, key);
2653 pos = hashval>>(hashtable->
shift);
2657 if( hashtable->
hashes[pos] == 0 )
2663 if( elemdistance > distance )
2666 if( hashtable->
hashes[pos] == hashval && hashtable->hashkeyeq(hashtable->
userptr,
2667 hashtable->hashgetkey(hashtable->
userptr, hashtable->
slots[pos]), key) )
2673 pos = (pos + 1) & hashtable->
mask;
2678 hashtable->
hashes[pos] = 0;
2682 uint32_t nextpos = (pos + 1) & hashtable->
mask;
2685 if( hashtable->
hashes[nextpos] == 0 )
2689 if( (hashtable->
hashes[nextpos]>>(hashtable->
shift)) == nextpos )
2693 hashtable->
slots[pos] = hashtable->
slots[nextpos];
2695 hashtable->
hashes[nextpos] = 0;
2708 assert(hashtable !=
NULL);
2720 assert(hashtable !=
NULL);
2730 return (
int) hashtable->
mask + 1;
2739 return hashtable->
hashes[entryidx] == 0 ?
NULL : hashtable->
slots[entryidx];
2747 assert(hashtable !=
NULL);
2758 uint32_t maxprobelen = 0;
2759 uint64_t probelensum = 0;
2763 assert(hashtable !=
NULL);
2765 nslots = hashtable->
mask + 1;
2768 for( i = 0; i < nslots; ++i )
2770 if( hashtable->
hashes[i] != 0 )
2773 probelensum += probelen;
2774 maxprobelen =
MAX(probelen, maxprobelen);
2793 const char* string1 = (
const char*)key1;
2794 const char* string2 = (
const char*)key2;
2796 return (strcmp(string1, string2) == 0);
2805 str = (
const char*)key;
2807 while( *str !=
'\0' )
2810 hash += (
unsigned int)(*str);
2828 return (key1 == key2);
2835 return (uint64_t) (uintptr_t) key;
2845 #undef ELEM_DISTANCE 2847 #define ELEM_DISTANCE(pos) (((pos) + hashmap->mask + 1 - (hashmap->hashes[(pos)]>>(hashmap->shift))) & hashmap->mask) 2859 uint32_t elemdistance;
2862 assert(hashmap !=
NULL);
2865 assert(hashmap->
mask > 0);
2866 assert(hashval != 0);
2868 pos = hashval>>(hashmap->
shift);
2875 if( hashmap->
hashes[pos] == 0 )
2879 hashmap->
hashes[pos] = hashval;
2890 hashmap->
hashes[pos] = hashval;
2901 if( distance < elemdistance )
2907 elemdistance = distance;
2909 hashval = hashmap->
hashes[pos];
2910 hashmap->
hashes[pos] = tmphash;
2918 pos = (pos + 1) & hashmap->
mask;
2934 uint32_t elemdistance;
2936 assert(hashmap !=
NULL);
2939 assert(hashmap->
mask > 0);
2943 assert(hashval != 0);
2945 *pos = hashval>>(hashmap->
shift);
2953 if( hashmap->
hashes[*pos] == 0 )
2958 if( elemdistance > distance )
2965 *pos = (*pos + 1) & hashmap->
mask;
2976 assert(hashmap !=
NULL);
2977 assert(hashmap->
shift < 32);
2980 if( ((((uint64_t)hashmap->
nelements)<<10)>>(32-hashmap->
shift) > 921) )
2989 nslots = hashmap->
mask + 1;
2991 newnslots = 2*nslots;
2992 hashmap->
mask = newnslots-1;
3003 for( i = 0; i < nslots; ++i )
3008 if( hashes[i] != 0 )
3031 assert(hashmap !=
NULL);
3032 assert(mapsize >= 0);
3033 assert(blkmem !=
NULL);
3042 (*hashmap)->shift = 32;
3043 (*hashmap)->shift -= (
unsigned int)ceil(log(
MAX(32, mapsize / 0.9)) / log(2.0));
3044 nslots = 1u << (32 - (*hashmap)->shift);
3045 (*hashmap)->mask = nslots - 1;
3046 (*hashmap)->blkmem = blkmem;
3047 (*hashmap)->nelements = 0;
3063 assert(hashmap !=
NULL);
3064 assert(*hashmap !=
NULL);
3066 nslots = (*hashmap)->mask + 1;
3069 uint32_t maxprobelen = 0;
3070 uint64_t probelensum = 0;
3073 assert(hashmap !=
NULL);
3075 for( i = 0; i < nslots; ++i )
3077 if( (*hashmap)->hashes[i] != 0 )
3079 uint32_t probelen = ((i + (*hashmap)->mask + 1 - ((*hashmap)->hashes[i]>>((*hashmap)->shift))) & (*hashmap)->mask) + 1;
3080 probelensum += probelen;
3081 maxprobelen =
MAX(probelen, maxprobelen);
3086 (
unsigned int)(*hashmap)->nelements, (
unsigned int)(*hashmap)->nelements, (
unsigned int)nslots,
3088 if( (*hashmap)->nelements > 0 )
3089 SCIPdebugPrintf(
", avg. probe length is %.1f, max. probe length is %u",
3090 (
SCIP_Real)(probelensum)/(
SCIP_Real)(*hashmap)->nelements, (
unsigned int)maxprobelen);
3114 assert(hashmap !=
NULL);
3117 assert(hashmap->
mask > 0);
3150 assert(hashmap !=
NULL);
3153 assert(hashmap->
mask > 0);
3186 assert(hashmap !=
NULL);
3189 assert(hashmap->
mask > 0);
3217 assert(hashmap !=
NULL);
3220 assert(hashmap->
mask > 0);
3237 assert(hashmap !=
NULL);
3240 assert(hashmap->
mask > 0);
3257 assert(hashmap !=
NULL);
3260 assert(hashmap->
mask > 0);
3281 assert(hashmap !=
NULL);
3283 assert(hashmap->
mask > 0);
3315 assert(hashmap !=
NULL);
3317 assert(hashmap->
mask > 0);
3349 assert(hashmap !=
NULL);
3351 assert(hashmap->
mask > 0);
3379 assert(hashmap !=
NULL);
3382 assert(hashmap->
mask > 0);
3395 assert(hashmap !=
NULL);
3397 assert(hashmap->
mask > 0);
3399 assert(origin !=
NULL);
3404 hashmap->
hashes[pos] = 0;
3410 uint32_t nextpos = (pos + 1) & hashmap->
mask;
3413 if( hashmap->
hashes[nextpos] == 0 )
3417 if( (hashmap->
hashes[nextpos]>>(hashmap->
shift)) == nextpos )
3424 hashmap->
hashes[nextpos] = 0;
3439 uint32_t maxprobelen = 0;
3440 uint64_t probelensum = 0;
3444 assert(hashmap !=
NULL);
3446 nslots = hashmap->
mask + 1;
3449 for( i = 0; i < nslots; ++i )
3451 if( hashmap->
hashes[i] != 0 )
3454 probelensum += probelen;
3455 maxprobelen =
MAX(probelen, maxprobelen);
3476 assert(hashmap !=
NULL);
3494 return (
int) hashmap->
mask + 1;
3503 assert(hashmap !=
NULL);
3505 return hashmap->
hashes[entryidx] == 0 ?
NULL : &hashmap->
slots[entryidx];
3513 assert(entry !=
NULL);
3523 assert(entry !=
NULL);
3533 assert(entry !=
NULL);
3543 assert(entry !=
NULL);
3554 assert(entry !=
NULL);
3565 assert(entry !=
NULL);
3576 assert(entry !=
NULL);
3586 assert(hashmap !=
NULL);
3601 #undef ELEM_DISTANCE 3603 #define ELEM_DISTANCE(pos) (((pos) + nslots - hashSetDesiredPos(hashset, hashset->slots[(pos)])) & mask) 3612 return (uint32_t)((UINT64_C(0x9e3779b97f4a7c15) * (uintptr_t)element)>>(hashset->
shift));
3621 uint32_t elemdistance;
3626 assert(hashset !=
NULL);
3628 assert(element !=
NULL);
3642 hashset->
slots[pos] = element;
3647 if( hashset->
slots[pos] == element )
3652 if( distance < elemdistance )
3655 elemdistance = distance;
3660 pos = (pos + 1) & mask;
3672 assert(hashset !=
NULL);
3673 assert(hashset->
shift < 64);
3676 if( ((((uint64_t)hashset->
nelements)<<10)>>(64-hashset->
shift) > 921) )
3685 newnslots = 2*nslots;
3695 for( i = 0; i < nslots; ++i )
3697 if( slots[i] !=
NULL )
3717 assert(hashset !=
NULL);
3719 assert(blkmem !=
NULL);
3728 (*hashset)->shift = 64;
3729 (*hashset)->shift -= (
unsigned int)ceil(log(
MAX(8.0, size / 0.9)) / log(2.0));
3731 (*hashset)->nelements = 0;
3755 assert(hashset !=
NULL);
3774 uint32_t elemdistance;
3776 assert(hashset !=
NULL);
3789 if( hashset->
slots[pos] == element )
3798 if( elemdistance > distance )
3801 pos = (pos + 1) & mask;
3815 uint32_t elemdistance;
3817 assert(hashset !=
NULL);
3819 assert(element !=
NULL);
3831 if( hashset->
slots[pos] == element )
3840 if( elemdistance > distance )
3843 pos = (pos + 1) & mask;
3847 assert(hashset->
slots[pos] == element);
3856 uint32_t nextpos = (pos + 1) & mask;
3875 hashset->
slots[pos] = hashset->
slots[nextpos];
3887 uint32_t maxprobelen = 0;
3888 uint64_t probelensum = 0;
3893 assert(hashset !=
NULL);
3899 for( i = 0; i < nslots; ++i )
3904 probelensum += probelen;
3905 maxprobelen =
MAX(probelen, maxprobelen);
3927 #undef SCIPhashsetIsEmpty 3928 #undef SCIPhashsetGetNElements 3929 #undef SCIPhashsetGetNSlots 3930 #undef SCIPhashsetGetSlots 3953 return (
int) (1u << (64 - hashset->
shift));
3961 return hashset->
slots;
3984 assert(realarray !=
NULL);
3985 assert(blkmem !=
NULL);
3988 (*realarray)->blkmem = blkmem;
3989 (*realarray)->vals =
NULL;
3990 (*realarray)->valssize = 0;
3991 (*realarray)->firstidx = -1;
3992 (*realarray)->minusedidx = INT_MAX;
3993 (*realarray)->maxusedidx = INT_MIN;
4005 assert(realarray !=
NULL);
4006 assert(sourcerealarray !=
NULL);
4009 if( sourcerealarray->
valssize > 0 )
4014 (*realarray)->valssize = sourcerealarray->
valssize;
4015 (*realarray)->firstidx = sourcerealarray->
firstidx;
4016 (*realarray)->minusedidx = sourcerealarray->
minusedidx;
4017 (*realarray)->maxusedidx = sourcerealarray->
maxusedidx;
4027 assert(realarray !=
NULL);
4028 assert(*realarray !=
NULL);
4050 assert(realarray !=
NULL);
4055 assert(0 <= minidx);
4056 assert(minidx <= maxidx);
4060 assert(0 <= minidx);
4061 assert(minidx <= maxidx);
4063 SCIPdebugMessage(
"extending realarray %p (firstidx=%d, size=%d, range=[%d,%d]) to range [%d,%d]\n",
4064 (
void*)realarray, realarray->
firstidx, realarray->valssize, realarray->minusedidx, realarray->maxusedidx, minidx, maxidx);
4067 nused = maxidx - minidx + 1;
4068 if( nused > realarray->valssize )
4074 newvalssize =
calcGrowSize(arraygrowinit, arraygrowfac, nused);
4076 nfree = newvalssize - nused;
4077 newfirstidx = minidx - nfree/2;
4078 newfirstidx =
MAX(newfirstidx, 0);
4079 assert(newfirstidx <= minidx);
4080 assert(maxidx < newfirstidx + newvalssize);
4083 if( realarray->firstidx != -1 )
4085 for( i = 0; i < realarray->minusedidx - newfirstidx; ++i )
4089 assert(realarray->maxusedidx - realarray->minusedidx + 1 > 0);
4092 &(realarray->vals[realarray->minusedidx - realarray->firstidx]),
4093 realarray->maxusedidx - realarray->minusedidx + 1);
4094 for( i = realarray->maxusedidx - newfirstidx + 1; i < newvalssize; ++i )
4099 for( i = 0; i < newvalssize; ++i )
4105 realarray->vals = newvals;
4106 realarray->valssize = newvalssize;
4107 realarray->firstidx = newfirstidx;
4109 else if( realarray->firstidx == -1 )
4112 nfree = realarray->valssize - nused;
4114 realarray->firstidx = minidx - nfree/2;
4115 assert(realarray->firstidx <= minidx);
4116 assert(maxidx < realarray->firstidx + realarray->valssize);
4118 for( i = 0; i < realarray->valssize; ++i )
4119 assert(realarray->vals[i] == 0.0);
4122 else if( minidx < realarray->firstidx )
4125 nfree = realarray->valssize - nused;
4127 newfirstidx = minidx - nfree/2;
4128 newfirstidx =
MAX(newfirstidx, 0);
4129 assert(newfirstidx <= minidx);
4130 assert(maxidx < newfirstidx + realarray->valssize);
4132 if( realarray->minusedidx <= realarray->maxusedidx )
4136 assert(realarray->firstidx <= realarray->minusedidx);
4137 assert(realarray->maxusedidx < realarray->firstidx + realarray->valssize);
4140 shift = realarray->firstidx - newfirstidx;
4142 for( i = realarray->maxusedidx - realarray->firstidx; i >= realarray->minusedidx - realarray->firstidx; --i )
4144 assert(0 <= i + shift && i + shift < realarray->valssize);
4145 realarray->vals[i + shift] = realarray->vals[i];
4148 for( i = 0; i < shift; ++i )
4149 realarray->vals[realarray->minusedidx - realarray->firstidx + i] = 0.0;
4151 realarray->firstidx = newfirstidx;
4153 else if( maxidx >= realarray->firstidx + realarray->valssize )
4156 nfree = realarray->valssize - nused;
4158 newfirstidx = minidx - nfree/2;
4159 newfirstidx =
MAX(newfirstidx, 0);
4160 assert(newfirstidx <= minidx);
4161 assert(maxidx < newfirstidx + realarray->valssize);
4163 if( realarray->minusedidx <= realarray->maxusedidx )
4167 assert(realarray->firstidx <= realarray->minusedidx);
4168 assert(realarray->maxusedidx < realarray->firstidx + realarray->valssize);
4171 shift = newfirstidx - realarray->firstidx;
4173 for( i = realarray->minusedidx - realarray->firstidx; i <= realarray->maxusedidx - realarray->firstidx; ++i )
4175 assert(0 <= i - shift && i - shift < realarray->valssize);
4176 realarray->vals[i - shift] = realarray->vals[i];
4179 for( i = 0; i < shift; ++i )
4180 realarray->vals[realarray->maxusedidx - realarray->firstidx - i] = 0.0;
4182 realarray->firstidx = newfirstidx;
4185 assert(minidx >= realarray->firstidx);
4186 assert(maxidx < realarray->firstidx + realarray->valssize);
4196 assert(realarray !=
NULL);
4198 SCIPdebugMessage(
"clearing realarray %p (firstidx=%d, size=%d, range=[%d,%d])\n",
4199 (
void*)realarray, realarray->
firstidx, realarray->valssize, realarray->minusedidx, realarray->maxusedidx);
4201 if( realarray->minusedidx <= realarray->maxusedidx )
4203 assert(realarray->firstidx <= realarray->minusedidx);
4204 assert(realarray->maxusedidx < realarray->firstidx + realarray->valssize);
4205 assert(realarray->firstidx != -1);
4206 assert(realarray->valssize > 0);
4210 realarray->maxusedidx - realarray->minusedidx + 1);
4213 realarray->minusedidx = INT_MAX;
4214 realarray->maxusedidx = INT_MIN;
4216 assert(realarray->minusedidx == INT_MAX);
4217 assert(realarray->maxusedidx == INT_MIN);
4228 assert(realarray !=
NULL);
4231 if( idx < realarray->minusedidx || idx > realarray->
maxusedidx )
4236 assert(idx - realarray->
firstidx >= 0);
4252 assert(realarray !=
NULL);
4255 SCIPdebugMessage(
"setting realarray %p (firstidx=%d, size=%d, range=[%d,%d]) index %d to %g\n",
4256 (
void*)realarray, realarray->
firstidx, realarray->valssize, realarray->minusedidx, realarray->maxusedidx, idx, val);
4262 assert(idx >= realarray->firstidx);
4263 assert(idx < realarray->firstidx + realarray->valssize);
4266 realarray->vals[idx - realarray->firstidx] = val;
4269 realarray->minusedidx = MIN(realarray->minusedidx, idx);
4270 realarray->maxusedidx =
MAX(realarray->maxusedidx, idx);
4272 else if( idx >= realarray->firstidx && idx < realarray->firstidx + realarray->valssize )
4275 realarray->vals[idx - realarray->firstidx] = 0.0;
4278 if( idx == realarray->minusedidx )
4280 assert(realarray->maxusedidx >= 0);
4281 assert(realarray->maxusedidx < realarray->firstidx + realarray->valssize);
4284 realarray->minusedidx++;
4286 while( realarray->minusedidx <= realarray->maxusedidx
4287 && realarray->vals[realarray->minusedidx - realarray->firstidx] == 0.0 );
4289 if( realarray->minusedidx > realarray->maxusedidx )
4291 realarray->minusedidx = INT_MAX;
4292 realarray->maxusedidx = INT_MIN;
4295 else if( idx == realarray->maxusedidx )
4297 assert(realarray->minusedidx >= 0);
4298 assert(realarray->minusedidx < realarray->maxusedidx);
4299 assert(realarray->maxusedidx < realarray->firstidx + realarray->valssize);
4302 realarray->maxusedidx--;
4303 assert(realarray->minusedidx <= realarray->maxusedidx);
4305 while( realarray->vals[realarray->maxusedidx - realarray->firstidx] == 0.0 );
4335 assert(realarray !=
NULL);
4345 assert(realarray !=
NULL);
4356 assert(intarray !=
NULL);
4357 assert(blkmem !=
NULL);
4360 (*intarray)->blkmem = blkmem;
4361 (*intarray)->vals =
NULL;
4362 (*intarray)->valssize = 0;
4363 (*intarray)->firstidx = -1;
4364 (*intarray)->minusedidx = INT_MAX;
4365 (*intarray)->maxusedidx = INT_MIN;
4377 assert(intarray !=
NULL);
4378 assert(sourceintarray !=
NULL);
4385 (*intarray)->valssize = sourceintarray->
valssize;
4386 (*intarray)->firstidx = sourceintarray->
firstidx;
4387 (*intarray)->minusedidx = sourceintarray->
minusedidx;
4388 (*intarray)->maxusedidx = sourceintarray->
maxusedidx;
4398 assert(intarray !=
NULL);
4399 assert(*intarray !=
NULL);
4421 assert(intarray !=
NULL);
4426 assert(0 <= minidx);
4427 assert(minidx <= maxidx);
4431 assert(0 <= minidx);
4432 assert(minidx <= maxidx);
4434 SCIPdebugMessage(
"extending intarray %p (firstidx=%d, size=%d, range=[%d,%d]) to range [%d,%d]\n",
4435 (
void*)intarray, intarray->
firstidx, intarray->valssize, intarray->minusedidx, intarray->maxusedidx, minidx, maxidx);
4438 nused = maxidx - minidx + 1;
4439 if( nused > intarray->valssize )
4445 newvalssize =
calcGrowSize(arraygrowinit, arraygrowfac, nused);
4447 nfree = newvalssize - nused;
4448 newfirstidx = minidx - nfree/2;
4449 newfirstidx =
MAX(newfirstidx, 0);
4450 assert(newfirstidx <= minidx);
4451 assert(maxidx < newfirstidx + newvalssize);
4454 if( intarray->firstidx != -1 )
4456 for( i = 0; i < intarray->minusedidx - newfirstidx; ++i )
4460 assert(intarray->maxusedidx - intarray->minusedidx + 1 > 0);
4463 &intarray->vals[intarray->minusedidx - intarray->firstidx],
4464 intarray->maxusedidx - intarray->minusedidx + 1);
4465 for( i = intarray->maxusedidx - newfirstidx + 1; i < newvalssize; ++i )
4470 for( i = 0; i < newvalssize; ++i )
4476 intarray->vals = newvals;
4477 intarray->valssize = newvalssize;
4478 intarray->firstidx = newfirstidx;
4480 else if( intarray->firstidx == -1 )
4483 nfree = intarray->valssize - nused;
4485 intarray->firstidx = minidx - nfree/2;
4486 assert(intarray->firstidx <= minidx);
4487 assert(maxidx < intarray->firstidx + intarray->valssize);
4489 for( i = 0; i < intarray->valssize; ++i )
4490 assert(intarray->vals[i] == 0);
4493 else if( minidx < intarray->firstidx )
4496 nfree = intarray->valssize - nused;
4498 newfirstidx = minidx - nfree/2;
4499 newfirstidx =
MAX(newfirstidx, 0);
4500 assert(newfirstidx <= minidx);
4501 assert(maxidx < newfirstidx + intarray->valssize);
4503 if( intarray->minusedidx <= intarray->maxusedidx )
4507 assert(intarray->firstidx <= intarray->minusedidx);
4508 assert(intarray->maxusedidx < intarray->firstidx + intarray->valssize);
4511 shift = intarray->firstidx - newfirstidx;
4513 for( i = intarray->maxusedidx - intarray->firstidx; i >= intarray->minusedidx - intarray->firstidx; --i )
4515 assert(0 <= i + shift && i + shift < intarray->valssize);
4516 intarray->vals[i + shift] = intarray->vals[i];
4519 for( i = 0; i < shift; ++i )
4520 intarray->vals[intarray->minusedidx - intarray->firstidx + i] = 0;
4522 intarray->firstidx = newfirstidx;
4524 else if( maxidx >= intarray->firstidx + intarray->valssize )
4527 nfree = intarray->valssize - nused;
4529 newfirstidx = minidx - nfree/2;
4530 newfirstidx =
MAX(newfirstidx, 0);
4531 assert(newfirstidx <= minidx);
4532 assert(maxidx < newfirstidx + intarray->valssize);
4534 if( intarray->minusedidx <= intarray->maxusedidx )
4538 assert(intarray->firstidx <= intarray->minusedidx);
4539 assert(intarray->maxusedidx < intarray->firstidx + intarray->valssize);
4542 shift = newfirstidx - intarray->firstidx;
4544 for( i = intarray->minusedidx - intarray->firstidx; i <= intarray->maxusedidx - intarray->firstidx; ++i )
4546 assert(0 <= i - shift && i - shift < intarray->valssize);
4547 intarray->vals[i - shift] = intarray->vals[i];
4550 for( i = 0; i < shift; ++i )
4551 intarray->vals[intarray->maxusedidx - intarray->firstidx - i] = 0;
4553 intarray->firstidx = newfirstidx;
4556 assert(minidx >= intarray->firstidx);
4557 assert(maxidx < intarray->firstidx + intarray->valssize);
4567 assert(intarray !=
NULL);
4569 SCIPdebugMessage(
"clearing intarray %p (firstidx=%d, size=%d, range=[%d,%d])\n",
4570 (
void*)intarray, intarray->
firstidx, intarray->valssize, intarray->minusedidx, intarray->maxusedidx);
4572 if( intarray->minusedidx <= intarray->maxusedidx )
4574 assert(intarray->firstidx <= intarray->minusedidx);
4575 assert(intarray->maxusedidx < intarray->firstidx + intarray->valssize);
4576 assert(intarray->firstidx != -1);
4577 assert(intarray->valssize > 0);
4581 intarray->maxusedidx - intarray->minusedidx + 1);
4584 intarray->minusedidx = INT_MAX;
4585 intarray->maxusedidx = INT_MIN;
4587 assert(intarray->minusedidx == INT_MAX);
4588 assert(intarray->maxusedidx == INT_MIN);
4599 assert(intarray !=
NULL);
4602 if( idx < intarray->minusedidx || idx > intarray->
maxusedidx )
4607 assert(idx - intarray->
firstidx >= 0);
4623 assert(intarray !=
NULL);
4626 SCIPdebugMessage(
"setting intarray %p (firstidx=%d, size=%d, range=[%d,%d]) index %d to %d\n",
4627 (
void*)intarray, intarray->
firstidx, intarray->valssize, intarray->minusedidx, intarray->maxusedidx, idx, val);
4633 assert(idx >= intarray->firstidx);
4634 assert(idx < intarray->firstidx + intarray->valssize);
4637 intarray->vals[idx - intarray->firstidx] = val;
4640 intarray->minusedidx = MIN(intarray->minusedidx, idx);
4641 intarray->maxusedidx =
MAX(intarray->maxusedidx, idx);
4643 else if( idx >= intarray->firstidx && idx < intarray->firstidx + intarray->valssize )
4646 intarray->vals[idx - intarray->firstidx] = 0;
4649 if( idx == intarray->minusedidx )
4651 assert(intarray->maxusedidx >= 0);
4652 assert(intarray->maxusedidx < intarray->firstidx + intarray->valssize);
4655 intarray->minusedidx++;
4657 while( intarray->minusedidx <= intarray->maxusedidx
4658 && intarray->vals[intarray->minusedidx - intarray->firstidx] == 0 );
4659 if( intarray->minusedidx > intarray->maxusedidx )
4661 intarray->minusedidx = INT_MAX;
4662 intarray->maxusedidx = INT_MIN;
4665 else if( idx == intarray->maxusedidx )
4667 assert(intarray->minusedidx >= 0);
4668 assert(intarray->minusedidx < intarray->maxusedidx);
4669 assert(intarray->maxusedidx < intarray->firstidx + intarray->valssize);
4672 intarray->maxusedidx--;
4673 assert(intarray->minusedidx <= intarray->maxusedidx);
4675 while( intarray->vals[intarray->maxusedidx - intarray->firstidx] == 0 );
4699 assert(intarray !=
NULL);
4709 assert(intarray !=
NULL);
4721 assert(boolarray !=
NULL);
4722 assert(blkmem !=
NULL);
4725 (*boolarray)->blkmem = blkmem;
4726 (*boolarray)->vals =
NULL;
4727 (*boolarray)->valssize = 0;
4728 (*boolarray)->firstidx = -1;
4729 (*boolarray)->minusedidx = INT_MAX;
4730 (*boolarray)->maxusedidx = INT_MIN;
4742 assert(boolarray !=
NULL);
4743 assert(sourceboolarray !=
NULL);
4746 if( sourceboolarray->
valssize > 0 )
4751 (*boolarray)->valssize = sourceboolarray->
valssize;
4752 (*boolarray)->firstidx = sourceboolarray->
firstidx;
4753 (*boolarray)->minusedidx = sourceboolarray->
minusedidx;
4754 (*boolarray)->maxusedidx = sourceboolarray->
maxusedidx;
4764 assert(boolarray !=
NULL);
4765 assert(*boolarray !=
NULL);
4787 assert(boolarray !=
NULL);
4792 assert(0 <= minidx);
4793 assert(minidx <= maxidx);
4797 assert(0 <= minidx);
4798 assert(minidx <= maxidx);
4800 SCIPdebugMessage(
"extending boolarray %p (firstidx=%d, size=%d, range=[%d,%d]) to range [%d,%d]\n",
4801 (
void*)boolarray, boolarray->
firstidx, boolarray->valssize, boolarray->minusedidx, boolarray->maxusedidx, minidx, maxidx);
4804 nused = maxidx - minidx + 1;
4805 if( nused > boolarray->valssize )
4811 newvalssize =
calcGrowSize(arraygrowinit, arraygrowfac, nused);
4813 nfree = newvalssize - nused;
4814 newfirstidx = minidx - nfree/2;
4815 newfirstidx =
MAX(newfirstidx, 0);
4816 assert(newfirstidx <= minidx);
4817 assert(maxidx < newfirstidx + newvalssize);
4820 if( boolarray->firstidx != -1 )
4822 for( i = 0; i < boolarray->minusedidx - newfirstidx; ++i )
4826 assert(boolarray->maxusedidx - boolarray->minusedidx + 1 > 0);
4829 &boolarray->vals[boolarray->minusedidx - boolarray->firstidx],
4830 boolarray->maxusedidx - boolarray->minusedidx + 1);
4831 for( i = boolarray->maxusedidx - newfirstidx + 1; i < newvalssize; ++i )
4836 for( i = 0; i < newvalssize; ++i )
4842 boolarray->vals = newvals;
4843 boolarray->valssize = newvalssize;
4844 boolarray->firstidx = newfirstidx;
4846 else if( boolarray->firstidx == -1 )
4849 nfree = boolarray->valssize - nused;
4851 boolarray->firstidx = minidx - nfree/2;
4852 assert(boolarray->firstidx <= minidx);
4853 assert(maxidx < boolarray->firstidx + boolarray->valssize);
4855 for( i = 0; i < boolarray->valssize; ++i )
4856 assert(boolarray->vals[i] ==
FALSE);
4859 else if( minidx < boolarray->firstidx )
4862 nfree = boolarray->valssize - nused;
4864 newfirstidx = minidx - nfree/2;
4865 newfirstidx =
MAX(newfirstidx, 0);
4866 assert(newfirstidx <= minidx);
4867 assert(maxidx < newfirstidx + boolarray->valssize);
4869 if( boolarray->minusedidx <= boolarray->maxusedidx )
4873 assert(boolarray->firstidx <= boolarray->minusedidx);
4874 assert(boolarray->maxusedidx < boolarray->firstidx + boolarray->valssize);
4877 shift = boolarray->firstidx - newfirstidx;
4879 for( i = boolarray->maxusedidx - boolarray->firstidx; i >= boolarray->minusedidx - boolarray->firstidx; --i )
4881 assert(0 <= i + shift && i + shift < boolarray->valssize);
4882 boolarray->vals[i + shift] = boolarray->vals[i];
4885 for( i = 0; i < shift; ++i )
4886 boolarray->vals[boolarray->minusedidx - boolarray->firstidx + i] =
FALSE;
4888 boolarray->firstidx = newfirstidx;
4890 else if( maxidx >= boolarray->firstidx + boolarray->valssize )
4893 nfree = boolarray->valssize - nused;
4895 newfirstidx = minidx - nfree/2;
4896 newfirstidx =
MAX(newfirstidx, 0);
4897 assert(newfirstidx <= minidx);
4898 assert(maxidx < newfirstidx + boolarray->valssize);
4900 if( boolarray->minusedidx <= boolarray->maxusedidx )
4904 assert(boolarray->firstidx <= boolarray->minusedidx);
4905 assert(boolarray->maxusedidx < boolarray->firstidx + boolarray->valssize);
4908 shift = newfirstidx - boolarray->firstidx;
4911 assert(0 <= boolarray->minusedidx - boolarray->firstidx - shift);
4912 assert(boolarray->maxusedidx - boolarray->firstidx - shift < boolarray->valssize);
4913 BMSmoveMemoryArray(&(boolarray->vals[boolarray->minusedidx - boolarray->firstidx - shift]),
4914 &(boolarray->vals[boolarray->minusedidx - boolarray->firstidx]),
4915 boolarray->maxusedidx - boolarray->minusedidx + 1);
4918 for( i = 0; i < shift; ++i )
4919 boolarray->vals[boolarray->maxusedidx - boolarray->firstidx - i] =
FALSE;
4921 boolarray->firstidx = newfirstidx;
4924 assert(minidx >= boolarray->firstidx);
4925 assert(maxidx < boolarray->firstidx + boolarray->valssize);
4935 assert(boolarray !=
NULL);
4937 SCIPdebugMessage(
"clearing boolarray %p (firstidx=%d, size=%d, range=[%d,%d])\n",
4938 (
void*)boolarray, boolarray->
firstidx, boolarray->valssize, boolarray->minusedidx, boolarray->maxusedidx);
4940 if( boolarray->minusedidx <= boolarray->maxusedidx )
4942 assert(boolarray->firstidx <= boolarray->minusedidx);
4943 assert(boolarray->maxusedidx < boolarray->firstidx + boolarray->valssize);
4944 assert(boolarray->firstidx != -1);
4945 assert(boolarray->valssize > 0);
4949 boolarray->maxusedidx - boolarray->minusedidx + 1);
4952 boolarray->minusedidx = INT_MAX;
4953 boolarray->maxusedidx = INT_MIN;
4955 assert(boolarray->minusedidx == INT_MAX);
4956 assert(boolarray->maxusedidx == INT_MIN);
4967 assert(boolarray !=
NULL);
4970 if( idx < boolarray->minusedidx || idx > boolarray->
maxusedidx )
4975 assert(idx - boolarray->
firstidx >= 0);
4991 assert(boolarray !=
NULL);
4994 SCIPdebugMessage(
"setting boolarray %p (firstidx=%d, size=%d, range=[%d,%d]) index %d to %u\n",
4995 (
void*)boolarray, boolarray->
firstidx, boolarray->valssize, boolarray->minusedidx, boolarray->maxusedidx, idx, val);
5001 assert(idx >= boolarray->firstidx);
5002 assert(idx < boolarray->firstidx + boolarray->valssize);
5005 boolarray->vals[idx - boolarray->firstidx] = val;
5008 boolarray->minusedidx = MIN(boolarray->minusedidx, idx);
5009 boolarray->maxusedidx =
MAX(boolarray->maxusedidx, idx);
5011 else if( idx >= boolarray->firstidx && idx < boolarray->firstidx + boolarray->valssize )
5014 boolarray->vals[idx - boolarray->firstidx] =
FALSE;
5017 if( idx == boolarray->minusedidx )
5019 assert(boolarray->maxusedidx >= 0);
5020 assert(boolarray->maxusedidx < boolarray->firstidx + boolarray->valssize);
5023 boolarray->minusedidx++;
5025 while( boolarray->minusedidx <= boolarray->maxusedidx
5026 && boolarray->vals[boolarray->minusedidx - boolarray->firstidx] ==
FALSE );
5027 if( boolarray->minusedidx > boolarray->maxusedidx )
5029 boolarray->minusedidx = INT_MAX;
5030 boolarray->maxusedidx = INT_MIN;
5033 else if( idx == boolarray->maxusedidx )
5035 assert(boolarray->minusedidx >= 0);
5036 assert(boolarray->minusedidx < boolarray->maxusedidx);
5037 assert(boolarray->maxusedidx < boolarray->firstidx + boolarray->valssize);
5040 boolarray->maxusedidx--;
5041 assert(boolarray->minusedidx <= boolarray->maxusedidx);
5043 while( boolarray->vals[boolarray->maxusedidx - boolarray->firstidx] ==
FALSE );
5055 assert(boolarray !=
NULL);
5065 assert(boolarray !=
NULL);
5077 assert(ptrarray !=
NULL);
5078 assert(blkmem !=
NULL);
5081 (*ptrarray)->blkmem = blkmem;
5082 (*ptrarray)->vals =
NULL;
5083 (*ptrarray)->valssize = 0;
5084 (*ptrarray)->firstidx = -1;
5085 (*ptrarray)->minusedidx = INT_MAX;
5086 (*ptrarray)->maxusedidx = INT_MIN;
5098 assert(ptrarray !=
NULL);
5099 assert(sourceptrarray !=
NULL);
5106 (*ptrarray)->valssize = sourceptrarray->
valssize;
5107 (*ptrarray)->firstidx = sourceptrarray->
firstidx;
5108 (*ptrarray)->minusedidx = sourceptrarray->
minusedidx;
5109 (*ptrarray)->maxusedidx = sourceptrarray->
maxusedidx;
5119 assert(ptrarray !=
NULL);
5120 assert(*ptrarray !=
NULL);
5142 assert(ptrarray !=
NULL);
5147 assert(0 <= minidx);
5148 assert(minidx <= maxidx);
5152 assert(0 <= minidx);
5153 assert(minidx <= maxidx);
5155 SCIPdebugMessage(
"extending ptrarray %p (firstidx=%d, size=%d, range=[%d,%d]) to range [%d,%d]\n",
5156 (
void*)ptrarray, ptrarray->
firstidx, ptrarray->valssize, ptrarray->minusedidx, ptrarray->maxusedidx, minidx, maxidx);
5159 nused = maxidx - minidx + 1;
5160 if( nused > ptrarray->valssize )
5166 newvalssize =
calcGrowSize(arraygrowinit, arraygrowfac, nused);
5168 nfree = newvalssize - nused;
5169 newfirstidx = minidx - nfree/2;
5170 newfirstidx =
MAX(newfirstidx, 0);
5171 assert(newfirstidx <= minidx);
5172 assert(maxidx < newfirstidx + newvalssize);
5175 if( ptrarray->firstidx != -1 )
5177 for( i = 0; i < ptrarray->minusedidx - newfirstidx; ++i )
5181 assert(ptrarray->maxusedidx - ptrarray->minusedidx + 1 > 0);
5184 &(ptrarray->vals[ptrarray->minusedidx - ptrarray->firstidx]),
5185 ptrarray->maxusedidx - ptrarray->minusedidx + 1);
5186 for( i = ptrarray->maxusedidx - newfirstidx + 1; i < newvalssize; ++i )
5191 for( i = 0; i < newvalssize; ++i )
5197 ptrarray->vals = newvals;
5198 ptrarray->valssize = newvalssize;
5199 ptrarray->firstidx = newfirstidx;
5201 else if( ptrarray->firstidx == -1 )
5204 nfree = ptrarray->valssize - nused;
5206 ptrarray->firstidx = minidx - nfree/2;
5207 assert(ptrarray->firstidx <= minidx);
5208 assert(maxidx < ptrarray->firstidx + ptrarray->valssize);
5210 for( i = 0; i < ptrarray->valssize; ++i )
5211 assert(ptrarray->vals[i] ==
NULL);
5214 else if( minidx < ptrarray->firstidx )
5217 nfree = ptrarray->valssize - nused;
5219 newfirstidx = minidx - nfree/2;
5220 newfirstidx =
MAX(newfirstidx, 0);
5221 assert(newfirstidx <= minidx);
5222 assert(maxidx < newfirstidx + ptrarray->valssize);
5224 if( ptrarray->minusedidx <= ptrarray->maxusedidx )
5228 assert(ptrarray->firstidx <= ptrarray->minusedidx);
5229 assert(ptrarray->maxusedidx < ptrarray->firstidx + ptrarray->valssize);
5232 shift = ptrarray->firstidx - newfirstidx;
5234 for( i = ptrarray->maxusedidx - ptrarray->firstidx; i >= ptrarray->minusedidx - ptrarray->firstidx; --i )
5236 assert(0 <= i + shift && i + shift < ptrarray->valssize);
5237 ptrarray->vals[i + shift] = ptrarray->vals[i];
5240 for( i = 0; i < shift; ++i )
5241 ptrarray->vals[ptrarray->minusedidx - ptrarray->firstidx + i] =
NULL;
5243 ptrarray->firstidx = newfirstidx;
5245 else if( maxidx >= ptrarray->firstidx + ptrarray->valssize )
5248 nfree = ptrarray->valssize - nused;
5250 newfirstidx = minidx - nfree/2;
5251 newfirstidx =
MAX(newfirstidx, 0);
5252 assert(newfirstidx <= minidx);
5253 assert(maxidx < newfirstidx + ptrarray->valssize);
5255 if( ptrarray->minusedidx <= ptrarray->maxusedidx )
5259 assert(ptrarray->firstidx <= ptrarray->minusedidx);
5260 assert(ptrarray->maxusedidx < ptrarray->firstidx + ptrarray->valssize);
5263 shift = newfirstidx - ptrarray->firstidx;
5265 for( i = ptrarray->minusedidx - ptrarray->firstidx; i <= ptrarray->maxusedidx - ptrarray->firstidx; ++i )
5267 assert(0 <= i - shift && i - shift < ptrarray->valssize);
5268 ptrarray->vals[i - shift] = ptrarray->vals[i];
5271 for( i = 0; i < shift; ++i )
5272 ptrarray->vals[ptrarray->maxusedidx - ptrarray->firstidx - i] =
NULL;
5274 ptrarray->firstidx = newfirstidx;
5277 assert(minidx >= ptrarray->firstidx);
5278 assert(maxidx < ptrarray->firstidx + ptrarray->valssize);
5288 assert(ptrarray !=
NULL);
5290 SCIPdebugMessage(
"clearing ptrarray %p (firstidx=%d, size=%d, range=[%d,%d])\n",
5291 (
void*)ptrarray, ptrarray->
firstidx, ptrarray->valssize, ptrarray->minusedidx, ptrarray->maxusedidx);
5293 if( ptrarray->minusedidx <= ptrarray->maxusedidx )
5295 assert(ptrarray->firstidx <= ptrarray->minusedidx);
5296 assert(ptrarray->maxusedidx < ptrarray->firstidx + ptrarray->valssize);
5297 assert(ptrarray->firstidx != -1);
5298 assert(ptrarray->valssize > 0);
5302 ptrarray->maxusedidx - ptrarray->minusedidx + 1);
5305 ptrarray->minusedidx = INT_MAX;
5306 ptrarray->maxusedidx = INT_MIN;
5308 assert(ptrarray->minusedidx == INT_MAX);
5309 assert(ptrarray->maxusedidx == INT_MIN);
5320 assert(ptrarray !=
NULL);
5323 if( idx < ptrarray->minusedidx || idx > ptrarray->
maxusedidx )
5328 assert(idx - ptrarray->
firstidx >= 0);
5344 assert(ptrarray !=
NULL);
5347 SCIPdebugMessage(
"setting ptrarray %p (firstidx=%d, size=%d, range=[%d,%d]) index %d to %p\n",
5348 (
void*)ptrarray, ptrarray->
firstidx, ptrarray->valssize, ptrarray->minusedidx, ptrarray->maxusedidx, idx, val);
5354 assert(idx >= ptrarray->firstidx);
5355 assert(idx < ptrarray->firstidx + ptrarray->valssize);
5358 ptrarray->vals[idx - ptrarray->firstidx] = val;
5361 ptrarray->minusedidx = MIN(ptrarray->minusedidx, idx);
5362 ptrarray->maxusedidx =
MAX(ptrarray->maxusedidx, idx);
5364 else if( idx >= ptrarray->firstidx && idx < ptrarray->firstidx + ptrarray->valssize )
5367 ptrarray->vals[idx - ptrarray->firstidx] =
NULL;
5370 if( idx == ptrarray->minusedidx )
5372 assert(ptrarray->maxusedidx >= 0);
5373 assert(ptrarray->maxusedidx < ptrarray->firstidx + ptrarray->valssize);
5376 ptrarray->minusedidx++;
5378 while( ptrarray->minusedidx <= ptrarray->maxusedidx
5379 && ptrarray->vals[ptrarray->minusedidx - ptrarray->firstidx] ==
NULL );
5380 if( ptrarray->minusedidx > ptrarray->maxusedidx )
5382 ptrarray->minusedidx = INT_MAX;
5383 ptrarray->maxusedidx = INT_MIN;
5386 else if( idx == ptrarray->maxusedidx )
5388 assert(ptrarray->minusedidx >= 0);
5389 assert(ptrarray->minusedidx < ptrarray->maxusedidx);
5390 assert(ptrarray->maxusedidx < ptrarray->firstidx + ptrarray->valssize);
5393 ptrarray->maxusedidx--;
5394 assert(ptrarray->minusedidx <= ptrarray->maxusedidx);
5396 while( ptrarray->vals[ptrarray->maxusedidx - ptrarray->firstidx] ==
NULL );
5408 assert(ptrarray !=
NULL);
5418 assert(ptrarray !=
NULL);
5434 value1 = (int)(
size_t)elem1;
5435 value2 = (int)(
size_t)elem2;
5437 if( value1 < value2 )
5440 if( value2 < value1 )
5458 assert(indcomp !=
NULL);
5459 assert(len == 0 || perm !=
NULL);
5462 for( pos = 0; pos < len; ++pos )
5469 #define SORTTPL_NAMEEXT Ind 5470 #define SORTTPL_KEYTYPE int 5471 #define SORTTPL_INDCOMP 5476 #define SORTTPL_NAMEEXT Ptr 5477 #define SORTTPL_KEYTYPE void* 5478 #define SORTTPL_PTRCOMP 5483 #define SORTTPL_NAMEEXT PtrPtr 5484 #define SORTTPL_KEYTYPE void* 5485 #define SORTTPL_FIELD1TYPE void* 5486 #define SORTTPL_PTRCOMP 5491 #define SORTTPL_NAMEEXT PtrReal 5492 #define SORTTPL_KEYTYPE void* 5493 #define SORTTPL_FIELD1TYPE SCIP_Real 5494 #define SORTTPL_PTRCOMP 5499 #define SORTTPL_NAMEEXT PtrInt 5500 #define SORTTPL_KEYTYPE void* 5501 #define SORTTPL_FIELD1TYPE int 5502 #define SORTTPL_PTRCOMP 5507 #define SORTTPL_NAMEEXT PtrBool 5508 #define SORTTPL_KEYTYPE void* 5509 #define SORTTPL_FIELD1TYPE SCIP_Bool 5510 #define SORTTPL_PTRCOMP 5515 #define SORTTPL_NAMEEXT PtrIntInt 5516 #define SORTTPL_KEYTYPE void* 5517 #define SORTTPL_FIELD1TYPE int 5518 #define SORTTPL_FIELD2TYPE int 5519 #define SORTTPL_PTRCOMP 5524 #define SORTTPL_NAMEEXT PtrRealInt 5525 #define SORTTPL_KEYTYPE void* 5526 #define SORTTPL_FIELD1TYPE SCIP_Real 5527 #define SORTTPL_FIELD2TYPE int 5528 #define SORTTPL_PTRCOMP 5532 #define SORTTPL_NAMEEXT PtrRealRealInt 5533 #define SORTTPL_KEYTYPE void* 5534 #define SORTTPL_FIELD1TYPE SCIP_Real 5535 #define SORTTPL_FIELD2TYPE SCIP_Real 5536 #define SORTTPL_FIELD3TYPE int 5537 #define SORTTPL_PTRCOMP 5541 #define SORTTPL_NAMEEXT PtrRealRealBoolBool 5542 #define SORTTPL_KEYTYPE void* 5543 #define SORTTPL_FIELD1TYPE SCIP_Real 5544 #define SORTTPL_FIELD2TYPE SCIP_Real 5545 #define SORTTPL_FIELD3TYPE SCIP_Bool 5546 #define SORTTPL_FIELD4TYPE SCIP_Bool 5547 #define SORTTPL_PTRCOMP 5551 #define SORTTPL_NAMEEXT PtrRealRealIntBool 5552 #define SORTTPL_KEYTYPE void* 5553 #define SORTTPL_FIELD1TYPE SCIP_Real 5554 #define SORTTPL_FIELD2TYPE SCIP_Real 5555 #define SORTTPL_FIELD3TYPE int 5556 #define SORTTPL_FIELD4TYPE SCIP_Bool 5557 #define SORTTPL_PTRCOMP 5561 #define SORTTPL_NAMEEXT PtrRealBool 5562 #define SORTTPL_KEYTYPE void* 5563 #define SORTTPL_FIELD1TYPE SCIP_Real 5564 #define SORTTPL_FIELD2TYPE SCIP_Bool 5565 #define SORTTPL_PTRCOMP 5570 #define SORTTPL_NAMEEXT PtrPtrInt 5571 #define SORTTPL_KEYTYPE void* 5572 #define SORTTPL_FIELD1TYPE void* 5573 #define SORTTPL_FIELD2TYPE int 5574 #define SORTTPL_PTRCOMP 5579 #define SORTTPL_NAMEEXT PtrPtrReal 5580 #define SORTTPL_KEYTYPE void* 5581 #define SORTTPL_FIELD1TYPE void* 5582 #define SORTTPL_FIELD2TYPE SCIP_Real 5583 #define SORTTPL_PTRCOMP 5588 #define SORTTPL_NAMEEXT PtrRealIntInt 5589 #define SORTTPL_KEYTYPE void* 5590 #define SORTTPL_FIELD1TYPE SCIP_Real 5591 #define SORTTPL_FIELD2TYPE int 5592 #define SORTTPL_FIELD3TYPE int 5593 #define SORTTPL_PTRCOMP 5598 #define SORTTPL_NAMEEXT PtrPtrIntInt 5599 #define SORTTPL_KEYTYPE void* 5600 #define SORTTPL_FIELD1TYPE void* 5601 #define SORTTPL_FIELD2TYPE int 5602 #define SORTTPL_FIELD3TYPE int 5603 #define SORTTPL_PTRCOMP 5608 #define SORTTPL_NAMEEXT PtrPtrRealInt 5609 #define SORTTPL_KEYTYPE void* 5610 #define SORTTPL_FIELD1TYPE void* 5611 #define SORTTPL_FIELD2TYPE SCIP_Real 5612 #define SORTTPL_FIELD3TYPE int 5613 #define SORTTPL_PTRCOMP 5618 #define SORTTPL_NAMEEXT PtrPtrRealBool 5619 #define SORTTPL_KEYTYPE void* 5620 #define SORTTPL_FIELD1TYPE void* 5621 #define SORTTPL_FIELD2TYPE SCIP_Real 5622 #define SORTTPL_FIELD3TYPE SCIP_Bool 5623 #define SORTTPL_PTRCOMP 5628 #define SORTTPL_NAMEEXT PtrPtrLongInt 5629 #define SORTTPL_KEYTYPE void* 5630 #define SORTTPL_FIELD1TYPE void* 5631 #define SORTTPL_FIELD2TYPE SCIP_Longint 5632 #define SORTTPL_FIELD3TYPE int 5633 #define SORTTPL_PTRCOMP 5638 #define SORTTPL_NAMEEXT PtrPtrLongIntInt 5639 #define SORTTPL_KEYTYPE void* 5640 #define SORTTPL_FIELD1TYPE void* 5641 #define SORTTPL_FIELD2TYPE SCIP_Longint 5642 #define SORTTPL_FIELD3TYPE int 5643 #define SORTTPL_FIELD4TYPE int 5644 #define SORTTPL_PTRCOMP 5649 #define SORTTPL_NAMEEXT Real 5650 #define SORTTPL_KEYTYPE SCIP_Real 5655 #define SORTTPL_NAMEEXT RealBoolPtr 5656 #define SORTTPL_KEYTYPE SCIP_Real 5657 #define SORTTPL_FIELD1TYPE SCIP_Bool 5658 #define SORTTPL_FIELD2TYPE void* 5663 #define SORTTPL_NAMEEXT RealPtr 5664 #define SORTTPL_KEYTYPE SCIP_Real 5665 #define SORTTPL_FIELD1TYPE void* 5670 #define SORTTPL_NAMEEXT RealInt 5671 #define SORTTPL_KEYTYPE SCIP_Real 5672 #define SORTTPL_FIELD1TYPE int 5677 #define SORTTPL_NAMEEXT RealIntInt 5678 #define SORTTPL_KEYTYPE SCIP_Real 5679 #define SORTTPL_FIELD1TYPE int 5680 #define SORTTPL_FIELD2TYPE int 5685 #define SORTTPL_NAMEEXT RealIntLong 5686 #define SORTTPL_KEYTYPE SCIP_Real 5687 #define SORTTPL_FIELD1TYPE int 5688 #define SORTTPL_FIELD2TYPE SCIP_Longint 5693 #define SORTTPL_NAMEEXT RealIntPtr 5694 #define SORTTPL_KEYTYPE SCIP_Real 5695 #define SORTTPL_FIELD1TYPE int 5696 #define SORTTPL_FIELD2TYPE void* 5701 #define SORTTPL_NAMEEXT RealRealPtr 5702 #define SORTTPL_KEYTYPE SCIP_Real 5703 #define SORTTPL_FIELD1TYPE SCIP_Real 5704 #define SORTTPL_FIELD2TYPE void* 5709 #define SORTTPL_NAMEEXT RealLongRealInt 5710 #define SORTTPL_KEYTYPE SCIP_Real 5711 #define SORTTPL_FIELD1TYPE SCIP_Longint 5712 #define SORTTPL_FIELD2TYPE SCIP_Real 5713 #define SORTTPL_FIELD3TYPE int 5717 #define SORTTPL_NAMEEXT RealRealIntInt 5718 #define SORTTPL_KEYTYPE SCIP_Real 5719 #define SORTTPL_FIELD1TYPE SCIP_Real 5720 #define SORTTPL_FIELD2TYPE int 5721 #define SORTTPL_FIELD3TYPE int 5726 #define SORTTPL_NAMEEXT RealRealRealInt 5727 #define SORTTPL_KEYTYPE SCIP_Real 5728 #define SORTTPL_FIELD1TYPE SCIP_Real 5729 #define SORTTPL_FIELD2TYPE SCIP_Real 5730 #define SORTTPL_FIELD3TYPE int 5735 #define SORTTPL_NAMEEXT RealRealRealPtr 5736 #define SORTTPL_KEYTYPE SCIP_Real 5737 #define SORTTPL_FIELD1TYPE SCIP_Real 5738 #define SORTTPL_FIELD2TYPE SCIP_Real 5739 #define SORTTPL_FIELD3TYPE void* 5744 #define SORTTPL_NAMEEXT RealPtrPtrInt 5745 #define SORTTPL_KEYTYPE SCIP_Real 5746 #define SORTTPL_FIELD1TYPE void* 5747 #define SORTTPL_FIELD2TYPE void* 5748 #define SORTTPL_FIELD3TYPE int 5753 #define SORTTPL_NAMEEXT RealPtrPtrIntInt 5754 #define SORTTPL_KEYTYPE SCIP_Real 5755 #define SORTTPL_FIELD1TYPE void* 5756 #define SORTTPL_FIELD2TYPE void* 5757 #define SORTTPL_FIELD3TYPE int 5758 #define SORTTPL_FIELD4TYPE int 5763 #define SORTTPL_NAMEEXT RealRealRealBoolPtr 5764 #define SORTTPL_KEYTYPE SCIP_Real 5765 #define SORTTPL_FIELD1TYPE SCIP_Real 5766 #define SORTTPL_FIELD2TYPE SCIP_Real 5767 #define SORTTPL_FIELD3TYPE SCIP_Bool 5768 #define SORTTPL_FIELD4TYPE void* 5773 #define SORTTPL_NAMEEXT RealRealRealBoolBoolPtr 5774 #define SORTTPL_KEYTYPE SCIP_Real 5775 #define SORTTPL_FIELD1TYPE SCIP_Real 5776 #define SORTTPL_FIELD2TYPE SCIP_Real 5777 #define SORTTPL_FIELD3TYPE SCIP_Bool 5778 #define SORTTPL_FIELD4TYPE SCIP_Bool 5779 #define SORTTPL_FIELD5TYPE void* 5784 #define SORTTPL_NAMEEXT Int 5785 #define SORTTPL_KEYTYPE int 5790 #define SORTTPL_NAMEEXT IntInt 5791 #define SORTTPL_KEYTYPE int 5792 #define SORTTPL_FIELD1TYPE int 5797 #define SORTTPL_NAMEEXT IntReal 5798 #define SORTTPL_KEYTYPE int 5799 #define SORTTPL_FIELD1TYPE SCIP_Real 5804 #define SORTTPL_NAMEEXT IntPtr 5805 #define SORTTPL_KEYTYPE int 5806 #define SORTTPL_FIELD1TYPE void* 5811 #define SORTTPL_NAMEEXT IntIntInt 5812 #define SORTTPL_KEYTYPE int 5813 #define SORTTPL_FIELD1TYPE int 5814 #define SORTTPL_FIELD2TYPE int 5819 #define SORTTPL_NAMEEXT IntIntLong 5820 #define SORTTPL_KEYTYPE int 5821 #define SORTTPL_FIELD1TYPE int 5822 #define SORTTPL_FIELD2TYPE SCIP_Longint 5826 #define SORTTPL_NAMEEXT IntRealLong 5827 #define SORTTPL_KEYTYPE int 5828 #define SORTTPL_FIELD1TYPE SCIP_Real 5829 #define SORTTPL_FIELD2TYPE SCIP_Longint 5834 #define SORTTPL_NAMEEXT IntIntPtr 5835 #define SORTTPL_KEYTYPE int 5836 #define SORTTPL_FIELD1TYPE int 5837 #define SORTTPL_FIELD2TYPE void* 5842 #define SORTTPL_NAMEEXT IntIntReal 5843 #define SORTTPL_KEYTYPE int 5844 #define SORTTPL_FIELD1TYPE int 5845 #define SORTTPL_FIELD2TYPE SCIP_Real 5850 #define SORTTPL_NAMEEXT IntPtrReal 5851 #define SORTTPL_KEYTYPE int 5852 #define SORTTPL_FIELD1TYPE void* 5853 #define SORTTPL_FIELD2TYPE SCIP_Real 5858 #define SORTTPL_NAMEEXT IntIntIntPtr 5859 #define SORTTPL_KEYTYPE int 5860 #define SORTTPL_FIELD1TYPE int 5861 #define SORTTPL_FIELD2TYPE int 5862 #define SORTTPL_FIELD3TYPE void* 5866 #define SORTTPL_NAMEEXT IntIntIntReal 5867 #define SORTTPL_KEYTYPE int 5868 #define SORTTPL_FIELD1TYPE int 5869 #define SORTTPL_FIELD2TYPE int 5870 #define SORTTPL_FIELD3TYPE SCIP_Real 5874 #define SORTTPL_NAMEEXT IntPtrIntReal 5875 #define SORTTPL_KEYTYPE int 5876 #define SORTTPL_FIELD1TYPE void* 5877 #define SORTTPL_FIELD2TYPE int 5878 #define SORTTPL_FIELD3TYPE SCIP_Real 5883 #define SORTTPL_NAMEEXT Long 5884 #define SORTTPL_KEYTYPE SCIP_Longint 5889 #define SORTTPL_NAMEEXT LongPtr 5890 #define SORTTPL_KEYTYPE SCIP_Longint 5891 #define SORTTPL_FIELD1TYPE void* 5896 #define SORTTPL_NAMEEXT LongPtrInt 5897 #define SORTTPL_KEYTYPE SCIP_Longint 5898 #define SORTTPL_FIELD1TYPE void* 5899 #define SORTTPL_FIELD2TYPE int 5904 #define SORTTPL_NAMEEXT LongPtrRealBool 5905 #define SORTTPL_KEYTYPE SCIP_Longint 5906 #define SORTTPL_FIELD1TYPE void* 5907 #define SORTTPL_FIELD2TYPE SCIP_Real 5908 #define SORTTPL_FIELD3TYPE SCIP_Bool 5913 #define SORTTPL_NAMEEXT LongPtrRealRealBool 5914 #define SORTTPL_KEYTYPE SCIP_Longint 5915 #define SORTTPL_FIELD1TYPE void* 5916 #define SORTTPL_FIELD2TYPE SCIP_Real 5917 #define SORTTPL_FIELD3TYPE SCIP_Real 5918 #define SORTTPL_FIELD4TYPE SCIP_Bool 5923 #define SORTTPL_NAMEEXT LongPtrRealRealIntBool 5924 #define SORTTPL_KEYTYPE SCIP_Longint 5925 #define SORTTPL_FIELD1TYPE void* 5926 #define SORTTPL_FIELD2TYPE SCIP_Real 5927 #define SORTTPL_FIELD3TYPE SCIP_Real 5928 #define SORTTPL_FIELD4TYPE int 5929 #define SORTTPL_FIELD5TYPE SCIP_Bool 5934 #define SORTTPL_NAMEEXT LongPtrPtrInt 5935 #define SORTTPL_KEYTYPE SCIP_Longint 5936 #define SORTTPL_FIELD1TYPE void* 5937 #define SORTTPL_FIELD2TYPE void* 5938 #define SORTTPL_FIELD3TYPE int 5943 #define SORTTPL_NAMEEXT LongPtrPtrIntInt 5944 #define SORTTPL_KEYTYPE SCIP_Longint 5945 #define SORTTPL_FIELD1TYPE void* 5946 #define SORTTPL_FIELD2TYPE void* 5947 #define SORTTPL_FIELD3TYPE int 5948 #define SORTTPL_FIELD4TYPE int 5953 #define SORTTPL_NAMEEXT LongPtrPtrBoolInt 5954 #define SORTTPL_KEYTYPE SCIP_Longint 5955 #define SORTTPL_FIELD1TYPE void* 5956 #define SORTTPL_FIELD2TYPE void* 5957 #define SORTTPL_FIELD3TYPE SCIP_Bool 5958 #define SORTTPL_FIELD4TYPE int 5963 #define SORTTPL_NAMEEXT PtrIntIntBoolBool 5964 #define SORTTPL_KEYTYPE void* 5965 #define SORTTPL_FIELD1TYPE int 5966 #define SORTTPL_FIELD2TYPE int 5967 #define SORTTPL_FIELD3TYPE SCIP_Bool 5968 #define SORTTPL_FIELD4TYPE SCIP_Bool 5969 #define SORTTPL_PTRCOMP 5974 #define SORTTPL_NAMEEXT IntPtrIntIntBoolBool 5975 #define SORTTPL_KEYTYPE int 5976 #define SORTTPL_FIELD1TYPE void* 5977 #define SORTTPL_FIELD2TYPE int 5978 #define SORTTPL_FIELD3TYPE int 5979 #define SORTTPL_FIELD4TYPE SCIP_Bool 5980 #define SORTTPL_FIELD5TYPE SCIP_Bool 5997 assert(indcomp !=
NULL);
5998 assert(len == 0 || perm !=
NULL);
6001 for( pos = 0; pos < len; ++pos )
6009 #define SORTTPL_NAMEEXT DownInd 6010 #define SORTTPL_KEYTYPE int 6011 #define SORTTPL_INDCOMP 6012 #define SORTTPL_BACKWARDS 6017 #define SORTTPL_NAMEEXT DownPtr 6018 #define SORTTPL_KEYTYPE void* 6019 #define SORTTPL_PTRCOMP 6020 #define SORTTPL_BACKWARDS 6025 #define SORTTPL_NAMEEXT DownPtrPtr 6026 #define SORTTPL_KEYTYPE void* 6027 #define SORTTPL_FIELD1TYPE void* 6028 #define SORTTPL_PTRCOMP 6029 #define SORTTPL_BACKWARDS 6034 #define SORTTPL_NAMEEXT DownPtrReal 6035 #define SORTTPL_KEYTYPE void* 6036 #define SORTTPL_FIELD1TYPE SCIP_Real 6037 #define SORTTPL_PTRCOMP 6038 #define SORTTPL_BACKWARDS 6043 #define SORTTPL_NAMEEXT DownPtrInt 6044 #define SORTTPL_KEYTYPE void* 6045 #define SORTTPL_FIELD1TYPE int 6046 #define SORTTPL_PTRCOMP 6047 #define SORTTPL_BACKWARDS 6051 #define SORTTPL_NAMEEXT DownPtrBool 6052 #define SORTTPL_KEYTYPE void* 6053 #define SORTTPL_FIELD1TYPE SCIP_Bool 6054 #define SORTTPL_PTRCOMP 6055 #define SORTTPL_BACKWARDS 6059 #define SORTTPL_NAMEEXT DownPtrIntInt 6060 #define SORTTPL_KEYTYPE void* 6061 #define SORTTPL_FIELD1TYPE int 6062 #define SORTTPL_FIELD2TYPE int 6063 #define SORTTPL_PTRCOMP 6064 #define SORTTPL_BACKWARDS 6069 #define SORTTPL_NAMEEXT DownPtrRealInt 6070 #define SORTTPL_KEYTYPE void* 6071 #define SORTTPL_FIELD1TYPE SCIP_Real 6072 #define SORTTPL_FIELD2TYPE int 6073 #define SORTTPL_PTRCOMP 6074 #define SORTTPL_BACKWARDS 6079 #define SORTTPL_NAMEEXT DownPtrRealBool 6080 #define SORTTPL_KEYTYPE void* 6081 #define SORTTPL_FIELD1TYPE SCIP_Real 6082 #define SORTTPL_FIELD2TYPE SCIP_Bool 6083 #define SORTTPL_PTRCOMP 6084 #define SORTTPL_BACKWARDS 6089 #define SORTTPL_NAMEEXT DownPtrPtrInt 6090 #define SORTTPL_KEYTYPE void* 6091 #define SORTTPL_FIELD1TYPE void* 6092 #define SORTTPL_FIELD2TYPE int 6093 #define SORTTPL_PTRCOMP 6094 #define SORTTPL_BACKWARDS 6099 #define SORTTPL_NAMEEXT DownPtrPtrReal 6100 #define SORTTPL_KEYTYPE void* 6101 #define SORTTPL_FIELD1TYPE void* 6102 #define SORTTPL_FIELD2TYPE SCIP_Real 6103 #define SORTTPL_PTRCOMP 6104 #define SORTTPL_BACKWARDS 6109 #define SORTTPL_NAMEEXT DownPtrRealIntInt 6110 #define SORTTPL_KEYTYPE void* 6111 #define SORTTPL_FIELD1TYPE SCIP_Real 6112 #define SORTTPL_FIELD2TYPE int 6113 #define SORTTPL_FIELD3TYPE int 6114 #define SORTTPL_PTRCOMP 6115 #define SORTTPL_BACKWARDS 6120 #define SORTTPL_NAMEEXT DownPtrPtrIntInt 6121 #define SORTTPL_KEYTYPE void* 6122 #define SORTTPL_FIELD1TYPE void* 6123 #define SORTTPL_FIELD2TYPE int 6124 #define SORTTPL_FIELD3TYPE int 6125 #define SORTTPL_PTRCOMP 6126 #define SORTTPL_BACKWARDS 6131 #define SORTTPL_NAMEEXT DownPtrPtrRealInt 6132 #define SORTTPL_KEYTYPE void* 6133 #define SORTTPL_FIELD1TYPE void* 6134 #define SORTTPL_FIELD2TYPE SCIP_Real 6135 #define SORTTPL_FIELD3TYPE int 6136 #define SORTTPL_PTRCOMP 6137 #define SORTTPL_BACKWARDS 6142 #define SORTTPL_NAMEEXT DownPtrPtrRealBool 6143 #define SORTTPL_KEYTYPE void* 6144 #define SORTTPL_FIELD1TYPE void* 6145 #define SORTTPL_FIELD2TYPE SCIP_Real 6146 #define SORTTPL_FIELD3TYPE SCIP_Bool 6147 #define SORTTPL_PTRCOMP 6148 #define SORTTPL_BACKWARDS 6153 #define SORTTPL_NAMEEXT DownPtrPtrLongInt 6154 #define SORTTPL_KEYTYPE void* 6155 #define SORTTPL_FIELD1TYPE void* 6156 #define SORTTPL_FIELD2TYPE SCIP_Longint 6157 #define SORTTPL_FIELD3TYPE int 6158 #define SORTTPL_PTRCOMP 6159 #define SORTTPL_BACKWARDS 6164 #define SORTTPL_NAMEEXT DownPtrPtrLongIntInt 6165 #define SORTTPL_KEYTYPE void* 6166 #define SORTTPL_FIELD1TYPE void* 6167 #define SORTTPL_FIELD2TYPE SCIP_Longint 6168 #define SORTTPL_FIELD3TYPE int 6169 #define SORTTPL_FIELD4TYPE int 6170 #define SORTTPL_PTRCOMP 6171 #define SORTTPL_BACKWARDS 6176 #define SORTTPL_NAMEEXT DownReal 6177 #define SORTTPL_KEYTYPE SCIP_Real 6178 #define SORTTPL_BACKWARDS 6183 #define SORTTPL_NAMEEXT DownRealBoolPtr 6184 #define SORTTPL_KEYTYPE SCIP_Real 6185 #define SORTTPL_FIELD1TYPE SCIP_Bool 6186 #define SORTTPL_FIELD2TYPE void* 6187 #define SORTTPL_BACKWARDS 6192 #define SORTTPL_NAMEEXT DownRealPtr 6193 #define SORTTPL_KEYTYPE SCIP_Real 6194 #define SORTTPL_FIELD1TYPE void* 6195 #define SORTTPL_BACKWARDS