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 #define SCIPhashSignature64(a) ((uint64_t)(UINT64_C(1) << ((a) % 64)))
471 #define SCIPhashTwo(a, b) ((uint32_t)((((uint64_t)(a) + 0xd37e9a1ce2148403ULL) * ((uint64_t)(b) + 0xe5fcc163aef32782ULL) )>>32))
472 
473 #define SCIPhashFour(a, b, c, d) ((uint32_t)((((uint64_t)(a) + 0xbd5c89185f082658ULL) * ((uint64_t)(b) + 0xe5fcc163aef32782ULL) + \
474  ((uint64_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint64_t)(d) + 0x926f2d4dc4a67218ULL))>>32 ))
475 
476 /* helpers to use above hashfuncions */
477 #define SCIPcombineTwoInt(a, b) (((uint64_t) (a) << 32) | (uint64_t) (b) )
478 
479 #define SCIPcombineThreeInt(a, b, c) (((uint64_t) (a) << 43) + ((uint64_t) (b) << 21) + ((uint64_t) (c)) )
480 
481 #define SCIPcombineFourInt(a, b, c, d) (((uint64_t) (a) << 48) + ((uint64_t) (b) << 32) + ((uint64_t) (c) << 16) + ((uint64_t) (d)) )
482 
483 /* computes a hashcode for a floating point value containing n bits after the comma */
484 #define SCIPrealHashCode(x, n) ( (x)*(1<<n) >= INT64_MAX ? INT64_MAX : ((x)*(1<<n) <= INT64_MIN ? INT64_MIN : (int64_t)((x)*(1<<n))) )
485 
486 #define SCIPpositiveRealHashCode(x, n) ( (x)*(1<<n) >= UINT64_MAX ? UINT64_MAX : (uint64_t)((x)*(1<<n)) )
487 
488 
489 /** creates a hash table */
490 extern
492  SCIP_HASHTABLE** hashtable, /**< pointer to store the created hash table */
493  BMS_BLKMEM* blkmem, /**< block memory used to store hash table entries */
494  int tablesize, /**< size of the hash table */
495  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
496  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
497  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
498  void* userptr /**< user pointer */
499  );
500 
501 /** frees the hash table */
502 extern
503 void SCIPhashtableFree(
504  SCIP_HASHTABLE** hashtable /**< pointer to the hash table */
505  );
506 
507 /** removes all elements of the hash table
508  *
509  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
510  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
511  *
512  * @deprecated Please use SCIPhashtableRemoveAll()
513  */
514 extern
515 void SCIPhashtableClear(
516  SCIP_HASHTABLE* hashtable /**< hash table */
517  );
518 
519 /** inserts element in hash table (multiple inserts of same element override the previous entry) */
520 extern
522  SCIP_HASHTABLE* hashtable, /**< hash table */
523  void* element /**< element to insert into the table */
524  );
525 
526 /** inserts element in hash table (multiple insertion of same element is checked and results in an error) */
527 extern
529  SCIP_HASHTABLE* hashtable, /**< hash table */
530  void* element /**< element to insert into the table */
531  );
532 
533 /** retrieve element with key from hash table, returns NULL if not existing */
534 extern
536  SCIP_HASHTABLE* hashtable, /**< hash table */
537  void* key /**< key to retrieve */
538  );
539 
540 /** returns whether the given element exists in the table */
541 extern
543  SCIP_HASHTABLE* hashtable, /**< hash table */
544  void* element /**< element to search in the table */
545  );
546 
547 /** removes element from the hash table, if it exists */
548 extern
550  SCIP_HASHTABLE* hashtable, /**< hash table */
551  void* element /**< element to remove from the table */
552  );
553 
554 /** removes all elements of the hash table */
555 extern
557  SCIP_HASHTABLE* hashtable /**< hash table */
558  );
559 
560 /** returns number of hash table elements */
561 extern
563  SCIP_HASHTABLE* hashtable /**< hash table */
564  );
565 
566 /** returns the load of the given hash table in percentage */
567 extern
569  SCIP_HASHTABLE* hashtable /**< hash table */
570  );
571 
572 /** prints statistics about hash table usage */
573 extern
575  SCIP_HASHTABLE* hashtable, /**< hash table */
576  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
577  );
578 
579 /**@} */
580 
581 /*
582  * MultiHash Table
583  */
584 
585 /**@defgroup MultiHash Multi Hash table
586  * @ingroup DataStructures
587  * @brief hash table that resolves conflicts by queueing, thereby allowing for duplicate entries
588  *
589  *@{
590  */
591 
592 /** returns a reasonable hash table size (a prime number) that is at least as large as the specified value */
593 extern
595  int minsize /**< minimal size of the hash table */
596  );
597 
598 /** creates a multihash table */
599 extern
601  SCIP_MULTIHASH** multihash, /**< pointer to store the created multihash table */
602  BMS_BLKMEM* blkmem, /**< block memory used to store multihash table entries */
603  int tablesize, /**< size of the hash table */
604  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
605  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
606  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
607  void* userptr /**< user pointer */
608  );
609 
610 /** frees the multihash table */
611 extern
612 void SCIPmultihashFree(
613  SCIP_MULTIHASH** multihash /**< pointer to the multihash table */
614  );
615 
616 /** inserts element in multihash table (multiple inserts of same element possible)
617  *
618  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding an element
619  * to the hash table, due to dynamic resizing.
620  */
621 extern
623  SCIP_MULTIHASH* multihash, /**< multihash table */
624  void* element /**< element to insert into the table */
625  );
626 
627 /** inserts element in multihash table (multiple insertion of same element is checked and results in an error)
628  *
629  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding a new
630  * element to the multihash table, due to dynamic resizing.
631  */
632 extern
634  SCIP_MULTIHASH* multihash, /**< multihash table */
635  void* element /**< element to insert into the table */
636  );
637 
638 /** retrieve element with key from multihash table, returns NULL if not existing */
639 extern
641  SCIP_MULTIHASH* multihash, /**< multihash table */
642  void* key /**< key to retrieve */
643  );
644 
645 /** retrieve element with key from multihash table, returns NULL if not existing
646  * can be used to retrieve all entries with the same key (one-by-one)
647  *
648  * @note The returned multimultihashlist pointer might get invalid when adding a new element to the multihash table.
649  */
650 extern
652  SCIP_MULTIHASH* multihash, /**< multihash table */
653  SCIP_MULTIHASHLIST** multihashlist, /**< input: entry in hash table list from which to start searching, or NULL
654  * output: entry in hash table list corresponding to element after
655  * retrieved one, or NULL */
656  void* key /**< key to retrieve */
657  );
658 
659 /** returns whether the given element exists in the multihash table */
660 extern
662  SCIP_MULTIHASH* multihash, /**< multihash table */
663  void* element /**< element to search in the table */
664  );
665 
666 /** removes element from the multihash table, if it exists */
667 extern
669  SCIP_MULTIHASH* multihash, /**< multihash table */
670  void* element /**< element to remove from the table */
671  );
672 
673 /** removes all elements of the multihash table
674  *
675  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
676  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
677  */
678 extern
680  SCIP_MULTIHASH* multihash /**< multihash table */
681  );
682 
683 /** returns number of multihash table elements */
684 extern
686  SCIP_MULTIHASH* multihash /**< multihash table */
687  );
688 
689 /** returns the load of the given multihash table in percentage */
690 extern
692  SCIP_MULTIHASH* multihash /**< multihash table */
693  );
694 
695 /** prints statistics about multihash table usage */
696 extern
698  SCIP_MULTIHASH* multihash, /**< multihash table */
699  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
700  );
701 
702 /** standard hash key comparator for string keys */
703 extern
704 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString);
705 
706 /** standard hashing function for string keys */
707 extern
708 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString);
709 
710 /** gets the element as the key */
711 extern
712 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard);
713 
714 /** returns TRUE iff both keys(pointer) are equal */
715 extern
716 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqPtr);
717 
718 /** returns the hash value of the key */
719 extern
720 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValPtr);
721 
722 /**@} */
723 
724 
725 /*
726  * Hash Map
727  */
728 
729 /**@defgroup HashMap Hash Map
730  * @ingroup DataStructures
731  * @brief hash map to store key-value pairs (called \p origin and \p image)
732  *
733  * @{
734  */
735 
736 /** creates a hash map mapping pointers to pointers */
737 extern
739  SCIP_HASHMAP** hashmap, /**< pointer to store the created hash map */
740  BMS_BLKMEM* blkmem, /**< block memory used to store hash map entries */
741  int mapsize /**< size of the hash map */
742  );
743 
744 /** frees the hash map */
745 extern
746 void SCIPhashmapFree(
747  SCIP_HASHMAP** hashmap /**< pointer to the hash map */
748  );
749 
750 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
751 extern
753  SCIP_HASHMAP* hashmap, /**< hash map */
754  void* origin, /**< origin to set image for */
755  void* image /**< new image for origin */
756  );
757 
758 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
759 extern
761  SCIP_HASHMAP* hashmap, /**< hash map */
762  void* origin, /**< origin to set image for */
763  SCIP_Real image /**< new image for origin */
764  );
765 
766 /** retrieves image of given origin from the hash map, or NULL if no image exists */
767 extern
768 void* SCIPhashmapGetImage(
769  SCIP_HASHMAP* hashmap, /**< hash map */
770  void* origin /**< origin to retrieve image for */
771  );
772 
773 /** retrieves image of given origin from the hash map, or NULL if no image exists */
774 extern
776  SCIP_HASHMAP* hashmap, /**< hash map */
777  void* origin /**< origin to retrieve image for */
778  );
779 
780 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
781  * new origin->image pair
782  */
783 extern
785  SCIP_HASHMAP* hashmap, /**< hash map */
786  void* origin, /**< origin to set image for */
787  void* image /**< new image for origin */
788  );
789 
790 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
791  * new origin->image pair
792  */
793 extern
795  SCIP_HASHMAP* hashmap, /**< hash map */
796  void* origin, /**< origin to set image for */
797  SCIP_Real image /**< new image for origin */
798  );
799 
800 /** checks whether an image to the given origin exists in the hash map */
801 extern
803  SCIP_HASHMAP* hashmap, /**< hash map */
804  void* origin /**< origin to search for */
805  );
806 
807 /** removes origin->image pair from the hash map, if it exists */
808 extern
810  SCIP_HASHMAP* hashmap, /**< hash map */
811  void* origin /**< origin to remove from the list */
812  );
813 
814 /** prints statistics about hash map usage */
815 extern
817  SCIP_HASHMAP* hashmap, /**< hash map */
818  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
819  );
820 
821 /** indicates whether a hash map has no entries */
822 extern
824  SCIP_HASHMAP* hashmap /**< hash map */
825  );
826 
827 /** gives the number of elements in a hash map */
828 extern
830  SCIP_HASHMAP* hashmap /**< hash map */
831  );
832 
833 /** gives the number of entries in the internal arrays of a hash map */
834 extern
836  SCIP_HASHMAP* hashmap /**< hash map */
837  );
838 
839 /** gives the hashmap entry at the given index or NULL if entry has no element */
840 extern
842  SCIP_HASHMAP* hashmap, /**< hash map */
843  int entryidx /**< index of hash map entry */
844  );
845 
846 /** gives the origin of the hashmap entry */
847 extern
849  SCIP_HASHMAPENTRY* entry /**< hash map entry */
850  );
851 
852 /** gives the image 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 /** removes all entries in a hash map. */
865 extern
867  SCIP_HASHMAP* hashmap /**< hash map */
868  );
869 
870 /**@} */
871 
872 
873 
874 /*
875  * Activity
876  */
877 
878 /**@defgroup ResourceActivity Resource Activity
879  * @ingroup DataStructures
880  * @brief ressource activity data structure
881  *
882  * @{
883  */
884 
885 /** create a resource activity */
886 extern
888  SCIP_RESOURCEACTIVITY** activity, /**< pointer to store the resource activity */
889  SCIP_VAR* var, /**< start time variable of the activity */
890  int duration, /**< duration of the activity */
891  int demand /**< demand of the activity */
892  );
893 
894 /** frees a resource activity */
895 extern
896 void SCIPactivityFree(
897  SCIP_RESOURCEACTIVITY** activity /**< pointer to the resource activity */
898  );
899 
900 #ifndef NDEBUG
901 
902 /** returns the start time variable of the resource activity */
903 extern
905  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
906  );
907 
908 /** returns the duration of the resource activity */
909 extern
911  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
912  );
913 
914 /** returns the demand of the resource activity */
915 extern
917  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
918  );
919 
920 /** returns the energy of the resource activity */
921 extern
923  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
924  );
925 
926 #else
927 
928 #define SCIPactivityGetVar(activity) ((activity)->var)
929 #define SCIPactivityGetDuration(activity) ((activity)->duration)
930 #define SCIPactivityGetDemand(activity) ((activity)->demand)
931 #define SCIPactivityGetEnergy(activity) ((activity)->duration * (activity)->demand)
932 
933 #endif
934 
935 /**@} */
936 
937 
938 /*
939  * Resource Profile
940  */
941 
942 /**@defgroup ResourceProfile Resource Profile
943  * @ingroup DataStructures
944  * @brief ressource profile data structure
945  *
946  * @{
947  */
948 
949 /** creates resource profile */
950 extern
952  SCIP_PROFILE** profile, /**< pointer to store the resource profile */
953  int capacity /**< resource capacity */
954  );
955 
956 /** frees given resource profile */
957 extern
958 void SCIPprofileFree(
959  SCIP_PROFILE** profile /**< pointer to the resource profile */
960  );
961 
962 /** output of the given resource profile */
963 extern
964 void SCIPprofilePrint(
965  SCIP_PROFILE* profile, /**< resource profile to output */
966  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
967  FILE* file /**< output file (or NULL for standard output) */
968  );
969 
970 /** returns the capacity of the resource profile */
971 extern
973  SCIP_PROFILE* profile /**< resource profile to use */
974  );
975 
976 /** returns the number time points of the resource profile */
977 extern
979  SCIP_PROFILE* profile /**< resource profile to use */
980  );
981 
982 /** returns the time points of the resource profile */
983 extern
985  SCIP_PROFILE* profile /**< resource profile to use */
986  );
987 
988 /** returns the loads of the resource profile */
989 extern
991  SCIP_PROFILE* profile /**< resource profile to use */
992  );
993 
994 /** returns the time point for given position of the resource profile */
995 extern
997  SCIP_PROFILE* profile, /**< resource profile to use */
998  int pos /**< position */
999  );
1000 
1001 /** returns the loads of the resource profile at the given position */
1002 extern
1003 int SCIPprofileGetLoad(
1004  SCIP_PROFILE* profile, /**< resource profile */
1005  int pos /**< position */
1006  );
1007 
1008 /** returns if the given time point exists in the resource profile and stores the position of the given time point if it
1009  * exists; otherwise the position of the next smaller existing time point is stored
1010  */
1011 extern
1013  SCIP_PROFILE* profile, /**< resource profile to search */
1014  int timepoint, /**< time point to search for */
1015  int* pos /**< pointer to store the position */
1016  );
1017 
1018 /** insert a core into resource profile; if the core is non-empty the resource profile will be updated otherwise nothing
1019  * happens
1020  */
1021 extern
1023  SCIP_PROFILE* profile, /**< resource profile to use */
1024  int left, /**< left side of the core */
1025  int right, /**< right side of the core */
1026  int height, /**< height of the core */
1027  int* pos, /**< pointer to store the first position were it gets infeasible */
1028  SCIP_Bool* infeasible /**< pointer to store if the core does not fit due to capacity */
1029  );
1030 
1031 /** subtracts the height from the resource profile during core time */
1032 extern
1034  SCIP_PROFILE* profile, /**< resource profile to use */
1035  int left, /**< left side of the core */
1036  int right, /**< right side of the core */
1037  int height /**< height of the core */
1038  );
1039 
1040 /** return the earliest possible starting point within the time interval [lb,ub] for a given core (given by its height
1041  * and duration)
1042  */
1043 extern
1045  SCIP_PROFILE* profile, /**< resource profile to use */
1046  int est, /**< earliest starting time of the given core */
1047  int lst, /**< latest starting time of the given core */
1048  int duration, /**< duration of the core */
1049  int height, /**< height of the core */
1050  SCIP_Bool* infeasible /**< pointer store if the corer cannot be inserted */
1051  );
1052 
1053 /** return the latest possible starting point within the time interval [lb,ub] for a given core (given by its height and
1054  * duration)
1055  */
1056 extern
1058  SCIP_PROFILE* profile, /**< resource profile to use */
1059  int lb, /**< earliest possible start point */
1060  int ub, /**< latest possible start point */
1061  int duration, /**< duration of the core */
1062  int height, /**< height of the core */
1063  SCIP_Bool* infeasible /**< pointer store if the core cannot be inserted */
1064  );
1065 
1066 /**@} */
1067 
1068 /*
1069  * Directed graph
1070  */
1071 
1072 /**@defgroup DirectedGraph Directed Graph
1073  * @ingroup DataStructures
1074  * @brief graph structure with common algorithms for directed and undirected graphs
1075  *
1076  * @{
1077  */
1078 
1079 /** creates directed graph structure */
1080 extern
1082  SCIP_DIGRAPH** digraph, /**< pointer to store the created directed graph */
1083  int nnodes /**< number of nodes */
1084  );
1085 
1086 /** resize directed graph structure */
1087 extern
1089  SCIP_DIGRAPH* digraph, /**< directed graph */
1090  int nnodes /**< new number of nodes */
1091  );
1092 
1093 /** copies directed graph structure
1094  *
1095  * @note The data in nodedata is copied verbatim. This possibly has to be adapted by the user.
1096  */
1097 extern
1099  SCIP_DIGRAPH** targetdigraph, /**< pointer to store the copied directed graph */
1100  SCIP_DIGRAPH* sourcedigraph /**< source directed graph */
1101  );
1102 
1103 /** sets the sizes of the successor lists for the nodes in a directed graph and allocates memory for the lists */
1104 extern
1106  SCIP_DIGRAPH* digraph, /**< directed graph */
1107  int* sizes /**< sizes of the successor lists */
1108  );
1109 
1110 /** frees given directed graph structure */
1111 extern
1112 void SCIPdigraphFree(
1113  SCIP_DIGRAPH** digraph /**< pointer to the directed graph */
1114  );
1115 
1116 /** add (directed) arc and a related data to the directed graph structure
1117  *
1118  * @note if the arc is already contained, it is added a second time
1119  */
1120 extern
1122  SCIP_DIGRAPH* digraph, /**< directed graph */
1123  int startnode, /**< start node of the arc */
1124  int endnode, /**< start node of the arc */
1125  void* data /**< data that should be stored for the arc; or NULL */
1126  );
1127 
1128 /** add (directed) arc to the directed graph structure, if it is not contained, yet
1129  *
1130  * @note if there already exists an arc from startnode to endnode, the new arc is not added,
1131  * even if its data is different
1132  */
1133 extern
1135  SCIP_DIGRAPH* digraph, /**< directed graph */
1136  int startnode, /**< start node of the arc */
1137  int endnode, /**< start node of the arc */
1138  void* data /**< data that should be stored for the arc; or NULL */
1139  );
1140 
1141 /** sets the number of successors to a given value */
1142 extern
1144  SCIP_DIGRAPH* digraph, /**< directed graph */
1145  int node, /**< node for which the number of successors has to be changed */
1146  int nsuccessors /**< new number of successors */
1147  );
1148 
1149 /** returns the number of nodes of the given digraph */
1150 extern
1152  SCIP_DIGRAPH* digraph /**< directed graph */
1153  );
1154 
1155 /** returns the node data, or NULL if no data exist */
1156 extern
1158  SCIP_DIGRAPH* digraph, /**< directed graph */
1159  int node /**< node for which the node data is returned */
1160  );
1161 
1162 /** sets the node data */
1163 extern
1165  SCIP_DIGRAPH* digraph, /**< directed graph */
1166  void* dataptr, /**< user node data pointer, or NULL */
1167  int node /**< node for which the node data is returned */
1168  );
1169 
1170 /** returns the total number of arcs in the given digraph */
1171 extern
1173  SCIP_DIGRAPH* digraph /**< directed graph */
1174  );
1175 
1176 /** returns the number of successor nodes of the given node */
1177 extern
1179  SCIP_DIGRAPH* digraph, /**< directed graph */
1180  int node /**< node for which the number of outgoing arcs is returned */
1181  );
1182 
1183 /** returns the array of indices of the successor nodes; this array must not be changed from outside */
1184 extern
1186  SCIP_DIGRAPH* digraph, /**< directed graph */
1187  int node /**< node for which the array of outgoing arcs is returned */
1188  );
1189 
1190 /** returns the array of data corresponding to the arcs originating at the given node, or NULL if no data exist; this
1191  * array must not be changed from outside
1192  */
1193 extern
1195  SCIP_DIGRAPH* digraph, /**< directed graph */
1196  int node /**< node for which the data corresponding to the outgoing arcs is returned */
1197  );
1198 
1199 /** Compute undirected connected components on the given graph.
1200  *
1201  * @note For each arc, its reverse is added, so the graph does not need to be the directed representation of an
1202  * undirected graph.
1203  */
1204 extern
1206  SCIP_DIGRAPH* digraph, /**< directed graph */
1207  int minsize, /**< all components with less nodes are ignored */
1208  int* components, /**< array with as many slots as there are nodes in the directed graph
1209  * to store for each node the component to which it belongs
1210  * (components are numbered 0 to ncomponents - 1); or NULL, if components
1211  * are accessed one-by-one using SCIPdigraphGetComponent() */
1212  int* ncomponents /**< pointer to store the number of components; or NULL, if the
1213  * number of components is accessed by SCIPdigraphGetNComponents() */
1214  );
1215 
1216 /** Computes all strongly connected components of an undirected connected component with Tarjan's Algorithm.
1217  * The resulting strongly connected components are sorted topologically (starting from the end of the
1218  * strongcomponents array).
1219  *
1220  * @note In general a topological sort of the strongly connected components is not unique.
1221  */
1222 extern
1224  SCIP_DIGRAPH* digraph, /**< directed graph */
1225  int compidx, /**< number of the undirected connected component */
1226  int* strongcomponents, /**< array to store the strongly connected components
1227  * (length >= size of the component) */
1228  int* strongcompstartidx, /**< array to store the start indices of the strongly connected
1229  * components (length >= size of the component) */
1230  int* nstrongcomponents /**< pointer to store the number of strongly connected
1231  * components */
1232  );
1233 
1234 /** Performes an (almost) topological sort on the undirected components of the given directed graph. The undirected
1235  * components should be computed before using SCIPdigraphComputeUndirectedComponents().
1236  *
1237  * @note In general a topological sort is not unique. Note, that there might be directed cycles, that are randomly
1238  * broken, which is the reason for having only almost topologically sorted arrays.
1239  */
1240 extern
1242  SCIP_DIGRAPH* digraph /**< directed graph */
1243  );
1244 
1245 /** returns the number of previously computed undirected components for the given directed graph */
1246 extern
1248  SCIP_DIGRAPH* digraph /**< directed graph */
1249  );
1250 
1251 /** Returns the previously computed undirected component of the given number for the given directed graph.
1252  * If the components were sorted using SCIPdigraphTopoSortComponents(), the component is (almost) topologically sorted.
1253  */
1254 extern
1256  SCIP_DIGRAPH* digraph, /**< directed graph */
1257  int compidx, /**< number of the component to return */
1258  int** nodes, /**< pointer to store the nodes in the component; or NULL, if not needed */
1259  int* nnodes /**< pointer to store the number of nodes in the component;
1260  * or NULL, if not needed */
1261  );
1262 
1263 /** frees the component information for the given directed graph */
1264 extern
1266  SCIP_DIGRAPH* digraph /**< directed graph */
1267  );
1268 
1269 /** output of the given directed graph via the given message handler */
1270 extern
1271 void SCIPdigraphPrint(
1272  SCIP_DIGRAPH* digraph, /**< directed graph */
1273  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1274  FILE* file /**< output file (or NULL for standard output) */
1275  );
1276 
1277 /** prints the given directed graph structure in GML format into the given file */
1278 extern
1279 void SCIPdigraphPrintGml(
1280  SCIP_DIGRAPH* digraph, /**< directed graph */
1281  FILE* file /**< file to write to */
1282  );
1283 
1284 
1285 /** output of the given directed graph via the given message handler */
1286 extern
1288  SCIP_DIGRAPH* digraph, /**< directed graph */
1289  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1290  FILE* file /**< output file (or NULL for standard output) */
1291  );
1292 
1293 /**@} */
1294 
1295 /*
1296  * Binary search tree
1297  */
1298 
1299 /**@defgroup BinaryTree Binary Search Tree
1300  * @ingroup DataStructures
1301  * @brief binary search tree data structure
1302  *@{
1303  */
1304 
1305 /** creates a binary tree node with sorting value and user data */
1306 extern
1308  SCIP_BT* tree, /**< binary search tree */
1309  SCIP_BTNODE** node, /**< pointer to store the created search node */
1310  void* dataptr /**< user node data pointer, or NULL */
1311  );
1312 
1313 /** frees the binary node including the rooted subtree
1314  *
1315  * @note The user pointer (object) is not freed. If needed, it has to be done by the user.
1316  */
1317 extern
1318 void SCIPbtnodeFree(
1319  SCIP_BT* tree, /**< binary tree */
1320  SCIP_BTNODE** node /**< node to be freed */
1321  );
1322 
1323 /** returns the user data pointer stored in that node */
1324 extern
1325 void* SCIPbtnodeGetData(
1326  SCIP_BTNODE* node /**< node */
1327  );
1328 
1329 /** returns the parent which can be NULL if the given node is the root */
1330 extern
1332  SCIP_BTNODE* node /**< node */
1333  );
1334 
1335 /** returns left child which can be NULL if the given node is a leaf */
1336 extern
1338  SCIP_BTNODE* node /**< node */
1339  );
1340 
1341 /** returns right child which can be NULL if the given node is a leaf */
1342 extern
1344  SCIP_BTNODE* node /**< node */
1345  );
1346 
1347 /** returns the sibling of the node or NULL if does not exist */
1348 extern
1350  SCIP_BTNODE* node /**< node */
1351  );
1352 
1353 /** returns whether the node is a root node */
1354 extern
1356  SCIP_BTNODE* node /**< node */
1357  );
1358 
1359 /** returns whether the node is a leaf */
1360 extern
1362  SCIP_BTNODE* node /**< node */
1363  );
1364 
1365 /** returns TRUE if the given node is left child */
1366 extern
1368  SCIP_BTNODE* node /**< node */
1369  );
1370 
1371 /** returns TRUE if the given node is right child */
1372 extern
1374  SCIP_BTNODE* node /**< node */
1375  );
1376 
1377 #ifdef NDEBUG
1378 
1379 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1380  * speed up the algorithms.
1381  */
1382 
1383 #define SCIPbtnodeGetData(node) ((node)->dataptr)
1384 #define SCIPbtnodeGetParent(node) ((node)->parent)
1385 #define SCIPbtnodeGetLeftchild(node) ((node)->left)
1386 #define SCIPbtnodeGetRightchild(node) ((node)->right)
1387 #define SCIPbtnodeGetSibling(node) ((node)->parent == NULL ? NULL : \
1388  (node)->parent->left == (node) ? (node)->parent->right : (node)->parent->left)
1389 #define SCIPbtnodeIsRoot(node) ((node)->parent == NULL)
1390 #define SCIPbtnodeIsLeaf(node) ((node)->left == NULL && (node)->right == NULL)
1391 #define SCIPbtnodeIsLeftchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->left == (node) ? TRUE : FALSE)
1392 #define SCIPbtnodeIsRightchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->right == (node) ? TRUE : FALSE)
1393 
1394 #endif
1395 
1396 /** sets the give node data
1397  *
1398  * @note The old user pointer is not freed.
1399  */
1400 extern
1401 void SCIPbtnodeSetData(
1402  SCIP_BTNODE* node, /**< node */
1403  void* dataptr /**< node user data pointer */
1404  );
1405 
1406 /** sets parent node
1407  *
1408  * @note The old parent including the rooted subtree is not delete.
1409  */
1410 extern
1411 void SCIPbtnodeSetParent(
1412  SCIP_BTNODE* node, /**< node */
1413  SCIP_BTNODE* parent /**< new parent node, or NULL */
1414  );
1415 
1416 /** sets left child
1417  *
1418  * @note The old left child including the rooted subtree is not delete.
1419  */
1420 extern
1422  SCIP_BTNODE* node, /**< node */
1423  SCIP_BTNODE* left /**< new left child, or NULL */
1424  );
1425 
1426 /** sets right child
1427  *
1428  * @note The old right child including the rooted subtree is not delete.
1429  */
1430 extern
1432  SCIP_BTNODE* node, /**< node */
1433  SCIP_BTNODE* right /**< new right child, or NULL */
1434  );
1435 
1436 /** creates an binary tree */
1437 extern
1439  SCIP_BT** tree, /**< pointer to store the created binary tree */
1440  BMS_BLKMEM* blkmem /**< block memory used to create nodes */
1441  );
1442 
1443 /** frees binary tree
1444  *
1445  * @note The user pointers (object) of the search nodes are not freed. If needed, it has to be done by the user.
1446  */
1447 extern
1448 void SCIPbtFree(
1449  SCIP_BT** tree /**< pointer to binary tree */
1450  );
1451 
1452 /** prints the binary tree in GML format into the given file */
1453 extern
1454 void SCIPbtPrintGml(
1455  SCIP_BT* tree, /**< binary tree */
1456  FILE* file /**< file to write to */
1457  );
1458 
1459 /** returns whether the binary tree is empty (has no nodes) */
1460 extern
1462  SCIP_BT * tree /**< binary tree */
1463  );
1464 
1465 /** returns the root node of the binary tree or NULL if the binary tree is empty */
1466 extern
1468  SCIP_BT* tree /**< tree to be evaluated */
1469  );
1470 
1471 #ifdef NDEBUG
1472 
1473 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1474  * speed up the algorithms.
1475  */
1476 
1477 #define SCIPbtIsEmpty(tree) (tree->root == NULL)
1478 #define SCIPbtGetRoot(tree) (tree->root)
1479 
1480 #endif
1481 
1482 /** sets root node
1483  *
1484  * @note The old root including the rooted subtree is not delete.
1485  */
1486 extern
1487 void SCIPbtSetRoot(
1488  SCIP_BT* tree, /**< tree to be evaluated */
1489  SCIP_BTNODE* root /**< new root, or NULL */
1490  );
1491 
1492 /**@} */
1493 
1494 /*
1495  * Numerical methods
1496  */
1497 
1498 /**@defgroup NumericalMethods Numerical Methods
1499  * @ingroup MiscellaneousMethods
1500  * @brief commonly used numerical methods
1501  *
1502  * @{
1503  */
1504 
1505 /** returns the machine epsilon: the smallest number eps > 0, for which 1.0 + eps > 1.0 */
1506 extern
1508  void
1509  );
1510 
1511 /** calculates the greatest common divisor of the two given values */
1512 extern
1514  SCIP_Longint val1, /**< first value of greatest common devisor calculation */
1515  SCIP_Longint val2 /**< second value of greatest common devisor calculation */
1516  );
1517 
1518 /** calculates the smallest common multiple of the two given values */
1519 extern
1521  SCIP_Longint val1, /**< first value of smallest common multiple calculation */
1522  SCIP_Longint val2 /**< second value of smallest common multiple calculation */
1523  );
1524 
1525 /** calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because
1526  * 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
1527  * big numbers or an negative value m (and m < n) and -1 will be returned
1528  */
1529 extern
1531  int n, /**< number of different elements */
1532  int m /**< number to choose out of the above */
1533  );
1534 
1535 /** converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was
1536  * successful
1537  */
1538 extern
1540  SCIP_Real val, /**< real value r to convert into rational number */
1541  SCIP_Real mindelta, /**< minimal allowed difference r - q of real r and rational q = n/d */
1542  SCIP_Real maxdelta, /**< maximal allowed difference r - q of real r and rational q = n/d */
1543  SCIP_Longint maxdnom, /**< maximal denominator allowed */
1544  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1545  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1546  );
1547 
1548 /** tries to find a value, such that all given values, if scaled with this value become integral in relative allowed
1549  * difference in between mindelta and maxdelta
1550  */
1551 extern
1553  SCIP_Real* vals, /**< values to scale */
1554  int nvals, /**< number of values to scale */
1555  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
1556  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
1557  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
1558  SCIP_Real maxscale, /**< maximal allowed scalar */
1559  SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
1560  SCIP_Bool* success /**< stores whether returned value is valid */
1561  );
1562 
1563 /** given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small
1564  * number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational
1565  * number inside the interval was found
1566  */
1567 extern
1569  SCIP_Real lb, /**< lower bound of the interval */
1570  SCIP_Real ub, /**< upper bound of the interval */
1571  SCIP_Longint maxdnom, /**< maximal denominator allowed for resulting rational number */
1572  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1573  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1574  );
1575 
1576 /** given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number
1577  * with simple denominator (i.e. a small number, probably multiplied with powers of 10);
1578  * if no valid rational number inside the interval was found, selects the central value of the interval
1579  */
1580 extern
1582  SCIP_Real lb, /**< lower bound of the interval */
1583  SCIP_Real ub, /**< upper bound of the interval */
1584  SCIP_Longint maxdnom /**< maximal denominator allowed for resulting rational number */
1585  );
1586 
1587 /* The C99 standard defines the function (or macro) isfinite.
1588  * On MacOS X, isfinite is also available.
1589  * From the BSD world, there comes a function finite.
1590  * On SunOS, finite is also available.
1591  * In the MS compiler world, there is a function _finite.
1592  * As last resort, we check whether x == x does not hold, but this works only for NaN's, not for infinities!
1593  */
1594 #if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__)
1595 #define SCIPisFinite isfinite
1596 #elif defined(_BSD_SOURCE) || defined(__sun)
1597 #define SCIPisFinite finite
1598 #elif defined(_MSC_VER)
1599 #define SCIPisFinite _finite
1600 #else
1601 #define SCIPisFinite(x) ((x) == (x))
1602 #endif
1603 
1604 /* In debug mode, the following methods are implemented as function calls to ensure
1605  * type validity.
1606  */
1607 
1608 /** returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0) */
1609 extern
1611  SCIP_Real val1, /**< first value to be compared */
1612  SCIP_Real val2 /**< second value to be compared */
1613  );
1614 
1615 #ifdef NDEBUG
1616 
1617 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1618  * speed up the algorithms.
1619  */
1620 
1621 #define SCIPrelDiff(val1, val2) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) )
1622 
1623 #endif
1624 
1625 /** computes the gap from the primal and the dual bound */
1626 extern
1628  SCIP_Real eps, /**< the value treated as zero */
1629  SCIP_Real inf, /**< the value treated as infinity */
1630  SCIP_Real primalbound, /**< the primal bound */
1631  SCIP_Real dualbound /**< the dual bound */
1632  );
1633 
1634 /**@} */
1635 
1636 
1637 /*
1638  * Random Numbers
1639  */
1640 
1641 /**@defgroup RandomNumbers Random Numbers
1642  * @ingroup MiscellaneousMethods
1643  * @brief structures and methods for pseudo random number generation
1644  *
1645  *@{
1646  */
1647 
1648 /** returns a random integer between minrandval and maxrandval
1649  *
1650  * @deprecated Please use SCIPrandomGetInt() to request a random integer.
1651  */
1652 extern
1653 int SCIPgetRandomInt(
1654  int minrandval, /**< minimal value to return */
1655  int maxrandval, /**< maximal value to return */
1656  unsigned int* seedp /**< pointer to seed value */
1657  );
1658 
1659 
1660 /** returns a random integer between minrandval and maxrandval */
1661 extern
1662 int SCIPrandomGetInt(
1663  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1664  int minrandval, /**< minimal value to return */
1665  int maxrandval /**< maximal value to return */
1666  );
1667 
1668 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1669  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1670  */
1671 extern
1673  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1674  void** set, /**< original set, from which elements should be drawn */
1675  int nelems, /**< number of elements in original set */
1676  void** subset, /**< subset in which drawn elements should be stored */
1677  int nsubelems /**< number of elements that should be drawn and stored */
1678  );
1679 
1680 /** returns a random real between minrandval and maxrandval */
1681 extern
1683  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1684  SCIP_Real minrandval, /**< minimal value to return */
1685  SCIP_Real maxrandval /**< maximal value to return */
1686  );
1687 
1688 /** creates and initializes a random number generator */
1689 extern
1691  SCIP_RANDNUMGEN** randnumgen, /**< random number generator */
1692  BMS_BLKMEM* blkmem, /**< block memory */
1693  unsigned int initialseed /**< initial random seed */
1694  );
1695 
1696 
1697 /** frees a random number generator */
1698 extern
1699 void SCIPrandomFree(
1700  SCIP_RANDNUMGEN** randnumgen /**< random number generator */
1701  );
1702 
1703 /** returns a random real between minrandval and maxrandval
1704  *
1705  * @deprecated Please use SCIPrandomGetReal() to request a random real.
1706  */
1707 extern
1709  SCIP_Real minrandval, /**< minimal value to return */
1710  SCIP_Real maxrandval, /**< maximal value to return */
1711  unsigned int* seedp /**< pointer to seed value */
1712  );
1713 
1714 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1715  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1716  *
1717  * @deprecated Please use SCIPrandomGetSubset()
1718  */
1719 extern
1721  void** set, /**< original set, from which elements should be drawn */
1722  int nelems, /**< number of elements in original set */
1723  void** subset, /**< subset in which drawn elements should be stored */
1724  int nsubelems, /**< number of elements that should be drawn and stored */
1725  unsigned int randseed /**< seed value for random generator */
1726  );
1727 
1728 
1729 /**@} */
1730 
1731 /*
1732  * Permutations / Shuffling
1733  */
1734 
1735 /**@defgroup PermutationsShuffling Permutations Shuffling
1736  * @ingroup MiscellaneousMethods
1737  * @brief methods for shuffling arrays
1738  *
1739  * @{
1740  */
1741 
1742 /** swaps two ints */
1743 extern
1744 void SCIPswapInts(
1745  int* value1, /**< pointer to first integer */
1746  int* value2 /**< pointer to second integer */
1747  );
1748 
1749 /** swaps two real values */
1750 extern
1751 void SCIPswapReals(
1752  SCIP_Real* value1, /**< pointer to first real value */
1753  SCIP_Real* value2 /**< pointer to second real value */
1754 );
1755 
1756 /** swaps the addresses of two pointers */
1757 extern
1758 void SCIPswapPointers(
1759  void** pointer1, /**< first pointer */
1760  void** pointer2 /**< second pointer */
1761  );
1762 
1763 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm
1764  *
1765  * @deprecated Please use SCIPrandomPermuteIntArray()
1766  */
1767 extern
1768 void SCIPpermuteIntArray(
1769  int* array, /**< array to be shuffled */
1770  int begin, /**< first included index that should be subject to shuffling
1771  * (0 for first array entry)
1772  */
1773  int end, /**< first excluded index that should not be subject to shuffling
1774  * (array size for last array entry)
1775  */
1776  unsigned int* randseed /**< seed value for the random generator */
1777  );
1778 
1779 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm */
1780 extern
1782  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1783  int* array, /**< array to be shuffled */
1784  int begin, /**< first included index that should be subject to shuffling
1785  * (0 for first array entry)
1786  */
1787  int end /**< first excluded index that should not be subject to shuffling
1788  * (array size for last array entry)
1789  */
1790  );
1791 
1792 /** randomly shuffles parts of an array using the Fisher-Yates algorithm */
1793 extern
1795  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1796  void** array, /**< array to be shuffled */
1797  int begin, /**< first included index that should be subject to shuffling
1798  * (0 for first array entry)
1799  */
1800  int end /**< first excluded index that should not be subject to shuffling
1801  * (array size for last array entry)
1802  */
1803  );
1804 
1805 /** randomly shuffles parts of an array using the Fisher-Yates algorithm
1806  *
1807  * @deprecated Please use SCIPrandomPermuteArray()
1808  */
1809 extern
1810 void SCIPpermuteArray(
1811  void** array, /**< array to be shuffled */
1812  int begin, /**< first included index that should be subject to shuffling
1813  * (0 for first array entry)
1814  */
1815  int end, /**< first excluded index that should not be subject to shuffling
1816  * (array size for last array entry)
1817  */
1818  unsigned int* randseed /**< pointer to seed value for the random generator */
1819  );
1820 
1821 /**@} */
1822 
1823 
1824 /*
1825  * Arrays
1826  */
1827 
1828 /**@defgroup Arrays Arrays
1829  * @ingroup MiscellaneousMethods
1830  * @brief miscellaneous methods for arrays
1831  *
1832  * @{
1833  */
1834 
1835 
1836 /** computes set intersection (duplicates removed) of two arrays that are ordered ascendingly */
1837 extern
1839  int* array1, /**< first array (in ascending order) */
1840  int narray1, /**< number of entries of first array */
1841  int* array2, /**< second array (in ascending order) */
1842  int narray2, /**< number of entries of second array */
1843  int* intersectarray, /**< intersection of array1 and array2
1844  * (note: it is possible to use array1 for this input argument) */
1845  int* nintersectarray /**< pointer to store number of entries of intersection array
1846  * (note: it is possible to use narray1 for this input argument) */
1847  );
1848 
1849 /** computes set difference (duplicates removed) of two arrays that are ordered ascendingly */
1850 extern
1852  int* array1, /**< first array (in ascending order) */
1853  int narray1, /**< number of entries of first array */
1854  int* array2, /**< second array (in ascending order) */
1855  int narray2, /**< number of entries of second array */
1856  int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
1857  * (note: it is possible to use array1 for this input argument) */
1858  int* nsetminusarray /**< pointer to store number of entries of setminus array
1859  * (note: it is possible to use narray1 for this input argument) */
1860  );
1861 
1862 /**@} */
1863 
1864 
1865 /*
1866  * Strings
1867  */
1868 
1869 /**@defgroup StringMethods String Methods
1870  * @ingroup MiscellaneousMethods
1871  * @brief commonly used methods for strings
1872  *
1873  *@{
1874  */
1875 
1876 /** copies characters from 'src' to 'dest', copying is stopped when either the 'stop' character is reached or after
1877  * 'cnt' characters have been copied, whichever comes first.
1878  *
1879  * @note undefined behaviuor on overlapping arrays
1880  */
1881 extern
1882 int SCIPmemccpy(
1883  char* dest, /**< destination pointer to copy to */
1884  const char* src, /**< source pointer to copy to */
1885  char stop, /**< character when found stop copying */
1886  unsigned int cnt /**< maximal number of characters to copy too */
1887  );
1888 
1889 /** prints an error message containing of the given string followed by a string describing the current system error;
1890  * prefers to use the strerror_r method, which is threadsafe; on systems where this method does not exist,
1891  * NO_STRERROR_R should be defined (see INSTALL), in this case, srerror is used which is not guaranteed to be
1892  * threadsafe (on SUN-systems, it actually is)
1893  */
1894 extern
1895 void SCIPprintSysError(
1896  const char* message /**< first part of the error message, e.g. the filename */
1897  );
1898 
1899 /** extracts tokens from strings - wrapper method for strtok_r() */
1900 extern
1901 char* SCIPstrtok(
1902  char* s, /**< string to parse */
1903  const char* delim, /**< delimiters for parsing */
1904  char** ptrptr /**< pointer to working char pointer - must stay the same while parsing */
1905  );
1906 
1907 /** translates the given string into a string where symbols ", ', and spaces are escaped with a \ prefix */
1908 extern
1909 void SCIPescapeString(
1910  char* t, /**< target buffer to store escaped string */
1911  int bufsize, /**< size of buffer t */
1912  const char* s /**< string to transform into escaped string */
1913  );
1914 
1915 /** safe version of snprintf */
1916 extern
1917 int SCIPsnprintf(
1918  char* t, /**< target string */
1919  int len, /**< length of the string to copy */
1920  const char* s, /**< source string */
1921  ... /**< further parameters */
1922  );
1923 
1924 /** 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
1925  *
1926  * @return Returns TRUE if a value could be extracted, otherwise FALSE
1927  */
1928 extern
1930  const char* str, /**< string to search */
1931  int* value, /**< pointer to store the parsed value */
1932  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1933  );
1934 
1935 /** 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
1936  *
1937  * @return Returns TRUE if a value could be extracted, otherwise FALSE
1938  */
1939 extern
1941  const char* str, /**< string to search */
1942  SCIP_Real* value, /**< pointer to store the parsed value */
1943  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1944  );
1945 
1946 /** copies the first size characters between a start and end character of str into token, if no error occured endptr
1947  * will point to the position after the read part, otherwise it will point to @p str
1948  */
1949 extern
1950 void SCIPstrCopySection(
1951  const char* str, /**< string to search */
1952  char startchar, /**< character which defines the beginning */
1953  char endchar, /**< character which defines the ending */
1954  char* token, /**< string to store the copy */
1955  int size, /**< size of the token char array */
1956  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
1957  );
1958 
1959 /**@} */
1960 
1961 /*
1962  * File methods
1963  */
1964 
1965 /**@defgroup FileMethods File Methods
1966  * @ingroup MiscellaneousMethods
1967  * @brief commonly used file methods
1968  *
1969  * @{
1970  */
1971 
1972 /** returns, whether the given file exists */
1973 extern
1975  const char* filename /**< file name */
1976  );
1977 
1978 /** splits filename into path, name, and extension */
1979 extern
1980 void SCIPsplitFilename(
1981  char* filename, /**< filename to split; is destroyed (but not freed) during process */
1982  char** path, /**< pointer to store path, or NULL if not needed */
1983  char** name, /**< pointer to store name, or NULL if not needed */
1984  char** extension, /**< pointer to store extension, or NULL if not needed */
1985  char** compression /**< pointer to store compression extension, or NULL if not needed */
1986  );
1987 
1988 /**@} */
1989 
1990 #ifdef __cplusplus
1991 }
1992 #endif
1993 
1994 #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:6835
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:3144
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:6115
void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition: misc.c:7610
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2254
SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
Definition: misc.c:2541
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:6929
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6817
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
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3134
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:5912
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:2765
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:6205
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:6567
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:7448
SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5766
void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition: misc.c:1249
SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition: misc.c:262
void SCIPhashtableClear(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2117
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:7113
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:6085
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:7126
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition: misc.c:3097
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2903
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:1074
int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition: misc.c:5924
SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2922
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:7049
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:2015
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:2997
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:6744
int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition: misc.c:5872
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:6443
SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition: misc.c:5721
void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:337
SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
Definition: misc.c:2532
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:6728
void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3059
int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5796
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition: misc.c:3115
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition: misc.c:3123
void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition: misc.c:7757
void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6754
void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition: misc.c:6770
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:2798
void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:7374
void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition: misc.c:5740
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:2462
type definitions for problem variables
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2384
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:5812
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:956
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:6666
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:2876
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:2560
void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2494
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:6694
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:6802
#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:3164
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:5938
SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition: misc.c:6472
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:6784
void SCIPbtFree(SCIP_BT **tree)
Definition: misc.c:7801
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2286
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:7258
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:5850
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:2315
int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:5892
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:5902
int SCIPgetRandomInt(int minrandval, int maxrandval, unsigned int *seedp)
Definition: misc.c:8605
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2065
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:2971
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3013
void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition: misc.c:7743
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition: misc.c:3107
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:6508
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:3154
#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:5776
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:2943
#define SCIP_Real
Definition: def.h:135
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:120
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:2366
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:6355
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:2846
SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2484
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:392
SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition: misc.c:7782
int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:5786
void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition: misc.c:7729
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition: misc.c:6589
int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:5882
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:2474
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:5836
methods for selecting (weighted) k-medians
memory allocation routines