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 2002-2022 Zuse Institute Berlin */
7 /* */
8 /* Licensed under the Apache License, Version 2.0 (the "License"); */
9 /* you may not use this file except in compliance with the License. */
10 /* You may obtain a copy of the License at */
11 /* */
12 /* http://www.apache.org/licenses/LICENSE-2.0 */
13 /* */
14 /* Unless required by applicable law or agreed to in writing, software */
15 /* distributed under the License is distributed on an "AS IS" BASIS, */
16 /* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. */
17 /* See the License for the specific language governing permissions and */
18 /* limitations under the License. */
19 /* */
20 /* You should have received a copy of the Apache-2.0 license */
21 /* along with SCIP; see the file LICENSE. If not visit scipopt.org. */
22 /* */
23 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
24 
25 /**@file pub_misc.h
26  * @ingroup PUBLICCOREAPI
27  * @brief public data structures and miscellaneous methods
28  * @author Tobias Achterberg
29  * @author Gerald Gamrath
30  * @author Stefan Heinz
31  * @author Gregor Hendel
32  * @author Michael Winkler
33  * @author Kati Wolter
34  *
35  * This file contains a bunch of data structures and miscellaneous methods:
36  *
37  * - \ref DataStructures "Data structures"
38  * - \ref MiscellaneousMethods "Miscellaneous Methods"
39  */
40 
41 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
42 
43 #ifndef __SCIP_PUB_MISC_H__
44 #define __SCIP_PUB_MISC_H__
45 
46 /* on SunOS, the function finite(a) (for the SCIPisFinite macro below) is declared in ieeefp.h */
47 #ifdef __sun
48 #include <ieeefp.h>
49 #endif
50 #include <math.h>
51 
52 #include "scip/def.h"
53 #include "blockmemshell/memory.h"
54 #include "scip/type_retcode.h"
55 #include "scip/type_misc.h"
56 #include "scip/type_message.h"
57 #include "scip/type_var.h"
58 #include "scip/pub_misc_select.h"
59 #include "scip/pub_misc_sort.h"
60 #include "scip/pub_misc_linear.h"
61 #include "scip/pub_misc_rowprep.h"
62 
63 /* in optimized mode some of the function are handled via defines, for that the structs are needed */
64 #ifdef NDEBUG
65 #include "scip/struct_misc.h"
66 #endif
67 
68 #ifdef __cplusplus
69 extern "C" {
70 #endif
71 
72 /*
73  * methods for statistical tests
74  */
75 
76 /**@defgroup STATISTICALTESTS Statistical tests
77  * @ingroup MiscellaneousMethods
78  * @brief public methods for statistical tests
79  *
80  * Below are the public methods for statistical tests inside of \SCIP
81  *
82  * @{
83  */
84 
85 /** get critical value of a Student-T distribution for a given number of degrees of freedom at a confidence level */
86 SCIP_EXPORT
88  SCIP_CONFIDENCELEVEL clevel, /**< (one-sided) confidence level */
89  int df /**< degrees of freedom */
90  );
91 
92 /** compute a t-value for the hypothesis that x and y are from the same population; Assuming that
93  * x and y represent normally distributed random samples with equal variance, the returned value
94  * comes from a Student-T distribution with countx + county - 2 degrees of freedom; this
95  * value can be compared with a critical value (see also SCIPstudentTGetCriticalValue()) at
96  * a predefined confidence level for checking if x and y significantly differ in location
97  */
98 SCIP_EXPORT
100  SCIP_Real meanx, /**< the mean of the first distribution */
101  SCIP_Real meany, /**< the mean of the second distribution */
102  SCIP_Real variancex, /**< the variance of the x-distribution */
103  SCIP_Real variancey, /**< the variance of the y-distribution */
104  SCIP_Real countx, /**< number of samples of x */
105  SCIP_Real county /**< number of samples of y */
106  );
107 
108 /** returns the value of the Gauss error function evaluated at a given point */
109 SCIP_EXPORT
111  SCIP_Real x /**< value to evaluate */
112  );
113 
114 /** get critical value of a standard normal distribution at a given confidence level */
115 SCIP_EXPORT
117  SCIP_CONFIDENCELEVEL clevel /**< (one-sided) confidence level */
118  );
119 
120 /** calculates the cumulative distribution P(-infinity <= x <= value) that a normally distributed
121  * random variable x takes a value between -infinity and parameter \p value.
122  *
123  * The distribution is given by the respective mean and deviation. This implementation
124  * uses the error function erf().
125  */
126 SCIP_EXPORT
128  SCIP_Real mean, /**< the mean value of the distribution */
129  SCIP_Real variance, /**< the square of the deviation of the distribution */
130  SCIP_Real value /**< the upper limit of the calculated distribution integral */
131  );
132 
133 /**@} */
134 
135 /**@defgroup Regression Linear Regression
136  * @ingroup MiscellaneousMethods
137  * @brief methods for linear regression
138  *
139  * Below are the public methods for incremental linear regression of observations pairs \f$(X_i,Y_i), i=1\dots,n\f$
140  *
141  * @{
142  */
143 
144 /** returns the number of observations of this regression */
145 SCIP_EXPORT
147  SCIP_REGRESSION* regression /**< regression data structure */
148  );
149 
150 /** return the current slope of the regression */
151 SCIP_EXPORT
153  SCIP_REGRESSION* regression /**< regression data structure */
154  );
155 
156 /** get the current y-intercept of the regression */
157 SCIP_EXPORT
159  SCIP_REGRESSION* regression /**< regression data structure */
160  );
161 
162 /** removes an observation (x,y) from the regression */
163 SCIP_EXPORT
165  SCIP_REGRESSION* regression, /**< regression data structure */
166  SCIP_Real x, /**< X of observation */
167  SCIP_Real y /**< Y of the observation */
168  );
169 
170 /** update regression by a new observation (x,y) */
171 SCIP_EXPORT
173  SCIP_REGRESSION* regression, /**< regression data structure */
174  SCIP_Real x, /**< X of observation */
175  SCIP_Real y /**< Y of the observation */
176  );
177 
178 /** reset regression data structure */
179 SCIP_EXPORT
181  SCIP_REGRESSION* regression /**< regression data structure */
182  );
183 
184 /** creates and resets a regression */
185 SCIP_EXPORT
187  SCIP_REGRESSION** regression /**< regression data structure */
188  );
189 
190 /** frees a regression */
191 SCIP_EXPORT
192 void SCIPregressionFree(
193  SCIP_REGRESSION** regression /**< regression data structure */
194  );
195 
196 /**@} */
197 
198 /*
199  */
200 
201 /**@defgroup GMLgraph GML Graphical Printing
202  * @ingroup MiscellaneousMethods
203  * @brief GML graph printing methods
204  *
205  * For a detailed format decription see http://docs.yworks.com/yfiles/doc/developers-guide/gml.html
206  *
207  * @{
208  */
209 
210 
211 /** writes a node section to the given graph file */
212 SCIP_EXPORT
213 void SCIPgmlWriteNode(
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  );
221 
222 /** writes a node section including weight to the given graph file */
223 SCIP_EXPORT
225  FILE* file, /**< file to write to */
226  unsigned int id, /**< id of the node */
227  const char* label, /**< label of the node */
228  const char* nodetype, /**< type of the node, or NULL */
229  const char* fillcolor, /**< color of the node's interior, or NULL */
230  const char* bordercolor, /**< color of the node's border, or NULL */
231  SCIP_Real weight /**< weight of node */
232  );
233 
234 /** writes an edge section to the given graph file */
235 SCIP_EXPORT
236 void SCIPgmlWriteEdge(
237  FILE* file, /**< file to write to */
238  unsigned int source, /**< source node id of the node */
239  unsigned int target, /**< target node id of the edge */
240  const char* label, /**< label of the edge, or NULL */
241  const char* color /**< color of the edge, or NULL */
242  );
243 
244 /** writes an arc section to the given graph file */
245 SCIP_EXPORT
246 void SCIPgmlWriteArc(
247  FILE* file, /**< file to write to */
248  unsigned int source, /**< source node id of the node */
249  unsigned int target, /**< target node id of the edge */
250  const char* label, /**< label of the edge, or NULL */
251  const char* color /**< color of the edge, or NULL */
252  );
253 
254 /** writes the starting line to a GML graph file, does not open a file */
255 SCIP_EXPORT
257  FILE* file, /**< file to write to */
258  SCIP_Bool directed /**< is the graph directed */
259  );
260 
261 /** writes the ending lines to a GML graph file, does not close a file */
262 SCIP_EXPORT
264  FILE* file /**< file to close */
265  );
266 
267 /**@} */
268 
269 /*
270  * Sparse solution
271  */
272 
273 /**@defgroup SparseSol Sparse Solution
274  * @ingroup DataStructures
275  * @brief sparse storage for multiple integer solutions
276  *
277  * @{
278  */
279 
280 /** creates a sparse solution */
281 SCIP_EXPORT
283  SCIP_SPARSESOL** sparsesol, /**< pointer to store the created sparse solution */
284  SCIP_VAR** vars, /**< variables in the sparse solution, must not contain continuous variables */
285  int nvars, /**< number of variables to store, size of the lower and upper bound arrays */
286  SCIP_Bool cleared /**< should the lower and upper bound arrays be cleared (entries set to 0) */
287  );
288 
289 /** frees sparse solution */
290 SCIP_EXPORT
291 void SCIPsparseSolFree(
292  SCIP_SPARSESOL** sparsesol /**< pointer to a sparse solution */
293  );
294 
295 /** returns the variables in the given sparse solution */
296 SCIP_EXPORT
298  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
299  );
300 
301 /** returns the number of variables in the given sparse solution */
302 SCIP_EXPORT
304  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
305  );
306 
307 /** returns the the lower bound array for all variables for a given sparse solution */
308 SCIP_EXPORT
310  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
311  );
312 
313 /** returns the the upper bound array for all variables for a given sparse solution */
314 SCIP_EXPORT
316  SCIP_SPARSESOL* sparsesol /**< a sparse solution */
317  );
318 
319 /** constructs the first solution of sparse solution (all variables are set to their lower bound value */
320 SCIP_EXPORT
322  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
323  SCIP_Longint* sol, /**< array to store the first solution */
324  int nvars /**< number of variables */
325  );
326 
327 /** constructs the next solution of the sparse solution and return whether there was one more or not */
328 SCIP_EXPORT
330  SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
331  SCIP_Longint* sol, /**< current solution array which get changed to the next solution */
332  int nvars /**< number of variables */
333  );
334 
335 /**@} */
336 
337 
338 /*
339  * Queue
340  */
341 
342 /**@defgroup Queue Queue
343  * @ingroup DataStructures
344  * @brief circular FIFO queue
345  *
346  * @{
347  */
348 
349 
350 /** creates a (circular) queue, best used if the size will be fixed or will not be increased that much */
351 SCIP_EXPORT
353  SCIP_QUEUE** queue, /**< pointer to the new queue */
354  int initsize, /**< initial number of available element slots */
355  SCIP_Real sizefac /**< memory growing factor applied, if more element slots are needed */
356  );
357 
358 
359 /** frees queue, but not the data elements themselves */
360 SCIP_EXPORT
361 void SCIPqueueFree(
362  SCIP_QUEUE** queue /**< pointer to a queue */
363  );
364 
365 /** clears the queue, but doesn't free the data elements themselves */
366 SCIP_EXPORT
367 void SCIPqueueClear(
368  SCIP_QUEUE* queue /**< queue */
369  );
370 
371 /** inserts pointer element at the end of the queue */
372 SCIP_EXPORT
374  SCIP_QUEUE* queue, /**< queue */
375  void* elem /**< element to be inserted */
376  );
377 
378 /** inserts unsigned integer element at the end of the queue */
379 SCIP_EXPORT
381  SCIP_QUEUE* queue, /**< queue */
382  unsigned int elem /**< element to be inserted */
383  );
384 
385 /** removes and returns the first element of the queue, or NULL if no element exists */
386 SCIP_EXPORT
387 void* SCIPqueueRemove(
388  SCIP_QUEUE* queue /**< queue */
389  );
390 
391 /** removes and returns the first unsigned integer element of the queue, or UNIT_MAX if no element exists */
392 SCIP_EXPORT
393 unsigned int SCIPqueueRemoveUInt(
394  SCIP_QUEUE* queue /**< queue */
395  );
396 
397 /** returns the first element of the queue without removing it, or NULL if no element exists */
398 SCIP_EXPORT
399 void* SCIPqueueFirst(
400  SCIP_QUEUE* queue /**< queue */
401  );
402 
403 /** returns the first unsigned integer element of the queue without removing it, or UINT_MAX if no element exists */
404 SCIP_EXPORT
405 unsigned int SCIPqueueFirstUInt(
406  SCIP_QUEUE* queue /**< queue */
407  );
408 
409 /** returns whether the queue is empty */
410 SCIP_EXPORT
412  SCIP_QUEUE* queue /**< queue */
413  );
414 
415 /** returns the number of elements in the queue */
416 SCIP_EXPORT
417 int SCIPqueueNElems(
418  SCIP_QUEUE* queue /**< queue */
419  );
420 
421 /**@} */
422 
423 /*
424  * Priority Queue
425  */
426 
427 /**@defgroup PriorityQueue Priority Queue
428  * @ingroup DataStructures
429  * @brief priority queue with O(1) access to the minimum element
430  *
431  * @{
432  */
433 
434 /** creates priority queue */
435 SCIP_EXPORT
437  SCIP_PQUEUE** pqueue, /**< pointer to a priority queue */
438  int initsize, /**< initial number of available element slots */
439  SCIP_Real sizefac, /**< memory growing factor applied, if more element slots are needed */
440  SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
441  SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)) /**< callback to act on position change of elem in priority queue, or NULL */
442  );
443 
444 /** frees priority queue, but not the data elements themselves */
445 SCIP_EXPORT
446 void SCIPpqueueFree(
447  SCIP_PQUEUE** pqueue /**< pointer to a priority queue */
448  );
449 
450 /** clears the priority queue, but doesn't free the data elements themselves */
451 SCIP_EXPORT
452 void SCIPpqueueClear(
453  SCIP_PQUEUE* pqueue /**< priority queue */
454  );
455 
456 /** inserts element into priority queue */
457 SCIP_EXPORT
459  SCIP_PQUEUE* pqueue, /**< priority queue */
460  void* elem /**< element to be inserted */
461  );
462 
463 /** delete element at specified position, maintaining the heap property */
464 SCIP_EXPORT
465 void SCIPpqueueDelPos(
466  SCIP_PQUEUE* pqueue, /**< priority queue */
467  int pos /**< position of element that should be deleted */
468  );
469 
470 /** removes and returns best element from the priority queue */
471 SCIP_EXPORT
472 void* SCIPpqueueRemove(
473  SCIP_PQUEUE* pqueue /**< priority queue */
474  );
475 
476 /** returns the best element of the queue without removing it */
477 SCIP_EXPORT
478 void* SCIPpqueueFirst(
479  SCIP_PQUEUE* pqueue /**< priority queue */
480  );
481 
482 /** returns the number of elements in the queue */
483 SCIP_EXPORT
484 int SCIPpqueueNElems(
485  SCIP_PQUEUE* pqueue /**< priority queue */
486  );
487 
488 /** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
489 SCIP_EXPORT
490 void** SCIPpqueueElems(
491  SCIP_PQUEUE* pqueue /**< priority queue */
492  );
493 
494 /** return the position of @p elem in the priority queue, or -1 if element is not found */
495 SCIP_EXPORT
496 int SCIPpqueueFind(
497  SCIP_PQUEUE* pqueue, /**< priority queue */
498  void* elem /**< element to be inserted */
499  );
500 
501 /**@} */
502 
503 
504 /*
505  * Hash Table
506  */
507 
508 /**@defgroup HashTable Hash Table
509  * @ingroup DataStructures
510  * @brief hash table that resolves conflicts by probing
511  *
512  *@{
513  */
514 
515 /* fast 2-universal hash functions for two to seven 32bit elements with 32bit output */
516 
517 #define SCIPhashSignature64(a) (UINT64_C(0x8000000000000000)>>((UINT32_C(0x9e3779b9) * ((uint32_t)(a)))>>26))
518 
519 #define SCIPhashTwo(a, b) ((uint32_t)((((uint32_t)(a) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) )>>32))
520 
521 #define SCIPhashThree(a, b, c) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
522  (uint32_t)(c) * 0xd37e9a1ce2148403ULL)>>32 ))
523 
524 #define SCIPhashFour(a, b, c, d) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
525  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL))>>32 ))
526 
527 #define SCIPhashFive(a, b, c, d, e) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
528  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
529  (uint32_t)(e) * 0xf48d4cd331e14327ULL)>>32 ))
530 
531 #define SCIPhashSix(a, b, c, d, e, f) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
532  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
533  ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL))>>32 ))
534 
535 #define SCIPhashSeven(a, b, c, d, e, f, g) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
536  ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
537  ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL) + \
538  (uint32_t)(g) * 0x7f497d9ba3bd83c0ULL)>>32 ))
539 
540 /** computes a hashcode for double precision floating point values containing
541  * 15 significant bits, the sign and the exponent
542  */
543 INLINE static
544 uint32_t SCIPrealHashCode(double x)
545 {
546  int theexp;
547  return (((uint32_t)(uint16_t)(int16_t)ldexp(frexp(x, &theexp), 15))<<16) | (uint32_t)(uint16_t)theexp;
548 }
549 
550 /** creates a hash table */
551 SCIP_EXPORT
553  SCIP_HASHTABLE** hashtable, /**< pointer to store the created hash table */
554  BMS_BLKMEM* blkmem, /**< block memory used to store hash table entries */
555  int tablesize, /**< size of the hash table */
556  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
557  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
558  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
559  void* userptr /**< user pointer */
560  );
561 
562 /** frees the hash table */
563 SCIP_EXPORT
564 void SCIPhashtableFree(
565  SCIP_HASHTABLE** hashtable /**< pointer to the hash table */
566  );
567 
568 /** removes all elements of the hash table
569  *
570  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
571  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
572  *
573  * @deprecated Please use SCIPhashtableRemoveAll()
574  */
575 SCIP_EXPORT
576 void SCIPhashtableClear(
577  SCIP_HASHTABLE* hashtable /**< hash table */
578  );
579 
580 /** inserts element in hash table (multiple inserts of same element override the previous entry) */
581 SCIP_EXPORT
583  SCIP_HASHTABLE* hashtable, /**< hash table */
584  void* element /**< element to insert into the table */
585  );
586 
587 /** inserts element in hash table (multiple insertion of same element is checked and results in an error) */
588 SCIP_EXPORT
590  SCIP_HASHTABLE* hashtable, /**< hash table */
591  void* element /**< element to insert into the table */
592  );
593 
594 /** retrieve element with key from hash table, returns NULL if not existing */
595 SCIP_EXPORT
597  SCIP_HASHTABLE* hashtable, /**< hash table */
598  void* key /**< key to retrieve */
599  );
600 
601 /** returns whether the given element exists in the table */
602 SCIP_EXPORT
604  SCIP_HASHTABLE* hashtable, /**< hash table */
605  void* element /**< element to search in the table */
606  );
607 
608 /** removes element from the hash table, if it exists */
609 SCIP_EXPORT
611  SCIP_HASHTABLE* hashtable, /**< hash table */
612  void* element /**< element to remove from the table */
613  );
614 
615 /** removes all elements of the hash table */
616 SCIP_EXPORT
618  SCIP_HASHTABLE* hashtable /**< hash table */
619  );
620 
621 /** returns number of hash table elements */
622 SCIP_EXPORT
624  SCIP_HASHTABLE* hashtable /**< hash table */
625  );
626 
627 /** gives the number of entries in the internal arrays of a hash table */
628 SCIP_EXPORT
630  SCIP_HASHTABLE* hashtable /**< hash table */
631  );
632 
633 /** gives the element at the given index or NULL if entry at that index has no element */
634 SCIP_EXPORT
636  SCIP_HASHTABLE* hashtable, /**< hash table */
637  int entryidx /**< index of hash table entry */
638  );
639 
640 /** returns the load of the given hash table in percentage */
641 SCIP_EXPORT
643  SCIP_HASHTABLE* hashtable /**< hash table */
644  );
645 
646 /** prints statistics about hash table usage */
647 SCIP_EXPORT
649  SCIP_HASHTABLE* hashtable, /**< hash table */
650  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
651  );
652 
653 /**@} */
654 
655 /*
656  * MultiHash Table
657  */
658 
659 /**@defgroup MultiHash Multi Hash table
660  * @ingroup DataStructures
661  * @brief hash table that resolves conflicts by queueing, thereby allowing for duplicate entries
662  *
663  *@{
664  */
665 
666 /** returns a reasonable hash table size (a prime number) that is at least as large as the specified value */
667 SCIP_EXPORT
669  int minsize /**< minimal size of the hash table */
670  );
671 
672 /** creates a multihash table */
673 SCIP_EXPORT
675  SCIP_MULTIHASH** multihash, /**< pointer to store the created multihash table */
676  BMS_BLKMEM* blkmem, /**< block memory used to store multihash table entries */
677  int tablesize, /**< size of the hash table */
678  SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
679  SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
680  SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
681  void* userptr /**< user pointer */
682  );
683 
684 /** frees the multihash table */
685 SCIP_EXPORT
686 void SCIPmultihashFree(
687  SCIP_MULTIHASH** multihash /**< pointer to the multihash table */
688  );
689 
690 /** inserts element in multihash table (multiple inserts of same element possible)
691  *
692  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding an element
693  * to the hash table, due to dynamic resizing.
694  */
695 SCIP_EXPORT
697  SCIP_MULTIHASH* multihash, /**< multihash table */
698  void* element /**< element to insert into the table */
699  );
700 
701 /** inserts element in multihash table (multiple insertion of same element is checked and results in an error)
702  *
703  * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding a new
704  * element to the multihash table, due to dynamic resizing.
705  */
706 SCIP_EXPORT
708  SCIP_MULTIHASH* multihash, /**< multihash table */
709  void* element /**< element to insert into the table */
710  );
711 
712 /** retrieve element with key from multihash table, returns NULL if not existing */
713 SCIP_EXPORT
715  SCIP_MULTIHASH* multihash, /**< multihash table */
716  void* key /**< key to retrieve */
717  );
718 
719 /** retrieve element with key from multihash table, returns NULL if not existing
720  * can be used to retrieve all entries with the same key (one-by-one)
721  *
722  * @note The returned multimultihashlist pointer might get invalid when adding a new element to the multihash table.
723  */
724 SCIP_EXPORT
726  SCIP_MULTIHASH* multihash, /**< multihash table */
727  SCIP_MULTIHASHLIST** multihashlist, /**< input: entry in hash table list from which to start searching, or NULL
728  * output: entry in hash table list corresponding to element after
729  * retrieved one, or NULL */
730  void* key /**< key to retrieve */
731  );
732 
733 /** returns whether the given element exists in the multihash table */
734 SCIP_EXPORT
736  SCIP_MULTIHASH* multihash, /**< multihash table */
737  void* element /**< element to search in the table */
738  );
739 
740 /** removes element from the multihash table, if it exists */
741 SCIP_EXPORT
743  SCIP_MULTIHASH* multihash, /**< multihash table */
744  void* element /**< element to remove from the table */
745  );
746 
747 /** removes all elements of the multihash table
748  *
749  * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
750  * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
751  */
752 SCIP_EXPORT
754  SCIP_MULTIHASH* multihash /**< multihash table */
755  );
756 
757 /** returns number of multihash table elements */
758 SCIP_EXPORT
760  SCIP_MULTIHASH* multihash /**< multihash table */
761  );
762 
763 /** returns the load of the given multihash table in percentage */
764 SCIP_EXPORT
766  SCIP_MULTIHASH* multihash /**< multihash table */
767  );
768 
769 /** prints statistics about multihash table usage */
770 SCIP_EXPORT
772  SCIP_MULTIHASH* multihash, /**< multihash table */
773  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
774  );
775 
776 /** standard hash key comparator for string keys */
777 SCIP_EXPORT
778 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString);
779 
780 /** standard hashing function for string keys */
781 SCIP_EXPORT
782 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString);
783 
784 /** gets the element as the key */
785 SCIP_EXPORT
786 SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard);
787 
788 /** returns TRUE iff both keys(pointer) are equal */
789 SCIP_EXPORT
790 SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqPtr);
791 
792 /** returns the hash value of the key */
793 SCIP_EXPORT
794 SCIP_DECL_HASHKEYVAL(SCIPhashKeyValPtr);
795 
796 /**@} */
797 
798 
799 /*
800  * Hash Map
801  */
802 
803 /**@defgroup HashMap Hash Map
804  * @ingroup DataStructures
805  * @brief hash map to store key-value pairs (called \p origin and \p image)
806  *
807  * @{
808  */
809 
810 /** creates a hash map mapping pointers to pointers */
811 SCIP_EXPORT
813  SCIP_HASHMAP** hashmap, /**< pointer to store the created hash map */
814  BMS_BLKMEM* blkmem, /**< block memory used to store hash map entries */
815  int mapsize /**< size of the hash map */
816  );
817 
818 /** frees the hash map */
819 SCIP_EXPORT
820 void SCIPhashmapFree(
821  SCIP_HASHMAP** hashmap /**< pointer to the hash map */
822  );
823 
824 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
825 SCIP_EXPORT
827  SCIP_HASHMAP* hashmap, /**< hash map */
828  void* origin, /**< origin to set image for */
829  void* image /**< new image for origin */
830  );
831 
832 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
833 SCIP_EXPORT
835  SCIP_HASHMAP* hashmap, /**< hash map */
836  void* origin, /**< origin to set image for */
837  int image /**< new image for origin */
838  );
839 
840 /** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
841 SCIP_EXPORT
843  SCIP_HASHMAP* hashmap, /**< hash map */
844  void* origin, /**< origin to set image for */
845  SCIP_Real image /**< new image for origin */
846  );
847 
848 /** retrieves image of given origin from the hash map, or NULL if no image exists */
849 SCIP_EXPORT
850 void* SCIPhashmapGetImage(
851  SCIP_HASHMAP* hashmap, /**< hash map */
852  void* origin /**< origin to retrieve image for */
853  );
854 
855 /** retrieves image of given origin from the hash map, or INT_MAX if no image exists */
856 SCIP_EXPORT
858  SCIP_HASHMAP* hashmap, /**< hash map */
859  void* origin /**< origin to retrieve image for */
860  );
861 
862 /** retrieves image of given origin from the hash map, or SCIP_INVALID if no image exists */
863 SCIP_EXPORT
865  SCIP_HASHMAP* hashmap, /**< hash map */
866  void* origin /**< origin to retrieve image for */
867  );
868 
869 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
870  * new origin->image pair
871  */
872 SCIP_EXPORT
874  SCIP_HASHMAP* hashmap, /**< hash map */
875  void* origin, /**< origin to set image for */
876  void* image /**< new image for origin */
877  );
878 
879 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
880  * new origin->image pair
881  */
882 SCIP_EXPORT
884  SCIP_HASHMAP* hashmap, /**< hash map */
885  void* origin, /**< origin to set image for */
886  int image /**< new image for origin */
887  );
888 
889 /** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
890  * new origin->image pair
891  */
892 SCIP_EXPORT
894  SCIP_HASHMAP* hashmap, /**< hash map */
895  void* origin, /**< origin to set image for */
896  SCIP_Real image /**< new image for origin */
897  );
898 
899 /** checks whether an image to the given origin exists in the hash map */
900 SCIP_EXPORT
902  SCIP_HASHMAP* hashmap, /**< hash map */
903  void* origin /**< origin to search for */
904  );
905 
906 /** removes origin->image pair from the hash map, if it exists */
907 SCIP_EXPORT
909  SCIP_HASHMAP* hashmap, /**< hash map */
910  void* origin /**< origin to remove from the list */
911  );
912 
913 /** prints statistics about hash map usage */
914 SCIP_EXPORT
916  SCIP_HASHMAP* hashmap, /**< hash map */
917  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
918  );
919 
920 /** indicates whether a hash map has no entries */
921 SCIP_EXPORT
923  SCIP_HASHMAP* hashmap /**< hash map */
924  );
925 
926 /** gives the number of elements in a hash map */
927 SCIP_EXPORT
929  SCIP_HASHMAP* hashmap /**< hash map */
930  );
931 
932 /** gives the number of entries in the internal arrays of a hash map */
933 SCIP_EXPORT
935  SCIP_HASHMAP* hashmap /**< hash map */
936  );
937 
938 /** gives the hashmap entry at the given index or NULL if entry has no element */
939 SCIP_EXPORT
941  SCIP_HASHMAP* hashmap, /**< hash map */
942  int entryidx /**< index of hash map entry */
943  );
944 
945 /** gives the origin of the hashmap entry */
946 SCIP_EXPORT
948  SCIP_HASHMAPENTRY* entry /**< hash map entry */
949  );
950 
951 /** gives the image of the hashmap entry */
952 SCIP_EXPORT
954  SCIP_HASHMAPENTRY* entry /**< hash map entry */
955  );
956 
957 /** gives the image of the hashmap entry */
958 SCIP_EXPORT
960  SCIP_HASHMAPENTRY* entry /**< hash map entry */
961  );
962 
963 /** gives the image of the hashmap entry */
964 SCIP_EXPORT
966  SCIP_HASHMAPENTRY* entry /**< hash map entry */
967  );
968 
969 /** sets pointer image of a hashmap entry */
970 SCIP_EXPORT
972  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
973  void* image /**< new image */
974  );
975 
976 /** sets integer image of a hashmap entry */
977 SCIP_EXPORT
979  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
980  int image /**< new image */
981  );
982 
983 /** sets real image of a hashmap entry */
984 SCIP_EXPORT
986  SCIP_HASHMAPENTRY* entry, /**< hash map entry */
987  SCIP_Real image /**< new image */
988  );
989 
990 /** removes all entries in a hash map. */
991 SCIP_EXPORT
993  SCIP_HASHMAP* hashmap /**< hash map */
994  );
995 
996 /**@} */
997 
998 
999 /*
1000  * Hash Set
1001  */
1002 
1003 /**@defgroup HashSet Hash Set
1004  * @ingroup DataStructures
1005  * @brief very lightweight hash set of pointers
1006  *
1007  * @{
1008  */
1009 
1010 /** creates a hash set of pointers */
1011 SCIP_EXPORT
1013  SCIP_HASHSET** hashset, /**< pointer to store the created hash set */
1014  BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1015  int size /**< initial size of the hash set; it is guaranteed that the set is not
1016  * resized if at most that many elements are inserted */
1017  );
1018 
1019 /** frees the hash set */
1020 SCIP_EXPORT
1021 void SCIPhashsetFree(
1022  SCIP_HASHSET** hashset, /**< pointer to the hash set */
1023  BMS_BLKMEM* blkmem /**< block memory used to store hash set entries */
1024  );
1025 
1026 /** inserts new element into the hash set */
1027 SCIP_EXPORT
1029  SCIP_HASHSET* hashset, /**< hash set */
1030  BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1031  void* element /**< element to insert */
1032  );
1033 
1034 /** checks whether an element exists in the hash set */
1035 SCIP_EXPORT
1037  SCIP_HASHSET* hashset, /**< hash set */
1038  void* element /**< element to search for */
1039  );
1040 
1041 /** removes an element from the hash set, if it exists */
1042 SCIP_EXPORT
1044  SCIP_HASHSET* hashset, /**< hash set */
1045  void* element /**< origin to remove from the list */
1046  );
1047 
1048 /** prints statistics about hash set usage */
1049 SCIP_EXPORT
1051  SCIP_HASHSET* hashset, /**< hash set */
1052  SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
1053  );
1054 
1055 /** indicates whether a hash set has no entries */
1056 SCIP_EXPORT
1058  SCIP_HASHSET* hashset /**< hash set */
1059  );
1060 
1061 /** gives the number of elements in a hash set */
1062 SCIP_EXPORT
1064  SCIP_HASHSET* hashset /**< hash set */
1065  );
1066 
1067 /** gives the number of slots of a hash set */
1068 SCIP_EXPORT
1070  SCIP_HASHSET* hashset /**< hash set */
1071  );
1072 
1073 /** gives the array of hash set slots; contains all elements in indetermined order and may contain NULL values */
1074 SCIP_EXPORT
1075 void** SCIPhashsetGetSlots(
1076  SCIP_HASHSET* hashset /**< hash set */
1077  );
1078 
1079 /** removes all entries in a hash set. */
1080 SCIP_EXPORT
1082  SCIP_HASHSET* hashset /**< hash set */
1083  );
1084 
1085 #ifdef NDEBUG
1086 
1087 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1088  * speed up the algorithms.
1089  */
1090 
1091 #define SCIPhashsetIsEmpty(hashset) ((hashset)->nelements == 0)
1092 #define SCIPhashsetGetNElements(hashset) ((hashset)->nelements)
1093 #define SCIPhashsetGetNSlots(hashset) (1u << (64 - (hashset)->shift))
1094 #define SCIPhashsetGetSlots(hashset) ((hashset)->slots)
1095 
1096 #endif
1097 
1098 /**@} */
1099 
1100 
1101 /*
1102  * Activity
1103  */
1104 
1105 /**@defgroup ResourceActivity Resource Activity
1106  * @ingroup DataStructures
1107  * @brief ressource activity data structure
1108  *
1109  * @{
1110  */
1111 
1112 /** create a resource activity */
1113 SCIP_EXPORT
1115  SCIP_RESOURCEACTIVITY** activity, /**< pointer to store the resource activity */
1116  SCIP_VAR* var, /**< start time variable of the activity */
1117  int duration, /**< duration of the activity */
1118  int demand /**< demand of the activity */
1119  );
1120 
1121 /** frees a resource activity */
1122 SCIP_EXPORT
1123 void SCIPactivityFree(
1124  SCIP_RESOURCEACTIVITY** activity /**< pointer to the resource activity */
1125  );
1126 
1127 #ifndef NDEBUG
1128 
1129 /** returns the start time variable of the resource activity */
1130 SCIP_EXPORT
1132  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1133  );
1134 
1135 /** returns the duration of the resource activity */
1136 SCIP_EXPORT
1138  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1139  );
1140 
1141 /** returns the demand of the resource activity */
1142 SCIP_EXPORT
1144  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1145  );
1146 
1147 /** returns the energy of the resource activity */
1148 SCIP_EXPORT
1150  SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1151  );
1152 
1153 #else
1154 
1155 #define SCIPactivityGetVar(activity) ((activity)->var)
1156 #define SCIPactivityGetDuration(activity) ((activity)->duration)
1157 #define SCIPactivityGetDemand(activity) ((activity)->demand)
1158 #define SCIPactivityGetEnergy(activity) ((activity)->duration * (activity)->demand)
1159 
1160 #endif
1161 
1162 /**@} */
1163 
1164 
1165 /*
1166  * Resource Profile
1167  */
1168 
1169 /**@defgroup ResourceProfile Resource Profile
1170  * @ingroup DataStructures
1171  * @brief ressource profile data structure
1172  *
1173  * @{
1174  */
1175 
1176 /** creates resource profile */
1177 SCIP_EXPORT
1179  SCIP_PROFILE** profile, /**< pointer to store the resource profile */
1180  int capacity /**< resource capacity */
1181  );
1182 
1183 /** frees given resource profile */
1184 SCIP_EXPORT
1185 void SCIPprofileFree(
1186  SCIP_PROFILE** profile /**< pointer to the resource profile */
1187  );
1188 
1189 /** output of the given resource profile */
1190 SCIP_EXPORT
1191 void SCIPprofilePrint(
1192  SCIP_PROFILE* profile, /**< resource profile to output */
1193  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1194  FILE* file /**< output file (or NULL for standard output) */
1195  );
1196 
1197 /** returns the capacity of the resource profile */
1198 SCIP_EXPORT
1200  SCIP_PROFILE* profile /**< resource profile to use */
1201  );
1202 
1203 /** returns the number time points of the resource profile */
1204 SCIP_EXPORT
1206  SCIP_PROFILE* profile /**< resource profile to use */
1207  );
1208 
1209 /** returns the time points of the resource profile */
1210 SCIP_EXPORT
1212  SCIP_PROFILE* profile /**< resource profile to use */
1213  );
1214 
1215 /** returns the loads of the resource profile */
1216 SCIP_EXPORT
1217 int* SCIPprofileGetLoads(
1218  SCIP_PROFILE* profile /**< resource profile to use */
1219  );
1220 
1221 /** returns the time point for given position of the resource profile */
1222 SCIP_EXPORT
1223 int SCIPprofileGetTime(
1224  SCIP_PROFILE* profile, /**< resource profile to use */
1225  int pos /**< position */
1226  );
1227 
1228 /** returns the loads of the resource profile at the given position */
1229 SCIP_EXPORT
1230 int SCIPprofileGetLoad(
1231  SCIP_PROFILE* profile, /**< resource profile */
1232  int pos /**< position */
1233  );
1234 
1235 /** returns if the given time point exists in the resource profile and stores the position of the given time point if it
1236  * exists; otherwise the position of the next smaller existing time point is stored
1237  */
1238 SCIP_EXPORT
1240  SCIP_PROFILE* profile, /**< resource profile to search */
1241  int timepoint, /**< time point to search for */
1242  int* pos /**< pointer to store the position */
1243  );
1244 
1245 /** insert a core into resource profile; if the core is non-empty the resource profile will be updated otherwise nothing
1246  * happens
1247  */
1248 SCIP_EXPORT
1250  SCIP_PROFILE* profile, /**< resource profile to use */
1251  int left, /**< left side of the core */
1252  int right, /**< right side of the core */
1253  int height, /**< height of the core */
1254  int* pos, /**< pointer to store the first position were it gets infeasible */
1255  SCIP_Bool* infeasible /**< pointer to store if the core does not fit due to capacity */
1256  );
1257 
1258 /** subtracts the height from the resource profile during core time */
1259 SCIP_EXPORT
1261  SCIP_PROFILE* profile, /**< resource profile to use */
1262  int left, /**< left side of the core */
1263  int right, /**< right side of the core */
1264  int height /**< height of the core */
1265  );
1266 
1267 /** return the earliest possible starting point within the time interval [lb,ub] for a given core (given by its height
1268  * and duration)
1269  */
1270 SCIP_EXPORT
1272  SCIP_PROFILE* profile, /**< resource profile to use */
1273  int est, /**< earliest starting time of the given core */
1274  int lst, /**< latest starting time of the given core */
1275  int duration, /**< duration of the core */
1276  int height, /**< height of the core */
1277  SCIP_Bool* infeasible /**< pointer store if the corer cannot be inserted */
1278  );
1279 
1280 /** return the latest possible starting point within the time interval [lb,ub] for a given core (given by its height and
1281  * duration)
1282  */
1283 SCIP_EXPORT
1285  SCIP_PROFILE* profile, /**< resource profile to use */
1286  int lb, /**< earliest possible start point */
1287  int ub, /**< latest possible start point */
1288  int duration, /**< duration of the core */
1289  int height, /**< height of the core */
1290  SCIP_Bool* infeasible /**< pointer store if the core cannot be inserted */
1291  );
1292 
1293 /**@} */
1294 
1295 /*
1296  * Directed graph
1297  */
1298 
1299 /**@addtogroup DirectedGraph
1300  *
1301  * @{
1302  */
1303 
1304 /** resize directed graph structure */
1305 SCIP_EXPORT
1307  SCIP_DIGRAPH* digraph, /**< directed graph */
1308  int nnodes /**< new number of nodes */
1309  );
1310 
1311 /** sets the sizes of the successor lists for the nodes in a directed graph and allocates memory for the lists */
1312 SCIP_EXPORT
1314  SCIP_DIGRAPH* digraph, /**< directed graph */
1315  int* sizes /**< sizes of the successor lists */
1316  );
1317 
1318 /** frees given directed graph structure */
1319 SCIP_EXPORT
1320 void SCIPdigraphFree(
1321  SCIP_DIGRAPH** digraph /**< pointer to the directed graph */
1322  );
1323 
1324 /** add (directed) arc and a related data to the directed graph structure
1325  *
1326  * @note if the arc is already contained, it is added a second time
1327  */
1328 SCIP_EXPORT
1330  SCIP_DIGRAPH* digraph, /**< directed graph */
1331  int startnode, /**< start node of the arc */
1332  int endnode, /**< start node of the arc */
1333  void* data /**< data that should be stored for the arc; or NULL */
1334  );
1335 
1336 /** add (directed) arc to the directed graph structure, if it is not contained, yet
1337  *
1338  * @note if there already exists an arc from startnode to endnode, the new arc is not added,
1339  * even if its data is different
1340  */
1341 SCIP_EXPORT
1343  SCIP_DIGRAPH* digraph, /**< directed graph */
1344  int startnode, /**< start node of the arc */
1345  int endnode, /**< start node of the arc */
1346  void* data /**< data that should be stored for the arc; or NULL */
1347  );
1348 
1349 /** sets the number of successors to a given value */
1350 SCIP_EXPORT
1352  SCIP_DIGRAPH* digraph, /**< directed graph */
1353  int node, /**< node for which the number of successors has to be changed */
1354  int nsuccessors /**< new number of successors */
1355  );
1356 
1357 /** returns the number of nodes of the given digraph */
1358 SCIP_EXPORT
1360  SCIP_DIGRAPH* digraph /**< directed graph */
1361  );
1362 
1363 /** returns the node data, or NULL if no data exist */
1364 SCIP_EXPORT
1366  SCIP_DIGRAPH* digraph, /**< directed graph */
1367  int node /**< node for which the node data is returned */
1368  );
1369 
1370 /** sets the node data */
1371 SCIP_EXPORT
1373  SCIP_DIGRAPH* digraph, /**< directed graph */
1374  void* dataptr, /**< user node data pointer, or NULL */
1375  int node /**< node for which the node data is returned */
1376  );
1377 
1378 /** returns the total number of arcs in the given digraph */
1379 SCIP_EXPORT
1381  SCIP_DIGRAPH* digraph /**< directed graph */
1382  );
1383 
1384 /** returns the number of successor nodes of the given node */
1385 SCIP_EXPORT
1387  SCIP_DIGRAPH* digraph, /**< directed graph */
1388  int node /**< node for which the number of outgoing arcs is returned */
1389  );
1390 
1391 /** returns the array of indices of the successor nodes; this array must not be changed from outside */
1392 SCIP_EXPORT
1394  SCIP_DIGRAPH* digraph, /**< directed graph */
1395  int node /**< node for which the array of outgoing arcs is returned */
1396  );
1397 
1398 /** returns the array of data corresponding to the arcs originating at the given node, or NULL if no data exist; this
1399  * array must not be changed from outside
1400  */
1401 SCIP_EXPORT
1403  SCIP_DIGRAPH* digraph, /**< directed graph */
1404  int node /**< node for which the data corresponding to the outgoing arcs is returned */
1405  );
1406 
1407 /** identifies the articulation points in a given directed graph
1408  * uses the helper recursive function findArticulationPointsUtil
1409  */
1410 SCIP_EXPORT
1412  SCIP_DIGRAPH* digraph, /**< directed graph */
1413  int** articulations, /**< array to store the sorted node indices of the computed articulation points, or NULL */
1414  int* narticulations /**< number of the computed articulation points, or NULL */
1415  );
1416 
1417 /** Compute undirected connected components on the given graph.
1418  *
1419  * @note For each arc, its reverse is added, so the graph does not need to be the directed representation of an
1420  * undirected graph.
1421  */
1422 SCIP_EXPORT
1424  SCIP_DIGRAPH* digraph, /**< directed graph */
1425  int minsize, /**< all components with less nodes are ignored */
1426  int* components, /**< array with as many slots as there are nodes in the directed graph
1427  * to store for each node the component to which it belongs
1428  * (components are numbered 0 to ncomponents - 1); or NULL, if components
1429  * are accessed one-by-one using SCIPdigraphGetComponent() */
1430  int* ncomponents /**< pointer to store the number of components; or NULL, if the
1431  * number of components is accessed by SCIPdigraphGetNComponents() */
1432  );
1433 
1434 /** Computes all strongly connected components of an undirected connected component with Tarjan's Algorithm.
1435  * The resulting strongly connected components are sorted topologically (starting from the end of the
1436  * strongcomponents array).
1437  *
1438  * @note In general a topological sort of the strongly connected components is not unique.
1439  */
1440 SCIP_EXPORT
1442  SCIP_DIGRAPH* digraph, /**< directed graph */
1443  int compidx, /**< number of the undirected connected component */
1444  int* strongcomponents, /**< array to store the strongly connected components
1445  * (length >= size of the component) */
1446  int* strongcompstartidx, /**< array to store the start indices of the strongly connected
1447  * components (length >= size of the component) */
1448  int* nstrongcomponents /**< pointer to store the number of strongly connected
1449  * components */
1450  );
1451 
1452 /** Performes an (almost) topological sort on the undirected components of the given directed graph. The undirected
1453  * components should be computed before using SCIPdigraphComputeUndirectedComponents().
1454  *
1455  * @note In general a topological sort is not unique. Note, that there might be directed cycles, that are randomly
1456  * broken, which is the reason for having only almost topologically sorted arrays.
1457  */
1458 SCIP_EXPORT
1460  SCIP_DIGRAPH* digraph /**< directed graph */
1461  );
1462 
1463 /** returns the number of previously computed undirected components for the given directed graph */
1464 SCIP_EXPORT
1466  SCIP_DIGRAPH* digraph /**< directed graph */
1467  );
1468 
1469 /** Returns the previously computed undirected component of the given number for the given directed graph.
1470  * If the components were sorted using SCIPdigraphTopoSortComponents(), the component is (almost) topologically sorted.
1471  */
1472 SCIP_EXPORT
1474  SCIP_DIGRAPH* digraph, /**< directed graph */
1475  int compidx, /**< number of the component to return */
1476  int** nodes, /**< pointer to store the nodes in the component; or NULL, if not needed */
1477  int* nnodes /**< pointer to store the number of nodes in the component;
1478  * or NULL, if not needed */
1479  );
1480 
1481 /** frees the component information for the given directed graph */
1482 SCIP_EXPORT
1484  SCIP_DIGRAPH* digraph /**< directed graph */
1485  );
1486 
1487 /** output of the given directed graph via the given message handler */
1488 SCIP_EXPORT
1489 void SCIPdigraphPrint(
1490  SCIP_DIGRAPH* digraph, /**< directed graph */
1491  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1492  FILE* file /**< output file (or NULL for standard output) */
1493  );
1494 
1495 /** prints the given directed graph structure in GML format into the given file */
1496 SCIP_EXPORT
1497 void SCIPdigraphPrintGml(
1498  SCIP_DIGRAPH* digraph, /**< directed graph */
1499  FILE* file /**< file to write to */
1500  );
1501 
1502 
1503 /** output of the given directed graph via the given message handler */
1504 SCIP_EXPORT
1506  SCIP_DIGRAPH* digraph, /**< directed graph */
1507  SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1508  FILE* file /**< output file (or NULL for standard output) */
1509  );
1510 
1511 /**@} */
1512 
1513 /*
1514  * Binary search tree
1515  */
1516 
1517 /**@defgroup BinaryTree Binary Search Tree
1518  * @ingroup DataStructures
1519  * @brief binary search tree data structure
1520  *@{
1521  */
1522 
1523 /** creates a binary tree node with sorting value and user data */
1524 SCIP_EXPORT
1526  SCIP_BT* tree, /**< binary search tree */
1527  SCIP_BTNODE** node, /**< pointer to store the created search node */
1528  void* dataptr /**< user node data pointer, or NULL */
1529  );
1530 
1531 /** frees the binary node including the rooted subtree
1532  *
1533  * @note The user pointer (object) is not freed. If needed, it has to be done by the user.
1534  */
1535 SCIP_EXPORT
1536 void SCIPbtnodeFree(
1537  SCIP_BT* tree, /**< binary tree */
1538  SCIP_BTNODE** node /**< node to be freed */
1539  );
1540 
1541 /** returns the user data pointer stored in that node */
1542 SCIP_EXPORT
1543 void* SCIPbtnodeGetData(
1544  SCIP_BTNODE* node /**< node */
1545  );
1546 
1547 /** returns the parent which can be NULL if the given node is the root */
1548 SCIP_EXPORT
1550  SCIP_BTNODE* node /**< node */
1551  );
1552 
1553 /** returns left child which can be NULL if the given node is a leaf */
1554 SCIP_EXPORT
1556  SCIP_BTNODE* node /**< node */
1557  );
1558 
1559 /** returns right child which can be NULL if the given node is a leaf */
1560 SCIP_EXPORT
1562  SCIP_BTNODE* node /**< node */
1563  );
1564 
1565 /** returns the sibling of the node or NULL if does not exist */
1566 SCIP_EXPORT
1568  SCIP_BTNODE* node /**< node */
1569  );
1570 
1571 /** returns whether the node is a root node */
1572 SCIP_EXPORT
1574  SCIP_BTNODE* node /**< node */
1575  );
1576 
1577 /** returns whether the node is a leaf */
1578 SCIP_EXPORT
1580  SCIP_BTNODE* node /**< node */
1581  );
1582 
1583 /** returns TRUE if the given node is left child */
1584 SCIP_EXPORT
1586  SCIP_BTNODE* node /**< node */
1587  );
1588 
1589 /** returns TRUE if the given node is right child */
1590 SCIP_EXPORT
1592  SCIP_BTNODE* node /**< node */
1593  );
1594 
1595 #ifdef NDEBUG
1596 
1597 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1598  * speed up the algorithms.
1599  */
1600 
1601 #define SCIPbtnodeGetData(node) ((node)->dataptr)
1602 #define SCIPbtnodeGetParent(node) ((node)->parent)
1603 #define SCIPbtnodeGetLeftchild(node) ((node)->left)
1604 #define SCIPbtnodeGetRightchild(node) ((node)->right)
1605 #define SCIPbtnodeGetSibling(node) ((node)->parent == NULL ? NULL : \
1606  (node)->parent->left == (node) ? (node)->parent->right : (node)->parent->left)
1607 #define SCIPbtnodeIsRoot(node) ((node)->parent == NULL)
1608 #define SCIPbtnodeIsLeaf(node) ((node)->left == NULL && (node)->right == NULL)
1609 #define SCIPbtnodeIsLeftchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->left == (node) ? TRUE : FALSE)
1610 #define SCIPbtnodeIsRightchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->right == (node) ? TRUE : FALSE)
1611 
1612 #endif
1613 
1614 /** sets the give node data
1615  *
1616  * @note The old user pointer is not freed.
1617  */
1618 SCIP_EXPORT
1619 void SCIPbtnodeSetData(
1620  SCIP_BTNODE* node, /**< node */
1621  void* dataptr /**< node user data pointer */
1622  );
1623 
1624 /** sets parent node
1625  *
1626  * @note The old parent including the rooted subtree is not delete.
1627  */
1628 SCIP_EXPORT
1629 void SCIPbtnodeSetParent(
1630  SCIP_BTNODE* node, /**< node */
1631  SCIP_BTNODE* parent /**< new parent node, or NULL */
1632  );
1633 
1634 /** sets left child
1635  *
1636  * @note The old left child including the rooted subtree is not delete.
1637  */
1638 SCIP_EXPORT
1640  SCIP_BTNODE* node, /**< node */
1641  SCIP_BTNODE* left /**< new left child, or NULL */
1642  );
1643 
1644 /** sets right child
1645  *
1646  * @note The old right child including the rooted subtree is not delete.
1647  */
1648 SCIP_EXPORT
1650  SCIP_BTNODE* node, /**< node */
1651  SCIP_BTNODE* right /**< new right child, or NULL */
1652  );
1653 
1654 /** creates an binary tree */
1655 SCIP_EXPORT
1657  SCIP_BT** tree, /**< pointer to store the created binary tree */
1658  BMS_BLKMEM* blkmem /**< block memory used to create nodes */
1659  );
1660 
1661 /** frees binary tree
1662  *
1663  * @note The user pointers (object) of the search nodes are not freed. If needed, it has to be done by the user.
1664  */
1665 SCIP_EXPORT
1666 void SCIPbtFree(
1667  SCIP_BT** tree /**< pointer to binary tree */
1668  );
1669 
1670 /** prints the binary tree in GML format into the given file */
1671 SCIP_EXPORT
1672 void SCIPbtPrintGml(
1673  SCIP_BT* tree, /**< binary tree */
1674  FILE* file /**< file to write to */
1675  );
1676 
1677 /** returns whether the binary tree is empty (has no nodes) */
1678 SCIP_EXPORT
1680  SCIP_BT * tree /**< binary tree */
1681  );
1682 
1683 /** returns the root node of the binary tree or NULL if the binary tree is empty */
1684 SCIP_EXPORT
1686  SCIP_BT* tree /**< tree to be evaluated */
1687  );
1688 
1689 #ifdef NDEBUG
1690 
1691 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1692  * speed up the algorithms.
1693  */
1694 
1695 #define SCIPbtIsEmpty(tree) (tree->root == NULL)
1696 #define SCIPbtGetRoot(tree) (tree->root)
1697 
1698 #endif
1699 
1700 /** sets root node
1701  *
1702  * @note The old root including the rooted subtree is not delete.
1703  */
1704 SCIP_EXPORT
1705 void SCIPbtSetRoot(
1706  SCIP_BT* tree, /**< tree to be evaluated */
1707  SCIP_BTNODE* root /**< new root, or NULL */
1708  );
1709 
1710 /**@} */
1711 
1712 /**@addtogroup DisjointSet
1713  *
1714  * @{
1715  */
1716 
1717 /*
1718  * disjoint set data structure
1719  */
1720 
1721 /** clears the disjoint set (union find) structure \p djset */
1722 SCIP_EXPORT
1724  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1725  );
1726 
1727 /** finds and returns the component identifier of this \p element */
1728 SCIP_EXPORT
1730  SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1731  int element /**< element to be found */
1732  );
1733 
1734 /** merges the components containing the elements \p p and \p q */
1735 SCIP_EXPORT
1737  SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1738  int p, /**< first element */
1739  int q, /**< second element */
1740  SCIP_Bool forcerepofp /**< force representative of p to be new representative */
1741  );
1742 
1743 /** returns the number of independent components in this disjoint set (union find) data structure */
1744 SCIP_EXPORT
1746  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1747  );
1748 
1749 /** returns the size (number of nodes) of this disjoint set (union find) data structure */
1750 SCIP_EXPORT
1752  SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1753  );
1754 
1755 /** @} */
1756 
1757 /*
1758  * Numerical methods
1759  */
1760 
1761 /**@defgroup NumericalMethods Numerical Methods
1762  * @ingroup MiscellaneousMethods
1763  * @brief commonly used numerical methods
1764  *
1765  * @{
1766  */
1767 
1768 /** returns the machine epsilon: the smallest number eps > 0, for which 1.0 + eps > 1.0 */
1769 SCIP_EXPORT
1771  void
1772  );
1773 
1774 /** returns the next representable value of from in the direction of to */
1775 SCIP_EXPORT
1777  SCIP_Real from, /**< value from which the next representable value should be returned */
1778  SCIP_Real to /**< direction in which the next representable value should be returned */
1779  );
1780 
1781 /** calculates the greatest common divisor of the two given values */
1782 SCIP_EXPORT
1784  SCIP_Longint val1, /**< first value of greatest common devisor calculation */
1785  SCIP_Longint val2 /**< second value of greatest common devisor calculation */
1786  );
1787 
1788 /** calculates the smallest common multiple of the two given values */
1789 SCIP_EXPORT
1791  SCIP_Longint val1, /**< first value of smallest common multiple calculation */
1792  SCIP_Longint val2 /**< second value of smallest common multiple calculation */
1793  );
1794 
1795 /** calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because
1796  * 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
1797  * big numbers or an negative value m (and m < n) and -1 will be returned
1798  */
1799 SCIP_EXPORT
1801  int n, /**< number of different elements */
1802  int m /**< number to choose out of the above */
1803  );
1804 
1805 /** calculates hash for floating-point number by using Fibonacci hashing */
1806 SCIP_EXPORT
1807 unsigned int SCIPcalcFibHash(
1808  SCIP_Real v /**< number to hash */
1809  );
1810 
1811 #ifdef NDEBUG
1812 
1813 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1814  * speed up the algorithms.
1815  */
1816 
1817 #define SCIPcalcFibHash(v) ((v) >= 0 ? ((unsigned long long)((v) * 2654435769)) % UINT_MAX : ((unsigned long long)(-(v) * 683565275)) % UINT_MAX )
1818 
1819 #endif
1820 
1821 /** converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was
1822  * successful
1823  */
1824 SCIP_EXPORT
1826  SCIP_Real val, /**< real value r to convert into rational number */
1827  SCIP_Real mindelta, /**< minimal allowed difference r - q of real r and rational q = n/d */
1828  SCIP_Real maxdelta, /**< maximal allowed difference r - q of real r and rational q = n/d */
1829  SCIP_Longint maxdnom, /**< maximal denominator allowed */
1830  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1831  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1832  );
1833 
1834 /** tries to find a value, such that all given values, if scaled with this value become integral in relative allowed
1835  * difference in between mindelta and maxdelta
1836  */
1837 SCIP_EXPORT
1839  SCIP_Real* vals, /**< values to scale */
1840  int nvals, /**< number of values to scale */
1841  SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
1842  SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
1843  SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
1844  SCIP_Real maxscale, /**< maximal allowed scalar */
1845  SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
1846  SCIP_Bool* success /**< stores whether returned value is valid */
1847  );
1848 
1849 /** given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small
1850  * number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational
1851  * number inside the interval was found
1852  */
1853 SCIP_EXPORT
1855  SCIP_Real lb, /**< lower bound of the interval */
1856  SCIP_Real ub, /**< upper bound of the interval */
1857  SCIP_Longint maxdnom, /**< maximal denominator allowed for resulting rational number */
1858  SCIP_Longint* nominator, /**< pointer to store the nominator n of the rational number */
1859  SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1860  );
1861 
1862 /** given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number
1863  * with simple denominator (i.e. a small number, probably multiplied with powers of 10);
1864  * if no valid rational number inside the interval was found, selects the central value of the interval
1865  */
1866 SCIP_EXPORT
1868  SCIP_Real lb, /**< lower bound of the interval */
1869  SCIP_Real ub, /**< upper bound of the interval */
1870  SCIP_Longint maxdnom /**< maximal denominator allowed for resulting rational number */
1871  );
1872 
1873 /** Performs the Newton Procedure from a given starting point to compute a root of the given function with
1874  * specified precision and maximum number of iterations. If the procedure fails, SCIP_INVALID is returned.
1875  */
1876 SCIP_EXPORT
1878  SCIP_DECL_NEWTONEVAL((*function)), /**< pointer to function for which roots are computed */
1879  SCIP_DECL_NEWTONEVAL((*derivative)), /**< pointer to derivative of above function */
1880  SCIP_Real* params, /**< parameters needed for function (can be NULL) */
1881  int nparams, /**< number of parameters (can be 0) */
1882  SCIP_Real x, /**< starting point */
1883  SCIP_Real eps, /**< tolerance */
1884  int k /**< iteration limit */
1885  );
1886 
1887 /* The C99 standard defines the function (or macro) isfinite.
1888  * On MacOS X, isfinite is also available.
1889  * From the BSD world, there comes a function finite.
1890  * On SunOS, finite is also available.
1891  * In the MS compiler world, there is a function _finite.
1892  * As last resort, we check whether x == x does not hold, but this works only for NaN's, not for infinities!
1893  */
1894 #if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__)
1895 #define SCIPisFinite isfinite
1896 #elif defined(_BSD_SOURCE) || defined(__sun)
1897 #define SCIPisFinite finite
1898 #elif defined(_MSC_VER)
1899 #define SCIPisFinite _finite
1900 #else
1901 #define SCIPisFinite(x) ((x) == (x))
1902 #endif
1903 
1904 /* In debug mode, the following methods are implemented as function calls to ensure
1905  * type validity.
1906  */
1907 
1908 /** returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0) */
1909 SCIP_EXPORT
1911  SCIP_Real val1, /**< first value to be compared */
1912  SCIP_Real val2 /**< second value to be compared */
1913  );
1914 
1915 #ifdef NDEBUG
1916 
1917 /* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1918  * speed up the algorithms.
1919  */
1920 
1921 #define SCIPrelDiff(val1, val2) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) )
1922 
1923 #endif
1924 
1925 /** computes the gap from the primal and the dual bound */
1926 SCIP_EXPORT
1928  SCIP_Real eps, /**< the value treated as zero */
1929  SCIP_Real inf, /**< the value treated as infinity */
1930  SCIP_Real primalbound, /**< the primal bound */
1931  SCIP_Real dualbound /**< the dual bound */
1932  );
1933 
1934 /**@} */
1935 
1936 
1937 /*
1938  * Random Numbers
1939  */
1940 
1941 /**@defgroup RandomNumbers Random Numbers
1942  * @ingroup MiscellaneousMethods
1943  * @brief structures and methods for pseudo random number generation
1944  *
1945  *@{
1946  */
1947 
1948 /** returns a random integer between minrandval and maxrandval
1949  *
1950  * @deprecated Please use SCIPrandomGetInt() to request a random integer.
1951  */
1952 SCIP_EXPORT
1953 int SCIPgetRandomInt(
1954  int minrandval, /**< minimal value to return */
1955  int maxrandval, /**< maximal value to return */
1956  unsigned int* seedp /**< pointer to seed value */
1957  );
1958 
1959 
1960 /** returns a random integer between minrandval and maxrandval */
1961 SCIP_EXPORT
1962 int SCIPrandomGetInt(
1963  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1964  int minrandval, /**< minimal value to return */
1965  int maxrandval /**< maximal value to return */
1966  );
1967 
1968 /** draws a random subset of disjoint elements from a given set of disjoint elements;
1969  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
1970  */
1971 SCIP_EXPORT
1973  SCIP_RANDNUMGEN* randgen, /**< random number generator */
1974  void** set, /**< original set, from which elements should be drawn */
1975  int nelems, /**< number of elements in original set */
1976  void** subset, /**< subset in which drawn elements should be stored */
1977  int nsubelems /**< number of elements that should be drawn and stored */
1978  );
1979 
1980 /** returns a random real between minrandval and maxrandval */
1981 SCIP_EXPORT
1983  SCIP_RANDNUMGEN* randgen, /**< random number generator data */
1984  SCIP_Real minrandval, /**< minimal value to return */
1985  SCIP_Real maxrandval /**< maximal value to return */
1986  );
1987 
1988 /** returns a random real between minrandval and maxrandval
1989  *
1990  * @deprecated Please use SCIPrandomGetReal() to request a random real.
1991  */
1992 SCIP_EXPORT
1994  SCIP_Real minrandval, /**< minimal value to return */
1995  SCIP_Real maxrandval, /**< maximal value to return */
1996  unsigned int* seedp /**< pointer to seed value */
1997  );
1998 
1999 /** draws a random subset of disjoint elements from a given set of disjoint elements;
2000  * this implementation is suited for the case that nsubelems is considerably smaller then nelems
2001  *
2002  * @deprecated Please use SCIPrandomGetSubset()
2003  */
2004 SCIP_EXPORT
2006  void** set, /**< original set, from which elements should be drawn */
2007  int nelems, /**< number of elements in original set */
2008  void** subset, /**< subset in which drawn elements should be stored */
2009  int nsubelems, /**< number of elements that should be drawn and stored */
2010  unsigned int randseed /**< seed value for random generator */
2011  );
2012 
2013 /**@} */
2014 
2015 /*
2016  * Permutations / Shuffling
2017  */
2018 
2019 /**@defgroup PermutationsShuffling Permutations Shuffling
2020  * @ingroup MiscellaneousMethods
2021  * @brief methods for shuffling arrays
2022  *
2023  * @{
2024  */
2025 
2026 /** swaps two ints */
2027 SCIP_EXPORT
2028 void SCIPswapInts(
2029  int* value1, /**< pointer to first integer */
2030  int* value2 /**< pointer to second integer */
2031  );
2032 
2033 /** swaps two real values */
2034 SCIP_EXPORT
2035 void SCIPswapReals(
2036  SCIP_Real* value1, /**< pointer to first real value */
2037  SCIP_Real* value2 /**< pointer to second real value */
2038 );
2039 
2040 /** swaps the addresses of two pointers */
2041 SCIP_EXPORT
2042 void SCIPswapPointers(
2043  void** pointer1, /**< first pointer */
2044  void** pointer2 /**< second pointer */
2045  );
2046 
2047 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm
2048  *
2049  * @deprecated Please use SCIPrandomPermuteIntArray()
2050  */
2051 SCIP_EXPORT
2052 void SCIPpermuteIntArray(
2053  int* array, /**< array to be shuffled */
2054  int begin, /**< first included index that should be subject to shuffling
2055  * (0 for first array entry)
2056  */
2057  int end, /**< first excluded index that should not be subject to shuffling
2058  * (array size for last array entry)
2059  */
2060  unsigned int* randseed /**< seed value for the random generator */
2061  );
2062 
2063 /** randomly shuffles parts of an integer array using the Fisher-Yates algorithm */
2064 SCIP_EXPORT
2066  SCIP_RANDNUMGEN* randgen, /**< random number generator */
2067  int* array, /**< array to be shuffled */
2068  int begin, /**< first included index that should be subject to shuffling
2069  * (0 for first array entry)
2070  */
2071  int end /**< first excluded index that should not be subject to shuffling
2072  * (array size for last array entry)
2073  */
2074  );
2075 
2076 /** randomly shuffles parts of an array using the Fisher-Yates algorithm */
2077 SCIP_EXPORT
2079  SCIP_RANDNUMGEN* randgen, /**< random number generator */
2080  void** array, /**< array to be shuffled */
2081  int begin, /**< first included index that should be subject to shuffling
2082  * (0 for first array entry)
2083  */
2084  int end /**< first excluded index that should not be subject to shuffling
2085  * (array size for last array entry)
2086  */
2087  );
2088 
2089 /** randomly shuffles parts of an array using the Fisher-Yates algorithm
2090  *
2091  * @deprecated Please use SCIPrandomPermuteArray()
2092  */
2093 SCIP_EXPORT
2094 void SCIPpermuteArray(
2095  void** array, /**< array to be shuffled */
2096  int begin, /**< first included index that should be subject to shuffling
2097  * (0 for first array entry)
2098  */
2099  int end, /**< first excluded index that should not be subject to shuffling
2100  * (array size for last array entry)
2101  */
2102  unsigned int* randseed /**< pointer to seed value for the random generator */
2103  );
2104 
2105 /**@} */
2106 
2107 
2108 /*
2109  * Arrays
2110  */
2111 
2112 /**@defgroup Arrays Arrays
2113  * @ingroup MiscellaneousMethods
2114  * @brief miscellaneous methods for arrays
2115  *
2116  * @{
2117  */
2118 
2119 
2120 /** computes set intersection (duplicates removed) of two integer arrays that are ordered ascendingly
2121  *
2122  * @deprecated Switch to SCIPcomputeArraysIntersectionInt().
2123  */
2124 SCIP_EXPORT
2126  int* array1, /**< first array (in ascending order) */
2127  int narray1, /**< number of entries of first array */
2128  int* array2, /**< second array (in ascending order) */
2129  int narray2, /**< number of entries of second array */
2130  int* intersectarray, /**< intersection of array1 and array2
2131  * (note: it is possible to use array1 for this input argument) */
2132  int* nintersectarray /**< pointer to store number of entries of intersection array
2133  * (note: it is possible to use narray1 for this input argument) */
2134  );
2135 
2136 /** computes set intersection (duplicates removed) of two integer arrays that are ordered ascendingly */
2137 SCIP_EXPORT
2139  int* array1, /**< first array (in ascending order) */
2140  int narray1, /**< number of entries of first array */
2141  int* array2, /**< second array (in ascending order) */
2142  int narray2, /**< number of entries of second array */
2143  int* intersectarray, /**< intersection of array1 and array2
2144  * (note: it is possible to use array1 for this input argument) */
2145  int* nintersectarray /**< pointer to store number of entries of intersection array
2146  * (note: it is possible to use narray1 for this input argument) */
2147  );
2148 
2149 /** computes set intersection (duplicates removed) of two void-pointer arrays that are ordered ascendingly */
2150 SCIP_EXPORT
2152  void** array1, /**< first array (in ascending order) */
2153  int narray1, /**< number of entries of first array */
2154  void** array2, /**< second array (in ascending order) */
2155  int narray2, /**< number of entries of second array */
2156  SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
2157  void** intersectarray, /**< intersection of array1 and array2
2158  * (note: it is possible to use array1 for this input argument) */
2159  int* nintersectarray /**< pointer to store number of entries of intersection array
2160  * (note: it is possible to use narray1 for this input argument) */
2161 );
2162 
2163 /** computes set difference (duplicates removed) of two integer arrays that are ordered ascendingly
2164  *
2165  * @deprecated Switch to SCIPcomputeArraysSetminusInt().
2166  */
2167 SCIP_EXPORT
2169  int* array1, /**< first array (in ascending order) */
2170  int narray1, /**< number of entries of first array */
2171  int* array2, /**< second array (in ascending order) */
2172  int narray2, /**< number of entries of second array */
2173  int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
2174  * (note: it is possible to use array1 for this input argument) */
2175  int* nsetminusarray /**< pointer to store number of entries of setminus array
2176  * (note: it is possible to use narray1 for this input argument) */
2177  );
2178 
2179 /** computes set difference (duplicates removed) of two integer arrays that are ordered ascendingly */
2180 SCIP_EXPORT
2182  int* array1, /**< first array (in ascending order) */
2183  int narray1, /**< number of entries of first array */
2184  int* array2, /**< second array (in ascending order) */
2185  int narray2, /**< number of entries of second array */
2186  int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
2187  * (note: it is possible to use array1 for this input argument) */
2188  int* nsetminusarray /**< pointer to store number of entries of setminus array
2189  * (note: it is possible to use narray1 for this input argument) */
2190  );
2191 
2192 /**@} */
2193 
2194 
2195 /*
2196  * Strings
2197  */
2198 
2199 /**@defgroup StringMethods String Methods
2200  * @ingroup MiscellaneousMethods
2201  * @brief commonly used methods for strings
2202  *
2203  *@{
2204  */
2205 
2206 /** copies characters from 'src' to 'dest', copying is stopped when either the 'stop' character is reached or after
2207  * 'cnt' characters have been copied, whichever comes first.
2208  *
2209  * @note undefined behaviuor on overlapping arrays
2210  */
2211 SCIP_EXPORT
2212 int SCIPmemccpy(
2213  char* dest, /**< destination pointer to copy to */
2214  const char* src, /**< source pointer to copy to */
2215  char stop, /**< character when found stop copying */
2216  unsigned int cnt /**< maximal number of characters to copy too */
2217  );
2218 
2219 /** prints an error message containing of the given string followed by a string describing the current system error;
2220  * prefers to use the strerror_r method, which is threadsafe; on systems where this method does not exist,
2221  * NO_STRERROR_R should be defined (see INSTALL), in this case, srerror is used which is not guaranteed to be
2222  * threadsafe (on SUN-systems, it actually is)
2223  */
2224 SCIP_EXPORT
2225 void SCIPprintSysError(
2226  const char* message /**< first part of the error message, e.g. the filename */
2227  );
2228 
2229 /** extracts tokens from strings - wrapper method for strtok_r() */
2230 SCIP_EXPORT
2231 char* SCIPstrtok(
2232  char* s, /**< string to parse */
2233  const char* delim, /**< delimiters for parsing */
2234  char** ptrptr /**< pointer to working char pointer - must stay the same while parsing */
2235  );
2236 
2237 /** translates the given string into a string where symbols ", ', and spaces are escaped with a \ prefix */
2238 SCIP_EXPORT
2239 void SCIPescapeString(
2240  char* t, /**< target buffer to store escaped string */
2241  int bufsize, /**< size of buffer t */
2242  const char* s /**< string to transform into escaped string */
2243  );
2244 
2245 /** safe version of snprintf */
2246 SCIP_EXPORT
2247 int SCIPsnprintf(
2248  char* t, /**< target string */
2249  int len, /**< length of the string to copy */
2250  const char* s, /**< source string */
2251  ... /**< further parameters */
2252  );
2253 
2254 /** safe version of strncpy
2255  *
2256  * Copies string in s to t using at most @a size-1 nonzero characters (strncpy copies size characters). It always adds
2257  * a terminating zero char. Does not pad the remaining string with zero characters (unlike strncpy). Returns the number
2258  * of copied nonzero characters, if the length of s is at most size - 1, and returns size otherwise. Thus, the original
2259  * string was truncated if the return value is size.
2260  */
2261 SCIP_EXPORT
2262 int SCIPstrncpy(
2263  char* t, /**< target string */
2264  const char* s, /**< source string */
2265  int size /**< maximal size of t */
2266  );
2267 
2268 /** 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
2269  *
2270  * @return Returns TRUE if a value could be extracted, otherwise FALSE
2271  */
2272 SCIP_EXPORT
2274  const char* str, /**< string to search */
2275  int* value, /**< pointer to store the parsed value */
2276  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2277  );
2278 
2279 /** 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
2280  *
2281  * @return Returns TRUE if a value could be extracted, otherwise FALSE
2282  */
2283 SCIP_EXPORT
2285  const char* str, /**< string to search */
2286  SCIP_Real* value, /**< pointer to store the parsed value */
2287  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2288  );
2289 
2290 /** copies the first size characters between a start and end character of str into token, if no error occurred endptr
2291  * will point to the position after the read part, otherwise it will point to @p str
2292  */
2293 SCIP_EXPORT
2294 void SCIPstrCopySection(
2295  const char* str, /**< string to search */
2296  char startchar, /**< character which defines the beginning */
2297  char endchar, /**< character which defines the ending */
2298  char* token, /**< string to store the copy */
2299  int size, /**< size of the token char array */
2300  char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2301  );
2302 
2303 /** checks whether a given string t appears at the beginning of the string s (up to spaces at beginning) */
2304 SCIP_EXPORT
2306  const char* s, /**< string to search in */
2307  const char* t, /**< string to search for */
2308  size_t tlen /**< length of t */
2309 );
2310 
2311 /**@} */
2312 
2313 /*
2314  * File methods
2315  */
2316 
2317 /**@defgroup FileMethods File Methods
2318  * @ingroup MiscellaneousMethods
2319  * @brief commonly used file methods
2320  *
2321  * @{
2322  */
2323 
2324 /** returns, whether the given file exists */
2325 SCIP_EXPORT
2327  const char* filename /**< file name */
2328  );
2329 
2330 /** splits filename into path, name, and extension */
2331 SCIP_EXPORT
2332 void SCIPsplitFilename(
2333  char* filename, /**< filename to split; is destroyed (but not freed) during process */
2334  char** path, /**< pointer to store path, or NULL if not needed */
2335  char** name, /**< pointer to store name, or NULL if not needed */
2336  char** extension, /**< pointer to store extension, or NULL if not needed */
2337  char** compression /**< pointer to store compression extension, or NULL if not needed */
2338  );
2339 
2340 /**@} */
2341 
2342 #ifdef __cplusplus
2343 }
2344 #endif
2345 
2346 #endif
void SCIPmultihashFree(SCIP_MULTIHASH **multihash)
Definition: misc.c:1943
void SCIPpermuteArray(void **array, int begin, int end, unsigned int *randseed)
Definition: misc.c:10350
SCIP_RETCODE SCIPbtnodeCreate(SCIP_BT *tree, SCIP_BTNODE **node, void *dataptr)
Definition: misc.c:8587
void ** SCIPdigraphGetSuccessorsData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7748
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1477
void SCIPbtnodeFree(SCIP_BT *tree, SCIP_BTNODE **node)
Definition: misc.c:8651
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3519
SCIP_Real SCIPnormalGetCriticalValue(SCIP_CONFIDENCELEVEL clevel)
Definition: misc.c:182
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition: misc.c:10648
SCIP_Real SCIPerf(SCIP_Real x)
Definition: misc.c:155
void SCIPhashmapEntrySetImageReal(SCIP_HASHMAPENTRY *entry, SCIP_Real image)
Definition: misc.c:3571
internal miscellaneous methods for linear constraints
SCIP_RETCODE SCIPhashsetRemove(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3807
void SCIPdisjointsetUnion(SCIP_DISJOINTSET *djset, int p, int q, SCIP_Bool forcerepofp)
Definition: misc.c:11184
void * SCIPhashtableGetEntry(SCIP_HASHTABLE *hashtable, int entryidx)
Definition: misc.c:2734
void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:819
type definitions for miscellaneous datastructures
SCIP_BTNODE * SCIPbtnodeGetSibling(SCIP_BTNODE *node)
Definition: misc.c:8736
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3306
SCIP_RETCODE SCIPprofileDeleteCore(SCIP_PROFILE *profile, int left, int right, int height)
Definition: misc.c:6961
void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition: misc.c:8696
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2496
SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
Definition: misc.c:2800
void SCIPdigraphFreeComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8428
int SCIPhashsetGetNElements(SCIP_HASHSET *hashset)
Definition: misc.c:3941
void SCIPhashmapEntrySetImageInt(SCIP_HASHMAPENTRY *entry, int image)
Definition: misc.c:3560
void ** SCIPhashsetGetSlots(SCIP_HASHSET *hashset)
Definition: misc.c:3957
void SCIPgmlWriteArc(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:638
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition: misc.c:8000
void SCIPcomputeArraysSetminusInt(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition: misc.c:10593
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7730
SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition: misc.c:1029
void SCIPgmlWriteNode(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition: misc.c:496
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition: misc.c:10983
#define INLINE
Definition: def.h:132
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3509
SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:842
int SCIPprofileGetTime(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6758
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:1910
void SCIPgmlWriteClosing(FILE *file)
Definition: misc.c:698
void SCIPswapPointers(void **pointer1, void **pointer2)
Definition: misc.c:10300
void SCIPbtnodeSetRightchild(SCIP_BTNODE *node, SCIP_BTNODE *right)
Definition: misc.c:8857
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3023
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition: misc.c:11072
int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:7051
miscellaneous datastructures
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10764
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randgen, void **array, int begin, int end)
Definition: misc.c:10083
SCIP_RETCODE SCIPhashsetCreate(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
Definition: misc.c:3708
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
SCIP_RETCODE SCIPdigraphSetSizes(SCIP_DIGRAPH *digraph, int *sizes)
Definition: misc.c:7455
SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3141
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8534
SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6597
void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition: misc.c:1463
SCIP_Bool SCIPhashsetExists(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3766
SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition: misc.c:273
void SCIPhashtableClear(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2347
SCIP_RETCODE SCIPcomputeArraysIntersection(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition: misc.c:10446
void SCIPregressionAddObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:380
void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
Definition: misc.c:10287
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8195
SCIP_Bool SCIPstrToIntValue(const char *str, int *value, char **endptr)
Definition: misc.c:10834
void SCIPpqueueFree(SCIP_PQUEUE **pqueue)
Definition: misc.c:1272
SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int height, int *pos, SCIP_Bool *infeasible)
Definition: misc.c:6931
type definitions for return codes for SCIP methods
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randgen, int minrandval, int maxrandval)
Definition: misc.c:10012
SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
Definition: misc.c:9728
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition: misc.c:8208
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition: misc.c:3472
int SCIPdisjointsetGetSize(SCIP_DISJOINTSET *djset)
Definition: misc.c:11264
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3210
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:1184
void SCIPpqueueDelPos(SCIP_PQUEUE *pqueue, int pos)
Definition: misc.c:1383
int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6770
SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3250
int SCIPstrncpy(char *t, const char *s, int size)
Definition: misc.c:10807
int SCIPhashsetGetNSlots(SCIP_HASHSET *hashset)
Definition: misc.c:3949
SCIP_VAR ** x
Definition: circlepacking.c:63
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8129
SCIP_Bool SCIPbtnodeIsRoot(SCIP_BTNODE *node)
Definition: misc.c:8756
real eps
void SCIPmultihashRemoveAll(SCIP_MULTIHASH *multihash)
Definition: misc.c:2160
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:2245
SCIP_Real SCIPcalcRootNewton(SCIP_DECL_NEWTONEVAL((*function)), SCIP_DECL_NEWTONEVAL((*derivative)), SCIP_Real *params, int nparams, SCIP_Real x, SCIP_Real eps, int k)
Definition: misc.c:9769
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3372
SCIP_Longint SCIPmultihashGetNElements(SCIP_MULTIHASH *multihash)
Definition: misc.c:2181
SCIP_Bool SCIPhashsetIsEmpty(SCIP_HASHSET *hashset)
Definition: misc.c:3933
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:10967
void SCIPqueueClear(SCIP_QUEUE *queue)
Definition: misc.c:978
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
Definition: misc.c:7657
int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition: misc.c:6718
SCIP_Bool SCIPrealToRational(SCIP_Real val, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:9304
SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition: misc.c:6552
void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:348
SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
Definition: misc.c:2791
void SCIPhashsetRemoveAll(SCIP_HASHSET *hashset)
Definition: misc.c:3965
#define SCIP_DECL_NEWTONEVAL(x)
Definition: type_misc.h:205
void SCIPdisjointsetClear(SCIP_DISJOINTSET *djset)
Definition: misc.c:11140
enum SCIP_Confidencelevel SCIP_CONFIDENCELEVEL
Definition: type_misc.h:53
SCIP_Bool SCIPstrAtStart(const char *s, const char *t, size_t tlen)
Definition: misc.c:11274
SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:799
int SCIPqueueNElems(SCIP_QUEUE *queue)
Definition: misc.c:1197
SCIP_Bool SCIPmultihashExists(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2099
SCIP_BTNODE * SCIPbtnodeGetParent(SCIP_BTNODE *node)
Definition: misc.c:8706
SCIP_RETCODE SCIPdigraphSetNSuccessors(SCIP_DIGRAPH *digraph, int node, int nsuccessors)
Definition: misc.c:7641
void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3434
int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6627
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition: misc.c:3490
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition: misc.c:3498
void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition: misc.c:8843
void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7667
void SCIPhashsetFree(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
Definition: misc.c:3739
static INLINE uint32_t SCIPrealHashCode(double x)
Definition: pub_misc.h:544
void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition: misc.c:7683
void SCIPescapeString(char *t, int bufsize, const char *s)
Definition: misc.c:10736
void SCIPhashmapEntrySetImage(SCIP_HASHMAPENTRY *entry, void *image)
Definition: misc.c:3549
void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition: misc.c:10895
SCIP_RETCODE SCIPmultihashSafeInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2015
void SCIPcomputeArraysIntersectionInt(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition: misc.c:10463
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3057
void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8460
void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition: misc.c:6571
int SCIPdisjointsetFind(SCIP_DISJOINTSET *djset, int element)
Definition: misc.c:11157
void SCIPgmlWriteEdge(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:594
unsigned int SCIPqueueRemoveUInt(SCIP_QUEUE *queue)
Definition: misc.c:1114
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2704
type definitions for problem variables
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2626
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:6666
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:967
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7573
SCIP_Bool SCIPbtnodeIsRightchild(SCIP_BTNODE *node)
Definition: misc.c:8794
SCIP_Real SCIPmultihashGetLoad(SCIP_MULTIHASH *multihash)
Definition: misc.c:2191
void * SCIPpqueueRemove(SCIP_PQUEUE *pqueue)
Definition: misc.c:1443
int SCIPdisjointsetGetComponentCount(SCIP_DISJOINTSET *djset)
Definition: misc.c:11254
SCIP_RETCODE SCIPgetRandomSubset(void **set, int nelems, void **subset, int nsubelems, unsigned int randseed)
Definition: misc.c:10384
SCIP_BTNODE * SCIPbtGetRoot(SCIP_BT *tree)
Definition: misc.c:8979
SCIP_RETCODE SCIPhashmapInsertReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3177
void SCIPregressionFree(SCIP_REGRESSION **regression)
Definition: misc.c:431
SCIP_RETCODE SCIPcomputeArraysSetminus(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition: misc.c:10576
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard)
Definition: misc.c:2819
void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2753
SCIP_BTNODE * SCIPbtnodeGetRightchild(SCIP_BTNODE *node)
Definition: misc.c:8726
SCIP_RETCODE SCIPdigraphAddArcSafe(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7604
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7715
#define SCIP_Bool
Definition: def.h:93
SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:809
void SCIPprintSysError(const char *message)
Definition: misc.c:10673
SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
Definition: misc.c:713
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3582
SCIP_RETCODE SCIPmultihashInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:1974
SCIP_Bool SCIPprofileFindLeft(SCIP_PROFILE *profile, int timepoint, int *pos)
Definition: misc.c:6784
SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition: misc.c:7325
unsigned int SCIPqueueFirstUInt(SCIP_QUEUE *queue)
Definition: misc.c:1166
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randgen, int *array, int begin, int end)
Definition: misc.c:10053
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition: misc.c:10865
int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition: misc.c:7697
void SCIPbtFree(SCIP_BT **tree)
Definition: misc.c:8887
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2528
SCIP_Bool SCIPbtnodeIsLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8776
SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
Definition: misc.c:9274
SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
Definition: misc.c:8340
void * SCIPmultihashRetrieveNext(SCIP_MULTIHASH *multihash, SCIP_MULTIHASHLIST **multihashlist, void *key)
Definition: misc.c:2063
SCIP_Real SCIPcomputeTwoSampleTTestValue(SCIP_Real meanx, SCIP_Real meany, SCIP_Real variancex, SCIP_Real variancey, SCIP_Real countx, SCIP_Real county)
Definition: misc.c:122
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1488
#define SCIP_DECL_PQUEUEELEMCHGPOS(x)
Definition: type_misc.h:208
void SCIPprofilePrint(SCIP_PROFILE *profile, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:6696
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:544
SCIP_Bool SCIPfindSimpleRational(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition: misc.c:9681
SCIP_RETCODE SCIPdigraphGetArticulationPoints(SCIP_DIGRAPH *digraph, int **articulations, int *narticulations)
Definition: misc.c:7911
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2557
int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6738
SCIP_VAR ** SCIPsparseSolGetVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:779
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition: misc.c:10034
int * SCIPprofileGetLoads(SCIP_PROFILE *profile)
Definition: misc.c:6748
int SCIPgetRandomInt(int minrandval, int maxrandval, unsigned int *seedp)
Definition: misc.c:9895
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2295
SCIP_Bool SCIPbtIsEmpty(SCIP_BT *tree)
Definition: misc.c:8969
SCIP_Real SCIPgetRandomReal(SCIP_Real minrandval, SCIP_Real maxrandval, unsigned int *seedp)
Definition: misc.c:9908
SCIP_BTNODE * SCIPbtnodeGetLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8716
SCIP_RETCODE SCIPpqueueCreate(SCIP_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)))
Definition: misc.c:1245
methods for sorting joint arrays of various types
int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:789
void SCIPbtSetRoot(SCIP_BT *tree, SCIP_BTNODE *root)
Definition: misc.c:8992
SCIP_RETCODE SCIPhashmapSetImageReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3340
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3388
int SCIPpqueueFind(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1499
void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition: misc.c:8829
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition: misc.c:3482
SCIP_Real SCIPstudentTGetCriticalValue(SCIP_CONFIDENCELEVEL clevel, int df)
Definition: misc.c:105
SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition: misc.c:943
SCIP_RETCODE SCIPpqueueInsert(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1344
SCIP_Real SCIPcalcMachineEpsilon(void)
Definition: misc.c:9008
SCIP_Real SCIPhashmapEntryGetImageReal(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3539
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:188
void * SCIPmultihashRetrieve(SCIP_MULTIHASH *multihash, void *key)
Definition: misc.c:2034
SCIP_Real SCIPnormalCDF(SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
Definition: misc.c:195
SCIP_Real SCIPregressionGetSlope(SCIP_REGRESSION *regression)
Definition: misc.c:263
int SCIPactivityGetDuration(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6607
SCIP_RETCODE SCIPqueueInsertUInt(SCIP_QUEUE *queue, unsigned int elem)
Definition: misc.c:1055
void SCIPhashsetPrintStatistics(SCIP_HASHSET *hashset, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3882
SCIP_RETCODE SCIPhashsetInsert(SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
Definition: misc.c:3749
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3272
#define SCIP_Real
Definition: def.h:186
void SCIPmultihashPrintStatistics(SCIP_MULTIHASH *multihash, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2201
void SCIPpermuteIntArray(int *array, int begin, int end, unsigned int *randseed)
Definition: misc.c:10316
SCIP_VAR ** y
Definition: circlepacking.c:64
SCIP_RETCODE SCIPrandomGetSubset(SCIP_RANDNUMGEN *randgen, void **set, int nelems, void **subset, int nsubelems)
Definition: misc.c:10115
SCIP_Longint SCIPcalcBinomCoef(int n, int m)
Definition: misc.c:10176
int SCIPhashmapEntryGetImageInt(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3529
int SCIPhashtableGetNEntries(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2726
#define SCIP_Longint
Definition: def.h:171
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:9467
void SCIPregressionReset(SCIP_REGRESSION *regression)
Definition: misc.c:399
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2608
void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition: misc.c:1080
unsigned int SCIPcalcFibHash(SCIP_Real v)
Definition: misc.c:10251
type definitions for message output methods
SCIP_RETCODE SCIPmultihashRemove(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2126
#define nnodes
Definition: gastrans.c:74
int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int lb, int ub, int duration, int height, SCIP_Bool *infeasible)
Definition: misc.c:7200
void SCIPgmlWriteOpening(FILE *file, SCIP_Bool directed)
Definition: misc.c:682
int SCIPcalcMultihashSize(int minsize)
Definition: misc.c:1587
SCIP_RETCODE SCIPregressionCreate(SCIP_REGRESSION **regression)
Definition: misc.c:415
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3105
SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2743
common defines and data types used in all packages of SCIP
void * SCIPqueueFirst(SCIP_QUEUE *queue)
Definition: misc.c:1148
void SCIPswapInts(int *value1, int *value2)
Definition: misc.c:10274
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:439
SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition: misc.c:8868
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3230
void SCIPcomputeArraysIntersectionPtr(void **array1, int narray1, void **array2, int narray2, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void **intersectarray, int *nintersectarray)
Definition: misc.c:10516
int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6617
void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition: misc.c:8815
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition: misc.c:7479
int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6728
void SCIPpqueueClear(SCIP_PQUEUE *pqueue)
Definition: misc.c:1283
int SCIPregressionGetNObservations(SCIP_REGRESSION *regression)
Definition: misc.c:253
char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
Definition: misc.c:10722
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9031
void SCIPdigraphPrintGml(SCIP_DIGRAPH *digraph, FILE *file)
Definition: misc.c:8495
void SCIPbtPrintGml(SCIP_BT *tree, FILE *file)
Definition: misc.c:8939
SCIP_Longint SCIPhashtableGetNElements(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2716
SCIP_Longint SCIPcalcSmaComMul(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9283
SCIP_Bool SCIPbtnodeIsLeaf(SCIP_BTNODE *node)
Definition: misc.c:8766
preparation of a linear inequality to become a SCIP_ROW
void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
Definition: misc.c:765
SCIP_Real SCIPcomputeGap(SCIP_Real eps, SCIP_Real inf, SCIP_Real primalbound, SCIP_Real dualbound)
Definition: misc.c:11090
void SCIPprofileFree(SCIP_PROFILE **profile)
Definition: misc.c:6680
methods for selecting (weighted) k-medians
memory allocation routines