SCIP Doxygen Documentation
 
Loading...
Searching...
No Matches
pub_misc.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2023 Zuse Institute Berlin (ZIB) */
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"
54#include "scip/type_retcode.h"
55#include "scip/type_misc.h"
56#include "scip/type_message.h"
57#include "scip/type_var.h"
59#include "scip/pub_misc_sort.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
69extern "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 */
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 */
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 */
110SCIP_Real SCIPerf(
111 SCIP_Real x /**< value to evaluate */
112 );
113
114/** get critical value of a standard normal distribution at a given confidence level */
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 */
127SCIP_Real SCIPnormalCDF(
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 */
147 SCIP_REGRESSION* regression /**< regression data structure */
148 );
149
150/** return the current slope of the regression */
152SCIP_Real SCIPregressionGetSlope(
153 SCIP_REGRESSION* regression /**< regression data structure */
154 );
155
156/** get the current y-intercept of the regression */
159 SCIP_REGRESSION* regression /**< regression data structure */
160 );
161
162/** removes an observation (x,y) from the regression */
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) */
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 */
181 SCIP_REGRESSION* regression /**< regression data structure */
182 );
183
184/** creates and resets a regression */
187 SCIP_REGRESSION** regression /**< regression data structure */
188 );
189
190/** frees a regression */
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 */
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 */
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 */
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 */
246void 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 */
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 */
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 */
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 */
292 SCIP_SPARSESOL** sparsesol /**< pointer to a sparse solution */
293 );
294
295/** returns the variables in the given sparse solution */
298 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
299 );
300
301/** returns the number of variables in the given sparse solution */
304 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
305 );
306
307/** returns the the lower bound array for all variables for a given sparse solution */
309SCIP_Longint* SCIPsparseSolGetLbs(
310 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
311 );
312
313/** returns the the upper bound array for all variables for a given sparse solution */
315SCIP_Longint* SCIPsparseSolGetUbs(
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 */
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 */
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 */
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 */
361void SCIPqueueFree(
362 SCIP_QUEUE** queue /**< pointer to a queue */
363 );
364
365/** clears the queue, but doesn't free the data elements themselves */
367void SCIPqueueClear(
368 SCIP_QUEUE* queue /**< queue */
369 );
370
371/** inserts pointer element at the end of the queue */
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 */
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 */
387void* 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 */
393unsigned 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 */
399void* 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 */
405unsigned int SCIPqueueFirstUInt(
406 SCIP_QUEUE* queue /**< queue */
407 );
408
409/** returns whether the queue is empty */
411SCIP_Bool SCIPqueueIsEmpty(
412 SCIP_QUEUE* queue /**< queue */
413 );
414
415/** returns the number of elements in the queue */
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 */
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 */
446void 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 */
452void SCIPpqueueClear(
453 SCIP_PQUEUE* pqueue /**< priority queue */
454 );
455
456/** inserts element into priority queue */
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 */
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 */
472void* SCIPpqueueRemove(
473 SCIP_PQUEUE* pqueue /**< priority queue */
474 );
475
476/** returns the best element of the queue without removing it */
478void* SCIPpqueueFirst(
479 SCIP_PQUEUE* pqueue /**< priority queue */
480 );
481
482/** returns the number of elements in the queue */
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! */
490void** 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 */
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 */
543INLINE static
544uint32_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 */
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 */
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 */
577 SCIP_HASHTABLE* hashtable /**< hash table */
578 );
579
580/** inserts element in hash table (multiple inserts of same element override the previous entry) */
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) */
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 */
597 SCIP_HASHTABLE* hashtable, /**< hash table */
598 void* key /**< key to retrieve */
599 );
600
601/** returns whether the given element exists in the table */
603SCIP_Bool SCIPhashtableExists(
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 */
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 */
618 SCIP_HASHTABLE* hashtable /**< hash table */
619 );
620
621/** returns number of hash table elements */
623SCIP_Longint SCIPhashtableGetNElements(
624 SCIP_HASHTABLE* hashtable /**< hash table */
625 );
626
627/** gives the number of entries in the internal arrays of a hash table */
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 */
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 */
642SCIP_Real SCIPhashtableGetLoad(
643 SCIP_HASHTABLE* hashtable /**< hash table */
644 );
645
646/** prints statistics about hash table usage */
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 */
669 int minsize /**< minimal size of the hash table */
670 );
671
672/** creates a multihash table */
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 */
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 */
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 */
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 */
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 */
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 */
735SCIP_Bool SCIPmultihashExists(
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 */
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 */
754 SCIP_MULTIHASH* multihash /**< multihash table */
755 );
756
757/** returns number of multihash table elements */
759SCIP_Longint SCIPmultihashGetNElements(
760 SCIP_MULTIHASH* multihash /**< multihash table */
761 );
762
763/** returns the load of the given multihash table in percentage */
765SCIP_Real SCIPmultihashGetLoad(
766 SCIP_MULTIHASH* multihash /**< multihash table */
767 );
768
769/** prints statistics about multihash table usage */
772 SCIP_MULTIHASH* multihash, /**< multihash table */
773 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
774 );
775
776/** standard hash key comparator for string keys */
779
780/** standard hashing function for string keys */
783
784/** gets the element as the key */
787
788/** returns TRUE iff both keys(pointer) are equal */
791
792/** returns the hash value of the key */
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 */
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 */
820void 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!) */
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!) */
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!) */
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 */
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 */
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 */
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 */
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 */
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 */
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 */
901SCIP_Bool SCIPhashmapExists(
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 */
909 SCIP_HASHMAP* hashmap, /**< hash map */
910 void* origin /**< origin to remove from the list */
911 );
912
913/** prints statistics about hash map usage */
916 SCIP_HASHMAP* hashmap, /**< hash map */
917 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
918 );
919
920/** indicates whether a hash map has no entries */
922SCIP_Bool SCIPhashmapIsEmpty(
923 SCIP_HASHMAP* hashmap /**< hash map */
924 );
925
926/** gives the number of elements in a hash map */
929 SCIP_HASHMAP* hashmap /**< hash map */
930 );
931
932/** gives the number of entries in the internal arrays of a hash map */
935 SCIP_HASHMAP* hashmap /**< hash map */
936 );
937
938/** gives the hashmap entry at the given index or NULL if entry has no element */
941 SCIP_HASHMAP* hashmap, /**< hash map */
942 int entryidx /**< index of hash map entry */
943 );
944
945/** gives the origin of the hashmap entry */
948 SCIP_HASHMAPENTRY* entry /**< hash map entry */
949 );
950
951/** gives the image of the hashmap entry */
954 SCIP_HASHMAPENTRY* entry /**< hash map entry */
955 );
956
957/** gives the image of the hashmap entry */
960 SCIP_HASHMAPENTRY* entry /**< hash map entry */
961 );
962
963/** gives the image of the hashmap entry */
966 SCIP_HASHMAPENTRY* entry /**< hash map entry */
967 );
968
969/** sets pointer image of a hashmap entry */
972 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
973 void* image /**< new image */
974 );
975
976/** sets integer image of a hashmap entry */
979 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
980 int image /**< new image */
981 );
982
983/** sets real image of a hashmap entry */
986 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
987 SCIP_Real image /**< new image */
988 );
989
990/** removes all entries in a hash map. */
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 */
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 */
1021void 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 */
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 */
1036SCIP_Bool SCIPhashsetExists(
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 */
1044 SCIP_HASHSET* hashset, /**< hash set */
1045 void* element /**< origin to remove from the list */
1046 );
1047
1048/** prints statistics about hash set usage */
1051 SCIP_HASHSET* hashset, /**< hash set */
1052 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
1053 );
1054
1055/** indicates whether a hash set has no entries */
1057SCIP_Bool SCIPhashsetIsEmpty(
1058 SCIP_HASHSET* hashset /**< hash set */
1059 );
1060
1061/** gives the number of elements in a hash set */
1064 SCIP_HASHSET* hashset /**< hash set */
1065 );
1066
1067/** gives the number of slots of a hash set */
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 */
1075void** SCIPhashsetGetSlots(
1076 SCIP_HASHSET* hashset /**< hash set */
1077 );
1078
1079/** removes all entries in a hash set. */
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 */
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 */
1123void 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 */
1132 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1133 );
1134
1135/** returns the duration of the resource activity */
1138 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1139 );
1140
1141/** returns the demand of the resource activity */
1144 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1145 );
1146
1147/** returns the energy of the resource activity */
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 */
1179 SCIP_PROFILE** profile, /**< pointer to store the resource profile */
1180 int capacity /**< resource capacity */
1181 );
1182
1183/** frees given resource profile */
1185void SCIPprofileFree(
1186 SCIP_PROFILE** profile /**< pointer to the resource profile */
1187 );
1188
1189/** output of the given resource profile */
1191void 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 */
1200 SCIP_PROFILE* profile /**< resource profile to use */
1201 );
1202
1203/** returns the number time points of the resource profile */
1206 SCIP_PROFILE* profile /**< resource profile to use */
1207 );
1208
1209/** returns the time points of the resource profile */
1212 SCIP_PROFILE* profile /**< resource profile to use */
1213 );
1214
1215/** returns the loads of the resource profile */
1218 SCIP_PROFILE* profile /**< resource profile to use */
1219 );
1220
1221/** returns the time point for given position of the resource profile */
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 */
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 */
1239SCIP_Bool SCIPprofileFindLeft(
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 */
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 */
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 */
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 */
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 */
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 */
1314 SCIP_DIGRAPH* digraph, /**< directed graph */
1315 int* sizes /**< sizes of the successor lists */
1316 );
1317
1318/** frees given directed graph structure */
1320void 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 */
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 */
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 */
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 */
1360 SCIP_DIGRAPH* digraph /**< directed graph */
1361 );
1362
1363/** returns the node data, or NULL if no data exist */
1366 SCIP_DIGRAPH* digraph, /**< directed graph */
1367 int node /**< node for which the node data is returned */
1368 );
1369
1370/** sets the node data */
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 */
1381 SCIP_DIGRAPH* digraph /**< directed graph */
1382 );
1383
1384/** returns the number of successor nodes of the given node */
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 */
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 */
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 */
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 */
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 */
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 */
1460 SCIP_DIGRAPH* digraph /**< directed graph */
1461 );
1462
1463/** returns the number of previously computed undirected components for the given directed graph */
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 */
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 */
1484 SCIP_DIGRAPH* digraph /**< directed graph */
1485 );
1486
1487/** output of the given directed graph via the given message handler */
1489void 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 */
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 */
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 */
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 */
1536void 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 */
1543void* SCIPbtnodeGetData(
1544 SCIP_BTNODE* node /**< node */
1545 );
1546
1547/** returns the parent which can be NULL if the given node is the root */
1550 SCIP_BTNODE* node /**< node */
1551 );
1552
1553/** returns left child which can be NULL if the given node is a leaf */
1556 SCIP_BTNODE* node /**< node */
1557 );
1558
1559/** returns right child which can be NULL if the given node is a leaf */
1562 SCIP_BTNODE* node /**< node */
1563 );
1564
1565/** returns the sibling of the node or NULL if does not exist */
1568 SCIP_BTNODE* node /**< node */
1569 );
1570
1571/** returns whether the node is a root node */
1573SCIP_Bool SCIPbtnodeIsRoot(
1574 SCIP_BTNODE* node /**< node */
1575 );
1576
1577/** returns whether the node is a leaf */
1579SCIP_Bool SCIPbtnodeIsLeaf(
1580 SCIP_BTNODE* node /**< node */
1581 );
1582
1583/** returns TRUE if the given node is left child */
1585SCIP_Bool SCIPbtnodeIsLeftchild(
1586 SCIP_BTNODE* node /**< node */
1587 );
1588
1589/** returns TRUE if the given node is right child */
1591SCIP_Bool SCIPbtnodeIsRightchild(
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 */
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 */
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 */
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 */
1650 SCIP_BTNODE* node, /**< node */
1651 SCIP_BTNODE* right /**< new right child, or NULL */
1652 );
1653
1654/** creates an binary tree */
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 */
1666void SCIPbtFree(
1667 SCIP_BT** tree /**< pointer to binary tree */
1668 );
1669
1670/** prints the binary tree in GML format into the given file */
1672void 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) */
1679SCIP_Bool SCIPbtIsEmpty(
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 */
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 */
1705void 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 */
1724 SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1725 );
1726
1727/** finds and returns the component identifier of this \p element */
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 */
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 */
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 */
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 */
1770SCIP_Real SCIPcalcMachineEpsilon(
1771 void
1772 );
1773
1774/** returns the next representable value of from in the direction of to */
1776SCIP_Real SCIPnextafter(
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 */
1783SCIP_Longint SCIPcalcGreComDiv(
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 */
1790SCIP_Longint SCIPcalcSmaComMul(
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 */
1800SCIP_Longint SCIPcalcBinomCoef(
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 */
1807unsigned 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 */
1825SCIP_Bool SCIPrealToRational(
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 */
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 */
1854SCIP_Bool SCIPfindSimpleRational(
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 */
1867SCIP_Real SCIPselectSimpleValue(
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 */
1877SCIP_Real SCIPcalcRootNewton(
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) */
1910SCIP_Real SCIPrelDiff(
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 */
1927SCIP_Real SCIPcomputeGap(
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 */
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 */
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 */
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 */
1982SCIP_Real SCIPrandomGetReal(
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 */
1993SCIP_Real SCIPgetRandomReal(
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 */
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 */
2028void SCIPswapInts(
2029 int* value1, /**< pointer to first integer */
2030 int* value2 /**< pointer to second integer */
2031 );
2032
2033/** swaps two real values */
2035void 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 */
2042void 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 */
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 */
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 */
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 */
2094void 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 */
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 */
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 */
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 */
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 */
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 */
2212int 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 */
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() */
2231char* 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 */
2239void 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/** increases string pointer as long as it refers to a space character or an explicit space control sequence */
2248 char** s /**< pointer to string pointer */
2249 );
2250
2251/** safe version of snprintf */
2253int SCIPsnprintf(
2254 char* t, /**< target string */
2255 int len, /**< length of the string to copy */
2256 const char* s, /**< source string */
2257 ... /**< further parameters */
2258 );
2259
2260/** safe version of strncpy
2261 *
2262 * Copies string in s to t using at most @a size-1 nonzero characters (strncpy copies size characters). It always adds
2263 * a terminating zero char. Does not pad the remaining string with zero characters (unlike strncpy). Returns the number
2264 * of copied nonzero characters, if the length of s is at most size - 1, and returns size otherwise. Thus, the original
2265 * string was truncated if the return value is size.
2266 */
2268int SCIPstrncpy(
2269 char* t, /**< target string */
2270 const char* s, /**< source string */
2271 int size /**< maximal size of t */
2272 );
2273
2274/** 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
2275 *
2276 * @return Returns TRUE if a value could be extracted, otherwise FALSE
2277 */
2279SCIP_Bool SCIPstrToIntValue(
2280 const char* str, /**< string to search */
2281 int* value, /**< pointer to store the parsed value */
2282 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2283 );
2284
2285/** 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
2286 *
2287 * @return Returns TRUE if a value could be extracted, otherwise FALSE
2288 */
2290SCIP_Bool SCIPstrToRealValue(
2291 const char* str, /**< string to search */
2292 SCIP_Real* value, /**< pointer to store the parsed value */
2293 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2294 );
2295
2296/** copies the first size characters between a start and end character of str into token, if no error occurred endptr
2297 * will point to the position after the read part, otherwise it will point to @p str
2298 */
2301 const char* str, /**< string to search */
2302 char startchar, /**< character which defines the beginning */
2303 char endchar, /**< character which defines the ending */
2304 char* token, /**< string to store the copy */
2305 int size, /**< size of the token char array */
2306 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2307 );
2308
2309/** checks whether a given string t appears at the beginning of the string s (up to spaces at beginning) */
2311SCIP_Bool SCIPstrAtStart(
2312 const char* s, /**< string to search in */
2313 const char* t, /**< string to search for */
2314 size_t tlen /**< length of t */
2315);
2316
2317/**@} */
2318
2319/*
2320 * File methods
2321 */
2322
2323/**@defgroup FileMethods File Methods
2324 * @ingroup MiscellaneousMethods
2325 * @brief commonly used file methods
2326 *
2327 * @{
2328 */
2329
2330/** returns, whether the given file exists */
2332SCIP_Bool SCIPfileExists(
2333 const char* filename /**< file name */
2334 );
2335
2336/** splits filename into path, name, and extension */
2339 char* filename, /**< filename to split; is destroyed (but not freed) during process */
2340 char** path, /**< pointer to store path, or NULL if not needed */
2341 char** name, /**< pointer to store name, or NULL if not needed */
2342 char** extension, /**< pointer to store extension, or NULL if not needed */
2343 char** compression /**< pointer to store compression extension, or NULL if not needed */
2344 );
2345
2346/**@} */
2347
2348#ifdef __cplusplus
2349}
2350#endif
2351
2352#endif
SCIP_VAR ** y
SCIP_VAR ** x
common defines and data types used in all packages of SCIP
#define INLINE
Definition def.h:132
#define nnodes
Definition gastrans.c:74
void SCIPcomputeArraysIntersectionPtr(void **array1, int narray1, void **array2, int narray2, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), void **intersectarray, int *nintersectarray)
Definition misc.c:10523
void SCIPcomputeArraysSetminusInt(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition misc.c:10600
SCIP_RETCODE SCIPcomputeArraysIntersection(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition misc.c:10453
SCIP_RETCODE SCIPcomputeArraysSetminus(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition misc.c:10583
void SCIPcomputeArraysIntersectionInt(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition misc.c:10470
void SCIPbtnodeSetRightchild(SCIP_BTNODE *node, SCIP_BTNODE *right)
Definition misc.c:8858
SCIP_BTNODE * SCIPbtnodeGetRightchild(SCIP_BTNODE *node)
Definition misc.c:8727
SCIP_Bool SCIPbtIsEmpty(SCIP_BT *tree)
Definition misc.c:8970
SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition misc.c:8869
void SCIPbtnodeFree(SCIP_BT *tree, SCIP_BTNODE **node)
Definition misc.c:8652
SCIP_Bool SCIPbtnodeIsLeaf(SCIP_BTNODE *node)
Definition misc.c:8767
void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition misc.c:8816
void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition misc.c:8697
SCIP_RETCODE SCIPbtnodeCreate(SCIP_BT *tree, SCIP_BTNODE **node, void *dataptr)
Definition misc.c:8588
SCIP_Bool SCIPbtnodeIsRightchild(SCIP_BTNODE *node)
Definition misc.c:8795
void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition misc.c:8830
SCIP_BTNODE * SCIPbtnodeGetSibling(SCIP_BTNODE *node)
Definition misc.c:8737
SCIP_Bool SCIPbtnodeIsLeftchild(SCIP_BTNODE *node)
Definition misc.c:8777
void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition misc.c:8844
SCIP_BTNODE * SCIPbtnodeGetParent(SCIP_BTNODE *node)
Definition misc.c:8707
void SCIPbtFree(SCIP_BT **tree)
Definition misc.c:8888
SCIP_BTNODE * SCIPbtnodeGetLeftchild(SCIP_BTNODE *node)
Definition misc.c:8717
void SCIPbtSetRoot(SCIP_BT *tree, SCIP_BTNODE *root)
Definition misc.c:8993
SCIP_Bool SCIPbtnodeIsRoot(SCIP_BTNODE *node)
Definition misc.c:8757
SCIP_BTNODE * SCIPbtGetRoot(SCIP_BT *tree)
Definition misc.c:8980
void SCIPbtPrintGml(SCIP_BT *tree, FILE *file)
Definition misc.c:8940
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition misc.c:8535
void ** SCIPdigraphGetSuccessorsData(SCIP_DIGRAPH *digraph, int node)
Definition misc.c:7749
void SCIPdigraphFreeComponents(SCIP_DIGRAPH *digraph)
Definition misc.c:8429
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition misc.c:7716
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition misc.c:8001
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
Definition misc.c:7658
void SCIPdigraphPrintGml(SCIP_DIGRAPH *digraph, FILE *file)
Definition misc.c:8496
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition misc.c:8209
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition misc.c:7574
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition misc.c:8130
SCIP_RETCODE SCIPdigraphSetSizes(SCIP_DIGRAPH *digraph, int *sizes)
Definition misc.c:7456
SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
Definition misc.c:8341
SCIP_RETCODE SCIPdigraphAddArcSafe(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition misc.c:7605
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition misc.c:7480
int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition misc.c:7698
void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition misc.c:8461
void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition misc.c:7668
void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition misc.c:7684
SCIP_RETCODE SCIPdigraphSetNSuccessors(SCIP_DIGRAPH *digraph, int node, int nsuccessors)
Definition misc.c:7642
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition misc.c:7731
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition misc.c:8196
SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition misc.c:7326
SCIP_RETCODE SCIPdigraphGetArticulationPoints(SCIP_DIGRAPH *digraph, int **articulations, int *narticulations)
Definition misc.c:7912
int SCIPdisjointsetGetSize(SCIP_DISJOINTSET *djset)
Definition misc.c:11288
void SCIPdisjointsetClear(SCIP_DISJOINTSET *djset)
Definition misc.c:11164
int SCIPdisjointsetGetComponentCount(SCIP_DISJOINTSET *djset)
Definition misc.c:11278
int SCIPdisjointsetFind(SCIP_DISJOINTSET *djset, int element)
Definition misc.c:11181
void SCIPdisjointsetUnion(SCIP_DISJOINTSET *djset, int p, int q, SCIP_Bool forcerepofp)
Definition misc.c:11208
SCIP_Bool SCIPfileExists(const char *filename)
Definition misc.c:10991
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition misc.c:11007
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
void SCIPgmlWriteNode(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition misc.c:496
void SCIPgmlWriteClosing(FILE *file)
Definition misc.c:698
void SCIPgmlWriteOpening(FILE *file, SCIP_Bool directed)
Definition misc.c:682
void SCIPgmlWriteEdge(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition misc.c:594
void SCIPgmlWriteArc(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition misc.c:638
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition misc.c:3058
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
Definition misc.c:3520
SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition misc.c:3251
SCIP_RETCODE SCIPhashmapInsertReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition misc.c:3178
void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition misc.c:3435
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition misc.c:3231
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition misc.c:3211
SCIP_RETCODE SCIPhashmapSetImageReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition misc.c:3341
void SCIPhashmapEntrySetImageInt(SCIP_HASHMAPENTRY *entry, int image)
Definition misc.c:3561
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition misc.c:3106
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition misc.c:3273
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition misc.c:3483
int SCIPhashmapEntryGetImageInt(SCIP_HASHMAPENTRY *entry)
Definition misc.c:3530
void SCIPhashmapEntrySetImageReal(SCIP_HASHMAPENTRY *entry, SCIP_Real image)
Definition misc.c:3572
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition misc.c:3491
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition misc.c:3499
void SCIPhashmapEntrySetImage(SCIP_HASHMAPENTRY *entry, void *image)
Definition misc.c:3550
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition misc.c:3024
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition misc.c:3510
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition misc.c:3373
SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition misc.c:3142
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition misc.c:3473
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition misc.c:3583
SCIP_Real SCIPhashmapEntryGetImageReal(SCIP_HASHMAPENTRY *entry)
Definition misc.c:3540
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition misc.c:3389
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition misc.c:3307
void SCIPhashsetFree(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
Definition misc.c:3740
void SCIPhashsetPrintStatistics(SCIP_HASHSET *hashset, SCIP_MESSAGEHDLR *messagehdlr)
Definition misc.c:3883
SCIP_Bool SCIPhashsetExists(SCIP_HASHSET *hashset, void *element)
Definition misc.c:3767
void ** SCIPhashsetGetSlots(SCIP_HASHSET *hashset)
Definition misc.c:3958
int SCIPhashsetGetNElements(SCIP_HASHSET *hashset)
Definition misc.c:3942
int SCIPhashsetGetNSlots(SCIP_HASHSET *hashset)
Definition misc.c:3950
void SCIPhashsetRemoveAll(SCIP_HASHSET *hashset)
Definition misc.c:3966
SCIP_Bool SCIPhashsetIsEmpty(SCIP_HASHSET *hashset)
Definition misc.c:3934
SCIP_RETCODE SCIPhashsetInsert(SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
Definition misc.c:3750
SCIP_RETCODE SCIPhashsetCreate(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
Definition misc.c:3709
SCIP_RETCODE SCIPhashsetRemove(SCIP_HASHSET *hashset, void *element)
Definition misc.c:3808
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition misc.c:2296
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2609
int SCIPhashtableGetNEntries(SCIP_HASHTABLE *hashtable)
Definition misc.c:2727
void SCIPhashtableClear(SCIP_HASHTABLE *hashtable)
Definition misc.c:2348
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2529
void * SCIPhashtableGetEntry(SCIP_HASHTABLE *hashtable, int entryidx)
Definition misc.c:2735
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:2246
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition misc.c:2558
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition misc.c:2705
SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition misc.c:2744
void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition misc.c:2754
static INLINE uint32_t SCIPrealHashCode(double x)
Definition pub_misc.h:544
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2627
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition misc.c:2497
SCIP_Longint SCIPhashtableGetNElements(SCIP_HASHTABLE *hashtable)
Definition misc.c:2717
SCIP_Longint SCIPmultihashGetNElements(SCIP_MULTIHASH *multihash)
Definition misc.c:2181
void SCIPmultihashFree(SCIP_MULTIHASH **multihash)
Definition misc.c:1943
SCIP_RETCODE SCIPmultihashInsert(SCIP_MULTIHASH *multihash, void *element)
Definition misc.c:1974
SCIP_RETCODE SCIPmultihashRemove(SCIP_MULTIHASH *multihash, void *element)
Definition misc.c:2126
void SCIPmultihashRemoveAll(SCIP_MULTIHASH *multihash)
Definition misc.c:2160
SCIP_RETCODE SCIPmultihashSafeInsert(SCIP_MULTIHASH *multihash, void *element)
Definition misc.c:2015
int SCIPcalcMultihashSize(int minsize)
Definition misc.c:1587
SCIP_Real SCIPmultihashGetLoad(SCIP_MULTIHASH *multihash)
Definition misc.c:2191
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 * SCIPmultihashRetrieve(SCIP_MULTIHASH *multihash, void *key)
Definition misc.c:2034
void * SCIPmultihashRetrieveNext(SCIP_MULTIHASH *multihash, SCIP_MULTIHASHLIST **multihashlist, void *key)
Definition misc.c:2063
SCIP_Bool SCIPmultihashExists(SCIP_MULTIHASH *multihash, void *element)
Definition misc.c:2099
void SCIPmultihashPrintStatistics(SCIP_MULTIHASH *multihash, SCIP_MESSAGEHDLR *messagehdlr)
Definition misc.c:2201
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition misc.c:9032
SCIP_Longint SCIPcalcBinomCoef(int n, int m)
Definition misc.c:10183
SCIP_Longint SCIPcalcSmaComMul(SCIP_Longint val1, SCIP_Longint val2)
Definition misc.c:9284
SCIP_Bool SCIPrealToRational(SCIP_Real val, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition misc.c:9305
SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
Definition misc.c:9735
SCIP_Real SCIPcomputeGap(SCIP_Real eps, SCIP_Real inf, SCIP_Real primalbound, SCIP_Real dualbound)
Definition misc.c:11114
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:9776
SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
Definition misc.c:9275
SCIP_Real SCIPcalcMachineEpsilon(void)
Definition misc.c:9009
unsigned int SCIPcalcFibHash(SCIP_Real v)
Definition misc.c:10258
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:9468
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition misc.c:11096
SCIP_Bool SCIPfindSimpleRational(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom, SCIP_Longint *nominator, SCIP_Longint *denominator)
Definition misc.c:9688
void SCIPswapInts(int *value1, int *value2)
Definition misc.c:10281
void SCIPswapPointers(void **pointer1, void **pointer2)
Definition misc.c:10307
void SCIPpermuteArray(void **array, int begin, int end, unsigned int *randseed)
Definition misc.c:10357
void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
Definition misc.c:10294
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randgen, int *array, int begin, int end)
Definition misc.c:10060
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randgen, void **array, int begin, int end)
Definition misc.c:10090
void SCIPpermuteIntArray(int *array, int begin, int end, unsigned int *randseed)
Definition misc.c:10323
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition misc.c:1488
void SCIPpqueueDelPos(SCIP_PQUEUE *pqueue, int pos)
Definition misc.c:1383
void SCIPpqueueClear(SCIP_PQUEUE *pqueue)
Definition misc.c:1283
int SCIPpqueueFind(SCIP_PQUEUE *pqueue, void *elem)
Definition misc.c:1499
SCIP_RETCODE SCIPpqueueCreate(SCIP_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)),)
Definition misc.c:1245
void SCIPpqueueFree(SCIP_PQUEUE **pqueue)
Definition misc.c:1272
SCIP_RETCODE SCIPpqueueInsert(SCIP_PQUEUE *pqueue, void *elem)
Definition misc.c:1344
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition misc.c:1477
void * SCIPpqueueRemove(SCIP_PQUEUE *pqueue)
Definition misc.c:1443
void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition misc.c:1463
int SCIPqueueNElems(SCIP_QUEUE *queue)
Definition misc.c:1197
unsigned int SCIPqueueRemoveUInt(SCIP_QUEUE *queue)
Definition misc.c:1114
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition misc.c:967
SCIP_RETCODE SCIPqueueInsertUInt(SCIP_QUEUE *queue, unsigned int elem)
Definition misc.c:1055
SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition misc.c:943
void SCIPqueueClear(SCIP_QUEUE *queue)
Definition misc.c:978
SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition misc.c:1029
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition misc.c:1184
void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition misc.c:1080
void * SCIPqueueFirst(SCIP_QUEUE *queue)
Definition misc.c:1148
unsigned int SCIPqueueFirstUInt(SCIP_QUEUE *queue)
Definition misc.c:1166
SCIP_RETCODE SCIPgetRandomSubset(void **set, int nelems, void **subset, int nsubelems, unsigned int randseed)
Definition misc.c:10391
SCIP_RETCODE SCIPrandomGetSubset(SCIP_RANDNUMGEN *randgen, void **set, int nelems, void **subset, int nsubelems)
Definition misc.c:10122
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition misc.c:10041
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randgen, int minrandval, int maxrandval)
Definition misc.c:10019
int SCIPgetRandomInt(int minrandval, int maxrandval, unsigned int *seedp)
Definition misc.c:9902
SCIP_Real SCIPgetRandomReal(SCIP_Real minrandval, SCIP_Real maxrandval, unsigned int *seedp)
Definition misc.c:9915
void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition misc.c:348
void SCIPregressionAddObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition misc.c:380
SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition misc.c:273
int SCIPregressionGetNObservations(SCIP_REGRESSION *regression)
Definition misc.c:253
void SCIPregressionFree(SCIP_REGRESSION **regression)
Definition misc.c:431
SCIP_RETCODE SCIPregressionCreate(SCIP_REGRESSION **regression)
Definition misc.c:415
void SCIPregressionReset(SCIP_REGRESSION *regression)
Definition misc.c:399
SCIP_Real SCIPregressionGetSlope(SCIP_REGRESSION *regression)
Definition misc.c:263
SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition misc.c:6553
int SCIPactivityGetDuration(SCIP_RESOURCEACTIVITY *activity)
Definition misc.c:6608
int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition misc.c:6628
SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition misc.c:6598
int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition misc.c:6618
void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition misc.c:6572
int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int lb, int ub, int duration, int height, SCIP_Bool *infeasible)
Definition misc.c:7201
int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition misc.c:6739
SCIP_Bool SCIPprofileFindLeft(SCIP_PROFILE *profile, int timepoint, int *pos)
Definition misc.c:6785
int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition misc.c:6729
void SCIPprofileFree(SCIP_PROFILE **profile)
Definition misc.c:6681
int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition misc.c:6771
int * SCIPprofileGetLoads(SCIP_PROFILE *profile)
Definition misc.c:6749
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition misc.c:6667
int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int height, SCIP_Bool *infeasible)
Definition misc.c:7052
int SCIPprofileGetTime(SCIP_PROFILE *profile, int pos)
Definition misc.c:6759
int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition misc.c:6719
SCIP_RETCODE SCIPprofileDeleteCore(SCIP_PROFILE *profile, int left, int right, int height)
Definition misc.c:6962
SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int height, int *pos, SCIP_Bool *infeasible)
Definition misc.c:6932
void SCIPprofilePrint(SCIP_PROFILE *profile, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition misc.c:6697
SCIP_Real SCIPnormalCDF(SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
Definition misc.c:195
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
SCIP_Real SCIPnormalGetCriticalValue(SCIP_CONFIDENCELEVEL clevel)
Definition misc.c:182
SCIP_Real SCIPstudentTGetCriticalValue(SCIP_CONFIDENCELEVEL clevel, int df)
Definition misc.c:105
SCIP_Real SCIPerf(SCIP_Real x)
Definition misc.c:155
int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
Definition misc.c:789
SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
Definition misc.c:799
void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition misc.c:819
SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
Definition misc.c:713
SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
Definition misc.c:809
void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
Definition misc.c:765
SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition misc.c:842
SCIP_VAR ** SCIPsparseSolGetVars(SCIP_SPARSESOL *sparsesol)
Definition misc.c:779
SCIP_Bool SCIPstrToIntValue(const char *str, int *value, char **endptr)
Definition misc.c:10858
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition misc.c:10788
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition misc.c:10889
void SCIPescapeString(char *t, int bufsize, const char *s)
Definition misc.c:10743
void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition misc.c:10919
void SCIPprintSysError(const char *message)
Definition misc.c:10680
SCIP_Bool SCIPstrAtStart(const char *s, const char *t, size_t tlen)
Definition misc.c:11298
SCIP_RETCODE SCIPskipSpace(char **s)
Definition misc.c:10777
int SCIPstrncpy(char *t, const char *s, int size)
Definition misc.c:10831
char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
Definition misc.c:10729
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition misc.c:10655
static SCIP_SOL * sol
int nvars
SCIP_VAR * var
static SCIP_VAR ** vars
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
Definition memory.h:439
real eps
internal miscellaneous methods for linear constraints
preparation of a linear inequality to become a SCIP_ROW
methods for selecting (weighted) k-medians
methods for sorting joint arrays of various types
miscellaneous datastructures
type definitions for message output methods
type definitions for miscellaneous datastructures
#define SCIP_DECL_PQUEUEELEMCHGPOS(x)
Definition type_misc.h:208
#define SCIP_DECL_SORTPTRCOMP(x)
Definition type_misc.h:188
#define SCIP_DECL_HASHKEYEQ(x)
Definition type_misc.h:194
#define SCIP_DECL_NEWTONEVAL(x)
Definition type_misc.h:205
#define SCIP_DECL_HASHGETKEY(x)
Definition type_misc.h:191
#define SCIP_DECL_HASHKEYVAL(x)
Definition type_misc.h:197
enum SCIP_Confidencelevel SCIP_CONFIDENCELEVEL
Definition type_misc.h:53
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
type definitions for problem variables