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-2017 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 email to scip@zib.de. */
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 
52 /* in optimized mode some of the function are handled via defines, for that the structs are needed */
53 #ifdef NDEBUG
54 #include "scip/struct_misc.h"
55 #endif
56 
57 #ifdef __cplusplus
58 extern "C" {
59 #endif
60 
61 /*
62  * methods for statistical tests
63  */
64 
65 /**@defgroup STATISTICALTESTS Statistical tests
66  * @ingroup MiscellaneousMethods
67  * @brief public methods for statistical tests
68  *
69  * Below are the public methods for statistical tests inside of \SCIP
70  *
71  * @{
72  */
73 
74 /** get critical value of a Student-T distribution for a given number of degrees of freedom at a confidence level */
75 extern
77  SCIP_CONFIDENCELEVEL clevel, /**< (one-sided) confidence level */
78  int df /**< degrees of freedom */
79  );
80 
81 /** compute a t-value for the hypothesis that x and y are from the same population; Assuming that
82  * x and y represent normally distributed random samples with equal variance, the returned value
83  * comes from a Student-T distribution with countx + county - 2 degrees of freedom; this
84  * value can be compared with a critical value (see also SCIPstudentTGetCriticalValue()) at
85  * a predefined confidence level for checking if x and y significantly differ in location
86  */
87 extern
89  SCIP_Real meanx, /**< the mean of the first distribution */
90  SCIP_Real meany, /**< the mean of the second distribution */
91  SCIP_Real variancex, /**< the variance of the x-distribution */
92  SCIP_Real variancey, /**< the variance of the y-distribution */
93  SCIP_Real countx, /**< number of samples of x */
94  SCIP_Real county /**< number of samples of y */
95  );
96 
97 /** returns the value of the Gauss error function evaluated at a given point */
98 extern
100  SCIP_Real x /**< value to evaluate */
101  );
102 
103 /** get critical value of a standard normal distribution at a given confidence level */
104 extern
106  SCIP_CONFIDENCELEVEL clevel /**< (one-sided) confidence level */
107  );
108 
109 /** calculates the cumulative distribution P(-infinity <= x <= value) that a normally distributed
110  * random variable x takes a value between -infinity and parameter \p value.
111  *
112  * The distribution is given by the respective mean and deviation. This implementation
113  * uses the error function erf().
114  */
115 extern
117  SCIP_Real mean, /**< the mean value of the distribution */
118  SCIP_Real variance, /**< the square of the deviation of the distribution */
119  SCIP_Real value /**< the upper limit of the calculated distribution integral */
120  );
121 
122 /**@} */
123 
124 /**@defgroup Regression Linear Regression
125  * @ingroup MiscellaneousMethods
126  * @brief methods for linear regression
127  *
128  * Below are the public methods for incremental linear regression of observations pairs \f$(X_i,Y_i), i=1\dots,n\f$
129  *
130  * @{
131  */
132 
133 /** returns the number of observations of this regression */
134 extern
136  SCIP_REGRESSION* regression /**< regression data structure */
137  );
138 
139 /** return the current slope of the regression */
140 extern
142  SCIP_REGRESSION* regression /**< regression data structure */
143  );
144 
145 /** get the current y-intercept of the regression */
146 extern
148  SCIP_REGRESSION* regression /**< regression data structure */
149  );
150 
151 /** removes an observation (x,y) from the regression */
152 extern
154  SCIP_REGRESSION* regression, /**< regression data structure */
155  SCIP_Real x, /**< X of observation */
156  SCIP_Real y /**< Y of the observation */
157  );
158 
159 /** update regression by a new observation (x,y) */
160 extern
162  SCIP_REGRESSION* regression, /**< regression data structure */
163  SCIP_Real x, /**< X of observation */
164  SCIP_Real y /**< Y of the observation */
165  );
166 
167 /** reset regression data structure */
168 extern
170  SCIP_REGRESSION* regression /**< regression data structure */
171  );
172 
173 /** creates and resets a regression */
174 extern
176  SCIP_REGRESSION** regression /**< regression data structure */
177  );
178 
179 /** frees a regression */
180 extern
181 void SCIPregressionFree(
182  SCIP_REGRESSION** regression /**< regression data structure */
183  );
184 
185 /**@} */
186 
187 /*
188  */
189 
190 /**@defgroup GMLgraph GML Graphical Printing
191  * @ingroup MiscellaneousMethods
192  * @brief GML graph printing methods
193  *
194  * For a detailed format decription see http://docs.yworks.com/yfiles/doc/developers-guide/gml.html
195  *
196  * @{
197  */
198 
199 
200 /** writes a node section to the given graph file */
201 extern
202 void SCIPgmlWriteNode(
203  FILE* file, /**< file to write to */
204  unsigned int id, /**< id of the node */
205  const char* label, /**< label of the node */
206  const char* nodetype, /**< type of the node, or NULL */
207  const char* fillcolor, /**< color of the node's interior, or NULL */
208  const char* bordercolor /**< color of the node's border, or NULL */
209  );
210 
211 /** writes a node section including weight to the given graph file */
212 extern
214  FILE* file, /**< file to write to */
215  unsigned int id, /**< id of the node */
216  const char* label, /**< label of the node */
217  const char* nodetype, /**< type of the node, or NULL */
218  const char* fillcolor, /**< color of the node's interior, or NULL */
219  const char* bordercolor, /**< color of the node's border, or NULL */
220  SCIP_Real weight /**< weight of node */
221  );
222 
223 /** writes an edge section to the given graph file */
224 extern
225 void SCIPgmlWriteEdge(
226  FILE* file, /**< file to write to */
227  unsigned int source, /**< source node id of the node */
228  unsigned int target, /**< target node id of the edge */
229  const char* label, /**< label of the edge, or NULL */
230  const char* color /**< color of the edge, or NULL */
231  );
232 
233 /** writes an arc section to the given graph file */
234 extern
235 void SCIPgmlWriteArc(
236  FILE* file, /**< file to write to */
237  unsigned int source, /**< source node id of the node */
238  unsigned int target, /**< target node id of the edge */
239  const char* label, /**< label of the edge, or NULL */
240  const char* color /**< color of the edge, or NULL */
241  );
242 
243 /** writes the starting line to a GML graph file, does not open a file */
244 extern
246  FILE* file, /**< file to write to */
247  SCIP_Bool directed /**< is the graph directed */
248  );
249 
250 /** writes the ending lines to a GML graph file, does not close a file */
251 extern
253  FILE* file /**< file to close */
254  );
255 
256 /**@} */
257 
258 /*
259  * Sparse solution
260  */
261 
262 /**@defgroup SparseSol Sparse Solution
263  * @brief sparse storage for multiple integer solutions
264  *
265  * @{
266  */
267 
268 /** creates a sparse solution */
269 extern
271  SCIP_SPARSESOL** sparsesol, /**< pointer to store the created sparse solution */
272  SCIP_VAR** vars, /**< variables in the sparse solution, must not contain continuous variables */
273  int nvars, /**< number of variables to store, size of the lower and upper bound arrays */
274  SCIP_Bool cleared /**< should the lower and upper bound arrays be cleared (entries set to 0) */
275  );
276 
277 /** frees sparse solution */
278 extern
279 void SCIPsparseSolFree(
280  SCIP_SPARSESOL** sparsesol /**< pointer to a sparse solution */
281  );
282 
283 /** returns the variables in the given sparse solution */
284 extern
286  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
287  );
288 
289 /** returns the number of variables in the given sparse solution */
290 extern
292  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
293  );
294 
295 /** returns the the lower bound array for all variables for a given sparse solution */
296 extern
298  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
299  );
300 
301 /** returns the the upper bound array for all variables for a given sparse solution */
302 extern
304  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
305  );
306 
307 /** constructs the first solution of sparse solution (all variables are set to their lower bound value */
308 extern
310  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
311  SCIP_Longint* sol, /**< array to store the first solution */
312  int nvars /**< number of variables */
313  );
314 
315 /** constructs the next solution of the sparse solution and return whether there was one more or not */
316 extern
318  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
319  SCIP_Longint* sol, /**< current solution array which get changed to the next solution */
320  int nvars /**< number of variables */
321  );
322 
323 /**@} */
324 
325 
326 /*
327  * Queue
328  */
329 
330 /**@defgroup Queue Queue
331  * @ingroup DataStructures
332  * @brief circular FIFO queue
333  *
334  * @{
335  */
336 
337 
338 /** creates a (circular) queue, best used if the size will be fixed or will not be increased that much */
339 extern
341  SCIP_QUEUE** queue, /**< pointer to the new queue */
342  int initsize, /**< initial number of available element slots */
343  SCIP_Real sizefac /**< memory growing factor applied, if more element slots are needed */
344  );
345 
346 
347 /** frees queue, but not the data elements themselves */
348 extern
349 void SCIPqueueFree(
350  SCIP_QUEUE** queue /**< pointer to a queue */
351  );
352 
353 /** clears the queue, but doesn't free the data elements themselves */
354 extern
355 void SCIPqueueClear(
356  SCIP_QUEUE* queue /**< queue */
357  );
358 
359 /** inserts element at the end of the queue */
360 extern
362  SCIP_QUEUE* queue, /**< queue */
363  void* elem /**< element to be inserted */
364  );
365 
366 /** removes and returns the first element of the queue */
367 extern
368 void* SCIPqueueRemove(
369  SCIP_QUEUE* queue /**< queue */
370  );
371 
372 /** returns the first element of the queue without removing it */
373 extern
374 void* SCIPqueueFirst(
375  SCIP_QUEUE* queue /**< queue */
376  );
377 
378 /** returns whether the queue is empty */
379 extern
381  SCIP_QUEUE* queue /**< queue */
382  );
383 
384 /** returns the number of elements in the queue */
385 extern
386 int SCIPqueueNElems(
387  SCIP_QUEUE* queue /**< queue */
388  );
389 
390 /**@} */
391 
392 /*
393  * Priority Queue
394  */
395 
396 /**@defgroup PriorityQueue Priority Queue
397  * @ingroup DataStructures
398  * @brief priority queue with O(1) access to the minimum element
399  *
400  * @{
401  */
402 
403 /** creates priority queue */
404 extern
406  SCIP_PQUEUE** pqueue, /**< pointer to a priority queue */
407  int initsize, /**< initial number of available element slots */
408  SCIP_Real sizefac, /**< memory growing factor applied, if more element slots are needed */
409  SCIP_DECL_SORTPTRCOMP((*ptrcomp)) /**< data element comparator */
410  );
411 
412 /** frees priority queue, but not the data elements themselves */
413 extern
414 void SCIPpqueueFree(
415  SCIP_PQUEUE** pqueue /**< pointer to a priority queue */
416  );
417 
418 /** clears the priority queue, but doesn't free the data elements themselves */
419 extern
420 void SCIPpqueueClear(
421  SCIP_PQUEUE* pqueue /**< priority queue */
422  );
423 
424 /** inserts element into priority queue */
425 extern
427  SCIP_PQUEUE* pqueue, /**< priority queue */
428  void* elem /**< element to be inserted */
429  );
430 
431 /** removes and returns best element from the priority queue */
432 extern
433 void* SCIPpqueueRemove(
434  SCIP_PQUEUE* pqueue /**< priority queue */
435  );
436 
437 /** returns the best element of the queue without removing it */
438 extern
439 void* SCIPpqueueFirst(
440  SCIP_PQUEUE* pqueue /**< priority queue */
441  );
442 
443 /** returns the number of elements in the queue */
444 extern
445 int SCIPpqueueNElems(
446  SCIP_PQUEUE* pqueue /**< priority queue */
447  );
448 
449 /** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
450 extern
451 void** SCIPpqueueElems(
452  SCIP_PQUEUE* pqueue /**< priority queue */
453  );
454 
455 /**@} */
456 
457 
458 /*
459  * Hash Table
460  */
461 
462 /**@defgroup HashTable Hash Table
463  * @ingroup DataStructures
464  * @brief hash table that resolves conflicts by probing
465  *
466  *@{
467  */
468 
469 /* fast 2-universal hash functions for two and four elements */
470 
471 #define SCIPhashSignature64(a) (UINT64_C(0x8000000000000000)>>((UINT32_C(0x9e3779b9) * ((uint32_t)(a)))>>26))
472 #define SCIPhashTwo(a, b) ((uint32_t)((((uint64_t)(a) + 0xd37e9a1ce2148403ULL) * ((uint64_t)(b) + 0xe5fcc163aef32782ULL) )>>32))
473 
474 #define SCIPhashFour(a, b, c, d) ((uint32_t)((((uint64_t)(a) + 0xbd5c89185f082658ULL) * ((uint64_t)(b) + 0xe5fcc163aef32782ULL) + \
475  ((uint64_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint64_t)(d) + 0x926f2d4dc4a67218ULL))>>32 ))
476 
477 /* helpers to use above hashfuncions */
478 #define SCIPcombineTwoInt(a, b) (((uint64_t) (a) << 32) | (uint64_t) (b) )
479 
480 #define SCIPcombineThreeInt(a, b, c) (((uint64_t) (a) << 43) + ((uint64_t) (b) << 21) + ((uint64_t) (c)) )
481 
482 #define SCIPcombineFourInt(a, b, c, d) (((uint64_t) (a) << 48) + ((uint64_t) (b) << 32) + ((uint64_t) (c) << 16) + ((uint64_t) (d)) )
483 
484 /** computes a hashcode for double precision floating point values containing
485  * 15 significant bits, the sign and the exponent
486  */
487 INLINE static
488 uint32_t SCIPrealHashCode(double x)
489 {
490  int exp;
491  return (((uint32_t)(uint16_t)(int16_t)ldexp(frexp(x, &exp), 15))<<16) | (uint32_t)exp;
492 }
493 
494 
495 /** creates a hash table */
496 extern
498  SCIP_HASHTABLE** hashtable, /**< pointer to store the created hash table */
499  BMS_BLKMEM* blkmem, /**< block memory used to store hash table entries */
500  int tablesize, /**< size of the hash table */
501  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
502  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
503  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
504  void* userptr /**< user pointer */
505  );
506 
507 /** frees the hash table */
508 extern
509 void SCIPhashtableFree(
510  SCIP_HASHTABLE** hashtable /**< pointer to the hash table */
511  );
512 
513 /** removes all elements of the hash table
514  *
515  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
516  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
517  *
518  * @deprecated Please use SCIPhashtableRemoveAll()
519  */
520 extern
521 void SCIPhashtableClear(
522  SCIP_HASHTABLE* hashtable /**< hash table */
523  );
524 
525 /** inserts element in hash table (multiple inserts of same element override the previous entry) */
526 extern
528  SCIP_HASHTABLE* hashtable, /**< hash table */
529  void* element /**< element to insert into the table */
530  );
531 
532 /** inserts element in hash table (multiple insertion of same element is checked and results in an error) */
533 extern
535  SCIP_HASHTABLE* hashtable, /**< hash table */
536  void* element /**< element to insert into the table */
537  );
538 
539 /** retrieve element with key from hash table, returns NULL if not existing */
540 extern
542  SCIP_HASHTABLE* hashtable, /**< hash table */
543  void* key /**< key to retrieve */
544  );
545 
546 /** returns whether the given element exists in the table */
547 extern
549  SCIP_HASHTABLE* hashtable, /**< hash table */
550  void* element /**< element to search in the table */
551  );
552 
553 /** removes element from the hash table, if it exists */
554 extern
556  SCIP_HASHTABLE* hashtable, /**< hash table */
557  void* element /**< element to remove from the table */
558  );
559 
560 /** removes all elements of the hash table */
561 extern
563  SCIP_HASHTABLE* hashtable /**< hash table */
564  );
565 
566 /** returns number of hash table elements */
567 extern
569  SCIP_HASHTABLE* hashtable /**< hash table */
570  );
571 
572 /** returns the load of the given hash table in percentage */
573 extern
575  SCIP_HASHTABLE* hashtable /**< hash table */
576  );
577 
578 /** prints statistics about hash table usage */
579 extern
581  SCIP_HASHTABLE* hashtable, /**< hash table */
582  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
583  );
584 
585 /**@} */
586 
587 /*
588  * MultiHash Table
589  */
590 
591 /**@defgroup MultiHash Multi Hash table
592  * @ingroup DataStructures
593  * @brief hash table that resolves conflicts by queueing, thereby allowing for duplicate entries
594  *
595  *@{
596  */
597 
598 /** returns a reasonable hash table size (a prime number) that is at least as large as the specified value */
599 extern
601  int minsize /**< minimal size of the hash table */
602  );
603 
604 /** creates a multihash table */
605 extern
607  SCIP_MULTIHASH** multihash, /**< pointer to store the created multihash table */
608  BMS_BLKMEM* blkmem, /**< block memory used to store multihash table entries */
609  int tablesize, /**< size of the hash table */
610  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
611  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
612  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
613  void* userptr /**< user pointer */
614  );
615 
616 /** frees the multihash table */
617 extern
618 void SCIPmultihashFree(
619  SCIP_MULTIHASH** multihash /**< pointer to the multihash table */
620  );
621 
622 /** inserts element in multihash table (multiple inserts of same element possible)
623  *
624  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding an element
625  * to the hash table, due to dynamic resizing.
626  */
627 extern
629  SCIP_MULTIHASH* multihash, /**< multihash table */
630  void* element /**< element to insert into the table */
631  );
632 
633 /** inserts element in multihash table (multiple insertion of same element is checked and results in an error)
634  *
635  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding a new
636  * element to the multihash table, due to dynamic resizing.
637  */
638 extern
640  SCIP_MULTIHASH* multihash, /**< multihash table */
641  void* element /**< element to insert into the table */
642  );
643 
644 /** retrieve element with key from multihash table, returns NULL if not existing */
645 extern
647  SCIP_MULTIHASH* multihash, /**< multihash table */
648  void* key /**< key to retrieve */
649  );
650 
651 /** retrieve element with key from multihash table, returns NULL if not existing
652  * can be used to retrieve all entries with the same key (one-by-one)
653  *
654  * @note The returned multimultihashlist pointer might get invalid when adding a new element to the multihash table.
655  */
656 extern
658  SCIP_MULTIHASH* multihash, /**< multihash table */
659  SCIP_MULTIHASHLIST** multihashlist, /**< input: entry in hash table list from which to start searching, or NULL
660  * output: entry in hash table list corresponding to element after
661  * retrieved one, or NULL */
662  void* key /**< key to retrieve */
663  );
664 
665 /** returns whether the given element exists in the multihash table */
666 extern
668  SCIP_MULTIHASH* multihash, /**< multihash table */
669  void* element /**< element to search in the table */
670  );
671 
672 /** removes element from the multihash table, if it exists */
673 extern
675  SCIP_MULTIHASH* multihash, /**< multihash table */
676  void* element /**< element to remove from the table */
677  );
678 
679 /** removes all elements of the multihash table
680  *
681  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
682  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
683  */
684 extern
686  SCIP_MULTIHASH* multihash /**< multihash table */
687  );
688 
689 /** returns number of multihash table elements */
690 extern
692  SCIP_MULTIHASH* multihash /**< multihash table */
693  );
694 
695 /** returns the load of the given multihash table in percentage */
696 extern
698  SCIP_MULTIHASH* multihash /**< multihash table */
699  );
700 
701 /** prints statistics about multihash table usage */
702 extern
704  SCIP_MULTIHASH* multihash, /**< multihash table */
705  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
706  );
707 
708 /** standard hash key comparator for string keys */
709 extern
710 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString);
711 
712 /** standard hashing function for string keys */
713 extern
714 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString);
715 
716 /** gets the element as the key */
717 extern
718 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard);
719 
720 /** returns TRUE iff both keys(pointer) are equal */
721 extern
722 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqPtr);
723 
724 /** returns the hash value of the key */
725 extern
726 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValPtr);
727 
728 /**@} */
729 
730 
731 /*
732  * Hash Map
733  */
734 
735 /**@defgroup HashMap Hash Map
736  * @ingroup DataStructures
737  * @brief hash map to store key-value pairs (called \p origin and \p image)
738  *
739  * @{
740  */
741 
742 /** creates a hash map mapping pointers to pointers */
743 extern
745  SCIP_HASHMAP** hashmap, /**< pointer to store the created hash map */
746  BMS_BLKMEM* blkmem, /**< block memory used to store hash map entries */
747  int mapsize /**< size of the hash map */
748  );
749 
750 /** frees the hash map */
751 extern
752 void SCIPhashmapFree(
753  SCIP_HASHMAP** hashmap /**< pointer to the hash map */
754  );
755 
756 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
757 extern
759  SCIP_HASHMAP* hashmap, /**< hash map */
760  void* origin, /**< origin to set image for */
761  void* image /**< new image for origin */
762  );
763 
764 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
765 extern
767  SCIP_HASHMAP* hashmap, /**< hash map */
768  void* origin, /**< origin to set image for */
769  SCIP_Real image /**< new image for origin */
770  );
771 
772 /** retrieves image of given origin from the hash map, or NULL if no image exists */
773 extern
774 void* SCIPhashmapGetImage(
775  SCIP_HASHMAP* hashmap, /**< hash map */
776  void* origin /**< origin to retrieve image for */
777  );
778 
779 /** retrieves image of given origin from the hash map, or NULL if no image exists */
780 extern
782  SCIP_HASHMAP* hashmap, /**< hash map */
783  void* origin /**< origin to retrieve image for */
784  );
785 
786 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
787  * new origin->image pair
788  */
789 extern
791  SCIP_HASHMAP* hashmap, /**< hash map */
792  void* origin, /**< origin to set image for */
793  void* image /**< new image for origin */
794  );
795 
796 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
797  * new origin->image pair
798  */
799 extern
801  SCIP_HASHMAP* hashmap, /**< hash map */
802  void* origin, /**< origin to set image for */
803  SCIP_Real image /**< new image for origin */
804  );
805 
806 /** checks whether an image to the given origin exists in the hash map */
807 extern
809  SCIP_HASHMAP* hashmap, /**< hash map */
810  void* origin /**< origin to search for */
811  );
812 
813 /** removes origin->image pair from the hash map, if it exists */
814 extern
816  SCIP_HASHMAP* hashmap, /**< hash map */
817  void* origin /**< origin to remove from the list */
818  );
819 
820 /** prints statistics about hash map usage */
821 extern
823  SCIP_HASHMAP* hashmap, /**< hash map */
824  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
825  );
826 
827 /** indicates whether a hash map has no entries */
828 extern
830  SCIP_HASHMAP* hashmap /**< hash map */
831  );
832 
833 /** gives the number of elements in a hash map */
834 extern
836  SCIP_HASHMAP* hashmap /**< hash map */
837  );
838 
839 /** gives the number of entries in the internal arrays of a hash map */
840 extern
842  SCIP_HASHMAP* hashmap /**< hash map */
843  );
844 
845 /** gives the hashmap entry at the given index or NULL if entry has no element */
846 extern
848  SCIP_HASHMAP* hashmap, /**< hash map */
849  int entryidx /**< index of hash map entry */
850  );
851 
852 /** gives the origin of the hashmap entry */
853 extern
855  SCIP_HASHMAPENTRY* entry /**< hash map entry */
856  );
857 
858 /** gives the image of the hashmap entry */
859 extern
861  SCIP_HASHMAPENTRY* entry /**< hash map entry */
862  );
863 
864 /** gives the image of the hashmap entry */
865 extern
867  SCIP_HASHMAPENTRY* entry /**< hash map entry */
868  );
869 
870 /** removes all entries in a hash map. */
871 extern
873  SCIP_HASHMAP* hashmap /**< hash map */
874  );
875 
876 /**@} */
877 
878 
879 
880 /*
881  * Activity
882  */
883 
884 /**@defgroup ResourceActivity Resource Activity
885  * @ingroup DataStructures
886  * @brief ressource activity data structure
887  *
888  * @{
889  */
890 
891 /** create a resource activity */
892 extern
894  SCIP_RESOURCEACTIVITY** activity, /**< pointer to store the resource activity */
895  SCIP_VAR* var, /**< start time variable of the activity */
896  int duration, /**< duration of the activity */
897  int demand /**< demand of the activity */
898  );
899 
900 /** frees a resource activity */
901 extern
902 void SCIPactivityFree(
903  SCIP_RESOURCEACTIVITY** activity /**< pointer to the resource activity */
904  );
905 
906 #ifndef NDEBUG
907 
908 /** returns the start time variable of the resource activity */
909 extern
911  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
912  );
913 
914 /** returns the duration of the resource activity */
915 extern
917  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
918  );
919 
920 /** returns the demand of the resource activity */
921 extern
923  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
924  );
925 
926 /** returns the energy of the resource activity */
927 extern
929  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
930  );
931 
932 #else
933 
934 #define SCIPactivityGetVar(activity) ((activity)->var)
935 #define SCIPactivityGetDuration(activity) ((activity)->duration)
936 #define SCIPactivityGetDemand(activity) ((activity)->demand)
937 #define SCIPactivityGetEnergy(activity) ((activity)->duration * (activity)->demand)
938 
939 #endif
940 
941 /**@} */
942 
943 
944 /*
945  * Resource Profile
946  */
947 
948 /**@defgroup ResourceProfile Resource Profile
949  * @ingroup DataStructures
950  * @brief ressource profile data structure
951  *
952  * @{
953  */
954 
955 /** creates resource profile */
956 extern
958  SCIP_PROFILE** profile, /**< pointer to store the resource profile */
959  int capacity /**< resource capacity */
960  );
961 
962 /** frees given resource profile */
963 extern
964 void SCIPprofileFree(
965  SCIP_PROFILE** profile /**< pointer to the resource profile */
966  );
967 
968 /** output of the given resource profile */
969 extern
970 void SCIPprofilePrint(
971  SCIP_PROFILE* profile, /**< resource profile to output */
972  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
973  FILE* file /**< output file (or NULL for standard output) */
974  );
975 
976 /** returns the capacity of the resource profile */
977 extern
979  SCIP_PROFILE* profile /**< resource profile to use */
980  );
981 
982 /** returns the number time points of the resource profile */
983 extern
985  SCIP_PROFILE* profile /**< resource profile to use */
986  );
987 
988 /** returns the time points of the resource profile */
989 extern
991  SCIP_PROFILE* profile /**< resource profile to use */
992  );
993 
994 /** returns the loads of the resource profile */
995 extern
997  SCIP_PROFILE* profile /**< resource profile to use */
998  );
999 
1000 /** returns the time point for given position of the resource profile */
1001 extern
1002 int SCIPprofileGetTime(
1003  SCIP_PROFILE* profile, /**< resource profile to use */
1004  int pos /**< position */
1005  );
1006 
1007 /** returns the loads of the resource profile at the given position */
1008 extern
1009 int SCIPprofileGetLoad(
1010  SCIP_PROFILE* profile, /**< resource profile */
1011  int pos /**< position */
1012  );
1013 
1014 /** returns if the given time point exists in the resource profile and stores the position of the given time point if it
1015  * exists; otherwise the position of the next smaller existing time point is stored
1016  */
1017 extern
1019  SCIP_PROFILE* profile, /**< resource profile to search */
1020  int timepoint, /**< time point to search for */
1021  int* pos /**< pointer to store the position */
1022  );
1023 
1024 /** insert a core into resource profile; if the core is non-empty the resource profile will be updated otherwise nothing
1025  * happens
1026  */
1027 extern
1029  SCIP_PROFILE* profile, /**< resource profile to use */
1030  int left, /**< left side of the core */
1031  int right, /**< right side of the core */
1032  int height, /**< height of the core */
1033  int* pos, /**< pointer to store the first position were it gets infeasible */
1034  SCIP_Bool* infeasible /**< pointer to store if the core does not fit due to capacity */
1035  );
1036 
1037 /** subtracts the height from the resource profile during core time */
1038 extern
1040  SCIP_PROFILE* profile, /**< resource profile to use */
1041  int left, /**< left side of the core */
1042  int right, /**< right side of the core */
1043  int height /**< height of the core */
1044  );
1045 
1046 /** return the earliest possible starting point within the time interval [lb,ub] for a given core (given by its height
1047  * and duration)
1048  */
1049 extern
1051  SCIP_PROFILE* profile, /**< resource profile to use */
1052  int est, /**< earliest starting time of the given core */
1053  int lst, /**< latest starting time of the given core */
1054  int duration, /**< duration of the core */
1055  int height, /**< height of the core */
1056  SCIP_Bool* infeasible /**< pointer store if the corer cannot be inserted */
1057  );
1058 
1059 /** return the latest possible starting point within the time interval [lb,ub] for a given core (given by its height and
1060  * duration)
1061  */
1062 extern
1064  SCIP_PROFILE* profile, /**< resource profile to use */
1065  int lb, /**< earliest possible start point */
1066  int ub, /**< latest possible start point */
1067  int duration, /**< duration of the core */
1068  int height, /**< height of the core */
1069  SCIP_Bool* infeasible /**< pointer store if the core cannot be inserted */
1070  );
1071 
1072 /**@} */
1073 
1074 /*
1075  * Directed graph
1076  */
1077 
1078 /**@defgroup DirectedGraph Directed Graph
1079  * @ingroup DataStructures
1080  * @brief graph structure with common algorithms for directed and undirected graphs
1081  *
1082  * @{
1083  */
1084 
1085 /** creates directed graph structure */
1086 extern
1088  SCIP_DIGRAPH** digraph, /**< pointer to store the created directed graph */
1089  int nnodes /**< number of nodes */
1090  );
1091 
1092 /** resize directed graph structure */
1093 extern
1095  SCIP_DIGRAPH* digraph, /**< directed graph */
1096  int nnodes /**< new number of nodes */
1097  );
1098 
1099 /** copies directed graph structure
1100  *
1101  * @note The data in nodedata is copied verbatim. This possibly has to be adapted by the user.
1102  */
1103 extern
1105  SCIP_DIGRAPH** targetdigraph, /**< pointer to store the copied directed graph */
1106  SCIP_DIGRAPH* sourcedigraph /**< source directed graph */
1107  );
1108 
1109 /** sets the sizes of the successor lists for the nodes in a directed graph and allocates memory for the lists */
1110 extern
1112  SCIP_DIGRAPH* digraph, /**< directed graph */
1113  int* sizes /**< sizes of the successor lists */
1114  );
1115 
1116 /** frees given directed graph structure */
1117 extern
1118 void SCIPdigraphFree(
1119  SCIP_DIGRAPH** digraph /**< pointer to the directed graph */
1120  );
1121 
1122 /** add (directed) arc and a related data to the directed graph structure
1123  *
1124  * @note if the arc is already contained, it is added a second time
1125  */
1126 extern
1128  SCIP_DIGRAPH* digraph, /**< directed graph */
1129  int startnode, /**< start node of the arc */
1130  int endnode, /**< start node of the arc */
1131  void* data /**< data that should be stored for the arc; or NULL */
1132  );
1133 
1134 /** add (directed) arc to the directed graph structure, if it is not contained, yet
1135  *
1136  * @note if there already exists an arc from startnode to endnode, the new arc is not added,
1137  * even if its data is different
1138  */
1139 extern
1141  SCIP_DIGRAPH* digraph, /**< directed graph */
1142  int startnode, /**< start node of the arc */
1143  int endnode, /**< start node of the arc */
1144  void* data /**< data that should be stored for the arc; or NULL */
1145  );
1146 
1147 /** sets the number of successors to a given value */
1148 extern
1150  SCIP_DIGRAPH* digraph, /**< directed graph */
1151  int node, /**< node for which the number of successors has to be changed */
1152  int nsuccessors /**< new number of successors */
1153  );
1154 
1155 /** returns the number of nodes of the given digraph */
1156 extern
1158  SCIP_DIGRAPH* digraph /**< directed graph */
1159  );
1160 
1161 /** returns the node data, or NULL if no data exist */
1162 extern
1164  SCIP_DIGRAPH* digraph, /**< directed graph */
1165  int node /**< node for which the node data is returned */
1166  );
1167 
1168 /** sets the node data */
1169 extern
1171  SCIP_DIGRAPH* digraph, /**< directed graph */
1172  void* dataptr, /**< user node data pointer, or NULL */
1173  int node /**< node for which the node data is returned */
1174  );
1175 
1176 /** returns the total number of arcs in the given digraph */
1177 extern
1179  SCIP_DIGRAPH* digraph /**< directed graph */
1180  );
1181 
1182 /** returns the number of successor nodes of the given node */
1183 extern
1185  SCIP_DIGRAPH* digraph, /**< directed graph */
1186  int node /**< node for which the number of outgoing arcs is returned */
1187  );
1188 
1189 /** returns the array of indices of the successor nodes; this array must not be changed from outside */
1190 extern
1192  SCIP_DIGRAPH* digraph, /**< directed graph */
1193  int node /**< node for which the array of outgoing arcs is returned */
1194  );
1195 
1196 /** returns the array of data corresponding to the arcs originating at the given node, or NULL if no data exist; this
1197  * array must not be changed from outside
1198  */
1199 extern
1201  SCIP_DIGRAPH* digraph, /**< directed graph */
1202  int node /**< node for which the data corresponding to the outgoing arcs is returned */
1203  );
1204 
1205 /** Compute undirected connected components on the given graph.
1206  *
1207  * @note For each arc, its reverse is added, so the graph does not need to be the directed representation of an
1208  * undirected graph.
1209  */
1210 extern
1212  SCIP_DIGRAPH* digraph, /**< directed graph */
1213  int minsize, /**< all components with less nodes are ignored */
1214  int* components, /**< array with as many slots as there are nodes in the directed graph
1215  * to store for each node the component to which it belongs
1216  * (components are numbered 0 to ncomponents - 1); or NULL, if components
1217  * are accessed one-by-one using SCIPdigraphGetComponent() */
1218  int* ncomponents /**< pointer to store the number of components; or NULL, if the
1219  * number of components is accessed by SCIPdigraphGetNComponents() */
1220  );
1221 
1222 /** Computes all strongly connected components of an undirected connected component with Tarjan's Algorithm.
1223  * The resulting strongly connected components are sorted topologically (starting from the end of the
1224  * strongcomponents array).
1225  *
1226  * @note In general a topological sort of the strongly connected components is not unique.
1227  */
1228 extern
1230  SCIP_DIGRAPH* digraph, /**< directed graph */
1231  int compidx, /**< number of the undirected connected component */
1232  int* strongcomponents, /**< array to store the strongly connected components
1233  * (length >= size of the component) */
1234  int* strongcompstartidx, /**< array to store the start indices of the strongly connected
1235  * components (length >= size of the component) */
1236  int* nstrongcomponents /**< pointer to store the number of strongly connected
1237  * components */
1238  );
1239 
1240 /** Performes an (almost) topological sort on the undirected components of the given directed graph. The undirected
1241  * components should be computed before using SCIPdigraphComputeUndirectedComponents().
1242  *
1243  * @note In general a topological sort is not unique. Note, that there might be directed cycles, that are randomly
1244  * broken, which is the reason for having only almost topologically sorted arrays.
1245  */
1246 extern
1248  SCIP_DIGRAPH* digraph /**< directed graph */
1249  );
1250 
1251 /** returns the number of previously computed undirected components for the given directed graph */
1252 extern
1254  SCIP_DIGRAPH* digraph /**< directed graph */
1255  );
1256 
1257 /** Returns the previously computed undirected component of the given number for the given directed graph.
1258  * If the components were sorted using SCIPdigraphTopoSortComponents(), the component is (almost) topologically sorted.
1259  */
1260 extern
1262  SCIP_DIGRAPH* digraph, /**< directed graph */
1263  int compidx, /**< number of the component to return */
1264  int** nodes, /**< pointer to store the nodes in the component; or NULL, if not needed */
1265  int* nnodes /**< pointer to store the number of nodes in the component;
1266  * or NULL, if not needed */
1267  );
1268 
1269 /** frees the component information for the given directed graph */
1270 extern
1272  SCIP_DIGRAPH* digraph /**< directed graph */
1273  );
1274 
1275 /** output of the given directed graph via the given message handler */
1276 extern
1277 void SCIPdigraphPrint(
1278  SCIP_DIGRAPH* digraph, /**< directed graph */
1279  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1280  FILE* file /**< output file (or NULL for standard output) */
1281  );
1282 
1283 /** prints the given directed graph structure in GML format into the given file */
1284 extern
1285 void SCIPdigraphPrintGml(
1286  SCIP_DIGRAPH* digraph, /**< directed graph */
1287  FILE* file /**< file to write to */
1288  );
1289 
1290 
1291 /** output of the given directed graph via the given message handler */
1292 extern
1294  SCIP_DIGRAPH* digraph, /**< directed graph */
1295  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1296  FILE* file /**< output file (or NULL for standard output) */
1297  );
1298 
1299 /**@} */
1300 
1301 /*
1302  * Binary search tree
1303  */
1304 
1305 /**@defgroup BinaryTree Binary Search Tree
1306  * @ingroup DataStructures
1307  * @brief binary search tree data structure
1308  *@{
1309  */
1310 
1311 /** creates a binary tree node with sorting value and user data */
1312 extern
1314  SCIP_BT* tree, /**< binary search tree */
1315  SCIP_BTNODE** node, /**< pointer to store the created search node */
1316  void* dataptr /**< user node data pointer, or NULL */
1317  );
1318 
1319 /** frees the binary node including the rooted subtree
1320  *
1321  * @note The user pointer (object) is not freed. If needed, it has to be done by the user.
1322  */
1323 extern
1324 void SCIPbtnodeFree(
1325  SCIP_BT* tree, /**< binary tree */
1326  SCIP_BTNODE** node /**< node to be freed */
1327  );
1328 
1329 /** returns the user data pointer stored in that node */
1330 extern
1331 void* SCIPbtnodeGetData(
1332  SCIP_BTNODE* node /**< node */
1333  );
1334 
1335 /** returns the parent which can be NULL if the given node is the root */
1336 extern
1338  SCIP_BTNODE* node /**< node */
1339  );
1340 
1341 /** returns left child which can be NULL if the given node is a leaf */
1342 extern
1344  SCIP_BTNODE* node /**< node */
1345  );
1346 
1347 /** returns right child which can be NULL if the given node is a leaf */
1348 extern
1350  SCIP_BTNODE* node /**< node */
1351  );
1352 
1353 /** returns the sibling of the node or NULL if does not exist */
1354 extern
1356  SCIP_BTNODE* node /**< node */
1357  );
1358 
1359 /** returns whether the node is a root node */
1360 extern
1362  SCIP_BTNODE* node /**< node */
1363  );
1364 
1365 /** returns whether the node is a leaf */
1366 extern
1368  SCIP_BTNODE* node /**< node */
1369  );
1370 
1371 /** returns TRUE if the given node is left child */
1372 extern
1374  SCIP_BTNODE* node /**< node */
1375  );
1376 
1377 /** returns TRUE if the given node is right child */
1378 extern
1380  SCIP_BTNODE* node /**< node */
1381  );
1382 
1383 #ifdef NDEBUG
1384 
1385 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1386  * speed up the algorithms.
1387  */
1388 
1389 #define SCIPbtnodeGetData(node) ((node)->dataptr)
1390 #define SCIPbtnodeGetParent(node) ((node)->parent)
1391 #define SCIPbtnodeGetLeftchild(node) ((node)->left)
1392 #define SCIPbtnodeGetRightchild(node) ((node)->right)
1393 #define SCIPbtnodeGetSibling(node) ((node)->parent == NULL ? NULL : \
1394  (node)->parent->left == (node) ? (node)->parent->right : (node)->parent->left)
1395 #define SCIPbtnodeIsRoot(node) ((node)->parent == NULL)
1396 #define SCIPbtnodeIsLeaf(node) ((node)->left == NULL && (node)->right == NULL)
1397 #define SCIPbtnodeIsLeftchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->left == (node) ? TRUE : FALSE)
1398 #define SCIPbtnodeIsRightchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->right == (node) ? TRUE : FALSE)
1399 
1400 #endif
1401 
1402 /** sets the give node data
1403  *
1404  * @note The old user pointer is not freed.
1405  */
1406 extern
1407 void SCIPbtnodeSetData(
1408  SCIP_BTNODE* node, /**< node */
1409  void* dataptr /**< node user data pointer */
1410  );
1411 
1412 /** sets parent node
1413  *
1414  * @note The old parent including the rooted subtree is not delete.
1415  */
1416 extern
1417 void SCIPbtnodeSetParent(
1418  SCIP_BTNODE* node, /**< node */
1419  SCIP_BTNODE* parent /**< new parent node, or NULL */
1420  );
1421 
1422 /** sets left child
1423  *
1424  * @note The old left child including the rooted subtree is not delete.
1425  */
1426 extern
1428  SCIP_BTNODE* node, /**< node */
1429  SCIP_BTNODE* left /**< new left child, or NULL */
1430  );
1431 
1432 /** sets right child
1433  *
1434  * @note The old right child including the rooted subtree is not delete.
1435  */
1436 extern
1438  SCIP_BTNODE* node, /**< node */
1439  SCIP_BTNODE* right /**< new right child, or NULL */
1440  );
1441 
1442 /** creates an binary tree */
1443 extern
1445  SCIP_BT** tree, /**< pointer to store the created binary tree */
1446  BMS_BLKMEM* blkmem /**< block memory used to create nodes */
1447  );
1448 
1449 /** frees binary tree
1450  *
1451  * @note The user pointers (object) of the search nodes are not freed. If needed, it has to be done by the user.
1452  */
1453 extern
1454 void SCIPbtFree(
1455  SCIP_BT** tree /**< pointer to binary tree */
1456  );
1457 
1458 /** prints the binary tree in GML format into the given file */
1459 extern
1460 void SCIPbtPrintGml(
1461  SCIP_BT* tree, /**< binary tree */
1462  FILE* file /**< file to write to */
1463  );
1464 
1465 /** returns whether the binary tree is empty (has no nodes) */
1466 extern
1468  SCIP_BT * tree /**< binary tree */
1469  );
1470 
1471 /** returns the root node of the binary tree or NULL if the binary tree is empty */
1472 extern
1474  SCIP_BT* tree /**< tree to be evaluated */
1475  );
1476 
1477 #ifdef NDEBUG
1478 
1479 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1480  * speed up the algorithms.
1481  */
1482 
1483 #define SCIPbtIsEmpty(tree) (tree->root == NULL)
1484 #define SCIPbtGetRoot(tree) (tree->root)
1485 
1486 #endif
1487 
1488 /** sets root node
1489  *
1490  * @note The old root including the rooted subtree is not delete.
1491  */
1492 extern
1493 void SCIPbtSetRoot(
1494  SCIP_BT* tree, /**< tree to be evaluated */
1495  SCIP_BTNODE* root /**< new root, or NULL */
1496  );
1497 
1498 /**@} */
1499 
1500 /*
1501  * Numerical methods
1502  */
1503 
1504 /**@defgroup NumericalMethods Numerical Methods
1505  * @ingroup MiscellaneousMethods
1506  * @brief commonly used numerical methods
1507  *
1508  * @{
1509  */
1510 
1511 /** returns the machine epsilon: the smallest number eps > 0, for which 1.0 + eps > 1.0 */
1512 extern
1514  void
1515  );
1516 
1517 /** calculates the greatest common divisor of the two given values */
1518 extern
1520  SCIP_Longint val1, /**< first value of greatest common devisor calculation */
1521  SCIP_Longint val2 /**< second value of greatest common devisor calculation */
1522  );
1523 
1524 /** calculates the smallest common multiple of the two given values */
1525 extern
1527  SCIP_Longint val1, /**< first value of smallest common multiple calculation */
1528  SCIP_Longint val2 /**< second value of smallest common multiple calculation */
1529  );
1530 
1531 /** calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because
1532  * 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
1533  * big numbers or an negative value m (and m < n) and -1 will be returned
1534  */
1535 extern
1537  int n, /**< number of different elements */
1538  int m /**< number to choose out of the above */
1539  );
1540 
1541 /** converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was
1542  * successful
1543  */
1544 extern
1546  SCIP_Real val, /**< real value r to convert into rational number */
1547  SCIP_Real mindelta, /**< minimal allowed difference r - q of real r and rational q = n/d */
1548  SCIP_Real maxdelta, /**< maximal allowed difference r - q of real r and rational q = n/d */
1549  SCIP_Longint maxdnom, /**< maximal denominator allowed */
1550  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1551  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1552  );
1553 
1554 /** tries to find a value, such that all given values, if scaled with this value become integral in relative allowed
1555  * difference in between mindelta and maxdelta
1556  */
1557 extern
1559  SCIP_Real* vals, /**< values to scale */
1560  int nvals, /**< number of values to scale */
1561  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
1562  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
1563  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
1564  SCIP_Real maxscale, /**< maximal allowed scalar */
1565  SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
1566  SCIP_Bool* success /**< stores whether returned value is valid */
1567  );
1568 
1569 /** given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small
1570  * number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational
1571  * number inside the interval was found
1572  */
1573 extern
1575  SCIP_Real lb, /**< lower bound of the interval */
1576  SCIP_Real ub, /**< upper bound of the interval */
1577  SCIP_Longint maxdnom, /**< maximal denominator allowed for resulting rational number */
1578  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1579  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1580  );
1581 
1582 /** given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number
1583  * with simple denominator (i.e. a small number, probably multiplied with powers of 10);
1584  * if no valid rational number inside the interval was found, selects the central value of the interval
1585  */
1586 extern
1588  SCIP_Real lb, /**< lower bound of the interval */
1589  SCIP_Real ub, /**< upper bound of the interval */
1590  SCIP_Longint maxdnom /**< maximal denominator allowed for resulting rational number */
1591  );
1592 
1593 /* The C99 standard defines the function (or macro) isfinite.
1594  * On MacOS X, isfinite is also available.
1595  * From the BSD world, there comes a function finite.
1596  * On SunOS, finite is also available.
1597  * In the MS compiler world, there is a function _finite.
1598  * As last resort, we check whether x == x does not hold, but this works only for NaN's, not for infinities!
1599  */
1600 #if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__)
1601 #define SCIPisFinite isfinite
1602 #elif defined(_BSD_SOURCE) || defined(__sun)
1603 #define SCIPisFinite finite
1604 #elif defined(_MSC_VER)
1605 #define SCIPisFinite _finite
1606 #else
1607 #define SCIPisFinite(x) ((x) == (x))
1608 #endif
1609 
1610 /* In debug mode, the following methods are implemented as function calls to ensure
1611  * type validity.
1612  */
1613 
1614 /** returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0) */
1615 extern
1617  SCIP_Real val1, /**< first value to be compared */
1618  SCIP_Real val2 /**< second value to be compared */
1619  );
1620 
1621 #ifdef NDEBUG
1622 
1623 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1624  * speed up the algorithms.
1625  */
1626 
1627 #define SCIPrelDiff(val1, val2) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) )
1628 
1629 #endif
1630 
1631 /** computes the gap from the primal and the dual bound */
1632 extern
1634  SCIP_Real eps, /**< the value treated as zero */
1635  SCIP_Real inf, /**< the value treated as infinity */
1636  SCIP_Real primalbound, /**< the primal bound */
1637  SCIP_Real dualbound /**< the dual bound */
1638  );
1639 
1640 /**@} */
1641 
1642 
1643 /*
1644  * Random Numbers
1645  */
1646 
1647 /**@defgroup RandomNumbers Random Numbers
1648  * @ingroup MiscellaneousMethods
1649  * @brief structures and methods for pseudo random number generation
1650  *
1651  *@{
1652  */
1653 
1654 /** returns a random integer between minrandval and maxrandval
1655  *
1656  * @deprecated Please use SCIPrandomGetInt() to request a random integer.
1657  */
1658 extern
1659 int SCIPgetRandomInt(
1660  int minrandval, /**< minimal value to return */
1661  int maxrandval, /**< maximal value to return */
1662  unsigned int* seedp /**< pointer to seed value */
1663  );
1664 
1665 
1666 /** returns a random integer between minrandval and maxrandval */
1667 extern
1668 int SCIPrandomGetInt(
1669  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1670  int minrandval, /**< minimal value to return */
1671  int maxrandval /**< maximal value to return */
1672  );
1673 
1674 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1675  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1676  */
1677 extern
1679  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1680  void** set, /**< original set, from which elements should be drawn */
1681  int nelems, /**< number of elements in original set */
1682  void** subset, /**< subset in which drawn elements should be stored */
1683  int nsubelems /**< number of elements that should be drawn and stored */
1684  );
1685 
1686 /** returns a random real between minrandval and maxrandval */
1687 extern
1689  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1690  SCIP_Real minrandval, /**< minimal value to return */
1691  SCIP_Real maxrandval /**< maximal value to return */
1692  );
1693 
1694 /** creates and initializes a random number generator */
1695 extern
1697  SCIP_RANDNUMGEN** randnumgen, /**< random number generator */
1698  BMS_BLKMEM* blkmem, /**< block memory */
1699  unsigned int initialseed /**< initial random seed */
1700  );
1701 
1702 
1703 /** frees a random number generator */
1704 extern
1705 void SCIPrandomFree(
1706  SCIP_RANDNUMGEN** randnumgen /**< random number generator */
1707  );
1708 
1709 /** returns a random real between minrandval and maxrandval
1710  *
1711  * @deprecated Please use SCIPrandomGetReal() to request a random real.
1712  */
1713 extern
1715  SCIP_Real minrandval, /**< minimal value to return */
1716  SCIP_Real maxrandval, /**< maximal value to return */
1717  unsigned int* seedp /**< pointer to seed value */
1718  );
1719 
1720 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1721  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1722  *
1723  * @deprecated Please use SCIPrandomGetSubset()
1724  */
1725 extern
1727  void** set, /**< original set, from which elements should be drawn */
1728  int nelems, /**< number of elements in original set */
1729  void** subset, /**< subset in which drawn elements should be stored */
1730  int nsubelems, /**< number of elements that should be drawn and stored */
1731  unsigned int randseed /**< seed value for random generator */
1732  );
1733 
1734 
1735 /**@} */
1736 
1737 /*
1738  * Permutations / Shuffling
1739  */
1740 
1741 /**@defgroup PermutationsShuffling Permutations Shuffling
1742  * @ingroup MiscellaneousMethods
1743  * @brief methods for shuffling arrays
1744  *
1745  * @{
1746  */
1747 
1748 /** swaps two ints */
1749 extern
1750 void SCIPswapInts(
1751  int* value1, /**< pointer to first integer */
1752  int* value2 /**< pointer to second integer */
1753  );
1754 
1755 /** swaps two real values */
1756 extern
1757 void SCIPswapReals(
1758  SCIP_Real* value1, /**< pointer to first real value */
1759  SCIP_Real* value2 /**< pointer to second real value */
1760 );
1761 
1762 /** swaps the addresses of two pointers */
1763 extern
1764 void SCIPswapPointers(
1765  void** pointer1, /**< first pointer */
1766  void** pointer2 /**< second pointer */
1767  );
1768 
1769 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm
1770  *
1771  * @deprecated Please use SCIPrandomPermuteIntArray()
1772  */
1773 extern
1774 void SCIPpermuteIntArray(
1775  int* array, /**< array to be shuffled */
1776  int begin, /**< first included index that should be subject to shuffling
1777  * (0 for first array entry)
1778  */
1779  int end, /**< first excluded index that should not be subject to shuffling
1780  * (array size for last array entry)
1781  */
1782  unsigned int* randseed /**< seed value for the random generator */
1783  );
1784 
1785 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm */
1786 extern
1788  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1789  int* array, /**< array to be shuffled */
1790  int begin, /**< first included index that should be subject to shuffling
1791  * (0 for first array entry)
1792  */
1793  int end /**< first excluded index that should not be subject to shuffling
1794  * (array size for last array entry)
1795  */
1796  );
1797 
1798 /** randomly shuffles parts of an array using the Fisher-Yates algorithm */
1799 extern
1801  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1802  void** array, /**< array to be shuffled */
1803  int begin, /**< first included index that should be subject to shuffling
1804  * (0 for first array entry)
1805  */
1806  int end /**< first excluded index that should not be subject to shuffling
1807  * (array size for last array entry)
1808  */
1809  );
1810 
1811 /** randomly shuffles parts of an array using the Fisher-Yates algorithm
1812  *
1813  * @deprecated Please use SCIPrandomPermuteArray()
1814  */
1815 extern
1816 void SCIPpermuteArray(
1817  void** array, /**< array to be shuffled */
1818  int begin, /**< first included index that should be subject to shuffling
1819  * (0 for first array entry)
1820  */
1821  int end, /**< first excluded index that should not be subject to shuffling
1822  * (array size for last array entry)
1823  */
1824  unsigned int* randseed /**< pointer to seed value for the random generator */
1825  );
1826 
1827 /**@} */
1828 
1829 
1830 /*
1831  * Arrays
1832  */
1833 
1834 /**@defgroup Arrays Arrays
1835  * @ingroup MiscellaneousMethods
1836  * @brief miscellaneous methods for arrays
1837  *
1838  * @{
1839  */
1840 
1841 
1842 /** computes set intersection (duplicates removed) of two arrays that are ordered ascendingly */
1843 extern
1845  int* array1, /**< first array (in ascending order) */
1846  int narray1, /**< number of entries of first array */
1847  int* array2, /**< second array (in ascending order) */
1848  int narray2, /**< number of entries of second array */
1849  int* intersectarray, /**< intersection of array1 and array2
1850  * (note: it is possible to use array1 for this input argument) */
1851  int* nintersectarray /**< pointer to store number of entries of intersection array
1852  * (note: it is possible to use narray1 for this input argument) */
1853  );
1854 
1855 /** computes set difference (duplicates removed) of two arrays that are ordered ascendingly */
1856 extern
1858  int* array1, /**< first array (in ascending order) */
1859  int narray1, /**< number of entries of first array */
1860  int* array2, /**< second array (in ascending order) */
1861  int narray2, /**< number of entries of second array */
1862  int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
1863  * (note: it is possible to use array1 for this input argument) */
1864  int* nsetminusarray /**< pointer to store number of entries of setminus array
1865  * (note: it is possible to use narray1 for this input argument) */
1866  );
1867 
1868 /**@} */
1869 
1870 
1871 /*
1872  * Strings
1873  */
1874 
1875 /**@defgroup StringMethods String Methods
1876  * @ingroup MiscellaneousMethods
1877  * @brief commonly used methods for strings
1878  *
1879  *@{
1880  */
1881 
1882 /** copies characters from 'src' to 'dest', copying is stopped when either the 'stop' character is reached or after
1883  * 'cnt' characters have been copied, whichever comes first.
1884  *
1885  * @note undefined behaviuor on overlapping arrays
1886  */
1887 extern
1888 int SCIPmemccpy(
1889  char* dest, /**< destination pointer to copy to */
1890  const char* src, /**< source pointer to copy to */
1891  char stop, /**< character when found stop copying */
1892  unsigned int cnt /**< maximal number of characters to copy too */
1893  );
1894 
1895 /** prints an error message containing of the given string followed by a string describing the current system error;
1896  * prefers to use the strerror_r method, which is threadsafe; on systems where this method does not exist,
1897  * NO_STRERROR_R should be defined (see INSTALL), in this case, srerror is used which is not guaranteed to be
1898  * threadsafe (on SUN-systems, it actually is)
1899  */
1900 extern
1901 void SCIPprintSysError(
1902  const char* message /**< first part of the error message, e.g. the filename */
1903  );
1904 
1905 /** extracts tokens from strings - wrapper method for strtok_r() */
1906 extern
1907 char* SCIPstrtok(
1908  char* s, /**< string to parse */
1909  const char* delim, /**< delimiters for parsing */
1910  char** ptrptr /**< pointer to working char pointer - must stay the same while parsing */
1911  );
1912 
1913 /** translates the given string into a string where symbols ", ', and spaces are escaped with a \ prefix */
1914 extern
1915 void SCIPescapeString(
1916  char* t, /**< target buffer to store escaped string */
1917  int bufsize, /**< size of buffer t */
1918  const char* s /**< string to transform into escaped string */
1919  );
1920 
1921 /** safe version of snprintf */
1922 extern
1923 int SCIPsnprintf(
1924  char* t, /**< target string */
1925  int len, /**< length of the string to copy */
1926  const char* s, /**< source string */
1927  ... /**< further parameters */
1928  );
1929 
1930 /** 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
1931  *
1932  * @return Returns TRUE if a value could be extracted, otherwise FALSE
1933  */
1934 extern
1936  const char* str, /**< string to search */
1937  int* value, /**< pointer to store the parsed value */
1938  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1939  );
1940 
1941 /** 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
1942  *
1943  * @return Returns TRUE if a value could be extracted, otherwise FALSE
1944  */
1945 extern
1947  const char* str, /**< string to search */
1948  SCIP_Real* value, /**< pointer to store the parsed value */
1949  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1950  );
1951 
1952 /** copies the first size characters between a start and end character of str into token, if no error occured endptr
1953  * will point to the position after the read part, otherwise it will point to @p str
1954  */
1955 extern
1956 void SCIPstrCopySection(
1957  const char* str, /**< string to search */
1958  char startchar, /**< character which defines the beginning */
1959  char endchar, /**< character which defines the ending */
1960  char* token, /**< string to store the copy */
1961  int size, /**< size of the token char array */
1962  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1963  );
1964 
1965 /**@} */
1966 
1967 /*
1968  * File methods
1969  */
1970 
1971 /**@defgroup FileMethods File Methods
1972  * @ingroup MiscellaneousMethods
1973  * @brief commonly used file methods
1974  *
1975  * @{
1976  */
1977 
1978 /** returns, whether the given file exists */
1979 extern
1981  const char* filename /**< file name */
1982  );
1983 
1984 /** splits filename into path, name, and extension */
1985 extern
1986 void SCIPsplitFilename(
1987  char* filename, /**< filename to split; is destroyed (but not freed) during process */
1988  char** path, /**< pointer to store path, or NULL if not needed */
1989  char** name, /**< pointer to store name, or NULL if not needed */
1990  char** extension, /**< pointer to store extension, or NULL if not needed */
1991  char** compression /**< pointer to store compression extension, or NULL if not needed */
1992  );
1993 
1994 /**@} */
1995 
1996 #ifdef __cplusplus
1997 }
1998 #endif
1999 
2000 #endif
void SCIPmultihashFree(SCIP_MULTIHASH **multihash)
Definition: misc.c:1712
void SCIPpermuteArray(void **array, int begin, int end, unsigned int *randseed)
Definition: misc.c:9046
SCIP_RETCODE SCIPbtnodeCreate(SCIP_BT *tree, SCIP_BTNODE **node, void *dataptr)
Definition: misc.c:7501
void ** SCIPdigraphGetSuccessorsData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6837
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1263
SCIP_RETCODE SCIPrandomCreate(SCIP_RANDNUMGEN **randnumgen, BMS_BLKMEM *blkmem, unsigned int initialseed)
Definition: misc.c:8693
void SCIPbtnodeFree(SCIP_BT *tree, SCIP_BTNODE **node)
Definition: misc.c:7565
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3143
SCIP_Real SCIPnormalGetCriticalValue(SCIP_CONFIDENCELEVEL clevel)
Definition: misc.c:171
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition: misc.c:9252
SCIP_Real SCIPerf(SCIP_Real x)
Definition: misc.c:144
void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:808
type definitions for miscellaneous datastructures
SCIP_BTNODE * SCIPbtnodeGetSibling(SCIP_BTNODE *node)
Definition: misc.c:7650
SCIP_RETCODE SCIPprofileDeleteCore(SCIP_PROFILE *profile, int left, int right, int height)
Definition: misc.c:6114
void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition: misc.c:7610
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2253
SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
Definition: misc.c:2540
void SCIPdigraphFreeComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:7347
void SCIPgmlWriteArc(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:627
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition: misc.c:6931
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6819
SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition: misc.c:978
void SCIPgmlWriteNode(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition: misc.c:485
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition: misc.c:9529
#define INLINE
Definition: def.h:92
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3133
SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:831
int SCIPprofileGetTime(SCIP_PROFILE *profile, int pos)
Definition: misc.c:5911
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:1679
void SCIPgmlWriteClosing(FILE *file)
Definition: misc.c:687
void SCIPswapPointers(void **pointer1, void **pointer2)
Definition: misc.c:8996
void SCIPbtnodeSetRightchild(SCIP_BTNODE *node, SCIP_BTNODE *right)
Definition: misc.c:7771
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:2764
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition: misc.c:9618
int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:6204
miscellaneous datastructures
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:9340
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randgen, void **array, int begin, int end)
Definition: misc.c:8794
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPdigraphSetSizes(SCIP_DIGRAPH *digraph, int *sizes)
Definition: misc.c:6569
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:7448
SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5765
void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition: misc.c:1249
SCIPInterval exp(const SCIPInterval &x)
SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition: misc.c:262
void SCIPhashtableClear(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2116
SCIP_RETCODE SCIPcomputeArraysIntersection(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition: misc.c:9139
void SCIPregressionAddObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:369
void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
Definition: misc.c:8983
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:7114
SCIP_Bool SCIPstrToIntValue(const char *str, int *value, char **endptr)
Definition: misc.c:9380
void SCIPpqueueFree(SCIP_PQUEUE **pqueue)
Definition: misc.c:1160
SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int height, int *pos, SCIP_Bool *infeasible)
Definition: misc.c:6084
type definitions for return codes for SCIP methods
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randgen, int minrandval, int maxrandval)
Definition: misc.c:8723
SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
Definition: misc.c:8482
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition: misc.c:7127
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition: misc.c:3096
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2902
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:1074
int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition: misc.c:5923
SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2921
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:7050
SCIP_Bool SCIPbtnodeIsRoot(SCIP_BTNODE *node)
Definition: misc.c:7670
void SCIPmultihashRemoveAll(SCIP_MULTIHASH *multihash)
Definition: misc.c:1929
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:2014
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2996
SCIP_Longint SCIPmultihashGetNElements(SCIP_MULTIHASH *multihash)
Definition: misc.c:1950
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:9513
void SCIPqueueClear(SCIP_QUEUE *queue)
Definition: misc.c:967
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
Definition: misc.c:6746
int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition: misc.c:5871
SCIP_Bool SCIPrealToRational(SCIP_Real val, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:8077
SCIP_RETCODE SCIPdigraphCreate(SCIP_DIGRAPH **digraph, int nnodes)
Definition: misc.c:6442
SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition: misc.c:5720
void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:337
SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
Definition: misc.c:2531
void SCIPrandomFree(SCIP_RANDNUMGEN **randnumgen)
Definition: misc.c:8710
enum SCIP_Confidencelevel SCIP_CONFIDENCELEVEL
Definition: type_misc.h:44
SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:788
int SCIPqueueNElems(SCIP_QUEUE *queue)
Definition: misc.c:1087
SCIP_Bool SCIPmultihashExists(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1868
SCIP_BTNODE * SCIPbtnodeGetParent(SCIP_BTNODE *node)
Definition: misc.c:7620
SCIP_RETCODE SCIPdigraphSetNSuccessors(SCIP_DIGRAPH *digraph, int node, int nsuccessors)
Definition: misc.c:6730
void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3058
int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5795
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition: misc.c:3114
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition: misc.c:3122
void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition: misc.c:7757
void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6756
static INLINE uint32_t SCIPrealHashCode(double x)
Definition: pub_misc.h:488
void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition: misc.c:6772
void SCIPescapeString(char *t, int bufsize, const char *s)
Definition: misc.c:9312
void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition: misc.c:9441
SCIP_RETCODE SCIPmultihashSafeInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1784
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:2797
void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:7374
void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition: misc.c:5739
void SCIPgmlWriteEdge(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:583
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2461
type definitions for problem variables
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2383
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:5811
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:956
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:6668
SCIP_Bool SCIPbtnodeIsRightchild(SCIP_BTNODE *node)
Definition: misc.c:7708
SCIP_Real SCIPmultihashGetLoad(SCIP_MULTIHASH *multihash)
Definition: misc.c:1960
void * SCIPpqueueRemove(SCIP_PQUEUE *pqueue)
Definition: misc.c:1208
SCIP_RETCODE SCIPgetRandomSubset(void **set, int nelems, void **subset, int nsubelems, unsigned int randseed)
Definition: misc.c:9080
SCIP_BTNODE * SCIPbtGetRoot(SCIP_BT *tree)
Definition: misc.c:7893
SCIP_RETCODE SCIPhashmapInsertReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:2875
void SCIPregressionFree(SCIP_REGRESSION **regression)
Definition: misc.c:420
SCIP_RETCODE SCIPcomputeArraysSetminus(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition: misc.c:9195
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard)
Definition: misc.c:2559
void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2493
SCIP_BTNODE * SCIPbtnodeGetRightchild(SCIP_BTNODE *node)
Definition: misc.c:7640
SCIP_RETCODE SCIPdigraphAddArcSafe(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:6696
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6804
#define SCIP_Bool
Definition: def.h:61
SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:798
void SCIPprintSysError(const char *message)
Definition: misc.c:9276
SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
Definition: misc.c:702
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3163
SCIP_RETCODE SCIPmultihashInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1743
SCIP_Bool SCIPprofileFindLeft(SCIP_PROFILE *profile, int timepoint, int *pos)
Definition: misc.c:5937
SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition: misc.c:6471
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randgen, int *array, int begin, int end)
Definition: misc.c:8764
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition: misc.c:9411
int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition: misc.c:6786
void SCIPbtFree(SCIP_BT **tree)
Definition: misc.c:7801
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2285
SCIP_Bool SCIPbtnodeIsLeftchild(SCIP_BTNODE *node)
Definition: misc.c:7690
static const unsigned int randseed
Definition: circle.c:46
SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
Definition: misc.c:7259
void * SCIPmultihashRetrieveNext(SCIP_MULTIHASH *multihash, SCIP_MULTIHASHLIST **multihashlist, void *key)
Definition: misc.c:1832
SCIP_Real SCIPcomputeTwoSampleTTestValue(SCIP_Real meanx, SCIP_Real meany, SCIP_Real variancex, SCIP_Real variancey, SCIP_Real countx, SCIP_Real county)
Definition: misc.c:111
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1274
void SCIPprofilePrint(SCIP_PROFILE *profile, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:5849
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:533
SCIP_Bool SCIPfindSimpleRational(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:8441
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2314
int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:5891
SCIP_VAR ** SCIPsparseSolGetVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:768
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition: misc.c:8745
int * SCIPprofileGetLoads(SCIP_PROFILE *profile)
Definition: misc.c:5901
int SCIPgetRandomInt(int minrandval, int maxrandval, unsigned int *seedp)
Definition: misc.c:8605
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2064
SCIP_Bool SCIPbtIsEmpty(SCIP_BT *tree)
Definition: misc.c:7883
SCIP_Real SCIPgetRandomReal(SCIP_Real minrandval, SCIP_Real maxrandval, unsigned int *seedp)
Definition: misc.c:8618
SCIP_BTNODE * SCIPbtnodeGetLeftchild(SCIP_BTNODE *node)
Definition: misc.c:7630
methods for sorting joint arrays of various types
int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:778
void SCIPbtSetRoot(SCIP_BT *tree, SCIP_BTNODE *root)
Definition: misc.c:7906
SCIP_RETCODE SCIPhashmapSetImageReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:2970
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3012
void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition: misc.c:7743
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition: misc.c:3106
SCIP_Real SCIPstudentTGetCriticalValue(SCIP_CONFIDENCELEVEL clevel, int df)
Definition: misc.c:94
SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition: misc.c:932
SCIP_RETCODE SCIPdigraphCopy(SCIP_DIGRAPH **targetdigraph, SCIP_DIGRAPH *sourcedigraph)
Definition: misc.c:6509
SCIP_RETCODE SCIPpqueueInsert(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1181
SCIP_Real SCIPcalcMachineEpsilon(void)
Definition: misc.c:7922
SCIP_RETCODE SCIPpqueueCreate(SCIP_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)))
Definition: misc.c:1135
SCIP_Real SCIPhashmapEntryGetImageReal(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3153
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:151
void * SCIPmultihashRetrieve(SCIP_MULTIHASH *multihash, void *key)
Definition: misc.c:1803
SCIP_Real SCIPnormalCDF(SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
Definition: misc.c:184
SCIP_Real SCIPregressionGetSlope(SCIP_REGRESSION *regression)
Definition: misc.c:252
int SCIPactivityGetDuration(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5775
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2942
#define SCIP_Real
Definition: def.h:145
void SCIPmultihashPrintStatistics(SCIP_MULTIHASH *multihash, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:1970
void SCIPpermuteIntArray(int *array, int begin, int end, unsigned int *randseed)
Definition: misc.c:9012
SCIP_RETCODE SCIPrandomGetSubset(SCIP_RANDNUMGEN *randgen, void **set, int nelems, void **subset, int nsubelems)
Definition: misc.c:8826
SCIP_Longint SCIPcalcBinomCoef(int n, int m)
Definition: misc.c:8887
#define SCIP_Longint
Definition: def.h:130
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:8237
void SCIPregressionReset(SCIP_REGRESSION *regression)
Definition: misc.c:388
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2365
void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition: misc.c:1022
type definitions for message output methods
SCIP_RETCODE SCIPmultihashRemove(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1895
#define nnodes
Definition: gastrans.c:65
int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int lb, int ub, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:6354
void SCIPgmlWriteOpening(FILE *file, SCIP_Bool directed)
Definition: misc.c:671
int SCIPcalcMultihashSize(int minsize)
Definition: misc.c:1356
SCIP_RETCODE SCIPregressionCreate(SCIP_REGRESSION **regression)
Definition: misc.c:404
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2845
SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2483
common defines and data types used in all packages of SCIP
void * SCIPqueueFirst(SCIP_QUEUE *queue)
Definition: misc.c:1056
void SCIPswapInts(int *value1, int *value2)
Definition: misc.c:8970
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:396
SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition: misc.c:7782
int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5785
void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition: misc.c:7729
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition: misc.c:6591
int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:5881
void SCIPpqueueClear(SCIP_PQUEUE *pqueue)
Definition: misc.c:1171
int SCIPregressionGetNObservations(SCIP_REGRESSION *regression)
Definition: misc.c:242
char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
Definition: misc.c:9298
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:7945
void SCIPdigraphPrintGml(SCIP_DIGRAPH *digraph, FILE *file)
Definition: misc.c:7409
void SCIPbtPrintGml(SCIP_BT *tree, FILE *file)
Definition: misc.c:7853
SCIP_Longint SCIPhashtableGetNElements(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2473
SCIP_Longint SCIPcalcSmaComMul(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:8056
SCIP_Bool SCIPbtnodeIsLeaf(SCIP_BTNODE *node)
Definition: misc.c:7680
void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
Definition: misc.c:754
SCIP_Real SCIPcomputeGap(SCIP_Real eps, SCIP_Real inf, SCIP_Real primalbound, SCIP_Real dualbound)
Definition: misc.c:9636
void SCIPprofileFree(SCIP_PROFILE **profile)
Definition: misc.c:5835
methods for selecting (weighted) k-medians
memory allocation routines