Scippy

SCIP

Solving Constraint Integer Programs

pub_misc.h
Go to the documentation of this file.
1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2 /* */
3 /* This file is part of the program and library */
4 /* SCIP --- Solving Constraint Integer Programs */
5 /* */
6 /* Copyright (C) 2002-2021 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scipopt.org. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file pub_misc.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public data structures and miscellaneous methods
19  * @author Tobias Achterberg
20  * @author Gerald Gamrath
21  * @author Stefan Heinz
22  * @author Gregor Hendel
23  * @author Michael Winkler
24  * @author Kati Wolter
25  *
26  * This file contains a bunch of data structures and miscellaneous methods:
27  *
28  * - \ref DataStructures "Data structures"
29  * - \ref MiscellaneousMethods "Miscellaneous Methods"
30  */
31 
32 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
33 
34 #ifndef __SCIP_PUB_MISC_H__
35 #define __SCIP_PUB_MISC_H__
36 
37 /* on SunOS, the function finite(a) (for the SCIPisFinite macro below) is declared in ieeefp.h */
38 #ifdef __sun
39 #include <ieeefp.h>
40 #endif
41 #include <math.h>
42 
43 #include "scip/def.h"
44 #include "blockmemshell/memory.h"
45 #include "scip/type_retcode.h"
46 #include "scip/type_misc.h"
47 #include "scip/type_message.h"
48 #include "scip/type_var.h"
49 #include "scip/pub_misc_select.h"
50 #include "scip/pub_misc_sort.h"
51 #include "scip/pub_misc_linear.h"
52 
53 /* in optimized mode some of the function are handled via defines, for that the structs are needed */
54 #ifdef NDEBUG
55 #include "scip/struct_misc.h"
56 #endif
57 
58 #ifdef __cplusplus
59 extern "C" {
60 #endif
61 
62 /*
63  * methods for statistical tests
64  */
65 
66 /**@defgroup STATISTICALTESTS Statistical tests
67  * @ingroup MiscellaneousMethods
68  * @brief public methods for statistical tests
69  *
70  * Below are the public methods for statistical tests inside of \SCIP
71  *
72  * @{
73  */
74 
75 /** get critical value of a Student-T distribution for a given number of degrees of freedom at a confidence level */
78  SCIP_CONFIDENCELEVEL clevel, /**< (one-sided) confidence level */
79  int df /**< degrees of freedom */
80  );
81 
82 /** compute a t-value for the hypothesis that x and y are from the same population; Assuming that
83  * x and y represent normally distributed random samples with equal variance, the returned value
84  * comes from a Student-T distribution with countx + county - 2 degrees of freedom; this
85  * value can be compared with a critical value (see also SCIPstudentTGetCriticalValue()) at
86  * a predefined confidence level for checking if x and y significantly differ in location
87  */
90  SCIP_Real meanx, /**< the mean of the first distribution */
91  SCIP_Real meany, /**< the mean of the second distribution */
92  SCIP_Real variancex, /**< the variance of the x-distribution */
93  SCIP_Real variancey, /**< the variance of the y-distribution */
94  SCIP_Real countx, /**< number of samples of x */
95  SCIP_Real county /**< number of samples of y */
96  );
97 
98 /** returns the value of the Gauss error function evaluated at a given point */
101  SCIP_Real x /**< value to evaluate */
102  );
103 
104 /** get critical value of a standard normal distribution at a given confidence level */
107  SCIP_CONFIDENCELEVEL clevel /**< (one-sided) confidence level */
108  );
109 
110 /** calculates the cumulative distribution P(-infinity <= x <= value) that a normally distributed
111  * random variable x takes a value between -infinity and parameter \p value.
112  *
113  * The distribution is given by the respective mean and deviation. This implementation
114  * uses the error function erf().
115  */
118  SCIP_Real mean, /**< the mean value of the distribution */
119  SCIP_Real variance, /**< the square of the deviation of the distribution */
120  SCIP_Real value /**< the upper limit of the calculated distribution integral */
121  );
122 
123 /**@} */
124 
125 /**@defgroup Regression Linear Regression
126  * @ingroup MiscellaneousMethods
127  * @brief methods for linear regression
128  *
129  * Below are the public methods for incremental linear regression of observations pairs \f$(X_i,Y_i), i=1\dots,n\f$
130  *
131  * @{
132  */
133 
134 /** returns the number of observations of this regression */
137  SCIP_REGRESSION* regression /**< regression data structure */
138  );
139 
140 /** return the current slope of the regression */
143  SCIP_REGRESSION* regression /**< regression data structure */
144  );
145 
146 /** get the current y-intercept of the regression */
149  SCIP_REGRESSION* regression /**< regression data structure */
150  );
151 
152 /** removes an observation (x,y) from the regression */
155  SCIP_REGRESSION* regression, /**< regression data structure */
156  SCIP_Real x, /**< X of observation */
157  SCIP_Real y /**< Y of the observation */
158  );
159 
160 /** update regression by a new observation (x,y) */
163  SCIP_REGRESSION* regression, /**< regression data structure */
164  SCIP_Real x, /**< X of observation */
165  SCIP_Real y /**< Y of the observation */
166  );
167 
168 /** reset regression data structure */
171  SCIP_REGRESSION* regression /**< regression data structure */
172  );
173 
174 /** creates and resets a regression */
177  SCIP_REGRESSION** regression /**< regression data structure */
178  );
179 
180 /** frees a regression */
182 void SCIPregressionFree(
183  SCIP_REGRESSION** regression /**< regression data structure */
184  );
185 
186 /**@} */
187 
188 /*
189  */
190 
191 /**@defgroup GMLgraph GML Graphical Printing
192  * @ingroup MiscellaneousMethods
193  * @brief GML graph printing methods
194  *
195  * For a detailed format decription see http://docs.yworks.com/yfiles/doc/developers-guide/gml.html
196  *
197  * @{
198  */
199 
200 
201 /** writes a node section to the given graph file */
203 void SCIPgmlWriteNode(
204  FILE* file, /**< file to write to */
205  unsigned int id, /**< id of the node */
206  const char* label, /**< label of the node */
207  const char* nodetype, /**< type of the node, or NULL */
208  const char* fillcolor, /**< color of the node's interior, or NULL */
209  const char* bordercolor /**< color of the node's border, or NULL */
210  );
211 
212 /** writes a node section including weight to the given graph file */
215  FILE* file, /**< file to write to */
216  unsigned int id, /**< id of the node */
217  const char* label, /**< label of the node */
218  const char* nodetype, /**< type of the node, or NULL */
219  const char* fillcolor, /**< color of the node's interior, or NULL */
220  const char* bordercolor, /**< color of the node's border, or NULL */
221  SCIP_Real weight /**< weight of node */
222  );
223 
224 /** writes an edge section to the given graph file */
226 void SCIPgmlWriteEdge(
227  FILE* file, /**< file to write to */
228  unsigned int source, /**< source node id of the node */
229  unsigned int target, /**< target node id of the edge */
230  const char* label, /**< label of the edge, or NULL */
231  const char* color /**< color of the edge, or NULL */
232  );
233 
234 /** writes an arc section to the given graph file */
236 void SCIPgmlWriteArc(
237  FILE* file, /**< file to write to */
238  unsigned int source, /**< source node id of the node */
239  unsigned int target, /**< target node id of the edge */
240  const char* label, /**< label of the edge, or NULL */
241  const char* color /**< color of the edge, or NULL */
242  );
243 
244 /** writes the starting line to a GML graph file, does not open a file */
247  FILE* file, /**< file to write to */
248  SCIP_Bool directed /**< is the graph directed */
249  );
250 
251 /** writes the ending lines to a GML graph file, does not close a file */
254  FILE* file /**< file to close */
255  );
256 
257 /**@} */
258 
259 /*
260  * Sparse solution
261  */
262 
263 /**@defgroup SparseSol Sparse Solution
264  * @ingroup DataStructures
265  * @brief sparse storage for multiple integer solutions
266  *
267  * @{
268  */
269 
270 /** creates a sparse solution */
273  SCIP_SPARSESOL** sparsesol, /**< pointer to store the created sparse solution */
274  SCIP_VAR** vars, /**< variables in the sparse solution, must not contain continuous variables */
275  int nvars, /**< number of variables to store, size of the lower and upper bound arrays */
276  SCIP_Bool cleared /**< should the lower and upper bound arrays be cleared (entries set to 0) */
277  );
278 
279 /** frees sparse solution */
281 void SCIPsparseSolFree(
282  SCIP_SPARSESOL** sparsesol /**< pointer to a sparse solution */
283  );
284 
285 /** returns the variables in the given sparse solution */
288  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
289  );
290 
291 /** returns the number of variables in the given sparse solution */
294  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
295  );
296 
297 /** returns the the lower bound array for all variables for a given sparse solution */
300  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
301  );
302 
303 /** returns the the upper bound array for all variables for a given sparse solution */
306  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
307  );
308 
309 /** constructs the first solution of sparse solution (all variables are set to their lower bound value */
312  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
313  SCIP_Longint* sol, /**< array to store the first solution */
314  int nvars /**< number of variables */
315  );
316 
317 /** constructs the next solution of the sparse solution and return whether there was one more or not */
320  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
321  SCIP_Longint* sol, /**< current solution array which get changed to the next solution */
322  int nvars /**< number of variables */
323  );
324 
325 /**@} */
326 
327 
328 /*
329  * Queue
330  */
331 
332 /**@defgroup Queue Queue
333  * @ingroup DataStructures
334  * @brief circular FIFO queue
335  *
336  * @{
337  */
338 
339 
340 /** creates a (circular) queue, best used if the size will be fixed or will not be increased that much */
343  SCIP_QUEUE** queue, /**< pointer to the new queue */
344  int initsize, /**< initial number of available element slots */
345  SCIP_Real sizefac /**< memory growing factor applied, if more element slots are needed */
346  );
347 
348 
349 /** frees queue, but not the data elements themselves */
351 void SCIPqueueFree(
352  SCIP_QUEUE** queue /**< pointer to a queue */
353  );
354 
355 /** clears the queue, but doesn't free the data elements themselves */
357 void SCIPqueueClear(
358  SCIP_QUEUE* queue /**< queue */
359  );
360 
361 /** inserts pointer element at the end of the queue */
364  SCIP_QUEUE* queue, /**< queue */
365  void* elem /**< element to be inserted */
366  );
367 
368 /** inserts unsigned integer element at the end of the queue */
371  SCIP_QUEUE* queue, /**< queue */
372  unsigned int elem /**< element to be inserted */
373  );
374 
375 /** removes and returns the first element of the queue, or NULL if no element exists */
377 void* SCIPqueueRemove(
378  SCIP_QUEUE* queue /**< queue */
379  );
380 
381 /** removes and returns the first unsigned integer element of the queue, or UNIT_MAX if no element exists */
383 unsigned int SCIPqueueRemoveUInt(
384  SCIP_QUEUE* queue /**< queue */
385  );
386 
387 /** returns the first element of the queue without removing it, or NULL if no element exists */
389 void* SCIPqueueFirst(
390  SCIP_QUEUE* queue /**< queue */
391  );
392 
393 /** returns the first unsigned integer element of the queue without removing it, or UINT_MAX if no element exists */
395 unsigned int SCIPqueueFirstUInt(
396  SCIP_QUEUE* queue /**< queue */
397  );
398 
399 /** returns whether the queue is empty */
402  SCIP_QUEUE* queue /**< queue */
403  );
404 
405 /** returns the number of elements in the queue */
407 int SCIPqueueNElems(
408  SCIP_QUEUE* queue /**< queue */
409  );
410 
411 /**@} */
412 
413 /*
414  * Priority Queue
415  */
416 
417 /**@defgroup PriorityQueue Priority Queue
418  * @ingroup DataStructures
419  * @brief priority queue with O(1) access to the minimum element
420  *
421  * @{
422  */
423 
424 /** creates priority queue */
427  SCIP_PQUEUE** pqueue, /**< pointer to a priority queue */
428  int initsize, /**< initial number of available element slots */
429  SCIP_Real sizefac, /**< memory growing factor applied, if more element slots are needed */
430  SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
431  SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)) /**< callback to act on position change of elem in priority queue, or NULL */
432  );
433 
434 /** frees priority queue, but not the data elements themselves */
436 void SCIPpqueueFree(
437  SCIP_PQUEUE** pqueue /**< pointer to a priority queue */
438  );
439 
440 /** clears the priority queue, but doesn't free the data elements themselves */
442 void SCIPpqueueClear(
443  SCIP_PQUEUE* pqueue /**< priority queue */
444  );
445 
446 /** inserts element into priority queue */
449  SCIP_PQUEUE* pqueue, /**< priority queue */
450  void* elem /**< element to be inserted */
451  );
452 
453 /** delete element at specified position, maintaining the heap property */
455 void SCIPpqueueDelPos(
456  SCIP_PQUEUE* pqueue, /**< priority queue */
457  int pos /**< position of element that should be deleted */
458  );
459 
460 /** removes and returns best element from the priority queue */
462 void* SCIPpqueueRemove(
463  SCIP_PQUEUE* pqueue /**< priority queue */
464  );
465 
466 /** returns the best element of the queue without removing it */
468 void* SCIPpqueueFirst(
469  SCIP_PQUEUE* pqueue /**< priority queue */
470  );
471 
472 /** returns the number of elements in the queue */
474 int SCIPpqueueNElems(
475  SCIP_PQUEUE* pqueue /**< priority queue */
476  );
477 
478 /** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
480 void** SCIPpqueueElems(
481  SCIP_PQUEUE* pqueue /**< priority queue */
482  );
483 
484 /** return the position of @p elem in the priority queue, or -1 if element is not found */
486 int SCIPpqueueFind(
487  SCIP_PQUEUE* pqueue, /**< priority queue */
488  void* elem /**< element to be inserted */
489  );
490 
491 /**@} */
492 
493 
494 /*
495  * Hash Table
496  */
497 
498 /**@defgroup HashTable Hash Table
499  * @ingroup DataStructures
500  * @brief hash table that resolves conflicts by probing
501  *
502  *@{
503  */
504 
505 /* fast 2-universal hash functions for two to seven 32bit elements with 32bit output */
506 
507 #define SCIPhashSignature64(a) (UINT64_C(0x8000000000000000)>>((UINT32_C(0x9e3779b9) * ((uint32_t)(a)))>>26))
508 
509 #define SCIPhashTwo(a, b) ((uint32_t)((((uint32_t)(a) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) )>>32))
510 
511 #define SCIPhashThree(a, b, c) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
512  (uint32_t)(c) * 0xd37e9a1ce2148403ULL)>>32 ))
513 
514 #define SCIPhashFour(a, b, c, d) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
515  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL))>>32 ))
516 
517 #define SCIPhashFive(a, b, c, d, e) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
518  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
519  (uint32_t)(e) * 0xf48d4cd331e14327ULL)>>32 ))
520 
521 #define SCIPhashSix(a, b, c, d, e, f) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
522  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
523  ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL))>>32 ))
524 
525 #define SCIPhashSeven(a, b, c, d, e, f, g) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
526  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
527  ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL) + \
528  (uint32_t)(g) * 0x7f497d9ba3bd83c0ULL)>>32 ))
529 
530 /** computes a hashcode for double precision floating point values containing
531  * 15 significant bits, the sign and the exponent
532  */
533 INLINE static
534 uint32_t SCIPrealHashCode(double x)
535 {
536  int theexp;
537  return (((uint32_t)(uint16_t)(int16_t)ldexp(frexp(x, &theexp), 15))<<16) | (uint32_t)(uint16_t)theexp;
538 }
539 
540 /** creates a hash table */
543  SCIP_HASHTABLE** hashtable, /**< pointer to store the created hash table */
544  BMS_BLKMEM* blkmem, /**< block memory used to store hash table entries */
545  int tablesize, /**< size of the hash table */
546  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
547  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
548  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
549  void* userptr /**< user pointer */
550  );
551 
552 /** frees the hash table */
554 void SCIPhashtableFree(
555  SCIP_HASHTABLE** hashtable /**< pointer to the hash table */
556  );
557 
558 /** removes all elements of the hash table
559  *
560  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
561  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
562  *
563  * @deprecated Please use SCIPhashtableRemoveAll()
564  */
566 void SCIPhashtableClear(
567  SCIP_HASHTABLE* hashtable /**< hash table */
568  );
569 
570 /** inserts element in hash table (multiple inserts of same element override the previous entry) */
573  SCIP_HASHTABLE* hashtable, /**< hash table */
574  void* element /**< element to insert into the table */
575  );
576 
577 /** inserts element in hash table (multiple insertion of same element is checked and results in an error) */
580  SCIP_HASHTABLE* hashtable, /**< hash table */
581  void* element /**< element to insert into the table */
582  );
583 
584 /** retrieve element with key from hash table, returns NULL if not existing */
587  SCIP_HASHTABLE* hashtable, /**< hash table */
588  void* key /**< key to retrieve */
589  );
590 
591 /** returns whether the given element exists in the table */
594  SCIP_HASHTABLE* hashtable, /**< hash table */
595  void* element /**< element to search in the table */
596  );
597 
598 /** removes element from the hash table, if it exists */
601  SCIP_HASHTABLE* hashtable, /**< hash table */
602  void* element /**< element to remove from the table */
603  );
604 
605 /** removes all elements of the hash table */
608  SCIP_HASHTABLE* hashtable /**< hash table */
609  );
610 
611 /** returns number of hash table elements */
614  SCIP_HASHTABLE* hashtable /**< hash table */
615  );
616 
617 /** gives the number of entries in the internal arrays of a hash table */
620  SCIP_HASHTABLE* hashtable /**< hash table */
621  );
622 
623 /** gives the element at the given index or NULL if entry at that index has no element */
626  SCIP_HASHTABLE* hashtable, /**< hash table */
627  int entryidx /**< index of hash table entry */
628  );
629 
630 /** returns the load of the given hash table in percentage */
633  SCIP_HASHTABLE* hashtable /**< hash table */
634  );
635 
636 /** prints statistics about hash table usage */
639  SCIP_HASHTABLE* hashtable, /**< hash table */
640  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
641  );
642 
643 /**@} */
644 
645 /*
646  * MultiHash Table
647  */
648 
649 /**@defgroup MultiHash Multi Hash table
650  * @ingroup DataStructures
651  * @brief hash table that resolves conflicts by queueing, thereby allowing for duplicate entries
652  *
653  *@{
654  */
655 
656 /** returns a reasonable hash table size (a prime number) that is at least as large as the specified value */
659  int minsize /**< minimal size of the hash table */
660  );
661 
662 /** creates a multihash table */
665  SCIP_MULTIHASH** multihash, /**< pointer to store the created multihash table */
666  BMS_BLKMEM* blkmem, /**< block memory used to store multihash table entries */
667  int tablesize, /**< size of the hash table */
668  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
669  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
670  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
671  void* userptr /**< user pointer */
672  );
673 
674 /** frees the multihash table */
676 void SCIPmultihashFree(
677  SCIP_MULTIHASH** multihash /**< pointer to the multihash table */
678  );
679 
680 /** inserts element in multihash table (multiple inserts of same element possible)
681  *
682  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding an element
683  * to the hash table, due to dynamic resizing.
684  */
687  SCIP_MULTIHASH* multihash, /**< multihash table */
688  void* element /**< element to insert into the table */
689  );
690 
691 /** inserts element in multihash table (multiple insertion of same element is checked and results in an error)
692  *
693  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding a new
694  * element to the multihash table, due to dynamic resizing.
695  */
698  SCIP_MULTIHASH* multihash, /**< multihash table */
699  void* element /**< element to insert into the table */
700  );
701 
702 /** retrieve element with key from multihash table, returns NULL if not existing */
705  SCIP_MULTIHASH* multihash, /**< multihash table */
706  void* key /**< key to retrieve */
707  );
708 
709 /** retrieve element with key from multihash table, returns NULL if not existing
710  * can be used to retrieve all entries with the same key (one-by-one)
711  *
712  * @note The returned multimultihashlist pointer might get invalid when adding a new element to the multihash table.
713  */
716  SCIP_MULTIHASH* multihash, /**< multihash table */
717  SCIP_MULTIHASHLIST** multihashlist, /**< input: entry in hash table list from which to start searching, or NULL
718  * output: entry in hash table list corresponding to element after
719  * retrieved one, or NULL */
720  void* key /**< key to retrieve */
721  );
722 
723 /** returns whether the given element exists in the multihash table */
726  SCIP_MULTIHASH* multihash, /**< multihash table */
727  void* element /**< element to search in the table */
728  );
729 
730 /** removes element from the multihash table, if it exists */
733  SCIP_MULTIHASH* multihash, /**< multihash table */
734  void* element /**< element to remove from the table */
735  );
736 
737 /** removes all elements of the multihash table
738  *
739  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
740  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
741  */
744  SCIP_MULTIHASH* multihash /**< multihash table */
745  );
746 
747 /** returns number of multihash table elements */
750  SCIP_MULTIHASH* multihash /**< multihash table */
751  );
752 
753 /** returns the load of the given multihash table in percentage */
756  SCIP_MULTIHASH* multihash /**< multihash table */
757  );
758 
759 /** prints statistics about multihash table usage */
762  SCIP_MULTIHASH* multihash, /**< multihash table */
763  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
764  );
765 
766 /** standard hash key comparator for string keys */
768 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString);
769 
770 /** standard hashing function for string keys */
772 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString);
773 
774 /** gets the element as the key */
776 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard);
777 
778 /** returns TRUE iff both keys(pointer) are equal */
780 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqPtr);
781 
782 /** returns the hash value of the key */
784 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValPtr);
785 
786 /**@} */
787 
788 
789 /*
790  * Hash Map
791  */
792 
793 /**@defgroup HashMap Hash Map
794  * @ingroup DataStructures
795  * @brief hash map to store key-value pairs (called \p origin and \p image)
796  *
797  * @{
798  */
799 
800 /** creates a hash map mapping pointers to pointers */
803  SCIP_HASHMAP** hashmap, /**< pointer to store the created hash map */
804  BMS_BLKMEM* blkmem, /**< block memory used to store hash map entries */
805  int mapsize /**< size of the hash map */
806  );
807 
808 /** frees the hash map */
810 void SCIPhashmapFree(
811  SCIP_HASHMAP** hashmap /**< pointer to the hash map */
812  );
813 
814 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
817  SCIP_HASHMAP* hashmap, /**< hash map */
818  void* origin, /**< origin to set image for */
819  void* image /**< new image for origin */
820  );
821 
822 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
825  SCIP_HASHMAP* hashmap, /**< hash map */
826  void* origin, /**< origin to set image for */
827  int image /**< new image for origin */
828  );
829 
830 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
833  SCIP_HASHMAP* hashmap, /**< hash map */
834  void* origin, /**< origin to set image for */
835  SCIP_Real image /**< new image for origin */
836  );
837 
838 /** retrieves image of given origin from the hash map, or NULL if no image exists */
840 void* SCIPhashmapGetImage(
841  SCIP_HASHMAP* hashmap, /**< hash map */
842  void* origin /**< origin to retrieve image for */
843  );
844 
845 /** retrieves image of given origin from the hash map, or INT_MAX if no image exists */
848  SCIP_HASHMAP* hashmap, /**< hash map */
849  void* origin /**< origin to retrieve image for */
850  );
851 
852 /** retrieves image of given origin from the hash map, or SCIP_INVALID if no image exists */
855  SCIP_HASHMAP* hashmap, /**< hash map */
856  void* origin /**< origin to retrieve image for */
857  );
858 
859 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
860  * new origin->image pair
861  */
864  SCIP_HASHMAP* hashmap, /**< hash map */
865  void* origin, /**< origin to set image for */
866  void* image /**< new image for origin */
867  );
868 
869 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
870  * new origin->image pair
871  */
874  SCIP_HASHMAP* hashmap, /**< hash map */
875  void* origin, /**< origin to set image for */
876  int image /**< new image for origin */
877  );
878 
879 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
880  * new origin->image pair
881  */
884  SCIP_HASHMAP* hashmap, /**< hash map */
885  void* origin, /**< origin to set image for */
886  SCIP_Real image /**< new image for origin */
887  );
888 
889 /** checks whether an image to the given origin exists in the hash map */
892  SCIP_HASHMAP* hashmap, /**< hash map */
893  void* origin /**< origin to search for */
894  );
895 
896 /** removes origin->image pair from the hash map, if it exists */
899  SCIP_HASHMAP* hashmap, /**< hash map */
900  void* origin /**< origin to remove from the list */
901  );
902 
903 /** prints statistics about hash map usage */
906  SCIP_HASHMAP* hashmap, /**< hash map */
907  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
908  );
909 
910 /** indicates whether a hash map has no entries */
913  SCIP_HASHMAP* hashmap /**< hash map */
914  );
915 
916 /** gives the number of elements in a hash map */
919  SCIP_HASHMAP* hashmap /**< hash map */
920  );
921 
922 /** gives the number of entries in the internal arrays of a hash map */
925  SCIP_HASHMAP* hashmap /**< hash map */
926  );
927 
928 /** gives the hashmap entry at the given index or NULL if entry has no element */
931  SCIP_HASHMAP* hashmap, /**< hash map */
932  int entryidx /**< index of hash map entry */
933  );
934 
935 /** gives the origin of the hashmap entry */
938  SCIP_HASHMAPENTRY* entry /**< hash map entry */
939  );
940 
941 /** gives the image of the hashmap entry */
944  SCIP_HASHMAPENTRY* entry /**< hash map entry */
945  );
946 
947 /** gives the image of the hashmap entry */
950  SCIP_HASHMAPENTRY* entry /**< hash map entry */
951  );
952 
953 /** gives the image of the hashmap entry */
956  SCIP_HASHMAPENTRY* entry /**< hash map entry */
957  );
958 
959 /** sets pointer image of a hashmap entry */
962  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
963  void* image /**< new image */
964  );
965 
966 /** sets integer image of a hashmap entry */
969  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
970  int image /**< new image */
971  );
972 
973 /** sets real image of a hashmap entry */
976  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
977  SCIP_Real image /**< new image */
978  );
979 
980 /** removes all entries in a hash map. */
983  SCIP_HASHMAP* hashmap /**< hash map */
984  );
985 
986 /**@} */
987 
988 
989 /*
990  * Hash Set
991  */
992 
993 /**@defgroup HashSet Hash Set
994  * @ingroup DataStructures
995  * @brief very lightweight hash set of pointers
996  *
997  * @{
998  */
999 
1000 /** creates a hash set of pointers */
1003  SCIP_HASHSET** hashset, /**< pointer to store the created hash set */
1004  BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1005  int size /**< initial size of the hash set; it is guaranteed that the set is not
1006  * resized if at most that many elements are inserted */
1007  );
1008 
1009 /** frees the hash set */
1011 void SCIPhashsetFree(
1012  SCIP_HASHSET** hashset, /**< pointer to the hash set */
1013  BMS_BLKMEM* blkmem /**< block memory used to store hash set entries */
1014  );
1015 
1016 /** inserts new element into the hash set */
1019  SCIP_HASHSET* hashset, /**< hash set */
1020  BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1021  void* element /**< element to insert */
1022  );
1023 
1024 /** checks whether an element exists in the hash set */
1027  SCIP_HASHSET* hashset, /**< hash set */
1028  void* element /**< element to search for */
1029  );
1030 
1031 /** removes an element from the hash set, if it exists */
1034  SCIP_HASHSET* hashset, /**< hash set */
1035  void* element /**< origin to remove from the list */
1036  );
1037 
1038 /** prints statistics about hash set usage */
1041  SCIP_HASHSET* hashset, /**< hash set */
1042  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
1043  );
1044 
1045 /** indicates whether a hash set has no entries */
1048  SCIP_HASHSET* hashset /**< hash set */
1049  );
1050 
1051 /** gives the number of elements in a hash set */
1054  SCIP_HASHSET* hashset /**< hash set */
1055  );
1056 
1057 /** gives the number of slots of a hash set */
1060  SCIP_HASHSET* hashset /**< hash set */
1061  );
1062 
1063 /** gives the array of hash set slots; contains all elements in indetermined order and may contain NULL values */
1065 void** SCIPhashsetGetSlots(
1066  SCIP_HASHSET* hashset /**< hash set */
1067  );
1068 
1069 /** removes all entries in a hash set. */
1072  SCIP_HASHSET* hashset /**< hash set */
1073  );
1074 
1075 #ifdef NDEBUG
1076 
1077 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1078  * speed up the algorithms.
1079  */
1080 
1081 #define SCIPhashsetIsEmpty(hashset) ((hashset)->nelements == 0)
1082 #define SCIPhashsetGetNElements(hashset) ((hashset)->nelements)
1083 #define SCIPhashsetGetNSlots(hashset) (1u << (64 - (hashset)->shift))
1084 #define SCIPhashsetGetSlots(hashset) ((hashset)->slots)
1085 
1086 #endif
1087 
1088 /**@} */
1089 
1090 
1091 /*
1092  * Activity
1093  */
1094 
1095 /**@defgroup ResourceActivity Resource Activity
1096  * @ingroup DataStructures
1097  * @brief ressource activity data structure
1098  *
1099  * @{
1100  */
1101 
1102 /** create a resource activity */
1105  SCIP_RESOURCEACTIVITY** activity, /**< pointer to store the resource activity */
1106  SCIP_VAR* var, /**< start time variable of the activity */
1107  int duration, /**< duration of the activity */
1108  int demand /**< demand of the activity */
1109  );
1110 
1111 /** frees a resource activity */
1113 void SCIPactivityFree(
1114  SCIP_RESOURCEACTIVITY** activity /**< pointer to the resource activity */
1115  );
1116 
1117 #ifndef NDEBUG
1118 
1119 /** returns the start time variable of the resource activity */
1122  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1123  );
1124 
1125 /** returns the duration of the resource activity */
1128  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1129  );
1130 
1131 /** returns the demand of the resource activity */
1134  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1135  );
1136 
1137 /** returns the energy of the resource activity */
1140  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1141  );
1142 
1143 #else
1144 
1145 #define SCIPactivityGetVar(activity) ((activity)->var)
1146 #define SCIPactivityGetDuration(activity) ((activity)->duration)
1147 #define SCIPactivityGetDemand(activity) ((activity)->demand)
1148 #define SCIPactivityGetEnergy(activity) ((activity)->duration * (activity)->demand)
1149 
1150 #endif
1151 
1152 /**@} */
1153 
1154 
1155 /*
1156  * Resource Profile
1157  */
1158 
1159 /**@defgroup ResourceProfile Resource Profile
1160  * @ingroup DataStructures
1161  * @brief ressource profile data structure
1162  *
1163  * @{
1164  */
1165 
1166 /** creates resource profile */
1169  SCIP_PROFILE** profile, /**< pointer to store the resource profile */
1170  int capacity /**< resource capacity */
1171  );
1172 
1173 /** frees given resource profile */
1175 void SCIPprofileFree(
1176  SCIP_PROFILE** profile /**< pointer to the resource profile */
1177  );
1178 
1179 /** output of the given resource profile */
1181 void SCIPprofilePrint(
1182  SCIP_PROFILE* profile, /**< resource profile to output */
1183  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1184  FILE* file /**< output file (or NULL for standard output) */
1185  );
1186 
1187 /** returns the capacity of the resource profile */
1190  SCIP_PROFILE* profile /**< resource profile to use */
1191  );
1192 
1193 /** returns the number time points of the resource profile */
1196  SCIP_PROFILE* profile /**< resource profile to use */
1197  );
1198 
1199 /** returns the time points of the resource profile */
1202  SCIP_PROFILE* profile /**< resource profile to use */
1203  );
1204 
1205 /** returns the loads of the resource profile */
1207 int* SCIPprofileGetLoads(
1208  SCIP_PROFILE* profile /**< resource profile to use */
1209  );
1210 
1211 /** returns the time point for given position of the resource profile */
1213 int SCIPprofileGetTime(
1214  SCIP_PROFILE* profile, /**< resource profile to use */
1215  int pos /**< position */
1216  );
1217 
1218 /** returns the loads of the resource profile at the given position */
1220 int SCIPprofileGetLoad(
1221  SCIP_PROFILE* profile, /**< resource profile */
1222  int pos /**< position */
1223  );
1224 
1225 /** returns if the given time point exists in the resource profile and stores the position of the given time point if it
1226  * exists; otherwise the position of the next smaller existing time point is stored
1227  */
1230  SCIP_PROFILE* profile, /**< resource profile to search */
1231  int timepoint, /**< time point to search for */
1232  int* pos /**< pointer to store the position */
1233  );
1234 
1235 /** insert a core into resource profile; if the core is non-empty the resource profile will be updated otherwise nothing
1236  * happens
1237  */
1240  SCIP_PROFILE* profile, /**< resource profile to use */
1241  int left, /**< left side of the core */
1242  int right, /**< right side of the core */
1243  int height, /**< height of the core */
1244  int* pos, /**< pointer to store the first position were it gets infeasible */
1245  SCIP_Bool* infeasible /**< pointer to store if the core does not fit due to capacity */
1246  );
1247 
1248 /** subtracts the height from the resource profile during core time */
1251  SCIP_PROFILE* profile, /**< resource profile to use */
1252  int left, /**< left side of the core */
1253  int right, /**< right side of the core */
1254  int height /**< height of the core */
1255  );
1256 
1257 /** return the earliest possible starting point within the time interval [lb,ub] for a given core (given by its height
1258  * and duration)
1259  */
1262  SCIP_PROFILE* profile, /**< resource profile to use */
1263  int est, /**< earliest starting time of the given core */
1264  int lst, /**< latest starting time of the given core */
1265  int duration, /**< duration of the core */
1266  int height, /**< height of the core */
1267  SCIP_Bool* infeasible /**< pointer store if the corer cannot be inserted */
1268  );
1269 
1270 /** return the latest possible starting point within the time interval [lb,ub] for a given core (given by its height and
1271  * duration)
1272  */
1275  SCIP_PROFILE* profile, /**< resource profile to use */
1276  int lb, /**< earliest possible start point */
1277  int ub, /**< latest possible start point */
1278  int duration, /**< duration of the core */
1279  int height, /**< height of the core */
1280  SCIP_Bool* infeasible /**< pointer store if the core cannot be inserted */
1281  );
1282 
1283 /**@} */
1284 
1285 /*
1286  * Directed graph
1287  */
1288 
1289 /**@addtogroup DirectedGraph
1290  *
1291  * @{
1292  */
1293 
1294 /** resize directed graph structure */
1297  SCIP_DIGRAPH* digraph, /**< directed graph */
1298  int nnodes /**< new number of nodes */
1299  );
1300 
1301 /** sets the sizes of the successor lists for the nodes in a directed graph and allocates memory for the lists */
1304  SCIP_DIGRAPH* digraph, /**< directed graph */
1305  int* sizes /**< sizes of the successor lists */
1306  );
1307 
1308 /** frees given directed graph structure */
1310 void SCIPdigraphFree(
1311  SCIP_DIGRAPH** digraph /**< pointer to the directed graph */
1312  );
1313 
1314 /** add (directed) arc and a related data to the directed graph structure
1315  *
1316  * @note if the arc is already contained, it is added a second time
1317  */
1320  SCIP_DIGRAPH* digraph, /**< directed graph */
1321  int startnode, /**< start node of the arc */
1322  int endnode, /**< start node of the arc */
1323  void* data /**< data that should be stored for the arc; or NULL */
1324  );
1325 
1326 /** add (directed) arc to the directed graph structure, if it is not contained, yet
1327  *
1328  * @note if there already exists an arc from startnode to endnode, the new arc is not added,
1329  * even if its data is different
1330  */
1333  SCIP_DIGRAPH* digraph, /**< directed graph */
1334  int startnode, /**< start node of the arc */
1335  int endnode, /**< start node of the arc */
1336  void* data /**< data that should be stored for the arc; or NULL */
1337  );
1338 
1339 /** sets the number of successors to a given value */
1342  SCIP_DIGRAPH* digraph, /**< directed graph */
1343  int node, /**< node for which the number of successors has to be changed */
1344  int nsuccessors /**< new number of successors */
1345  );
1346 
1347 /** returns the number of nodes of the given digraph */
1350  SCIP_DIGRAPH* digraph /**< directed graph */
1351  );
1352 
1353 /** returns the node data, or NULL if no data exist */
1356  SCIP_DIGRAPH* digraph, /**< directed graph */
1357  int node /**< node for which the node data is returned */
1358  );
1359 
1360 /** sets the node data */
1363  SCIP_DIGRAPH* digraph, /**< directed graph */
1364  void* dataptr, /**< user node data pointer, or NULL */
1365  int node /**< node for which the node data is returned */
1366  );
1367 
1368 /** returns the total number of arcs in the given digraph */
1371  SCIP_DIGRAPH* digraph /**< directed graph */
1372  );
1373 
1374 /** returns the number of successor nodes of the given node */
1377  SCIP_DIGRAPH* digraph, /**< directed graph */
1378  int node /**< node for which the number of outgoing arcs is returned */
1379  );
1380 
1381 /** returns the array of indices of the successor nodes; this array must not be changed from outside */
1384  SCIP_DIGRAPH* digraph, /**< directed graph */
1385  int node /**< node for which the array of outgoing arcs is returned */
1386  );
1387 
1388 /** returns the array of data corresponding to the arcs originating at the given node, or NULL if no data exist; this
1389  * array must not be changed from outside
1390  */
1393  SCIP_DIGRAPH* digraph, /**< directed graph */
1394  int node /**< node for which the data corresponding to the outgoing arcs is returned */
1395  );
1396 
1397 /** identifies the articulation points in a given directed graph
1398  * uses the helper recursive function findArticulationPointsUtil
1399  */
1402  SCIP_DIGRAPH* digraph, /**< directed graph */
1403  int** articulations, /**< array to store the sorted node indices of the computed articulation points, or NULL */
1404  int* narticulations /**< number of the computed articulation points, or NULL */
1405  );
1406 
1407 /** Compute undirected connected components on the given graph.
1408  *
1409  * @note For each arc, its reverse is added, so the graph does not need to be the directed representation of an
1410  * undirected graph.
1411  */
1414  SCIP_DIGRAPH* digraph, /**< directed graph */
1415  int minsize, /**< all components with less nodes are ignored */
1416  int* components, /**< array with as many slots as there are nodes in the directed graph
1417  * to store for each node the component to which it belongs
1418  * (components are numbered 0 to ncomponents - 1); or NULL, if components
1419  * are accessed one-by-one using SCIPdigraphGetComponent() */
1420  int* ncomponents /**< pointer to store the number of components; or NULL, if the
1421  * number of components is accessed by SCIPdigraphGetNComponents() */
1422  );
1423 
1424 /** Computes all strongly connected components of an undirected connected component with Tarjan's Algorithm.
1425  * The resulting strongly connected components are sorted topologically (starting from the end of the
1426  * strongcomponents array).
1427  *
1428  * @note In general a topological sort of the strongly connected components is not unique.
1429  */
1432  SCIP_DIGRAPH* digraph, /**< directed graph */
1433  int compidx, /**< number of the undirected connected component */
1434  int* strongcomponents, /**< array to store the strongly connected components
1435  * (length >= size of the component) */
1436  int* strongcompstartidx, /**< array to store the start indices of the strongly connected
1437  * components (length >= size of the component) */
1438  int* nstrongcomponents /**< pointer to store the number of strongly connected
1439  * components */
1440  );
1441 
1442 /** Performes an (almost) topological sort on the undirected components of the given directed graph. The undirected
1443  * components should be computed before using SCIPdigraphComputeUndirectedComponents().
1444  *
1445  * @note In general a topological sort is not unique. Note, that there might be directed cycles, that are randomly
1446  * broken, which is the reason for having only almost topologically sorted arrays.
1447  */
1450  SCIP_DIGRAPH* digraph /**< directed graph */
1451  );
1452 
1453 /** returns the number of previously computed undirected components for the given directed graph */
1456  SCIP_DIGRAPH* digraph /**< directed graph */
1457  );
1458 
1459 /** Returns the previously computed undirected component of the given number for the given directed graph.
1460  * If the components were sorted using SCIPdigraphTopoSortComponents(), the component is (almost) topologically sorted.
1461  */
1464  SCIP_DIGRAPH* digraph, /**< directed graph */
1465  int compidx, /**< number of the component to return */
1466  int** nodes, /**< pointer to store the nodes in the component; or NULL, if not needed */
1467  int* nnodes /**< pointer to store the number of nodes in the component;
1468  * or NULL, if not needed */
1469  );
1470 
1471 /** frees the component information for the given directed graph */
1474  SCIP_DIGRAPH* digraph /**< directed graph */
1475  );
1476 
1477 /** output of the given directed graph via the given message handler */
1479 void SCIPdigraphPrint(
1480  SCIP_DIGRAPH* digraph, /**< directed graph */
1481  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1482  FILE* file /**< output file (or NULL for standard output) */
1483  );
1484 
1485 /** prints the given directed graph structure in GML format into the given file */
1487 void SCIPdigraphPrintGml(
1488  SCIP_DIGRAPH* digraph, /**< directed graph */
1489  FILE* file /**< file to write to */
1490  );
1491 
1492 
1493 /** output of the given directed graph via the given message handler */
1496  SCIP_DIGRAPH* digraph, /**< directed graph */
1497  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1498  FILE* file /**< output file (or NULL for standard output) */
1499  );
1500 
1501 /**@} */
1502 
1503 /*
1504  * Binary search tree
1505  */
1506 
1507 /**@defgroup BinaryTree Binary Search Tree
1508  * @ingroup DataStructures
1509  * @brief binary search tree data structure
1510  *@{
1511  */
1512 
1513 /** creates a binary tree node with sorting value and user data */
1516  SCIP_BT* tree, /**< binary search tree */
1517  SCIP_BTNODE** node, /**< pointer to store the created search node */
1518  void* dataptr /**< user node data pointer, or NULL */
1519  );
1520 
1521 /** frees the binary node including the rooted subtree
1522  *
1523  * @note The user pointer (object) is not freed. If needed, it has to be done by the user.
1524  */
1526 void SCIPbtnodeFree(
1527  SCIP_BT* tree, /**< binary tree */
1528  SCIP_BTNODE** node /**< node to be freed */
1529  );
1530 
1531 /** returns the user data pointer stored in that node */
1533 void* SCIPbtnodeGetData(
1534  SCIP_BTNODE* node /**< node */
1535  );
1536 
1537 /** returns the parent which can be NULL if the given node is the root */
1540  SCIP_BTNODE* node /**< node */
1541  );
1542 
1543 /** returns left child which can be NULL if the given node is a leaf */
1546  SCIP_BTNODE* node /**< node */
1547  );
1548 
1549 /** returns right child which can be NULL if the given node is a leaf */
1552  SCIP_BTNODE* node /**< node */
1553  );
1554 
1555 /** returns the sibling of the node or NULL if does not exist */
1558  SCIP_BTNODE* node /**< node */
1559  );
1560 
1561 /** returns whether the node is a root node */
1564  SCIP_BTNODE* node /**< node */
1565  );
1566 
1567 /** returns whether the node is a leaf */
1570  SCIP_BTNODE* node /**< node */
1571  );
1572 
1573 /** returns TRUE if the given node is left child */
1576  SCIP_BTNODE* node /**< node */
1577  );
1578 
1579 /** returns TRUE if the given node is right child */
1582  SCIP_BTNODE* node /**< node */
1583  );
1584 
1585 #ifdef NDEBUG
1586 
1587 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1588  * speed up the algorithms.
1589  */
1590 
1591 #define SCIPbtnodeGetData(node) ((node)->dataptr)
1592 #define SCIPbtnodeGetParent(node) ((node)->parent)
1593 #define SCIPbtnodeGetLeftchild(node) ((node)->left)
1594 #define SCIPbtnodeGetRightchild(node) ((node)->right)
1595 #define SCIPbtnodeGetSibling(node) ((node)->parent == NULL ? NULL : \
1596  (node)->parent->left == (node) ? (node)->parent->right : (node)->parent->left)
1597 #define SCIPbtnodeIsRoot(node) ((node)->parent == NULL)
1598 #define SCIPbtnodeIsLeaf(node) ((node)->left == NULL && (node)->right == NULL)
1599 #define SCIPbtnodeIsLeftchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->left == (node) ? TRUE : FALSE)
1600 #define SCIPbtnodeIsRightchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->right == (node) ? TRUE : FALSE)
1601 
1602 #endif
1603 
1604 /** sets the give node data
1605  *
1606  * @note The old user pointer is not freed.
1607  */
1609 void SCIPbtnodeSetData(
1610  SCIP_BTNODE* node, /**< node */
1611  void* dataptr /**< node user data pointer */
1612  );
1613 
1614 /** sets parent node
1615  *
1616  * @note The old parent including the rooted subtree is not delete.
1617  */
1619 void SCIPbtnodeSetParent(
1620  SCIP_BTNODE* node, /**< node */
1621  SCIP_BTNODE* parent /**< new parent node, or NULL */
1622  );
1623 
1624 /** sets left child
1625  *
1626  * @note The old left child including the rooted subtree is not delete.
1627  */
1630  SCIP_BTNODE* node, /**< node */
1631  SCIP_BTNODE* left /**< new left child, or NULL */
1632  );
1633 
1634 /** sets right child
1635  *
1636  * @note The old right child including the rooted subtree is not delete.
1637  */
1640  SCIP_BTNODE* node, /**< node */
1641  SCIP_BTNODE* right /**< new right child, or NULL */
1642  );
1643 
1644 /** creates an binary tree */
1647  SCIP_BT** tree, /**< pointer to store the created binary tree */
1648  BMS_BLKMEM* blkmem /**< block memory used to create nodes */
1649  );
1650 
1651 /** frees binary tree
1652  *
1653  * @note The user pointers (object) of the search nodes are not freed. If needed, it has to be done by the user.
1654  */
1656 void SCIPbtFree(
1657  SCIP_BT** tree /**< pointer to binary tree */
1658  );
1659 
1660 /** prints the binary tree in GML format into the given file */
1662 void SCIPbtPrintGml(
1663  SCIP_BT* tree, /**< binary tree */
1664  FILE* file /**< file to write to */
1665  );
1666 
1667 /** returns whether the binary tree is empty (has no nodes) */
1670  SCIP_BT * tree /**< binary tree */
1671  );
1672 
1673 /** returns the root node of the binary tree or NULL if the binary tree is empty */
1676  SCIP_BT* tree /**< tree to be evaluated */
1677  );
1678 
1679 #ifdef NDEBUG
1680 
1681 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1682  * speed up the algorithms.
1683  */
1684 
1685 #define SCIPbtIsEmpty(tree) (tree->root == NULL)
1686 #define SCIPbtGetRoot(tree) (tree->root)
1687 
1688 #endif
1689 
1690 /** sets root node
1691  *
1692  * @note The old root including the rooted subtree is not delete.
1693  */
1695 void SCIPbtSetRoot(
1696  SCIP_BT* tree, /**< tree to be evaluated */
1697  SCIP_BTNODE* root /**< new root, or NULL */
1698  );
1699 
1700 /**@} */
1701 
1702 /**@addtogroup DisjointSet
1703  *
1704  * @{
1705  */
1706 
1707 /*
1708  * disjoint set data structure
1709  */
1710 
1711 /** clears the disjoint set (union find) structure \p djset */
1714  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1715  );
1716 
1717 /** finds and returns the component identifier of this \p element */
1720  SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1721  int element /**< element to be found */
1722  );
1723 
1724 /** merges the components containing the elements \p p and \p q */
1727  SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1728  int p, /**< first element */
1729  int q, /**< second element */
1730  SCIP_Bool forcerepofp /**< force representative of p to be new representative */
1731  );
1732 
1733 /** returns the number of independent components in this disjoint set (union find) data structure */
1736  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1737  );
1738 
1739 /** returns the size (number of nodes) of this disjoint set (union find) data structure */
1742  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1743  );
1744 
1745 /** @} */
1746 
1747 /*
1748  * Numerical methods
1749  */
1750 
1751 /**@defgroup NumericalMethods Numerical Methods
1752  * @ingroup MiscellaneousMethods
1753  * @brief commonly used numerical methods
1754  *
1755  * @{
1756  */
1757 
1758 /** returns the machine epsilon: the smallest number eps > 0, for which 1.0 + eps > 1.0 */
1761  void
1762  );
1763 
1764 /** returns the next representable value of from in the direction of to */
1767  SCIP_Real from, /**< value from which the next representable value should be returned */
1768  SCIP_Real to /**< direction in which the next representable value should be returned */
1769  );
1770 
1771 /** calculates the greatest common divisor of the two given values */
1774  SCIP_Longint val1, /**< first value of greatest common devisor calculation */
1775  SCIP_Longint val2 /**< second value of greatest common devisor calculation */
1776  );
1777 
1778 /** calculates the smallest common multiple of the two given values */
1781  SCIP_Longint val1, /**< first value of smallest common multiple calculation */
1782  SCIP_Longint val2 /**< second value of smallest common multiple calculation */
1783  );
1784 
1785 /** calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because
1786  * the n=33 is the last line in the Pascal's triangle where each entry fits in a 4 byte value), an error occurs due to
1787  * big numbers or an negative value m (and m < n) and -1 will be returned
1788  */
1791  int n, /**< number of different elements */
1792  int m /**< number to choose out of the above */
1793  );
1794 
1795 /** converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was
1796  * successful
1797  */
1800  SCIP_Real val, /**< real value r to convert into rational number */
1801  SCIP_Real mindelta, /**< minimal allowed difference r - q of real r and rational q = n/d */
1802  SCIP_Real maxdelta, /**< maximal allowed difference r - q of real r and rational q = n/d */
1803  SCIP_Longint maxdnom, /**< maximal denominator allowed */
1804  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1805  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1806  );
1807 
1808 /** tries to find a value, such that all given values, if scaled with this value become integral in relative allowed
1809  * difference in between mindelta and maxdelta
1810  */
1813  SCIP_Real* vals, /**< values to scale */
1814  int nvals, /**< number of values to scale */
1815  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
1816  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
1817  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
1818  SCIP_Real maxscale, /**< maximal allowed scalar */
1819  SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
1820  SCIP_Bool* success /**< stores whether returned value is valid */
1821  );
1822 
1823 /** given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small
1824  * number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational
1825  * number inside the interval was found
1826  */
1829  SCIP_Real lb, /**< lower bound of the interval */
1830  SCIP_Real ub, /**< upper bound of the interval */
1831  SCIP_Longint maxdnom, /**< maximal denominator allowed for resulting rational number */
1832  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1833  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1834  );
1835 
1836 /** given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number
1837  * with simple denominator (i.e. a small number, probably multiplied with powers of 10);
1838  * if no valid rational number inside the interval was found, selects the central value of the interval
1839  */
1842  SCIP_Real lb, /**< lower bound of the interval */
1843  SCIP_Real ub, /**< upper bound of the interval */
1844  SCIP_Longint maxdnom /**< maximal denominator allowed for resulting rational number */
1845  );
1846 
1847 /* The C99 standard defines the function (or macro) isfinite.
1848  * On MacOS X, isfinite is also available.
1849  * From the BSD world, there comes a function finite.
1850  * On SunOS, finite is also available.
1851  * In the MS compiler world, there is a function _finite.
1852  * As last resort, we check whether x == x does not hold, but this works only for NaN's, not for infinities!
1853  */
1854 #if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__)
1855 #define SCIPisFinite isfinite
1856 #elif defined(_BSD_SOURCE) || defined(__sun)
1857 #define SCIPisFinite finite
1858 #elif defined(_MSC_VER)
1859 #define SCIPisFinite _finite
1860 #else
1861 #define SCIPisFinite(x) ((x) == (x))
1862 #endif
1863 
1864 /* In debug mode, the following methods are implemented as function calls to ensure
1865  * type validity.
1866  */
1867 
1868 /** returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0) */
1871  SCIP_Real val1, /**< first value to be compared */
1872  SCIP_Real val2 /**< second value to be compared */
1873  );
1874 
1875 #ifdef NDEBUG
1876 
1877 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1878  * speed up the algorithms.
1879  */
1880 
1881 #define SCIPrelDiff(val1, val2) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) )
1882 
1883 #endif
1884 
1885 /** computes the gap from the primal and the dual bound */
1888  SCIP_Real eps, /**< the value treated as zero */
1889  SCIP_Real inf, /**< the value treated as infinity */
1890  SCIP_Real primalbound, /**< the primal bound */
1891  SCIP_Real dualbound /**< the dual bound */
1892  );
1893 
1894 /**@} */
1895 
1896 
1897 /*
1898  * Random Numbers
1899  */
1900 
1901 /**@defgroup RandomNumbers Random Numbers
1902  * @ingroup MiscellaneousMethods
1903  * @brief structures and methods for pseudo random number generation
1904  *
1905  *@{
1906  */
1907 
1908 /** returns a random integer between minrandval and maxrandval
1909  *
1910  * @deprecated Please use SCIPrandomGetInt() to request a random integer.
1911  */
1913 int SCIPgetRandomInt(
1914  int minrandval, /**< minimal value to return */
1915  int maxrandval, /**< maximal value to return */
1916  unsigned int* seedp /**< pointer to seed value */
1917  );
1918 
1919 
1920 /** returns a random integer between minrandval and maxrandval */
1922 int SCIPrandomGetInt(
1923  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1924  int minrandval, /**< minimal value to return */
1925  int maxrandval /**< maximal value to return */
1926  );
1927 
1928 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1929  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1930  */
1933  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1934  void** set, /**< original set, from which elements should be drawn */
1935  int nelems, /**< number of elements in original set */
1936  void** subset, /**< subset in which drawn elements should be stored */
1937  int nsubelems /**< number of elements that should be drawn and stored */
1938  );
1939 
1940 /** returns a random real between minrandval and maxrandval */
1943  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1944  SCIP_Real minrandval, /**< minimal value to return */
1945  SCIP_Real maxrandval /**< maximal value to return */
1946  );
1947 
1948 /** returns a random real between minrandval and maxrandval
1949  *
1950  * @deprecated Please use SCIPrandomGetReal() to request a random real.
1951  */
1954  SCIP_Real minrandval, /**< minimal value to return */
1955  SCIP_Real maxrandval, /**< maximal value to return */
1956  unsigned int* seedp /**< pointer to seed value */
1957  );
1958 
1959 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1960  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1961  *
1962  * @deprecated Please use SCIPrandomGetSubset()
1963  */
1966  void** set, /**< original set, from which elements should be drawn */
1967  int nelems, /**< number of elements in original set */
1968  void** subset, /**< subset in which drawn elements should be stored */
1969  int nsubelems, /**< number of elements that should be drawn and stored */
1970  unsigned int randseed /**< seed value for random generator */
1971  );
1972 
1973 
1974 /**@} */
1975 
1976 /*
1977  * Permutations / Shuffling
1978  */
1979 
1980 /**@defgroup PermutationsShuffling Permutations Shuffling
1981  * @ingroup MiscellaneousMethods
1982  * @brief methods for shuffling arrays
1983  *
1984  * @{
1985  */
1986 
1987 /** swaps two ints */
1989 void SCIPswapInts(
1990  int* value1, /**< pointer to first integer */
1991  int* value2 /**< pointer to second integer */
1992  );
1993 
1994 /** swaps two real values */
1996 void SCIPswapReals(
1997  SCIP_Real* value1, /**< pointer to first real value */
1998  SCIP_Real* value2 /**< pointer to second real value */
1999 );
2000 
2001 /** swaps the addresses of two pointers */
2003 void SCIPswapPointers(
2004  void** pointer1, /**< first pointer */
2005  void** pointer2 /**< second pointer */
2006  );
2007 
2008 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm
2009  *
2010  * @deprecated Please use SCIPrandomPermuteIntArray()
2011  */
2013 void SCIPpermuteIntArray(
2014  int* array, /**< array to be shuffled */
2015  int begin, /**< first included index that should be subject to shuffling
2016  * (0 for first array entry)
2017  */
2018  int end, /**< first excluded index that should not be subject to shuffling
2019  * (array size for last array entry)
2020  */
2021  unsigned int* randseed /**< seed value for the random generator */
2022  );
2023 
2024 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm */
2027  SCIP_RANDNUMGEN* randgen, /**< random number generator */
2028  int* array, /**< array to be shuffled */
2029  int begin, /**< first included index that should be subject to shuffling
2030  * (0 for first array entry)
2031  */
2032  int end /**< first excluded index that should not be subject to shuffling
2033  * (array size for last array entry)
2034  */
2035  );
2036 
2037 /** randomly shuffles parts of an array using the Fisher-Yates algorithm */
2040  SCIP_RANDNUMGEN* randgen, /**< random number generator */
2041  void** array, /**< array to be shuffled */
2042  int begin, /**< first included index that should be subject to shuffling
2043  * (0 for first array entry)
2044  */
2045  int end /**< first excluded index that should not be subject to shuffling
2046  * (array size for last array entry)
2047  */
2048  );
2049 
2050 /** randomly shuffles parts of an array using the Fisher-Yates algorithm
2051  *
2052  * @deprecated Please use SCIPrandomPermuteArray()
2053  */
2055 void SCIPpermuteArray(
2056  void** array, /**< array to be shuffled */
2057  int begin, /**< first included index that should be subject to shuffling
2058  * (0 for first array entry)
2059  */
2060  int end, /**< first excluded index that should not be subject to shuffling
2061  * (array size for last array entry)
2062  */
2063  unsigned int* randseed /**< pointer to seed value for the random generator */
2064  );
2065 
2066 /**@} */
2067 
2068 
2069 /*
2070  * Arrays
2071  */
2072 
2073 /**@defgroup Arrays Arrays
2074  * @ingroup MiscellaneousMethods
2075  * @brief miscellaneous methods for arrays
2076  *
2077  * @{
2078  */
2079 
2080 
2081 /** computes set intersection (duplicates removed) of two arrays that are ordered ascendingly */
2084  int* array1, /**< first array (in ascending order) */
2085  int narray1, /**< number of entries of first array */
2086  int* array2, /**< second array (in ascending order) */
2087  int narray2, /**< number of entries of second array */
2088  int* intersectarray, /**< intersection of array1 and array2
2089  * (note: it is possible to use array1 for this input argument) */
2090  int* nintersectarray /**< pointer to store number of entries of intersection array
2091  * (note: it is possible to use narray1 for this input argument) */
2092  );
2093 
2094 /** computes set difference (duplicates removed) of two arrays that are ordered ascendingly */
2097  int* array1, /**< first array (in ascending order) */
2098  int narray1, /**< number of entries of first array */
2099  int* array2, /**< second array (in ascending order) */
2100  int narray2, /**< number of entries of second array */
2101  int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
2102  * (note: it is possible to use array1 for this input argument) */
2103  int* nsetminusarray /**< pointer to store number of entries of setminus array
2104  * (note: it is possible to use narray1 for this input argument) */
2105  );
2106 
2107 /**@} */
2108 
2109 
2110 /*
2111  * Strings
2112  */
2113 
2114 /**@defgroup StringMethods String Methods
2115  * @ingroup MiscellaneousMethods
2116  * @brief commonly used methods for strings
2117  *
2118  *@{
2119  */
2120 
2121 /** copies characters from 'src' to 'dest', copying is stopped when either the 'stop' character is reached or after
2122  * 'cnt' characters have been copied, whichever comes first.
2123  *
2124  * @note undefined behaviuor on overlapping arrays
2125  */
2127 int SCIPmemccpy(
2128  char* dest, /**< destination pointer to copy to */
2129  const char* src, /**< source pointer to copy to */
2130  char stop, /**< character when found stop copying */
2131  unsigned int cnt /**< maximal number of characters to copy too */
2132  );
2133 
2134 /** prints an error message containing of the given string followed by a string describing the current system error;
2135  * prefers to use the strerror_r method, which is threadsafe; on systems where this method does not exist,
2136  * NO_STRERROR_R should be defined (see INSTALL), in this case, srerror is used which is not guaranteed to be
2137  * threadsafe (on SUN-systems, it actually is)
2138  */
2140 void SCIPprintSysError(
2141  const char* message /**< first part of the error message, e.g. the filename */
2142  );
2143 
2144 /** extracts tokens from strings - wrapper method for strtok_r() */
2146 char* SCIPstrtok(
2147  char* s, /**< string to parse */
2148  const char* delim, /**< delimiters for parsing */
2149  char** ptrptr /**< pointer to working char pointer - must stay the same while parsing */
2150  );
2151 
2152 /** translates the given string into a string where symbols ", ', and spaces are escaped with a \ prefix */
2154 void SCIPescapeString(
2155  char* t, /**< target buffer to store escaped string */
2156  int bufsize, /**< size of buffer t */
2157  const char* s /**< string to transform into escaped string */
2158  );
2159 
2160 /** safe version of snprintf */
2162 int SCIPsnprintf(
2163  char* t, /**< target string */
2164  int len, /**< length of the string to copy */
2165  const char* s, /**< source string */
2166  ... /**< further parameters */
2167  );
2168 
2169 /** safe version of strncpy
2170  *
2171  * Copies string in s to t using at most @a size-1 nonzero characters (strncpy copies size characters). It always adds
2172  * a terminating zero char. Does not pad the remaining string with zero characters (unlike strncpy). Returns the number
2173  * of copied nonzero characters, if the length of s is at most size - 1, and returns size otherwise. Thus, the original
2174  * string was truncated if the return value is size.
2175  */
2177 int SCIPstrncpy(
2178  char* t, /**< target string */
2179  const char* s, /**< source string */
2180  int size /**< maximal size of t */
2181  );
2182 
2183 /** extract the next token as a integer value if it is one; in case no value is parsed the endptr is set to @p str
2184  *
2185  * @return Returns TRUE if a value could be extracted, otherwise FALSE
2186  */
2189  const char* str, /**< string to search */
2190  int* value, /**< pointer to store the parsed value */
2191  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2192  );
2193 
2194 /** extract the next token as a double value if it is one; in case a value is parsed the endptr is set to @p str
2195  *
2196  * @return Returns TRUE if a value could be extracted, otherwise FALSE
2197  */
2200  const char* str, /**< string to search */
2201  SCIP_Real* value, /**< pointer to store the parsed value */
2202  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2203  );
2204 
2205 /** copies the first size characters between a start and end character of str into token, if no error occurred endptr
2206  * will point to the position after the read part, otherwise it will point to @p str
2207  */
2209 void SCIPstrCopySection(
2210  const char* str, /**< string to search */
2211  char startchar, /**< character which defines the beginning */
2212  char endchar, /**< character which defines the ending */
2213  char* token, /**< string to store the copy */
2214  int size, /**< size of the token char array */
2215  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2216  );
2217 
2218 /** checks whether a given string t appears at the beginning of the string s (up to spaces at beginning) */
2221  const char* s, /**< string to search in */
2222  const char* t, /**< string to search for */
2223  size_t tlen /**< length of t */
2224 );
2225 
2226 /**@} */
2227 
2228 /*
2229  * File methods
2230  */
2231 
2232 /**@defgroup FileMethods File Methods
2233  * @ingroup MiscellaneousMethods
2234  * @brief commonly used file methods
2235  *
2236  * @{
2237  */
2238 
2239 /** returns, whether the given file exists */
2242  const char* filename /**< file name */
2243  );
2244 
2245 /** splits filename into path, name, and extension */
2247 void SCIPsplitFilename(
2248  char* filename, /**< filename to split; is destroyed (but not freed) during process */
2249  char** path, /**< pointer to store path, or NULL if not needed */
2250  char** name, /**< pointer to store name, or NULL if not needed */
2251  char** extension, /**< pointer to store extension, or NULL if not needed */
2252  char** compression /**< pointer to store compression extension, or NULL if not needed */
2253  );
2254 
2255 /**@} */
2256 
2257 #ifdef __cplusplus
2258 }
2259 #endif
2260 
2261 #endif
SCIP_EXPORT int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:7042
SCIP_EXPORT int SCIPcalcMultihashSize(int minsize)
Definition: misc.c:1578
SCIP_EXPORT SCIP_RETCODE SCIPqueueInsertUInt(SCIP_QUEUE *queue, unsigned int elem)
Definition: misc.c:1046
SCIP_EXPORT void ** SCIPdigraphGetSuccessorsData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7739
SCIP_EXPORT SCIP_Real SCIPstudentTGetCriticalValue(SCIP_CONFIDENCELEVEL clevel, int df)
Definition: misc.c:96
SCIP_EXPORT SCIP_Longint SCIPcalcBinomCoef(int n, int m)
Definition: misc.c:10123
SCIP_EXPORT void * SCIPpqueueRemove(SCIP_PQUEUE *pqueue)
Definition: misc.c:1434
SCIP_EXPORT void SCIPescapeString(char *t, int bufsize, const char *s)
Definition: misc.c:10576
SCIP_EXPORT SCIP_Bool SCIPmultihashExists(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2090
SCIP_EXPORT SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3096
SCIP_EXPORT SCIP_RETCODE SCIPrandomGetSubset(SCIP_RANDNUMGEN *randgen, void **set, int nelems, void **subset, int nsubelems)
Definition: misc.c:10062
SCIP_EXPORT void SCIPgmlWriteEdge(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:585
SCIP_EXPORT SCIP_BTNODE * SCIPbtnodeGetRightchild(SCIP_BTNODE *node)
Definition: misc.c:8717
SCIP_EXPORT SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2519
SCIP_EXPORT int SCIPhashtableGetNEntries(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2717
SCIP_EXPORT int SCIPqueueNElems(SCIP_QUEUE *queue)
Definition: misc.c:1188
SCIP_EXPORT void SCIPpqueueFree(SCIP_PQUEUE **pqueue)
Definition: misc.c:1263
SCIP_EXPORT unsigned int SCIPqueueRemoveUInt(SCIP_QUEUE *queue)
Definition: misc.c:1105
SCIP_EXPORT SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2487
SCIP_EXPORT void SCIPpqueueDelPos(SCIP_PQUEUE *pqueue, int pos)
Definition: misc.c:1374
SCIP_EXPORT SCIP_Real SCIPcalcMachineEpsilon(void)
Definition: misc.c:8999
SCIP_EXPORT int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
Definition: misc.c:7648
SCIP_EXPORT int SCIPactivityGetDuration(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6598
internal miscellaneous methods for linear constraints
SCIP_EXPORT int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8186
SCIP_EXPORT void SCIPhashsetRemoveAll(SCIP_HASHSET *hashset)
Definition: misc.c:3956
type definitions for miscellaneous datastructures
SCIP_EXPORT void * SCIPmultihashRetrieveNext(SCIP_MULTIHASH *multihash, SCIP_MULTIHASHLIST **multihashlist, void *key)
Definition: misc.c:2054
SCIP_EXPORT void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition: misc.c:1454
SCIP_EXPORT SCIP_BTNODE * SCIPbtnodeGetSibling(SCIP_BTNODE *node)
Definition: misc.c:8727
static void message(unsigned int type, const CURF *curf, const char *msg,...)
Definition: grphload.c:317
SCIP_EXPORT SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:10807
SCIP_EXPORT SCIP_BTNODE * SCIPbtnodeGetLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8707
SCIP_EXPORT int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6761
SCIP_EXPORT int SCIPdisjointsetFind(SCIP_DISJOINTSET *djset, int element)
Definition: misc.c:10997
SCIP_EXPORT void * SCIPhashtableGetEntry(SCIP_HASHTABLE *hashtable, int entryidx)
Definition: misc.c:2725
SCIP_EXPORT int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition: misc.c:3473
SCIP_EXPORT SCIP_Longint SCIPhashtableGetNElements(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2707
SCIP_EXPORT int SCIPdisjointsetGetSize(SCIP_DISJOINTSET *djset)
Definition: misc.c:11104
SCIP_EXPORT SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition: misc.c:1020
SCIP_EXPORT SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2599
SCIP_EXPORT SCIP_RETCODE SCIPcomputeArraysSetminus(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition: misc.c:10431
SCIP_EXPORT void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2548
SCIP_EXPORT void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:810
SCIP_EXPORT void SCIPpermuteArray(void **array, int begin, int end, unsigned int *randseed)
Definition: misc.c:10282
SCIP_EXPORT SCIP_RETCODE SCIPregressionCreate(SCIP_REGRESSION **regression)
Definition: misc.c:406
SCIP_EXPORT SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
Definition: misc.c:8331
SCIP_EXPORT SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9022
SCIP_EXPORT SCIP_RETCODE SCIPmultihashSafeInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2006
#define SCIP_EXPORT
Definition: def.h:100
SCIP_EXPORT SCIP_Real SCIPcomputeTwoSampleTTestValue(SCIP_Real meanx, SCIP_Real meany, SCIP_Real variancex, SCIP_Real variancey, SCIP_Real countx, SCIP_Real county)
Definition: misc.c:113
#define INLINE
Definition: def.h:109
SCIP_EXPORT SCIP_Bool SCIPbtnodeIsLeaf(SCIP_BTNODE *node)
Definition: misc.c:8757
SCIP_EXPORT SCIP_BTNODE * SCIPbtnodeGetParent(SCIP_BTNODE *node)
Definition: misc.c:8697
SCIP_EXPORT SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3132
SCIP_EXPORT SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition: misc.c:8859
SCIP_EXPORT void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition: misc.c:1071
SCIP_EXPORT void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition: misc.c:10735
SCIP_EXPORT void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3510
SCIP_EXPORT SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition: misc.c:9981
miscellaneous datastructures
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:54
SCIP_EXPORT int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7706
SCIP_EXPORT SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
Definition: misc.c:2782
SCIP_EXPORT int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1468
SCIP_EXPORT void * SCIPmultihashRetrieve(SCIP_MULTIHASH *multihash, void *key)
Definition: misc.c:2025
SCIP_EXPORT SCIP_RETCODE SCIPdigraphAddArcSafe(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7595
SCIP_EXPORT void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition: misc.c:7470
SCIP_EXPORT void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3201
SCIP_EXPORT void SCIPhashtableClear(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2338
SCIP_EXPORT int SCIPhashmapEntryGetImageInt(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3520
SCIP_EXPORT void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
Definition: misc.c:10219
SCIP_EXPORT SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2617
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_RETCODE SCIPmultihashInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1965
SCIP_EXPORT void SCIPqueueClear(SCIP_QUEUE *queue)
Definition: misc.c:969
SCIP_EXPORT void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8525
SCIP_EXPORT SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:790
SCIP_EXPORT char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
Definition: misc.c:10562
SCIP_EXPORT SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition: misc.c:7316
SCIP_EXPORT void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3500
SCIP_EXPORT SCIP_Real SCIPmultihashGetLoad(SCIP_MULTIHASH *multihash)
Definition: misc.c:2182
SCIP_EXPORT void SCIPprofilePrint(SCIP_PROFILE *profile, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:6687
SCIP_VAR ** x
Definition: circlepacking.c:54
SCIP_EXPORT void SCIPpqueueClear(SCIP_PQUEUE *pqueue)
Definition: misc.c:1274
real eps
SCIP_EXPORT void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition: misc.c:8687
SCIP_EXPORT void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition: misc.c:8806
SCIP_EXPORT SCIP_Real SCIPerf(SCIP_Real x)
Definition: misc.c:146
SCIP_EXPORT SCIP_Bool SCIPbtnodeIsLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8767
SCIP_EXPORT void SCIPgmlWriteOpening(FILE *file, SCIP_Bool directed)
Definition: misc.c:673
SCIP_EXPORT void SCIPgmlWriteArc(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:629
SCIP_EXPORT SCIP_RETCODE SCIPhashtableCreate(SCIP_HASHTABLE **hashtable, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:2236
SCIP_EXPORT SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition: misc.c:264
SCIP_EXPORT int SCIPregressionGetNObservations(SCIP_REGRESSION *regression)
Definition: misc.c:244
SCIP_EXPORT int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3221
SCIP_EXPORT void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:339
SCIP_EXPORT SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:1175
SCIP_EXPORT SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3363
SCIP_EXPORT SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition: misc.c:7991
SCIP_EXPORT int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6719
SCIP_EXPORT SCIP_Bool SCIPhashsetExists(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3757
SCIP_EXPORT SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition: misc.c:3489
SCIP_EXPORT SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition: misc.c:10912
enum SCIP_Confidencelevel SCIP_CONFIDENCELEVEL
Definition: type_misc.h:44
SCIP_EXPORT void SCIPregressionReset(SCIP_REGRESSION *regression)
Definition: misc.c:390
SCIP_EXPORT int SCIPstrncpy(char *t, const char *s, int size)
Definition: misc.c:10647
SCIP_EXPORT void SCIPhashsetPrintStatistics(SCIP_HASHSET *hashset, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3873
SCIP_EXPORT int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6608
SCIP_EXPORT SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition: misc.c:10705
SCIP_EXPORT SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition: misc.c:6543
SCIP_EXPORT SCIP_Real SCIPregressionGetSlope(SCIP_REGRESSION *regression)
Definition: misc.c:254
SCIP_EXPORT int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition: misc.c:6709
SCIP_EXPORT void SCIPdisjointsetUnion(SCIP_DISJOINTSET *djset, int p, int q, SCIP_Bool forcerepofp)
Definition: misc.c:11024
SCIP_EXPORT int SCIPhashsetGetNSlots(SCIP_HASHSET *hashset)
Definition: misc.c:3940
SCIP_EXPORT void SCIPmultihashPrintStatistics(SCIP_MULTIHASH *multihash, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2192
static INLINE uint32_t SCIPrealHashCode(double x)
Definition: pub_misc.h:534
SCIP_EXPORT int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition: misc.c:3481
SCIP_EXPORT void SCIPbtPrintGml(SCIP_BT *tree, FILE *file)
Definition: misc.c:8930
SCIP_EXPORT void SCIPbtnodeFree(SCIP_BT *tree, SCIP_BTNODE **node)
Definition: misc.c:8642
SCIP_EXPORT SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:800
SCIP_EXPORT int SCIPdisjointsetGetComponentCount(SCIP_DISJOINTSET *djset)
Definition: misc.c:11094
SCIP_EXPORT SCIP_RETCODE SCIPmultihashCreate(SCIP_MULTIHASH **multihash, BMS_BLKMEM *blkmem, int tablesize, SCIP_DECL_HASHGETKEY((*hashgetkey)), SCIP_DECL_HASHKEYEQ((*hashkeyeq)), SCIP_DECL_HASHKEYVAL((*hashkeyval)), void *userptr)
Definition: misc.c:1901
SCIP_EXPORT SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:833
SCIP_EXPORT void SCIPhashmapEntrySetImageReal(SCIP_HASHMAPENTRY *entry, SCIP_Real image)
Definition: misc.c:3562
SCIP_EXPORT void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition: misc.c:10823
SCIP_EXPORT SCIP_RETCODE SCIPhashmapInsertReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3168
SCIP_EXPORT void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition: misc.c:8199
SCIP_EXPORT void SCIPswapInts(int *value1, int *value2)
Definition: misc.c:10206
SCIP_EXPORT SCIP_Real SCIPnormalCDF(SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
Definition: misc.c:186
type definitions for problem variables
Definition: grphload.c:88
SCIP_EXPORT SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition: misc.c:934
SCIP_EXPORT SCIP_Bool SCIPstrAtStart(const char *s, const char *t, size_t tlen)
Definition: misc.c:11114
SCIP_EXPORT SCIP_Bool SCIPfindSimpleRational(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:9672
SCIP_EXPORT void SCIPhashsetFree(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
Definition: misc.c:3730
SCIP_EXPORT SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2734
SCIP_EXPORT int SCIPpqueueFind(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1490
SCIP_EXPORT SCIP_RETCODE SCIPhashsetCreate(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
Definition: misc.c:3699
SCIP_EXPORT int SCIPrandomGetInt(SCIP_RANDNUMGEN *randgen, int minrandval, int maxrandval)
Definition: misc.c:9959
SCIP_EXPORT void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2286
SCIP_EXPORT void SCIPdisjointsetClear(SCIP_DISJOINTSET *djset)
Definition: misc.c:10980
#define SCIP_Bool
Definition: def.h:70
SCIP_EXPORT SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6588
SCIP_EXPORT SCIP_RETCODE SCIPhashsetRemove(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3798
SCIP_EXPORT SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3014
SCIP_EXPORT SCIP_Bool SCIPbtnodeIsRoot(SCIP_BTNODE *node)
Definition: misc.c:8747
SCIP_EXPORT SCIP_RETCODE SCIPgetRandomSubset(void **set, int nelems, void **subset, int nsubelems, unsigned int randseed)
Definition: misc.c:10316
SCIP_EXPORT void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
Definition: misc.c:756
SCIP_EXPORT SCIP_RETCODE SCIPprofileDeleteCore(SCIP_PROFILE *profile, int left, int right, int height)
Definition: misc.c:6952
SCIP_EXPORT int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7721
SCIP_EXPORT void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition: misc.c:6562
SCIP_EXPORT int SCIPprofileGetTime(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6749
SCIP_EXPORT void SCIPbtSetRoot(SCIP_BT *tree, SCIP_BTNODE *root)
Definition: misc.c:8983
SCIP_EXPORT SCIP_Bool SCIPrealToRational(SCIP_Real val, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:9295
SCIP_EXPORT SCIP_Bool SCIPprofileFindLeft(SCIP_PROFILE *profile, int timepoint, int *pos)
Definition: misc.c:6775
SCIP_EXPORT void SCIPgmlWriteClosing(FILE *file)
Definition: misc.c:689
SCIP_EXPORT void SCIPmultihashFree(SCIP_MULTIHASH **multihash)
Definition: misc.c:1934
SCIP_EXPORT SCIP_RETCODE SCIPdigraphSetNSuccessors(SCIP_DIGRAPH *digraph, int node, int nsuccessors)
Definition: misc.c:7632
SCIP_EXPORT SCIP_RETCODE SCIPbtnodeCreate(SCIP_BT *tree, SCIP_BTNODE **node, void *dataptr)
Definition: misc.c:8578
static const unsigned int randseed
Definition: circle.c:46
SCIP_EXPORT void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randgen, int *array, int begin, int end)
Definition: misc.c:10000
SCIP_EXPORT SCIP_Bool SCIPbtIsEmpty(SCIP_BT *tree)
Definition: misc.c:8960
SCIP_EXPORT SCIP_Real SCIPhashmapEntryGetImageReal(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3530
#define SCIP_DECL_PQUEUEELEMCHGPOS(x)
Definition: type_misc.h:184
SCIP_EXPORT unsigned int SCIPqueueFirstUInt(SCIP_QUEUE *queue)
Definition: misc.c:1157
SCIP_EXPORT SCIP_Bool SCIPhashsetIsEmpty(SCIP_HASHSET *hashset)
Definition: misc.c:3924
SCIP_EXPORT SCIP_RETCODE SCIPdigraphSetSizes(SCIP_DIGRAPH *digraph, int *sizes)
Definition: misc.c:7446
SCIP_EXPORT int * SCIPprofileGetLoads(SCIP_PROFILE *profile)
Definition: misc.c:6739
SCIP_EXPORT SCIP_BTNODE * SCIPbtGetRoot(SCIP_BT *tree)
Definition: misc.c:8970
SCIP_EXPORT SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3573
SCIP_EXPORT SCIP_Real SCIPcomputeGap(SCIP_Real eps, SCIP_Real inf, SCIP_Real primalbound, SCIP_Real dualbound)
Definition: misc.c:10930
SCIP_EXPORT void SCIPswapPointers(void **pointer1, void **pointer2)
Definition: misc.c:10232
SCIP_EXPORT void SCIPregressionFree(SCIP_REGRESSION **regression)
Definition: misc.c:422
SCIP_EXPORT SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
Definition: misc.c:9265
SCIP_EXPORT SCIP_VAR ** SCIPsparseSolGetVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:770
SCIP_EXPORT SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3241
SCIP_EXPORT void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3425
SCIP_EXPORT void SCIPpermuteIntArray(int *array, int begin, int end, unsigned int *randseed)
Definition: misc.c:10248
SCIP_EXPORT int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int lb, int ub, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:7191
methods for sorting joint arrays of various types
SCIP_EXPORT void SCIPmultihashRemoveAll(SCIP_MULTIHASH *multihash)
Definition: misc.c:2151
SCIP_EXPORT int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition: misc.c:7688
SCIP_EXPORT SCIP_RETCODE SCIPpqueueCreate(SCIP_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)))
Definition: misc.c:1236
SCIP_EXPORT void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1479
SCIP_EXPORT SCIP_RETCODE SCIPhashsetInsert(SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
Definition: misc.c:3740
SCIP_EXPORT SCIP_RETCODE SCIPmultihashRemove(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2117
SCIP_EXPORT int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6729
SCIP_EXPORT SCIP_RETCODE SCIPdigraphGetArticulationPoints(SCIP_DIGRAPH *digraph, int **articulations, int *narticulations)
Definition: misc.c:7902
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:172
SCIP_EXPORT void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2695
SCIP_EXPORT void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition: misc.c:8820
SCIP_EXPORT int SCIPgetRandomInt(int minrandval, int maxrandval, unsigned int *seedp)
Definition: misc.c:9842
SCIP_EXPORT void SCIPgmlWriteNodeWeight(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor, SCIP_Real weight)
Definition: misc.c:535
SCIP_EXPORT SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
Definition: misc.c:2791
SCIP_EXPORT void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition: misc.c:8834
SCIP_EXPORT void SCIPprofileFree(SCIP_PROFILE **profile)
Definition: misc.c:6671
SCIP_EXPORT int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6618
SCIP_EXPORT int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10604
SCIP_EXPORT void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2744
SCIP_EXPORT void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7658
SCIP_EXPORT void SCIPbtnodeSetRightchild(SCIP_BTNODE *node, SCIP_BTNODE *right)
Definition: misc.c:8848
SCIP_EXPORT SCIP_Real SCIPgetRandomReal(SCIP_Real minrandval, SCIP_Real maxrandval, unsigned int *seedp)
Definition: misc.c:9855
SCIP_EXPORT void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3048
SCIP_EXPORT SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
Definition: misc.c:9719
SCIP_EXPORT void SCIPdigraphPrintGml(SCIP_DIGRAPH *digraph, FILE *file)
Definition: misc.c:8486
#define SCIP_Real
Definition: def.h:163
SCIP_VAR ** y
Definition: circlepacking.c:55
SCIP_EXPORT SCIP_Bool SCIPbtnodeIsRightchild(SCIP_BTNODE *node)
Definition: misc.c:8785
SCIP_EXPORT SCIP_RETCODE SCIPcomputeArraysIntersection(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition: misc.c:10375
SCIP_EXPORT SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8120
SCIP_EXPORT void SCIPhashmapEntrySetImageInt(SCIP_HASHMAPENTRY *entry, int image)
Definition: misc.c:3551
SCIP_EXPORT void SCIPprintSysError(const char *message)
Definition: misc.c:10513
#define SCIP_Longint
Definition: def.h:148
SCIP_EXPORT SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard)
Definition: misc.c:2810
type definitions for message output methods
SCIP_EXPORT void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8451
#define nnodes
Definition: gastrans.c:65
SCIP_EXPORT void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:958
SCIP_EXPORT void SCIPregressionAddObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:371
common defines and data types used in all packages of SCIP
SCIP_EXPORT void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition: misc.c:7674
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:429
SCIP_EXPORT SCIP_Bool SCIPstrToIntValue(const char *str, int *value, char **endptr)
Definition: misc.c:10674
SCIP_EXPORT SCIP_RETCODE SCIPhashmapSetImageReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3331
SCIP_EXPORT void SCIPgmlWriteNode(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition: misc.c:487
SCIP_EXPORT SCIP_RETCODE SCIPcalcIntegralScalar(SCIP_Real *vals, int nvals, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Real maxscale, SCIP_Real *intscalar, SCIP_Bool *success)
Definition: misc.c:9458
SCIP_EXPORT int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:780
SCIP_EXPORT SCIP_Longint SCIPcalcSmaComMul(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9274
SCIP_EXPORT SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition: misc.c:3463
SCIP_EXPORT SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
Definition: misc.c:704
SCIP_EXPORT void SCIPbtFree(SCIP_BT **tree)
Definition: misc.c:8878
SCIP_EXPORT void ** SCIPhashsetGetSlots(SCIP_HASHSET *hashset)
Definition: misc.c:3948
SCIP_EXPORT SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int height, int *pos, SCIP_Bool *infeasible)
Definition: misc.c:6922
SCIP_EXPORT SCIP_Longint SCIPmultihashGetNElements(SCIP_MULTIHASH *multihash)
Definition: misc.c:2172
SCIP_EXPORT void * SCIPqueueFirst(SCIP_QUEUE *queue)
Definition: misc.c:1139
SCIP_EXPORT int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition: misc.c:10488
SCIP_EXPORT SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3379
SCIP_EXPORT void SCIPhashmapEntrySetImage(SCIP_HASHMAPENTRY *entry, void *image)
Definition: misc.c:3540
SCIP_EXPORT void SCIPdigraphFreeComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8419
SCIP_EXPORT SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:6657
SCIP_EXPORT int SCIPhashsetGetNElements(SCIP_HASHSET *hashset)
Definition: misc.c:3932
SCIP_EXPORT void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randgen, void **array, int begin, int end)
Definition: misc.c:10030
SCIP_EXPORT SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3263
SCIP_EXPORT SCIP_Real SCIPnormalGetCriticalValue(SCIP_CONFIDENCELEVEL clevel)
Definition: misc.c:173
SCIP_EXPORT SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7564
methods for selecting (weighted) k-medians
SCIP_EXPORT SCIP_RETCODE SCIPpqueueInsert(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1335
SCIP_EXPORT SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3297
memory allocation routines