Scippy

SCIP

Solving Constraint Integer Programs

pub_misc.h
Go to the documentation of this file.
1/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
2/* */
3/* This file is part of the program and library */
4/* SCIP --- Solving Constraint Integer Programs */
5/* */
6/* Copyright (c) 2002-2025 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/* The C99 standard defines the function (or macro) isfinite.
69 * On MacOS X, isfinite is also available.
70 * From the BSD world, there comes a function finite.
71 * On SunOS, finite is also available.
72 * In the MS compiler world, there is a function _finite.
73 * As last resort, we check whether x == x does not hold, but this works only for NaN's, not for infinities!
74 */
75#if _XOPEN_SOURCE >= 600 || defined(_ISOC99_SOURCE) || _POSIX_C_SOURCE >= 200112L || defined(__APPLE__)
76#define SCIPisFinite isfinite
77#elif defined(_BSD_SOURCE) || defined(__sun)
78#define SCIPisFinite finite
79#elif defined(_MSC_VER)
80#define SCIPisFinite _finite
81#else
82#define SCIPisFinite(x) ((x) == (x))
83#endif
84
85#ifdef __cplusplus
86extern "C" {
87#endif
88
89/*
90 * methods for statistical tests
91 */
92
93/**@defgroup STATISTICALTESTS Statistical tests
94 * @ingroup MiscellaneousMethods
95 * @brief public methods for statistical tests
96 *
97 * Below are the public methods for statistical tests inside of \SCIP
98 *
99 * @{
100 */
101
102/** get critical value of a Student-T distribution for a given number of degrees of freedom at a confidence level */
103SCIP_EXPORT
105 SCIP_CONFIDENCELEVEL clevel, /**< (one-sided) confidence level */
106 int df /**< degrees of freedom */
107 );
108
109/** compute a t-value for the hypothesis that x and y are from the same population; Assuming that
110 * x and y represent normally distributed random samples with equal variance, the returned value
111 * comes from a Student-T distribution with countx + county - 2 degrees of freedom; this
112 * value can be compared with a critical value (see also SCIPstudentTGetCriticalValue()) at
113 * a predefined confidence level for checking if x and y significantly differ in location
114 */
115SCIP_EXPORT
117 SCIP_Real meanx, /**< the mean of the first distribution */
118 SCIP_Real meany, /**< the mean of the second distribution */
119 SCIP_Real variancex, /**< the variance of the x-distribution */
120 SCIP_Real variancey, /**< the variance of the y-distribution */
121 SCIP_Real countx, /**< number of samples of x */
122 SCIP_Real county /**< number of samples of y */
123 );
124
125/** returns the value of the Gauss error function evaluated at a given point */
126SCIP_EXPORT
128 SCIP_Real x /**< value to evaluate */
129 );
130
131/** get critical value of a standard normal distribution at a given confidence level */
132SCIP_EXPORT
134 SCIP_CONFIDENCELEVEL clevel /**< (one-sided) confidence level */
135 );
136
137/** calculates the cumulative distribution P(-infinity <= x <= value) that a normally distributed
138 * random variable x takes a value between -infinity and parameter \p value.
139 *
140 * The distribution is given by the respective mean and deviation. This implementation
141 * uses the error function erf().
142 */
143SCIP_EXPORT
145 SCIP_Real mean, /**< the mean value of the distribution */
146 SCIP_Real variance, /**< the square of the deviation of the distribution */
147 SCIP_Real value /**< the upper limit of the calculated distribution integral */
148 );
149
150/**@} */
151
152/**@defgroup Regression Linear Regression
153 * @ingroup MiscellaneousMethods
154 * @brief methods for linear regression
155 *
156 * Below are the public methods for incremental linear regression of observations pairs \f$(X_i,Y_i), i=1\dots,n\f$
157 *
158 * @{
159 */
160
161/** returns the number of observations of this regression */
162SCIP_EXPORT
164 SCIP_REGRESSION* regression /**< regression data structure */
165 );
166
167/** return the current slope of the regression */
168SCIP_EXPORT
170 SCIP_REGRESSION* regression /**< regression data structure */
171 );
172
173/** get the current y-intercept of the regression */
174SCIP_EXPORT
176 SCIP_REGRESSION* regression /**< regression data structure */
177 );
178
179/** removes an observation (x,y) from the regression */
180SCIP_EXPORT
182 SCIP_REGRESSION* regression, /**< regression data structure */
183 SCIP_Real x, /**< X of observation */
184 SCIP_Real y /**< Y of the observation */
185 );
186
187/** update regression by a new observation (x,y) */
188SCIP_EXPORT
190 SCIP_REGRESSION* regression, /**< regression data structure */
191 SCIP_Real x, /**< X of observation */
192 SCIP_Real y /**< Y of the observation */
193 );
194
195/** reset regression data structure */
196SCIP_EXPORT
198 SCIP_REGRESSION* regression /**< regression data structure */
199 );
200
201/** creates and resets a regression */
202SCIP_EXPORT
204 SCIP_REGRESSION** regression /**< regression data structure */
205 );
206
207/** frees a regression */
208SCIP_EXPORT
210 SCIP_REGRESSION** regression /**< regression data structure */
211 );
212
213/**@} */
214
215/*
216 */
217
218/**@defgroup GMLgraph GML Graphical Printing
219 * @ingroup MiscellaneousMethods
220 * @brief GML graph printing methods
221 *
222 * For a detailed format decription see http://docs.yworks.com/yfiles/doc/developers-guide/gml.html
223 *
224 * @{
225 */
226
227
228/** writes a node section to the given graph file */
229SCIP_EXPORT
231 FILE* file, /**< file to write to */
232 unsigned int id, /**< id of the node */
233 const char* label, /**< label of the node */
234 const char* nodetype, /**< type of the node, or NULL */
235 const char* fillcolor, /**< color of the node's interior, or NULL */
236 const char* bordercolor /**< color of the node's border, or NULL */
237 );
238
239/** writes a node section including weight to the given graph file */
240SCIP_EXPORT
242 FILE* file, /**< file to write to */
243 unsigned int id, /**< id of the node */
244 const char* label, /**< label of the node */
245 const char* nodetype, /**< type of the node, or NULL */
246 const char* fillcolor, /**< color of the node's interior, or NULL */
247 const char* bordercolor, /**< color of the node's border, or NULL */
248 SCIP_Real weight /**< weight of node */
249 );
250
251/** writes an edge section to the given graph file */
252SCIP_EXPORT
254 FILE* file, /**< file to write to */
255 unsigned int source, /**< source node id of the node */
256 unsigned int target, /**< target node id of the edge */
257 const char* label, /**< label of the edge, or NULL */
258 const char* color /**< color of the edge, or NULL */
259 );
260
261/** writes an arc section to the given graph file */
262SCIP_EXPORT
263void SCIPgmlWriteArc(
264 FILE* file, /**< file to write to */
265 unsigned int source, /**< source node id of the node */
266 unsigned int target, /**< target node id of the edge */
267 const char* label, /**< label of the edge, or NULL */
268 const char* color /**< color of the edge, or NULL */
269 );
270
271/** writes the starting line to a GML graph file, does not open a file */
272SCIP_EXPORT
274 FILE* file, /**< file to write to */
275 SCIP_Bool directed /**< is the graph directed */
276 );
277
278/** writes the ending lines to a GML graph file, does not close a file */
279SCIP_EXPORT
281 FILE* file /**< file to close */
282 );
283
284/** writes the opening line to a dot graph file, does not open a file */
285SCIP_EXPORT
287 FILE* file /**< file to write to */
288);
289
290/** adds a node to the dot graph */
291SCIP_EXPORT
293 FILE* file, /**< file to write to */
294 int node, /**< node id */
295 const char* label, /**< node label */
296 const char* nodetype, /**< type of the node, or NULL */
297 const char* fillcolor, /**< color of the node's interior, or NULL */
298 const char* bordercolor /**< color of the node's border, or NULL */
299);
300
301/** adds an arc (edge) between two nodes in the dot graph */
302SCIP_EXPORT
303void SCIPdotWriteArc(
304 FILE* file, /**< file to write to */
305 int source, /**< source node id of the node */
306 int target, /**< target node id of the edge */
307 const char* color /**< color of the edge, or NULL */
308);
309
310/** writes the closing line to a dot graph file, does not close a file */
311SCIP_EXPORT
313 FILE* file /**< file to write to */
314);
315
316/**@} */
317
318/*
319 * Sparse solution
320 */
321
322/**@defgroup SparseSol Sparse Solution
323 * @ingroup DataStructures
324 * @brief sparse storage for multiple integer solutions
325 *
326 * @{
327 */
328
329/** creates a sparse solution */
330SCIP_EXPORT
332 SCIP_SPARSESOL** sparsesol, /**< pointer to store the created sparse solution */
333 SCIP_VAR** vars, /**< variables in the sparse solution, must not contain continuous variables */
334 int nvars, /**< number of variables to store, size of the lower and upper bound arrays */
335 SCIP_Bool cleared /**< should the lower and upper bound arrays be cleared (entries set to 0) */
336 );
337
338/** frees sparse solution */
339SCIP_EXPORT
341 SCIP_SPARSESOL** sparsesol /**< pointer to a sparse solution */
342 );
343
344/** returns the variables in the given sparse solution */
345SCIP_EXPORT
347 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
348 );
349
350/** returns the number of variables in the given sparse solution */
351SCIP_EXPORT
353 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
354 );
355
356/** returns the the lower bound array for all variables for a given sparse solution */
357SCIP_EXPORT
359 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
360 );
361
362/** returns the the upper bound array for all variables for a given sparse solution */
363SCIP_EXPORT
365 SCIP_SPARSESOL* sparsesol /**< a sparse solution */
366 );
367
368/** constructs the first solution of sparse solution (all variables are set to their lower bound value */
369SCIP_EXPORT
371 SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
372 SCIP_Longint* sol, /**< array to store the first solution */
373 int nvars /**< number of variables */
374 );
375
376/** constructs the next solution of the sparse solution and return whether there was one more or not */
377SCIP_EXPORT
379 SCIP_SPARSESOL* sparsesol, /**< sparse solutions */
380 SCIP_Longint* sol, /**< current solution array which get changed to the next solution */
381 int nvars /**< number of variables */
382 );
383
384/**@} */
385
386
387/*
388 * Queue
389 */
390
391/**@defgroup Queue Queue
392 * @ingroup DataStructures
393 * @brief circular FIFO queue
394 *
395 * @{
396 */
397
398
399/** creates a (circular) queue, best used if the size will be fixed or will not be increased that much */
400SCIP_EXPORT
402 SCIP_QUEUE** queue, /**< pointer to the new queue */
403 int initsize, /**< initial number of available element slots */
404 SCIP_Real sizefac /**< memory growing factor applied, if more element slots are needed */
405 );
406
407
408/** frees queue, but not the data elements themselves */
409SCIP_EXPORT
410void SCIPqueueFree(
411 SCIP_QUEUE** queue /**< pointer to a queue */
412 );
413
414/** clears the queue, but doesn't free the data elements themselves */
415SCIP_EXPORT
416void SCIPqueueClear(
417 SCIP_QUEUE* queue /**< queue */
418 );
419
420/** inserts pointer element at the end of the queue */
421SCIP_EXPORT
423 SCIP_QUEUE* queue, /**< queue */
424 void* elem /**< element to be inserted */
425 );
426
427/** inserts unsigned integer element at the end of the queue */
428SCIP_EXPORT
430 SCIP_QUEUE* queue, /**< queue */
431 unsigned int elem /**< element to be inserted */
432 );
433
434/** removes and returns the first element of the queue, or NULL if no element exists */
435SCIP_EXPORT
436void* SCIPqueueRemove(
437 SCIP_QUEUE* queue /**< queue */
438 );
439
440/** removes and returns the first unsigned integer element of the queue, or UNIT_MAX if no element exists */
441SCIP_EXPORT
442unsigned int SCIPqueueRemoveUInt(
443 SCIP_QUEUE* queue /**< queue */
444 );
445
446/** returns the first element of the queue without removing it, or NULL if no element exists */
447SCIP_EXPORT
448void* SCIPqueueFirst(
449 SCIP_QUEUE* queue /**< queue */
450 );
451
452/** returns the first unsigned integer element of the queue without removing it, or UINT_MAX if no element exists */
453SCIP_EXPORT
454unsigned int SCIPqueueFirstUInt(
455 SCIP_QUEUE* queue /**< queue */
456 );
457
458/** returns whether the queue is empty */
459SCIP_EXPORT
461 SCIP_QUEUE* queue /**< queue */
462 );
463
464/** returns the number of elements in the queue */
465SCIP_EXPORT
467 SCIP_QUEUE* queue /**< queue */
468 );
469
470/**@} */
471
472/*
473 * Priority Queue
474 */
475
476/**@defgroup PriorityQueue Priority Queue
477 * @ingroup DataStructures
478 * @brief priority queue with O(1) access to the minimum element
479 *
480 * @{
481 */
482
483/** creates priority queue */
484SCIP_EXPORT
486 SCIP_PQUEUE** pqueue, /**< pointer to a priority queue */
487 int initsize, /**< initial number of available element slots */
488 SCIP_Real sizefac, /**< memory growing factor applied, if more element slots are needed */
489 SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
490 SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)) /**< callback to act on position change of elem in priority queue, or NULL */
491 );
492
493/** frees priority queue, but not the data elements themselves */
494SCIP_EXPORT
495void SCIPpqueueFree(
496 SCIP_PQUEUE** pqueue /**< pointer to a priority queue */
497 );
498
499/** clears the priority queue, but doesn't free the data elements themselves */
500SCIP_EXPORT
501void SCIPpqueueClear(
502 SCIP_PQUEUE* pqueue /**< priority queue */
503 );
504
505/** inserts element into priority queue */
506SCIP_EXPORT
508 SCIP_PQUEUE* pqueue, /**< priority queue */
509 void* elem /**< element to be inserted */
510 );
511
512/** delete element at specified position, maintaining the heap property */
513SCIP_EXPORT
515 SCIP_PQUEUE* pqueue, /**< priority queue */
516 int pos /**< position of element that should be deleted */
517 );
518
519/** removes and returns best element from the priority queue */
520SCIP_EXPORT
521void* SCIPpqueueRemove(
522 SCIP_PQUEUE* pqueue /**< priority queue */
523 );
524
525/** returns the best element of the queue without removing it */
526SCIP_EXPORT
527void* SCIPpqueueFirst(
528 SCIP_PQUEUE* pqueue /**< priority queue */
529 );
530
531/** returns the number of elements in the queue */
532SCIP_EXPORT
534 SCIP_PQUEUE* pqueue /**< priority queue */
535 );
536
537/** returns the elements of the queue; changing the returned array may destroy the queue's ordering! */
538SCIP_EXPORT
539void** SCIPpqueueElems(
540 SCIP_PQUEUE* pqueue /**< priority queue */
541 );
542
543/** return the position of @p elem in the priority queue, or -1 if element is not found */
544SCIP_EXPORT
546 SCIP_PQUEUE* pqueue, /**< priority queue */
547 void* elem /**< element to be inserted */
548 );
549
550/**@} */
551
552
553/*
554 * Hash Table
555 */
556
557/**@defgroup HashTable Hash Table
558 * @ingroup DataStructures
559 * @brief hash table that resolves conflicts by probing
560 *
561 *@{
562 */
563
564/* fast 2-universal hash functions for two to seven 32bit elements with 32bit output */
565
566#define SCIPhashSignature64(a) (UINT64_C(0x8000000000000000)>>((UINT32_C(0x9e3779b9) * ((uint32_t)(a)))>>26))
567
568#define SCIPhashTwo(a, b) ((uint32_t)((((uint32_t)(a) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) )>>32))
569
570#define SCIPhashThree(a, b, c) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
571 (uint32_t)(c) * 0xd37e9a1ce2148403ULL)>>32 ))
572
573#define SCIPhashFour(a, b, c, d) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
574 ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL))>>32 ))
575
576#define SCIPhashFive(a, b, c, d, e) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
577 ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
578 (uint32_t)(e) * 0xf48d4cd331e14327ULL)>>32 ))
579
580#define SCIPhashSix(a, b, c, d, e, f) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
581 ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
582 ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL))>>32 ))
583
584#define SCIPhashSeven(a, b, c, d, e, f, g) ((uint32_t)((((uint32_t)(a) + 0xbd5c89185f082658ULL) * ((uint32_t)(b) + 0xe5fcc163aef32782ULL) + \
585 ((uint32_t)(c) + 0xd37e9a1ce2148403ULL) * ((uint32_t)(d) + 0x926f2d4dc4a67218ULL) + \
586 ((uint32_t)(e) + 0xf48d4cd331e14327ULL) * ((uint32_t)(f) + 0x80791a4edfc44c75ULL) + \
587 (uint32_t)(g) * 0x7f497d9ba3bd83c0ULL)>>32 ))
588
589/** computes a hashcode for double precision floating point values containing
590 * 15 significant bits, the sign and the exponent
591 */
592INLINE static
593uint32_t SCIPrealHashCode(double x)
594{
595 uint16_t mantissa;
596 int thenum;
597 int theexp;
598
599 /* hashing infinite or nan values is not supported */
600 assert(SCIPisFinite(x));
601
602 /* get 16 digits of absolute mantissa */
603 mantissa = (uint16_t)ldexp(frexp(ABS(x), &theexp), 16) + 1;
604
605 /* pave sign bit with overflow */
606 if( mantissa == 0 ) /* cppcheck-suppress knownConditionTrueFalse */
607 {
608 /* divide overflow 2^16 by four */
609 mantissa = 1 << 14;
610
611 /* increment the exponent */
612 ++theexp;
613 }
614 /* pave sign bit without overflow */
615 else
616 /* divide mantissa by two */
617 mantissa >>= 1;
618
619 /* determine mantissa hash */
620 thenum = x < 0.0 ? -(int)mantissa : (int)mantissa;
621
622 return (((uint32_t)(uint16_t)theexp) << 16) | ((uint32_t)(uint16_t)thenum);
623}
624
625/** creates a hash table */
626SCIP_EXPORT
628 SCIP_HASHTABLE** hashtable, /**< pointer to store the created hash table */
629 BMS_BLKMEM* blkmem, /**< block memory used to store hash table entries */
630 int tablesize, /**< size of the hash table */
631 SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
632 SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
633 SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
634 void* userptr /**< user pointer */
635 );
636
637/** frees the hash table */
638SCIP_EXPORT
640 SCIP_HASHTABLE** hashtable /**< pointer to the hash table */
641 );
642
643/** inserts element in hash table (multiple inserts of same element override the previous entry) */
644SCIP_EXPORT
646 SCIP_HASHTABLE* hashtable, /**< hash table */
647 void* element /**< element to insert into the table */
648 );
649
650/** inserts element in hash table (multiple insertion of same element is checked and results in an error) */
651SCIP_EXPORT
653 SCIP_HASHTABLE* hashtable, /**< hash table */
654 void* element /**< element to insert into the table */
655 );
656
657/** retrieve element with key from hash table, returns NULL if not existing */
658SCIP_EXPORT
660 SCIP_HASHTABLE* hashtable, /**< hash table */
661 void* key /**< key to retrieve */
662 );
663
664/** returns whether the given element exists in the table */
665SCIP_EXPORT
667 SCIP_HASHTABLE* hashtable, /**< hash table */
668 void* element /**< element to search in the table */
669 );
670
671/** removes element from the hash table, if it exists */
672SCIP_EXPORT
674 SCIP_HASHTABLE* hashtable, /**< hash table */
675 void* element /**< element to remove from the table */
676 );
677
678/** removes all elements of the hash table */
679SCIP_EXPORT
681 SCIP_HASHTABLE* hashtable /**< hash table */
682 );
683
684/** returns number of hash table elements */
685SCIP_EXPORT
687 SCIP_HASHTABLE* hashtable /**< hash table */
688 );
689
690/** gives the number of entries in the internal arrays of a hash table */
691SCIP_EXPORT
693 SCIP_HASHTABLE* hashtable /**< hash table */
694 );
695
696/** gives the element at the given index or NULL if entry at that index has no element */
697SCIP_EXPORT
699 SCIP_HASHTABLE* hashtable, /**< hash table */
700 int entryidx /**< index of hash table entry */
701 );
702
703/** returns the load of the given hash table in percentage */
704SCIP_EXPORT
706 SCIP_HASHTABLE* hashtable /**< hash table */
707 );
708
709/** prints statistics about hash table usage */
710SCIP_EXPORT
712 SCIP_HASHTABLE* hashtable, /**< hash table */
713 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
714 );
715
716/**@} */
717
718/*
719 * MultiHash Table
720 */
721
722/**@defgroup MultiHash Multi Hash table
723 * @ingroup DataStructures
724 * @brief hash table that resolves conflicts by queueing, thereby allowing for duplicate entries
725 *
726 *@{
727 */
728
729/** returns a reasonable hash table size (a prime number) that is at least as large as the specified value */
730SCIP_EXPORT
732 int minsize /**< minimal size of the hash table */
733 );
734
735/** creates a multihash table */
736SCIP_EXPORT
738 SCIP_MULTIHASH** multihash, /**< pointer to store the created multihash table */
739 BMS_BLKMEM* blkmem, /**< block memory used to store multihash table entries */
740 int tablesize, /**< size of the hash table */
741 SCIP_DECL_HASHGETKEY((*hashgetkey)), /**< gets the key of the given element */
742 SCIP_DECL_HASHKEYEQ ((*hashkeyeq)), /**< returns TRUE iff both keys are equal */
743 SCIP_DECL_HASHKEYVAL((*hashkeyval)), /**< returns the hash value of the key */
744 void* userptr /**< user pointer */
745 );
746
747/** frees the multihash table */
748SCIP_EXPORT
750 SCIP_MULTIHASH** multihash /**< pointer to the multihash table */
751 );
752
753/** inserts element in multihash table (multiple inserts of same element possible)
754 *
755 * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding an element
756 * to the hash table, due to dynamic resizing.
757 */
758SCIP_EXPORT
760 SCIP_MULTIHASH* multihash, /**< multihash table */
761 void* element /**< element to insert into the table */
762 );
763
764/** inserts element in multihash table (multiple insertion of same element is checked and results in an error)
765 *
766 * @note A pointer to a multihashlist returned by SCIPmultihashRetrieveNext() might get invalid when adding a new
767 * element to the multihash table, due to dynamic resizing.
768 */
769SCIP_EXPORT
771 SCIP_MULTIHASH* multihash, /**< multihash table */
772 void* element /**< element to insert into the table */
773 );
774
775/** retrieve element with key from multihash table, returns NULL if not existing */
776SCIP_EXPORT
778 SCIP_MULTIHASH* multihash, /**< multihash table */
779 void* key /**< key to retrieve */
780 );
781
782/** retrieve element with key from multihash table, returns NULL if not existing
783 * can be used to retrieve all entries with the same key (one-by-one)
784 *
785 * @note The returned multimultihashlist pointer might get invalid when adding a new element to the multihash table.
786 */
787SCIP_EXPORT
789 SCIP_MULTIHASH* multihash, /**< multihash table */
790 SCIP_MULTIHASHLIST** multihashlist, /**< input: entry in hash table list from which to start searching, or NULL
791 * output: entry in hash table list corresponding to element after
792 * retrieved one, or NULL */
793 void* key /**< key to retrieve */
794 );
795
796/** returns whether the given element exists in the multihash table */
797SCIP_EXPORT
799 SCIP_MULTIHASH* multihash, /**< multihash table */
800 void* element /**< element to search in the table */
801 );
802
803/** removes element from the multihash table, if it exists */
804SCIP_EXPORT
806 SCIP_MULTIHASH* multihash, /**< multihash table */
807 void* element /**< element to remove from the table */
808 );
809
810/** removes all elements of the multihash table
811 *
812 * @note From a performance point of view you should not fill and clear a hash table too often since the clearing can
813 * be expensive. Clearing is done by looping over all buckets and removing the hash table lists one-by-one.
814 */
815SCIP_EXPORT
817 SCIP_MULTIHASH* multihash /**< multihash table */
818 );
819
820/** returns number of multihash table elements */
821SCIP_EXPORT
823 SCIP_MULTIHASH* multihash /**< multihash table */
824 );
825
826/** returns the load of the given multihash table in percentage */
827SCIP_EXPORT
829 SCIP_MULTIHASH* multihash /**< multihash table */
830 );
831
832/** prints statistics about multihash table usage */
833SCIP_EXPORT
835 SCIP_MULTIHASH* multihash, /**< multihash table */
836 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
837 );
838
839/** standard hash key comparator for string keys */
840SCIP_EXPORT
841SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString);
842
843/** standard hashing function for string keys */
844SCIP_EXPORT
845SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString);
846
847/** gets the element as the key */
848SCIP_EXPORT
849SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard);
850
851/** returns TRUE iff both keys(pointer) are equal */
852SCIP_EXPORT
853SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqPtr);
854
855/** returns the hash value of the key */
856SCIP_EXPORT
857SCIP_DECL_HASHKEYVAL(SCIPhashKeyValPtr);
858
859/**@} */
860
861
862/*
863 * Hash Map
864 */
865
866/**@defgroup HashMap Hash Map
867 * @ingroup DataStructures
868 * @brief hash map to store key-value pairs (called \p origin and \p image)
869 *
870 * @{
871 */
872
873/** creates a hash map mapping pointers to pointers */
874SCIP_EXPORT
876 SCIP_HASHMAP** hashmap, /**< pointer to store the created hash map */
877 BMS_BLKMEM* blkmem, /**< block memory used to store hash map entries */
878 int mapsize /**< size of the hash map */
879 );
880
881/** frees the hash map */
882SCIP_EXPORT
883void SCIPhashmapFree(
884 SCIP_HASHMAP** hashmap /**< pointer to the hash map */
885 );
886
887/** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
888SCIP_EXPORT
890 SCIP_HASHMAP* hashmap, /**< hash map */
891 void* origin, /**< origin to set image for */
892 void* image /**< new image for origin */
893 );
894
895/** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
896SCIP_EXPORT
898 SCIP_HASHMAP* hashmap, /**< hash map */
899 void* origin, /**< origin to set image for */
900 SCIP_Longint image /**< new image for origin */
901 );
902
903/** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
904SCIP_EXPORT
906 SCIP_HASHMAP* hashmap, /**< hash map */
907 void* origin, /**< origin to set image for */
908 int image /**< new image for origin */
909 );
910
911/** inserts new origin->image pair in hash map (must not be called for already existing origins!) */
912SCIP_EXPORT
914 SCIP_HASHMAP* hashmap, /**< hash map */
915 void* origin, /**< origin to set image for */
916 SCIP_Real image /**< new image for origin */
917 );
918
919/** retrieves image of given origin from the hash map, or NULL if no image exists */
920SCIP_EXPORT
922 SCIP_HASHMAP* hashmap, /**< hash map */
923 void* origin /**< origin to retrieve image for */
924 );
925
926/** retrieves image of given origin from the hash map, or INT_MAX if no image exists */
927SCIP_EXPORT
929 SCIP_HASHMAP* hashmap, /**< hash map */
930 void* origin /**< origin to retrieve image for */
931 );
932
933/** retrieves image of given origin from the hash map, or SCIP_LONGINT_MAX if no image exists */
934SCIP_EXPORT
936 SCIP_HASHMAP* hashmap, /**< hash map */
937 void* origin /**< origin to retrieve image for */
938 );
939
940/** retrieves image of given origin from the hash map, or SCIP_INVALID if no image exists */
941SCIP_EXPORT
943 SCIP_HASHMAP* hashmap, /**< hash map */
944 void* origin /**< origin to retrieve image for */
945 );
946
947/** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
948 * new origin->image pair
949 */
950SCIP_EXPORT
952 SCIP_HASHMAP* hashmap, /**< hash map */
953 void* origin, /**< origin to set image for */
954 void* image /**< new image for origin */
955 );
956
957/** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
958 * new origin->image pair
959 */
960SCIP_EXPORT
962 SCIP_HASHMAP* hashmap, /**< hash map */
963 void* origin, /**< origin to set image for */
964 int image /**< new image for origin */
965 );
966
967/** sets image for given origin in the hash map, either by modifying existing origin->image pair or by appending a
968 * new origin->image pair
969 */
970SCIP_EXPORT
972 SCIP_HASHMAP* hashmap, /**< hash map */
973 void* origin, /**< origin to set image for */
974 SCIP_Real image /**< new image for origin */
975 );
976
977/** checks whether an image to the given origin exists in the hash map */
978SCIP_EXPORT
980 SCIP_HASHMAP* hashmap, /**< hash map */
981 void* origin /**< origin to search for */
982 );
983
984/** removes origin->image pair from the hash map, if it exists */
985SCIP_EXPORT
987 SCIP_HASHMAP* hashmap, /**< hash map */
988 void* origin /**< origin to remove from the list */
989 );
990
991/** prints statistics about hash map usage */
992SCIP_EXPORT
994 SCIP_HASHMAP* hashmap, /**< hash map */
995 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
996 );
997
998/** indicates whether a hash map has no entries */
999SCIP_EXPORT
1001 SCIP_HASHMAP* hashmap /**< hash map */
1002 );
1003
1004/** gives the number of elements in a hash map */
1005SCIP_EXPORT
1007 SCIP_HASHMAP* hashmap /**< hash map */
1008 );
1009
1010/** gives the number of entries in the internal arrays of a hash map */
1011SCIP_EXPORT
1013 SCIP_HASHMAP* hashmap /**< hash map */
1014 );
1015
1016/** gives the hashmap entry at the given index or NULL if entry has no element */
1017SCIP_EXPORT
1019 SCIP_HASHMAP* hashmap, /**< hash map */
1020 int entryidx /**< index of hash map entry */
1021 );
1022
1023/** gives the origin of the hashmap entry */
1024SCIP_EXPORT
1026 SCIP_HASHMAPENTRY* entry /**< hash map entry */
1027 );
1028
1029/** gives the image of the hashmap entry */
1030SCIP_EXPORT
1032 SCIP_HASHMAPENTRY* entry /**< hash map entry */
1033 );
1034
1035/** gives the image of the hashmap entry */
1036SCIP_EXPORT
1038 SCIP_HASHMAPENTRY* entry /**< hash map entry */
1039 );
1040
1041/** gives the image of the hashmap entry */
1042SCIP_EXPORT
1044 SCIP_HASHMAPENTRY* entry /**< hash map entry */
1045 );
1046
1047/** sets pointer image of a hashmap entry */
1048SCIP_EXPORT
1050 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
1051 void* image /**< new image */
1052 );
1053
1054/** sets integer image of a hashmap entry */
1055SCIP_EXPORT
1057 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
1058 int image /**< new image */
1059 );
1060
1061/** sets real image of a hashmap entry */
1062SCIP_EXPORT
1064 SCIP_HASHMAPENTRY* entry, /**< hash map entry */
1065 SCIP_Real image /**< new image */
1066 );
1067
1068/** removes all entries in a hash map. */
1069SCIP_EXPORT
1071 SCIP_HASHMAP* hashmap /**< hash map */
1072 );
1073
1074/**@} */
1075
1076
1077/*
1078 * Hash Set
1079 */
1080
1081/**@defgroup HashSet Hash Set
1082 * @ingroup DataStructures
1083 * @brief very lightweight hash set of pointers
1084 *
1085 * @{
1086 */
1087
1088/** creates a hash set of pointers */
1089SCIP_EXPORT
1091 SCIP_HASHSET** hashset, /**< pointer to store the created hash set */
1092 BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1093 int size /**< initial size of the hash set; it is guaranteed that the set is not
1094 * resized if at most that many elements are inserted */
1095 );
1096
1097/** frees the hash set */
1098SCIP_EXPORT
1099void SCIPhashsetFree(
1100 SCIP_HASHSET** hashset, /**< pointer to the hash set */
1101 BMS_BLKMEM* blkmem /**< block memory used to store hash set entries */
1102 );
1103
1104/** inserts new element into the hash set */
1105SCIP_EXPORT
1107 SCIP_HASHSET* hashset, /**< hash set */
1108 BMS_BLKMEM* blkmem, /**< block memory used to store hash set entries */
1109 void* element /**< element to insert */
1110 );
1111
1112/** checks whether an element exists in the hash set */
1113SCIP_EXPORT
1115 SCIP_HASHSET* hashset, /**< hash set */
1116 void* element /**< element to search for */
1117 );
1118
1119/** removes an element from the hash set, if it exists */
1120SCIP_EXPORT
1122 SCIP_HASHSET* hashset, /**< hash set */
1123 void* element /**< origin to remove from the list */
1124 );
1125
1126/** prints statistics about hash set usage */
1127SCIP_EXPORT
1129 SCIP_HASHSET* hashset, /**< hash set */
1130 SCIP_MESSAGEHDLR* messagehdlr /**< message handler */
1131 );
1132
1133/** indicates whether a hash set has no entries */
1134SCIP_EXPORT
1136 SCIP_HASHSET* hashset /**< hash set */
1137 );
1138
1139/** gives the number of elements in a hash set */
1140SCIP_EXPORT
1142 SCIP_HASHSET* hashset /**< hash set */
1143 );
1144
1145/** gives the number of slots of a hash set */
1146SCIP_EXPORT
1148 SCIP_HASHSET* hashset /**< hash set */
1149 );
1150
1151/** gives the array of hash set slots; contains all elements in indetermined order and may contain NULL values */
1152SCIP_EXPORT
1153void** SCIPhashsetGetSlots(
1154 SCIP_HASHSET* hashset /**< hash set */
1155 );
1156
1157/** removes all entries in a hash set. */
1158SCIP_EXPORT
1160 SCIP_HASHSET* hashset /**< hash set */
1161 );
1162
1163#ifdef NDEBUG
1164
1165/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1166 * speed up the algorithms.
1167 */
1168
1169#define SCIPhashsetIsEmpty(hashset) ((hashset)->nelements == 0)
1170#define SCIPhashsetGetNElements(hashset) ((hashset)->nelements)
1171#define SCIPhashsetGetNSlots(hashset) (1u << (64 - (hashset)->shift))
1172#define SCIPhashsetGetSlots(hashset) ((hashset)->slots)
1173
1174#endif
1175
1176/**@} */
1177
1178
1179/*
1180 * Activity
1181 */
1182
1183/**@defgroup ResourceActivity Resource Activity
1184 * @ingroup DataStructures
1185 * @brief ressource activity data structure
1186 *
1187 * @{
1188 */
1189
1190/** create a resource activity */
1191SCIP_EXPORT
1193 SCIP_RESOURCEACTIVITY** activity, /**< pointer to store the resource activity */
1194 SCIP_VAR* var, /**< start time variable of the activity */
1195 int duration, /**< duration of the activity */
1196 int demand /**< demand of the activity */
1197 );
1198
1199/** frees a resource activity */
1200SCIP_EXPORT
1201void SCIPactivityFree(
1202 SCIP_RESOURCEACTIVITY** activity /**< pointer to the resource activity */
1203 );
1204
1205#ifndef NDEBUG
1206
1207/** returns the start time variable of the resource activity */
1208SCIP_EXPORT
1210 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1211 );
1212
1213/** returns the duration of the resource activity */
1214SCIP_EXPORT
1216 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1217 );
1218
1219/** returns the demand of the resource activity */
1220SCIP_EXPORT
1222 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1223 );
1224
1225/** returns the energy of the resource activity */
1226SCIP_EXPORT
1228 SCIP_RESOURCEACTIVITY* activity /**< resource activity */
1229 );
1230
1231#else
1232
1233#define SCIPactivityGetVar(activity) ((activity)->var)
1234#define SCIPactivityGetDuration(activity) ((activity)->duration)
1235#define SCIPactivityGetDemand(activity) ((activity)->demand)
1236#define SCIPactivityGetEnergy(activity) ((activity)->duration * (activity)->demand)
1237
1238#endif
1239
1240/**@} */
1241
1242
1243/*
1244 * Resource Profile
1245 */
1246
1247/**@defgroup ResourceProfile Resource Profile
1248 * @ingroup DataStructures
1249 * @brief ressource profile data structure
1250 *
1251 * @{
1252 */
1253
1254/** creates resource profile */
1255SCIP_EXPORT
1257 SCIP_PROFILE** profile, /**< pointer to store the resource profile */
1258 int capacity /**< resource capacity */
1259 );
1260
1261/** frees given resource profile */
1262SCIP_EXPORT
1263void SCIPprofileFree(
1264 SCIP_PROFILE** profile /**< pointer to the resource profile */
1265 );
1266
1267/** output of the given resource profile */
1268SCIP_EXPORT
1269void SCIPprofilePrint(
1270 SCIP_PROFILE* profile, /**< resource profile to output */
1271 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1272 FILE* file /**< output file (or NULL for standard output) */
1273 );
1274
1275/** returns the capacity of the resource profile */
1276SCIP_EXPORT
1278 SCIP_PROFILE* profile /**< resource profile to use */
1279 );
1280
1281/** returns the number time points of the resource profile */
1282SCIP_EXPORT
1284 SCIP_PROFILE* profile /**< resource profile to use */
1285 );
1286
1287/** returns the time points of the resource profile */
1288SCIP_EXPORT
1290 SCIP_PROFILE* profile /**< resource profile to use */
1291 );
1292
1293/** returns the loads of the resource profile */
1294SCIP_EXPORT
1296 SCIP_PROFILE* profile /**< resource profile to use */
1297 );
1298
1299/** returns the time point for given position of the resource profile */
1300SCIP_EXPORT
1302 SCIP_PROFILE* profile, /**< resource profile to use */
1303 int pos /**< position */
1304 );
1305
1306/** returns the loads of the resource profile at the given position */
1307SCIP_EXPORT
1309 SCIP_PROFILE* profile, /**< resource profile */
1310 int pos /**< position */
1311 );
1312
1313/** returns if the given time point exists in the resource profile and stores the position of the given time point if it
1314 * exists; otherwise the position of the next smaller existing time point is stored
1315 */
1316SCIP_EXPORT
1318 SCIP_PROFILE* profile, /**< resource profile to search */
1319 int timepoint, /**< time point to search for */
1320 int* pos /**< pointer to store the position */
1321 );
1322
1323/** insert a core into resource profile; if the core is non-empty the resource profile will be updated otherwise nothing
1324 * happens
1325 */
1326SCIP_EXPORT
1328 SCIP_PROFILE* profile, /**< resource profile to use */
1329 int left, /**< left side of the core */
1330 int right, /**< right side of the core */
1331 int demand, /**< demand of the core */
1332 int* pos, /**< pointer to store the first position were it gets infeasible */
1333 SCIP_Bool* infeasible /**< pointer to store if the core does not fit due to capacity */
1334 );
1335
1336/** subtracts the height from the resource profile during core time */
1337SCIP_EXPORT
1339 SCIP_PROFILE* profile, /**< resource profile to use */
1340 int left, /**< left side of the core */
1341 int right, /**< right side of the core */
1342 int demand /**< demand of the core */
1343 );
1344
1345/** return the earliest possible starting point within the time interval [lb,ub] for a given core (given by its height
1346 * and duration)
1347 */
1348SCIP_EXPORT
1350 SCIP_PROFILE* profile, /**< resource profile to use */
1351 int est, /**< earliest starting time of the given core */
1352 int lst, /**< latest starting time of the given core */
1353 int duration, /**< duration of the core */
1354 int demand, /**< demand of the core */
1355 SCIP_Bool* infeasible /**< pointer store if the corer cannot be inserted */
1356 );
1357
1358/** return the latest possible starting point within the time interval [lb,ub] for a given core (given by its height and
1359 * duration)
1360 */
1361SCIP_EXPORT
1363 SCIP_PROFILE* profile, /**< resource profile to use */
1364 int est, /**< earliest possible start point */
1365 int lst, /**< latest possible start point */
1366 int duration, /**< duration of the core */
1367 int demand, /**< demand of the core */
1368 SCIP_Bool* infeasible /**< pointer store if the core cannot be inserted */
1369 );
1370
1371/**@} */
1372
1373/*
1374 * Directed graph
1375 */
1376
1377/**@addtogroup DirectedGraph
1378 *
1379 * @{
1380 */
1381
1382/** resize directed graph structure */
1383SCIP_EXPORT
1385 SCIP_DIGRAPH* digraph, /**< directed graph */
1386 int nnodes /**< new number of nodes */
1387 );
1388
1389/** sets the sizes of the successor lists for the nodes in a directed graph and allocates memory for the lists */
1390SCIP_EXPORT
1392 SCIP_DIGRAPH* digraph, /**< directed graph */
1393 int* sizes /**< sizes of the successor lists */
1394 );
1395
1396/** frees given directed graph structure */
1397SCIP_EXPORT
1398void SCIPdigraphFree(
1399 SCIP_DIGRAPH** digraph /**< pointer to the directed graph */
1400 );
1401
1402/** add (directed) arc and a related data to the directed graph structure
1403 *
1404 * @note if the arc is already contained, it is added a second time
1405 */
1406SCIP_EXPORT
1408 SCIP_DIGRAPH* digraph, /**< directed graph */
1409 int startnode, /**< start node of the arc */
1410 int endnode, /**< start node of the arc */
1411 void* data /**< data that should be stored for the arc; or NULL */
1412 );
1413
1414/** add (directed) arc to the directed graph structure, if it is not contained, yet
1415 *
1416 * @note if there already exists an arc from startnode to endnode, the new arc is not added,
1417 * even if its data is different
1418 */
1419SCIP_EXPORT
1421 SCIP_DIGRAPH* digraph, /**< directed graph */
1422 int startnode, /**< start node of the arc */
1423 int endnode, /**< start node of the arc */
1424 void* data /**< data that should be stored for the arc; or NULL */
1425 );
1426
1427/** sets the number of successors to a given value */
1428SCIP_EXPORT
1430 SCIP_DIGRAPH* digraph, /**< directed graph */
1431 int node, /**< node for which the number of successors has to be changed */
1432 int nsuccessors /**< new number of successors */
1433 );
1434
1435/** returns the number of nodes of the given digraph */
1436SCIP_EXPORT
1438 SCIP_DIGRAPH* digraph /**< directed graph */
1439 );
1440
1441/** returns the node data, or NULL if no data exist */
1442SCIP_EXPORT
1444 SCIP_DIGRAPH* digraph, /**< directed graph */
1445 int node /**< node for which the node data is returned */
1446 );
1447
1448/** sets the node data */
1449SCIP_EXPORT
1451 SCIP_DIGRAPH* digraph, /**< directed graph */
1452 void* dataptr, /**< user node data pointer, or NULL */
1453 int node /**< node for which the node data is returned */
1454 );
1455
1456/** returns the total number of arcs in the given digraph */
1457SCIP_EXPORT
1459 SCIP_DIGRAPH* digraph /**< directed graph */
1460 );
1461
1462/** returns the number of successor nodes of the given node */
1463SCIP_EXPORT
1465 SCIP_DIGRAPH* digraph, /**< directed graph */
1466 int node /**< node for which the number of outgoing arcs is returned */
1467 );
1468
1469/** returns the array of indices of the successor nodes; this array must not be changed from outside */
1470SCIP_EXPORT
1472 SCIP_DIGRAPH* digraph, /**< directed graph */
1473 int node /**< node for which the array of outgoing arcs is returned */
1474 );
1475
1476/** returns the array of data corresponding to the arcs originating at the given node, or NULL if no data exist; this
1477 * array must not be changed from outside
1478 */
1479SCIP_EXPORT
1481 SCIP_DIGRAPH* digraph, /**< directed graph */
1482 int node /**< node for which the data corresponding to the outgoing arcs is returned */
1483 );
1484
1485/** identifies the articulation points in a given directed graph
1486 * uses the helper recursive function findArticulationPointsUtil
1487 */
1488SCIP_EXPORT
1490 SCIP_DIGRAPH* digraph, /**< directed graph */
1491 int** articulations, /**< array to store the sorted node indices of the computed articulation points, or NULL */
1492 int* narticulations /**< number of the computed articulation points, or NULL */
1493 );
1494
1495/** Compute undirected connected components on the given graph.
1496 *
1497 * @note For each arc, its reverse is added, so the graph does not need to be the directed representation of an
1498 * undirected graph.
1499 */
1500SCIP_EXPORT
1502 SCIP_DIGRAPH* digraph, /**< directed graph */
1503 int minsize, /**< all components with less nodes are ignored */
1504 int* components, /**< array with as many slots as there are nodes in the directed graph
1505 * to store for each node the component to which it belongs
1506 * (components are numbered 0 to ncomponents - 1); or NULL, if components
1507 * are accessed one-by-one using SCIPdigraphGetComponent() */
1508 int* ncomponents /**< pointer to store the number of components; or NULL, if the
1509 * number of components is accessed by SCIPdigraphGetNComponents() */
1510 );
1511
1512/** Computes all strongly connected components of an undirected connected component with Tarjan's Algorithm.
1513 * The resulting strongly connected components are sorted topologically (starting from the end of the
1514 * strongcomponents array).
1515 *
1516 * @note In general a topological sort of the strongly connected components is not unique.
1517 */
1518SCIP_EXPORT
1520 SCIP_DIGRAPH* digraph, /**< directed graph */
1521 int compidx, /**< number of the undirected connected component */
1522 int* strongcomponents, /**< array to store the strongly connected components
1523 * (length >= size of the component) */
1524 int* strongcompstartidx, /**< array to store the start indices of the strongly connected
1525 * components (length >= size of the component) */
1526 int* nstrongcomponents /**< pointer to store the number of strongly connected
1527 * components */
1528 );
1529
1530/** Performes an (almost) topological sort on the undirected components of the given directed graph. The undirected
1531 * components should be computed before using SCIPdigraphComputeUndirectedComponents().
1532 *
1533 * @note In general a topological sort is not unique. Note, that there might be directed cycles, that are randomly
1534 * broken, which is the reason for having only almost topologically sorted arrays.
1535 */
1536SCIP_EXPORT
1538 SCIP_DIGRAPH* digraph /**< directed graph */
1539 );
1540
1541/** returns the number of previously computed undirected components for the given directed graph */
1542SCIP_EXPORT
1544 SCIP_DIGRAPH* digraph /**< directed graph */
1545 );
1546
1547/** Returns the previously computed undirected component of the given number for the given directed graph.
1548 * If the components were sorted using SCIPdigraphTopoSortComponents(), the component is (almost) topologically sorted.
1549 */
1550SCIP_EXPORT
1552 SCIP_DIGRAPH* digraph, /**< directed graph */
1553 int compidx, /**< number of the component to return */
1554 int** nodes, /**< pointer to store the nodes in the component; or NULL, if not needed */
1555 int* nnodes /**< pointer to store the number of nodes in the component;
1556 * or NULL, if not needed */
1557 );
1558
1559/** frees the component information for the given directed graph */
1560SCIP_EXPORT
1562 SCIP_DIGRAPH* digraph /**< directed graph */
1563 );
1564
1565/** output of the given directed graph via the given message handler */
1566SCIP_EXPORT
1567void SCIPdigraphPrint(
1568 SCIP_DIGRAPH* digraph, /**< directed graph */
1569 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1570 FILE* file /**< output file (or NULL for standard output) */
1571 );
1572
1573/** prints the given directed graph structure in GML format into the given file */
1574SCIP_EXPORT
1576 SCIP_DIGRAPH* digraph, /**< directed graph */
1577 FILE* file /**< file to write to */
1578 );
1579
1580
1581/** output of the given directed graph via the given message handler */
1582SCIP_EXPORT
1584 SCIP_DIGRAPH* digraph, /**< directed graph */
1585 SCIP_MESSAGEHDLR* messagehdlr, /**< message handler */
1586 FILE* file /**< output file (or NULL for standard output) */
1587 );
1588
1589/**@} */
1590
1591/*
1592 * Binary search tree
1593 */
1594
1595/**@defgroup BinaryTree Binary Search Tree
1596 * @ingroup DataStructures
1597 * @brief binary search tree data structure
1598 *@{
1599 */
1600
1601/** creates a binary tree node with sorting value and user data */
1602SCIP_EXPORT
1604 SCIP_BT* tree, /**< binary search tree */
1605 SCIP_BTNODE** node, /**< pointer to store the created search node */
1606 void* dataptr /**< user node data pointer, or NULL */
1607 );
1608
1609/** frees the binary node including the rooted subtree
1610 *
1611 * @note The user pointer (object) is not freed. If needed, it has to be done by the user.
1612 */
1613SCIP_EXPORT
1614void SCIPbtnodeFree(
1615 SCIP_BT* tree, /**< binary tree */
1616 SCIP_BTNODE** node /**< node to be freed */
1617 );
1618
1619/** returns the user data pointer stored in that node */
1620SCIP_EXPORT
1621void* SCIPbtnodeGetData(
1622 SCIP_BTNODE* node /**< node */
1623 );
1624
1625/** returns the parent which can be NULL if the given node is the root */
1626SCIP_EXPORT
1628 SCIP_BTNODE* node /**< node */
1629 );
1630
1631/** returns left child which can be NULL if the given node is a leaf */
1632SCIP_EXPORT
1634 SCIP_BTNODE* node /**< node */
1635 );
1636
1637/** returns right child which can be NULL if the given node is a leaf */
1638SCIP_EXPORT
1640 SCIP_BTNODE* node /**< node */
1641 );
1642
1643/** returns the sibling of the node or NULL if does not exist */
1644SCIP_EXPORT
1646 SCIP_BTNODE* node /**< node */
1647 );
1648
1649/** returns whether the node is a root node */
1650SCIP_EXPORT
1652 SCIP_BTNODE* node /**< node */
1653 );
1654
1655/** returns whether the node is a leaf */
1656SCIP_EXPORT
1658 SCIP_BTNODE* node /**< node */
1659 );
1660
1661/** returns TRUE if the given node is left child */
1662SCIP_EXPORT
1664 SCIP_BTNODE* node /**< node */
1665 );
1666
1667/** returns TRUE if the given node is right child */
1668SCIP_EXPORT
1670 SCIP_BTNODE* node /**< node */
1671 );
1672
1673#ifdef NDEBUG
1674
1675/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1676 * speed up the algorithms.
1677 */
1678
1679#define SCIPbtnodeGetData(node) ((node)->dataptr)
1680#define SCIPbtnodeGetParent(node) ((node)->parent)
1681#define SCIPbtnodeGetLeftchild(node) ((node)->left)
1682#define SCIPbtnodeGetRightchild(node) ((node)->right)
1683#define SCIPbtnodeGetSibling(node) ((node)->parent == NULL ? NULL : \
1684 (node)->parent->left == (node) ? (node)->parent->right : (node)->parent->left)
1685#define SCIPbtnodeIsRoot(node) ((node)->parent == NULL)
1686#define SCIPbtnodeIsLeaf(node) ((node)->left == NULL && (node)->right == NULL)
1687#define SCIPbtnodeIsLeftchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->left == (node) ? TRUE : FALSE)
1688#define SCIPbtnodeIsRightchild(node) ((node)->parent == NULL ? FALSE : (node)->parent->right == (node) ? TRUE : FALSE)
1689
1690#endif
1691
1692/** sets the give node data
1693 *
1694 * @note The old user pointer is not freed.
1695 */
1696SCIP_EXPORT
1698 SCIP_BTNODE* node, /**< node */
1699 void* dataptr /**< node user data pointer */
1700 );
1701
1702/** sets parent node
1703 *
1704 * @note The old parent including the rooted subtree is not delete.
1705 */
1706SCIP_EXPORT
1708 SCIP_BTNODE* node, /**< node */
1709 SCIP_BTNODE* parent /**< new parent node, or NULL */
1710 );
1711
1712/** sets left child
1713 *
1714 * @note The old left child including the rooted subtree is not delete.
1715 */
1716SCIP_EXPORT
1718 SCIP_BTNODE* node, /**< node */
1719 SCIP_BTNODE* left /**< new left child, or NULL */
1720 );
1721
1722/** sets right child
1723 *
1724 * @note The old right child including the rooted subtree is not delete.
1725 */
1726SCIP_EXPORT
1728 SCIP_BTNODE* node, /**< node */
1729 SCIP_BTNODE* right /**< new right child, or NULL */
1730 );
1731
1732/** creates an binary tree */
1733SCIP_EXPORT
1735 SCIP_BT** tree, /**< pointer to store the created binary tree */
1736 BMS_BLKMEM* blkmem /**< block memory used to create nodes */
1737 );
1738
1739/** frees binary tree
1740 *
1741 * @note The user pointers (object) of the search nodes are not freed. If needed, it has to be done by the user.
1742 */
1743SCIP_EXPORT
1744void SCIPbtFree(
1745 SCIP_BT** tree /**< pointer to binary tree */
1746 );
1747
1748/** prints the binary tree in GML format into the given file */
1749SCIP_EXPORT
1750void SCIPbtPrintGml(
1751 SCIP_BT* tree, /**< binary tree */
1752 FILE* file /**< file to write to */
1753 );
1754
1755/** returns whether the binary tree is empty (has no nodes) */
1756SCIP_EXPORT
1758 SCIP_BT * tree /**< binary tree */
1759 );
1760
1761/** returns the root node of the binary tree or NULL if the binary tree is empty */
1762SCIP_EXPORT
1764 SCIP_BT* tree /**< tree to be evaluated */
1765 );
1766
1767#ifdef NDEBUG
1768
1769/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1770 * speed up the algorithms.
1771 */
1772
1773#define SCIPbtIsEmpty(tree) (tree->root == NULL)
1774#define SCIPbtGetRoot(tree) (tree->root)
1775
1776#endif
1777
1778/** sets root node
1779 *
1780 * @note The old root including the rooted subtree is not delete.
1781 */
1782SCIP_EXPORT
1783void SCIPbtSetRoot(
1784 SCIP_BT* tree, /**< tree to be evaluated */
1785 SCIP_BTNODE* root /**< new root, or NULL */
1786 );
1787
1788/**@} */
1789
1790/**@addtogroup DisjointSet
1791 *
1792 * @{
1793 */
1794
1795/*
1796 * disjoint set data structure
1797 */
1798
1799/** clears the disjoint set (union find) structure \p djset */
1800SCIP_EXPORT
1802 SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1803 );
1804
1805/** finds and returns the component identifier of this \p element */
1806SCIP_EXPORT
1808 SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1809 int element /**< element to be found */
1810 );
1811
1812/** merges the components containing the elements \p p and \p q */
1813SCIP_EXPORT
1815 SCIP_DISJOINTSET* djset, /**< disjoint set (union find) data structure */
1816 int p, /**< first element */
1817 int q, /**< second element */
1818 SCIP_Bool forcerepofp /**< force representative of p to be new representative */
1819 );
1820
1821/** returns the number of independent components in this disjoint set (union find) data structure */
1822SCIP_EXPORT
1824 SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1825 );
1826
1827/** returns the size (number of nodes) of this disjoint set (union find) data structure */
1828SCIP_EXPORT
1830 SCIP_DISJOINTSET* djset /**< disjoint set (union find) data structure */
1831 );
1832
1833/** @} */
1834
1835/*
1836 * Numerical methods
1837 */
1838
1839/**@defgroup NumericalMethods Numerical Methods
1840 * @ingroup MiscellaneousMethods
1841 * @brief commonly used numerical methods
1842 *
1843 * @{
1844 */
1845
1846/** returns the machine epsilon: the smallest number eps > 0, for which 1.0 + eps > 1.0 */
1847SCIP_EXPORT
1849 void
1850 );
1851
1852/** returns the next representable value of from in the direction of to */
1853SCIP_EXPORT
1855 SCIP_Real from, /**< value from which the next representable value should be returned */
1856 SCIP_Real to /**< direction in which the next representable value should be returned */
1857 );
1858
1859/** calculates the greatest common divisor of the two given values */
1860SCIP_EXPORT
1862 SCIP_Longint val1, /**< first value of greatest common devisor calculation */
1863 SCIP_Longint val2 /**< second value of greatest common devisor calculation */
1864 );
1865
1866/** calculates the smallest common multiple of the two given values */
1867SCIP_EXPORT
1869 SCIP_Longint val1, /**< first value of smallest common multiple calculation */
1870 SCIP_Longint val2 /**< second value of smallest common multiple calculation */
1871 );
1872
1873/** calculates a binomial coefficient n over m, choose m elements out of n, maximal value will be 33 over 16 (because
1874 * 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
1875 * big numbers or an negative value m (and m < n) and -1 will be returned
1876 */
1877SCIP_EXPORT
1879 int n, /**< number of different elements */
1880 int m /**< number to choose out of the above */
1881 );
1882
1883/** calculates hash for floating-point number by using Fibonacci hashing */
1884SCIP_EXPORT
1885unsigned int SCIPcalcFibHash(
1886 SCIP_Real v /**< number to hash */
1887 );
1888
1889#ifdef NDEBUG
1890
1891/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1892 * speed up the algorithms.
1893 */
1894
1895#define SCIPcalcFibHash(v) ((v) >= 0 ? ((unsigned long long)((v) * 2654435769)) % UINT_MAX : ((unsigned long long)(-(v) * 683565275)) % UINT_MAX )
1896
1897#endif
1898
1899/** converts a real number into a (approximate) rational representation, and returns TRUE iff the conversion was
1900 * successful
1901 */
1902SCIP_EXPORT
1904 SCIP_Real val, /**< real value r to convert into rational number */
1905 SCIP_Real mindelta, /**< minimal allowed difference r - q of real r and rational q = n/d */
1906 SCIP_Real maxdelta, /**< maximal allowed difference r - q of real r and rational q = n/d */
1907 SCIP_Longint maxdnom, /**< maximal denominator allowed */
1908 SCIP_Longint* numerator, /**< pointer to store the numerator n of the rational number */
1909 SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1910 );
1911
1912/** checks, if value is integral without any tolerances */
1913SCIP_EXPORT
1915 SCIP_Real val /**< value to process */
1916 );
1917
1918/** tries to find a value, such that all given values, if scaled with this value become integral in relative allowed
1919 * difference in between mindelta and maxdelta
1920 */
1921SCIP_EXPORT
1923 SCIP_Real* vals, /**< values to scale */
1924 int nvals, /**< number of values to scale */
1925 SCIP_Real mindelta, /**< minimal relative allowed difference of scaled coefficient s*c and integral i */
1926 SCIP_Real maxdelta, /**< maximal relative allowed difference of scaled coefficient s*c and integral i */
1927 SCIP_Longint maxdnom, /**< maximal denominator allowed in rational numbers */
1928 SCIP_Real maxscale, /**< maximal allowed scalar */
1929 SCIP_Real* intscalar, /**< pointer to store scalar that would make the coefficients integral, or NULL */
1930 SCIP_Bool* success /**< stores whether returned value is valid */
1931 );
1932
1933/** tries to find a value, such that all given values, if scaled with this value become integral */
1934SCIP_EXPORT
1936 BMS_BUFMEM* buffer, /**< buffer memory */
1937 SCIP_RATIONAL** vals, /**< values to scale */
1938 int nvals, /**< number of values to scale */
1939 SCIP_Real maxscale, /**< maximal allowed scalar */
1940 SCIP_RATIONAL* intscalar, /**< pointer to store scalar that would make the coefficients integral */
1941 SCIP_Bool* success /**< stores whether returned value is valid */
1942 );
1943
1944/** given a (usually very small) interval, tries to find a rational number with simple denominator (i.e. a small
1945 * number, probably multiplied with powers of 10) out of this interval; returns TRUE iff a valid rational
1946 * number inside the interval was found
1947 */
1948SCIP_EXPORT
1950 SCIP_Real lb, /**< lower bound of the interval */
1951 SCIP_Real ub, /**< upper bound of the interval */
1952 SCIP_Longint maxdnom, /**< maximal denominator allowed for resulting rational number */
1953 SCIP_Longint* numerator, /**< pointer to store the numerator n of the rational number */
1954 SCIP_Longint* denominator /**< pointer to store the denominator d of the rational number */
1955 );
1956
1957/** given a (usually very small) interval, selects a value inside this interval; it is tried to select a rational number
1958 * with simple denominator (i.e. a small number, probably multiplied with powers of 10);
1959 * if no valid rational number inside the interval was found, selects the central value of the interval
1960 */
1961SCIP_EXPORT
1963 SCIP_Real lb, /**< lower bound of the interval */
1964 SCIP_Real ub, /**< upper bound of the interval */
1965 SCIP_Longint maxdnom /**< maximal denominator allowed for resulting rational number */
1966 );
1967
1968/** Performs the Newton Procedure from a given starting point to compute a root of the given function with
1969 * specified precision and maximum number of iterations. If the procedure fails, SCIP_INVALID is returned.
1970 */
1971SCIP_EXPORT
1973 SCIP_DECL_NEWTONEVAL((*function)), /**< pointer to function for which roots are computed */
1974 SCIP_DECL_NEWTONEVAL((*derivative)), /**< pointer to derivative of above function */
1975 SCIP_Real* params, /**< parameters needed for function (can be NULL) */
1976 int nparams, /**< number of parameters (can be 0) */
1977 SCIP_Real x, /**< starting point */
1978 SCIP_Real eps, /**< tolerance */
1979 int k /**< iteration limit */
1980 );
1981
1982/* In debug mode, the following methods are implemented as function calls to ensure
1983 * type validity.
1984 */
1985
1986/** returns the relative difference: (val1-val2)/max(|val1|,|val2|,1.0) */
1987SCIP_EXPORT
1989 SCIP_Real val1, /**< first value to be compared */
1990 SCIP_Real val2 /**< second value to be compared */
1991 );
1992
1993#ifdef NDEBUG
1994
1995/* In optimized mode, the function calls are overwritten by defines to reduce the number of function calls and
1996 * speed up the algorithms.
1997 */
1998
1999#define SCIPrelDiff(val1, val2) ( ((val1)-(val2))/(MAX3(1.0,REALABS(val1),REALABS(val2))) )
2000
2001#endif
2002
2003/** computes the gap from the primal and the dual bound */
2004SCIP_EXPORT
2006 SCIP_Real eps, /**< the value treated as zero */
2007 SCIP_Real inf, /**< the value treated as infinity */
2008 SCIP_Real primalbound, /**< the primal bound */
2009 SCIP_Real dualbound /**< the dual bound */
2010 );
2011
2012/**@} */
2013
2014
2015/*
2016 * Random Numbers
2017 */
2018
2019/**@defgroup RandomNumbers Random Numbers
2020 * @ingroup MiscellaneousMethods
2021 * @brief structures and methods for pseudo random number generation
2022 *
2023 *@{
2024 */
2025
2026/** returns a random integer between minrandval and maxrandval */
2027SCIP_EXPORT
2029 SCIP_RANDNUMGEN* randnumgen, /**< random number generator data */
2030 int minrandval, /**< minimal value to return */
2031 int maxrandval /**< maximal value to return */
2032 );
2033
2034/** draws a random subset of disjoint elements from a given set of disjoint elements;
2035 * this implementation is suited for the case that nsubelems is considerably smaller then nelems
2036 */
2037SCIP_EXPORT
2039 SCIP_RANDNUMGEN* randnumgen, /**< random number generator */
2040 void** set, /**< original set, from which elements should be drawn */
2041 int nelems, /**< number of elements in original set */
2042 void** subset, /**< subset in which drawn elements should be stored */
2043 int nsubelems /**< number of elements that should be drawn and stored */
2044 );
2045
2046/** returns a random real between minrandval and maxrandval */
2047SCIP_EXPORT
2049 SCIP_RANDNUMGEN* randnumgen, /**< random number generator data */
2050 SCIP_Real minrandval, /**< minimal value to return */
2051 SCIP_Real maxrandval /**< maximal value to return */
2052 );
2053
2054/**@} */
2055
2056/*
2057 * Permutations / Shuffling
2058 */
2059
2060/**@defgroup PermutationsShuffling Permutations Shuffling
2061 * @ingroup MiscellaneousMethods
2062 * @brief methods for shuffling arrays
2063 *
2064 * @{
2065 */
2066
2067/** swaps two ints */
2068SCIP_EXPORT
2069void SCIPswapInts(
2070 int* value1, /**< pointer to first integer */
2071 int* value2 /**< pointer to second integer */
2072 );
2073
2074/** swaps two real values */
2075SCIP_EXPORT
2076void SCIPswapReals(
2077 SCIP_Real* value1, /**< pointer to first real value */
2078 SCIP_Real* value2 /**< pointer to second real value */
2079);
2080
2081/** swaps the addresses of two pointers */
2082SCIP_EXPORT
2083void SCIPswapPointers(
2084 void** pointer1, /**< first pointer */
2085 void** pointer2 /**< second pointer */
2086 );
2087
2088/** randomly shuffles parts of an integer array using the Fisher-Yates algorithm */
2089SCIP_EXPORT
2091 SCIP_RANDNUMGEN* randnumgen, /**< random number generator */
2092 int* array, /**< array to be shuffled */
2093 int begin, /**< first included index that should be subject to shuffling
2094 * (0 for first array entry)
2095 */
2096 int end /**< first excluded index that should not be subject to shuffling
2097 * (array size for last array entry)
2098 */
2099 );
2100
2101/** randomly shuffles parts of an array using the Fisher-Yates algorithm */
2102SCIP_EXPORT
2104 SCIP_RANDNUMGEN* randnumgen, /**< random number generator */
2105 void** array, /**< array to be shuffled */
2106 int begin, /**< first included index that should be subject to shuffling
2107 * (0 for first array entry)
2108 */
2109 int end /**< first excluded index that should not be subject to shuffling
2110 * (array size for last array entry)
2111 */
2112 );
2113
2114/**@} */
2115
2116
2117/*
2118 * Arrays
2119 */
2120
2121/**@defgroup Arrays Arrays
2122 * @ingroup MiscellaneousMethods
2123 * @brief miscellaneous methods for arrays
2124 *
2125 * @{
2126 */
2127
2128/** computes set intersection (duplicates removed) of two integer arrays that are ordered ascendingly */
2129SCIP_EXPORT
2131 int* array1, /**< first array (in ascending order) */
2132 int narray1, /**< number of entries of first array */
2133 int* array2, /**< second array (in ascending order) */
2134 int narray2, /**< number of entries of second array */
2135 int* intersectarray, /**< intersection of array1 and array2
2136 * (note: it is possible to use array1 for this input argument) */
2137 int* nintersectarray /**< pointer to store number of entries of intersection array
2138 * (note: it is possible to use narray1 for this input argument) */
2139 );
2140
2141/** computes set intersection (duplicates removed) of two void-pointer arrays that are ordered ascendingly */
2142SCIP_EXPORT
2144 void** array1, /**< first array (in ascending order) */
2145 int narray1, /**< number of entries of first array */
2146 void** array2, /**< second array (in ascending order) */
2147 int narray2, /**< number of entries of second array */
2148 SCIP_DECL_SORTPTRCOMP((*ptrcomp)), /**< data element comparator */
2149 void** intersectarray, /**< intersection of array1 and array2
2150 * (note: it is possible to use array1 for this input argument) */
2151 int* nintersectarray /**< pointer to store number of entries of intersection array
2152 * (note: it is possible to use narray1 for this input argument) */
2153);
2154
2155/** computes set difference (duplicates removed) of two integer arrays that are ordered ascendingly */
2156SCIP_EXPORT
2158 int* array1, /**< first array (in ascending order) */
2159 int narray1, /**< number of entries of first array */
2160 int* array2, /**< second array (in ascending order) */
2161 int narray2, /**< number of entries of second array */
2162 int* setminusarray, /**< array to store entries of array1 that are not an entry of array2
2163 * (note: it is possible to use array1 for this input argument) */
2164 int* nsetminusarray /**< pointer to store number of entries of setminus array
2165 * (note: it is possible to use narray1 for this input argument) */
2166 );
2167
2168/**@} */
2169
2170
2171/*
2172 * Strings
2173 */
2174
2175/**@defgroup StringMethods String Methods
2176 * @ingroup MiscellaneousMethods
2177 * @brief commonly used methods for strings
2178 *
2179 *@{
2180 */
2181
2182/** copies characters from 'src' to 'dest', copying is stopped when either the 'stop' character is reached or after
2183 * 'cnt' characters have been copied, whichever comes first.
2184 *
2185 * @note undefined behaviuor on overlapping arrays
2186 */
2187SCIP_EXPORT
2188int SCIPmemccpy(
2189 char* dest, /**< destination pointer to copy to */
2190 const char* src, /**< source pointer to copy to */
2191 char stop, /**< character when found stop copying */
2192 unsigned int cnt /**< maximal number of characters to copy too */
2193 );
2194
2195/** prints an error message containing of the given string followed by a string describing the current system error;
2196 * prefers to use the strerror_r method, which is threadsafe; on systems where this method does not exist,
2197 * NO_STRERROR_R should be defined (see INSTALL), in this case, srerror is used which is not guaranteed to be
2198 * threadsafe (on SUN-systems, it actually is)
2199 */
2200SCIP_EXPORT
2202 const char* message /**< first part of the error message, e.g. the filename */
2203 );
2204
2205/** extracts tokens from strings - wrapper method for strtok_r() */
2206SCIP_EXPORT
2207char* SCIPstrtok(
2208 char* s, /**< string to parse */
2209 const char* delim, /**< delimiters for parsing */
2210 char** ptrptr /**< pointer to working char pointer - must stay the same while parsing */
2211 );
2212
2213/** translates the given string into a string where symbols ", ', and spaces are escaped with a \ prefix */
2214SCIP_EXPORT
2215void SCIPescapeString(
2216 char* t, /**< target buffer to store escaped string */
2217 int bufsize, /**< size of buffer t */
2218 const char* s /**< string to transform into escaped string */
2219 );
2220
2221/** increases string pointer as long as it refers to a space character or an explicit space control sequence */
2222SCIP_EXPORT
2224 char** s /**< pointer to string pointer */
2225 );
2226
2227/** safe version of snprintf */
2228SCIP_EXPORT
2229int SCIPsnprintf(
2230 char* t, /**< target string */
2231 int len, /**< length of the string to copy */
2232 const char* s, /**< source string */
2233 ... /**< further parameters */
2234 );
2235
2236/** safe version of strncpy
2237 *
2238 * Copies string in s to t using at most @a size-1 nonzero characters (strncpy copies size characters). It always adds
2239 * a terminating zero char. Does not pad the remaining string with zero characters (unlike strncpy). Returns the number
2240 * of copied nonzero characters, if the length of s is at most size - 1, and returns size otherwise. Thus, the original
2241 * string was truncated if the return value is size.
2242 */
2243SCIP_EXPORT
2244int SCIPstrncpy(
2245 char* t, /**< target string */
2246 const char* s, /**< source string */
2247 int size /**< maximal size of t */
2248 );
2249
2250/** portable version of strcasecmp for case-insensitive comparison of two strings */
2251SCIP_EXPORT
2252int SCIPstrcasecmp(
2253 const char* s1, /**< first string */
2254 const char* s2 /**< second string */
2255 );
2256
2257/** portable version of strncasecmp for case-insensitive comparison of two strings up to a given number of characters */
2258SCIP_EXPORT
2259int SCIPstrncasecmp(
2260 const char* s1, /**< first string */
2261 const char* s2, /**< second string */
2262 int length /**< maximal length to compare */
2263 );
2264
2265/** 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
2266 *
2267 * @return Returns TRUE if a value could be extracted, otherwise FALSE
2268 */
2269SCIP_EXPORT
2271 const char* str, /**< string to search */
2272 int* value, /**< pointer to store the parsed value */
2273 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2274 );
2275
2276/** 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
2277 *
2278 * @return Returns TRUE if a value could be extracted, otherwise FALSE
2279 */
2280SCIP_EXPORT
2282 const char* str, /**< string to search */
2283 SCIP_Real* value, /**< pointer to store the parsed value */
2284 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2285 );
2286
2287/** copies the first size characters between a start and end character of str into token, if no error occurred endptr
2288 * will point to the position after the read part, otherwise it will point to @p str
2289 */
2290SCIP_EXPORT
2292 const char* str, /**< string to search */
2293 char startchar, /**< character which defines the beginning */
2294 char endchar, /**< character which defines the ending */
2295 char* token, /**< string to store the copy */
2296 int size, /**< size of the token char array */
2297 char** endptr /**< pointer to store the final string position if successfully parsed, otherwise @p str */
2298 );
2299
2300/** checks whether a given string t appears at the beginning of the string s (up to spaces at beginning) */
2301SCIP_EXPORT
2303 const char* s, /**< string to search in */
2304 const char* t, /**< string to search for */
2305 size_t tlen /**< length of t */
2306);
2307
2308/**@} */
2309
2310/*
2311 * File methods
2312 */
2313
2314/**@defgroup FileMethods File Methods
2315 * @ingroup MiscellaneousMethods
2316 * @brief commonly used file methods
2317 *
2318 * @{
2319 */
2320
2321/** returns whether the given file exists */
2322SCIP_EXPORT
2324 const char* filename /**< file name */
2325 );
2326
2327/** splits filename into path, name, and extension */
2328SCIP_EXPORT
2330 char* filename, /**< filename to split; is destroyed (but not freed) during process */
2331 char** path, /**< pointer to store path, or NULL if not needed */
2332 char** name, /**< pointer to store name, or NULL if not needed */
2333 char** extension, /**< pointer to store extension, or NULL if not needed */
2334 char** compression /**< pointer to store compression extension, or NULL if not needed */
2335 );
2336
2337/**@} */
2338
2339#ifdef __cplusplus
2340}
2341#endif
2342
2343#endif
SCIP_VAR ** y
Definition: circlepacking.c:64
SCIP_VAR ** x
Definition: circlepacking.c:63
common defines and data types used in all packages of SCIP
#define SCIP_Longint
Definition: def.h:141
#define INLINE
Definition: def.h:120
#define SCIP_Bool
Definition: def.h:91
#define SCIP_Real
Definition: def.h:156
#define ABS(x)
Definition: def.h:216
#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:10583
void SCIPcomputeArraysSetminusInt(int *array1, int narray1, int *array2, int narray2, int *setminusarray, int *nsetminusarray)
Definition: misc.c:10639
void SCIPcomputeArraysIntersectionInt(int *array1, int narray1, int *array2, int narray2, int *intersectarray, int *nintersectarray)
Definition: misc.c:10530
void SCIPbtnodeSetRightchild(SCIP_BTNODE *node, SCIP_BTNODE *right)
Definition: misc.c:9023
SCIP_BTNODE * SCIPbtnodeGetRightchild(SCIP_BTNODE *node)
Definition: misc.c:8892
SCIP_Bool SCIPbtIsEmpty(SCIP_BT *tree)
Definition: misc.c:9135
SCIP_RETCODE SCIPbtCreate(SCIP_BT **tree, BMS_BLKMEM *blkmem)
Definition: misc.c:9034
void SCIPbtnodeFree(SCIP_BT *tree, SCIP_BTNODE **node)
Definition: misc.c:8817
SCIP_Bool SCIPbtnodeIsLeaf(SCIP_BTNODE *node)
Definition: misc.c:8932
void SCIPbtnodeSetData(SCIP_BTNODE *node, void *dataptr)
Definition: misc.c:8981
void * SCIPbtnodeGetData(SCIP_BTNODE *node)
Definition: misc.c:8862
SCIP_RETCODE SCIPbtnodeCreate(SCIP_BT *tree, SCIP_BTNODE **node, void *dataptr)
Definition: misc.c:8753
SCIP_Bool SCIPbtnodeIsRightchild(SCIP_BTNODE *node)
Definition: misc.c:8960
void SCIPbtnodeSetParent(SCIP_BTNODE *node, SCIP_BTNODE *parent)
Definition: misc.c:8995
SCIP_BTNODE * SCIPbtnodeGetSibling(SCIP_BTNODE *node)
Definition: misc.c:8902
SCIP_Bool SCIPbtnodeIsLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8942
void SCIPbtnodeSetLeftchild(SCIP_BTNODE *node, SCIP_BTNODE *left)
Definition: misc.c:9009
SCIP_BTNODE * SCIPbtnodeGetParent(SCIP_BTNODE *node)
Definition: misc.c:8872
void SCIPbtFree(SCIP_BT **tree)
Definition: misc.c:9053
SCIP_BTNODE * SCIPbtnodeGetLeftchild(SCIP_BTNODE *node)
Definition: misc.c:8882
void SCIPbtSetRoot(SCIP_BT *tree, SCIP_BTNODE *root)
Definition: misc.c:9158
SCIP_Bool SCIPbtnodeIsRoot(SCIP_BTNODE *node)
Definition: misc.c:8922
SCIP_BTNODE * SCIPbtGetRoot(SCIP_BT *tree)
Definition: misc.c:9145
void SCIPbtPrintGml(SCIP_BT *tree, FILE *file)
Definition: misc.c:9105
void SCIPdigraphPrintComponents(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8700
void ** SCIPdigraphGetSuccessorsData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7914
void SCIPdigraphFreeComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8594
int SCIPdigraphGetNSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7881
SCIP_RETCODE SCIPdigraphComputeUndirectedComponents(SCIP_DIGRAPH *digraph, int minsize, int *components, int *ncomponents)
Definition: misc.c:8165
int SCIPdigraphGetNNodes(SCIP_DIGRAPH *digraph)
Definition: misc.c:7823
void SCIPdigraphPrintGml(SCIP_DIGRAPH *digraph, FILE *file)
Definition: misc.c:8661
void SCIPdigraphGetComponent(SCIP_DIGRAPH *digraph, int compidx, int **nodes, int *nnodes)
Definition: misc.c:8374
SCIP_RETCODE SCIPdigraphAddArc(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7739
SCIP_RETCODE SCIPdigraphTopoSortComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8295
SCIP_RETCODE SCIPdigraphSetSizes(SCIP_DIGRAPH *digraph, int *sizes)
Definition: misc.c:7621
SCIP_RETCODE SCIPdigraphComputeDirectedComponents(SCIP_DIGRAPH *digraph, int compidx, int *strongcomponents, int *strongcompstartidx, int *nstrongcomponents)
Definition: misc.c:8506
SCIP_RETCODE SCIPdigraphAddArcSafe(SCIP_DIGRAPH *digraph, int startnode, int endnode, void *data)
Definition: misc.c:7770
void SCIPdigraphFree(SCIP_DIGRAPH **digraph)
Definition: misc.c:7645
int SCIPdigraphGetNArcs(SCIP_DIGRAPH *digraph)
Definition: misc.c:7863
void SCIPdigraphPrint(SCIP_DIGRAPH *digraph, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:8626
void * SCIPdigraphGetNodeData(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7833
void SCIPdigraphSetNodeData(SCIP_DIGRAPH *digraph, void *dataptr, int node)
Definition: misc.c:7849
SCIP_RETCODE SCIPdigraphSetNSuccessors(SCIP_DIGRAPH *digraph, int node, int nsuccessors)
Definition: misc.c:7807
int * SCIPdigraphGetSuccessors(SCIP_DIGRAPH *digraph, int node)
Definition: misc.c:7896
int SCIPdigraphGetNComponents(SCIP_DIGRAPH *digraph)
Definition: misc.c:8361
SCIP_RETCODE SCIPdigraphResize(SCIP_DIGRAPH *digraph, int nnodes)
Definition: misc.c:7491
SCIP_RETCODE SCIPdigraphGetArticulationPoints(SCIP_DIGRAPH *digraph, int **articulations, int *narticulations)
Definition: misc.c:8077
int SCIPdisjointsetGetSize(SCIP_DISJOINTSET *djset)
Definition: misc.c:11354
void SCIPdisjointsetClear(SCIP_DISJOINTSET *djset)
Definition: misc.c:11230
int SCIPdisjointsetGetComponentCount(SCIP_DISJOINTSET *djset)
Definition: misc.c:11344
int SCIPdisjointsetFind(SCIP_DISJOINTSET *djset, int element)
Definition: misc.c:11247
void SCIPdisjointsetUnion(SCIP_DISJOINTSET *djset, int p, int q, SCIP_Bool forcerepofp)
Definition: misc.c:11274
SCIP_Bool SCIPfileExists(const char *filename)
Definition: misc.c:11057
void SCIPsplitFilename(char *filename, char **path, char **name, char **extension, char **compression)
Definition: misc.c:11073
void SCIPdotWriteOpening(FILE *file)
Definition: misc.c:715
void SCIPdotWriteClosing(FILE *file)
Definition: misc.c:753
void SCIPdotWriteArc(FILE *file, int source, int target, const char *color)
Definition: misc.c:740
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:549
void SCIPgmlWriteNode(FILE *file, unsigned int id, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition: misc.c:501
void SCIPgmlWriteClosing(FILE *file)
Definition: misc.c:703
void SCIPdotWriteNode(FILE *file, int node, const char *label, const char *nodetype, const char *fillcolor, const char *bordercolor)
Definition: misc.c:725
void SCIPgmlWriteOpening(FILE *file, SCIP_Bool directed)
Definition: misc.c:687
void SCIPgmlWriteEdge(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:599
void SCIPgmlWriteArc(FILE *file, unsigned int source, unsigned int target, const char *label, const char *color)
Definition: misc.c:643
void SCIPhashmapFree(SCIP_HASHMAP **hashmap)
Definition: misc.c:3095
void * SCIPhashmapEntryGetImage(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3613
SCIP_Real SCIPhashmapGetImageReal(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3344
SCIP_RETCODE SCIPhashmapInsertReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3251
void SCIPhashmapPrintStatistics(SCIP_HASHMAP *hashmap, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3528
int SCIPhashmapGetImageInt(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3304
void * SCIPhashmapGetImage(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3284
SCIP_RETCODE SCIPhashmapSetImageReal(SCIP_HASHMAP *hashmap, void *origin, SCIP_Real image)
Definition: misc.c:3434
void SCIPhashmapEntrySetImageInt(SCIP_HASHMAPENTRY *entry, int image)
Definition: misc.c:3654
SCIP_RETCODE SCIPhashmapInsert(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3143
SCIP_RETCODE SCIPhashmapSetImage(SCIP_HASHMAP *hashmap, void *origin, void *image)
Definition: misc.c:3366
int SCIPhashmapGetNElements(SCIP_HASHMAP *hashmap)
Definition: misc.c:3576
int SCIPhashmapEntryGetImageInt(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3623
void SCIPhashmapEntrySetImageReal(SCIP_HASHMAPENTRY *entry, SCIP_Real image)
Definition: misc.c:3665
int SCIPhashmapGetNEntries(SCIP_HASHMAP *hashmap)
Definition: misc.c:3584
SCIP_HASHMAPENTRY * SCIPhashmapGetEntry(SCIP_HASHMAP *hashmap, int entryidx)
Definition: misc.c:3592
void SCIPhashmapEntrySetImage(SCIP_HASHMAPENTRY *entry, void *image)
Definition: misc.c:3643
SCIP_RETCODE SCIPhashmapCreate(SCIP_HASHMAP **hashmap, BMS_BLKMEM *blkmem, int mapsize)
Definition: misc.c:3061
void * SCIPhashmapEntryGetOrigin(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3603
SCIP_Bool SCIPhashmapExists(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3466
SCIP_RETCODE SCIPhashmapInsertInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3179
SCIP_Bool SCIPhashmapIsEmpty(SCIP_HASHMAP *hashmap)
Definition: misc.c:3566
SCIP_RETCODE SCIPhashmapInsertLong(SCIP_HASHMAP *hashmap, void *origin, SCIP_Longint image)
Definition: misc.c:3215
SCIP_RETCODE SCIPhashmapRemoveAll(SCIP_HASHMAP *hashmap)
Definition: misc.c:3676
SCIP_Real SCIPhashmapEntryGetImageReal(SCIP_HASHMAPENTRY *entry)
Definition: misc.c:3633
SCIP_RETCODE SCIPhashmapRemove(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3482
SCIP_Longint SCIPhashmapGetImageLong(SCIP_HASHMAP *hashmap, void *origin)
Definition: misc.c:3324
SCIP_RETCODE SCIPhashmapSetImageInt(SCIP_HASHMAP *hashmap, void *origin, int image)
Definition: misc.c:3400
void SCIPhashsetFree(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem)
Definition: misc.c:3833
void SCIPhashsetPrintStatistics(SCIP_HASHSET *hashset, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:3976
SCIP_Bool SCIPhashsetExists(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3860
void ** SCIPhashsetGetSlots(SCIP_HASHSET *hashset)
Definition: misc.c:4051
int SCIPhashsetGetNElements(SCIP_HASHSET *hashset)
Definition: misc.c:4035
int SCIPhashsetGetNSlots(SCIP_HASHSET *hashset)
Definition: misc.c:4043
void SCIPhashsetRemoveAll(SCIP_HASHSET *hashset)
Definition: misc.c:4059
SCIP_Bool SCIPhashsetIsEmpty(SCIP_HASHSET *hashset)
Definition: misc.c:4027
SCIP_RETCODE SCIPhashsetInsert(SCIP_HASHSET *hashset, BMS_BLKMEM *blkmem, void *element)
Definition: misc.c:3843
SCIP_RETCODE SCIPhashsetCreate(SCIP_HASHSET **hashset, BMS_BLKMEM *blkmem, int size)
Definition: misc.c:3802
SCIP_RETCODE SCIPhashsetRemove(SCIP_HASHSET *hashset, void *element)
Definition: misc.c:3901
void SCIPhashtableFree(SCIP_HASHTABLE **hashtable)
Definition: misc.c:2348
SCIP_Bool SCIPhashtableExists(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2647
int SCIPhashtableGetNEntries(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2765
SCIP_RETCODE SCIPhashtableSafeInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2567
void * SCIPhashtableGetEntry(SCIP_HASHTABLE *hashtable, int entryidx)
Definition: misc.c:2773
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:2298
void * SCIPhashtableRetrieve(SCIP_HASHTABLE *hashtable, void *key)
Definition: misc.c:2596
void SCIPhashtableRemoveAll(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2743
SCIP_Real SCIPhashtableGetLoad(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2782
void SCIPhashtablePrintStatistics(SCIP_HASHTABLE *hashtable, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2792
static INLINE uint32_t SCIPrealHashCode(double x)
Definition: pub_misc.h:593
SCIP_RETCODE SCIPhashtableRemove(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2665
SCIP_RETCODE SCIPhashtableInsert(SCIP_HASHTABLE *hashtable, void *element)
Definition: misc.c:2535
SCIP_Longint SCIPhashtableGetNElements(SCIP_HASHTABLE *hashtable)
Definition: misc.c:2755
SCIP_Longint SCIPmultihashGetNElements(SCIP_MULTIHASH *multihash)
Definition: misc.c:2233
void SCIPmultihashFree(SCIP_MULTIHASH **multihash)
Definition: misc.c:1995
SCIP_RETCODE SCIPmultihashInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2026
SCIP_RETCODE SCIPmultihashRemove(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2178
void SCIPmultihashRemoveAll(SCIP_MULTIHASH *multihash)
Definition: misc.c:2212
SCIP_RETCODE SCIPmultihashSafeInsert(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2067
SCIP_DECL_HASHKEYEQ(SCIPhashKeyEqString)
Definition: misc.c:2830
int SCIPcalcMultihashSize(int minsize)
Definition: misc.c:1639
SCIP_Real SCIPmultihashGetLoad(SCIP_MULTIHASH *multihash)
Definition: misc.c:2243
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:1962
SCIP_DECL_HASHKEYVAL(SCIPhashKeyValString)
Definition: misc.c:2839
void * SCIPmultihashRetrieve(SCIP_MULTIHASH *multihash, void *key)
Definition: misc.c:2086
void * SCIPmultihashRetrieveNext(SCIP_MULTIHASH *multihash, SCIP_MULTIHASHLIST **multihashlist, void *key)
Definition: misc.c:2115
SCIP_Bool SCIPmultihashExists(SCIP_MULTIHASH *multihash, void *element)
Definition: misc.c:2151
void SCIPmultihashPrintStatistics(SCIP_MULTIHASH *multihash, SCIP_MESSAGEHDLR *messagehdlr)
Definition: misc.c:2253
SCIP_DECL_HASHGETKEY(SCIPhashGetKeyStandard)
Definition: misc.c:2858
SCIP_Longint SCIPcalcGreComDiv(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9197
SCIP_Longint SCIPcalcBinomCoef(int n, int m)
Definition: misc.c:10387
SCIP_Longint SCIPcalcSmaComMul(SCIP_Longint val1, SCIP_Longint val2)
Definition: misc.c:9449
SCIP_Real SCIPselectSimpleValue(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom)
Definition: misc.c:10041
SCIP_Real SCIPcomputeGap(SCIP_Real eps, SCIP_Real inf, SCIP_Real primalbound, SCIP_Real dualbound)
Definition: misc.c:11180
SCIP_Bool SCIPfindSimpleRational(SCIP_Real lb, SCIP_Real ub, SCIP_Longint maxdnom, SCIP_Longint *numerator, SCIP_Longint *denominator)
Definition: misc.c:9994
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:10082
SCIP_Real SCIPnextafter(SCIP_Real from, SCIP_Real to)
Definition: misc.c:9440
SCIP_RETCODE SCIPcalcIntegralScalarExact(BMS_BUFMEM *buffer, SCIP_RATIONAL **vals, int nvals, SCIP_Real maxscale, SCIP_RATIONAL *intscalar, SCIP_Bool *success)
Definition: misc.c:9842
SCIP_Bool SCIPrealIsExactlyIntegral(SCIP_Real val)
Definition: misc.c:9604
SCIP_Real SCIPcalcMachineEpsilon(void)
Definition: misc.c:9174
unsigned int SCIPcalcFibHash(SCIP_Real v)
Definition: misc.c:10462
SCIP_Bool SCIPrealToRational(SCIP_Real val, SCIP_Real mindelta, SCIP_Real maxdelta, SCIP_Longint maxdnom, SCIP_Longint *numerator, SCIP_Longint *denominator)
Definition: misc.c:9470
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:9641
SCIP_Real SCIPrelDiff(SCIP_Real val1, SCIP_Real val2)
Definition: misc.c:11162
void SCIPswapInts(int *value1, int *value2)
Definition: misc.c:10485
void SCIPrandomPermuteIntArray(SCIP_RANDNUMGEN *randnumgen, int *array, int begin, int end)
Definition: misc.c:10264
void SCIPswapPointers(void **pointer1, void **pointer2)
Definition: misc.c:10511
void SCIPswapReals(SCIP_Real *value1, SCIP_Real *value2)
Definition: misc.c:10498
void SCIPrandomPermuteArray(SCIP_RANDNUMGEN *randnumgen, void **array, int begin, int end)
Definition: misc.c:10294
void ** SCIPpqueueElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1540
void SCIPpqueueDelPos(SCIP_PQUEUE *pqueue, int pos)
Definition: misc.c:1435
void SCIPpqueueClear(SCIP_PQUEUE *pqueue)
Definition: misc.c:1335
int SCIPpqueueFind(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1551
void SCIPpqueueFree(SCIP_PQUEUE **pqueue)
Definition: misc.c:1324
SCIP_RETCODE SCIPpqueueInsert(SCIP_PQUEUE *pqueue, void *elem)
Definition: misc.c:1396
int SCIPpqueueNElems(SCIP_PQUEUE *pqueue)
Definition: misc.c:1529
SCIP_RETCODE SCIPpqueueCreate(SCIP_PQUEUE **pqueue, int initsize, SCIP_Real sizefac, SCIP_DECL_SORTPTRCOMP((*ptrcomp)), SCIP_DECL_PQUEUEELEMCHGPOS((*elemchgpos)))
Definition: misc.c:1297
void * SCIPpqueueRemove(SCIP_PQUEUE *pqueue)
Definition: misc.c:1495
void * SCIPpqueueFirst(SCIP_PQUEUE *pqueue)
Definition: misc.c:1515
int SCIPqueueNElems(SCIP_QUEUE *queue)
Definition: misc.c:1249
unsigned int SCIPqueueRemoveUInt(SCIP_QUEUE *queue)
Definition: misc.c:1166
void SCIPqueueFree(SCIP_QUEUE **queue)
Definition: misc.c:1019
SCIP_RETCODE SCIPqueueInsertUInt(SCIP_QUEUE *queue, unsigned int elem)
Definition: misc.c:1107
SCIP_RETCODE SCIPqueueCreate(SCIP_QUEUE **queue, int initsize, SCIP_Real sizefac)
Definition: misc.c:995
void SCIPqueueClear(SCIP_QUEUE *queue)
Definition: misc.c:1030
SCIP_RETCODE SCIPqueueInsert(SCIP_QUEUE *queue, void *elem)
Definition: misc.c:1081
SCIP_Bool SCIPqueueIsEmpty(SCIP_QUEUE *queue)
Definition: misc.c:1236
void * SCIPqueueRemove(SCIP_QUEUE *queue)
Definition: misc.c:1132
void * SCIPqueueFirst(SCIP_QUEUE *queue)
Definition: misc.c:1200
unsigned int SCIPqueueFirstUInt(SCIP_QUEUE *queue)
Definition: misc.c:1218
SCIP_Real SCIPrandomGetReal(SCIP_RANDNUMGEN *randnumgen, SCIP_Real minrandval, SCIP_Real maxrandval)
Definition: misc.c:10245
SCIP_RETCODE SCIPrandomGetSubset(SCIP_RANDNUMGEN *randnumgen, void **set, int nelems, void **subset, int nsubelems)
Definition: misc.c:10326
int SCIPrandomGetInt(SCIP_RANDNUMGEN *randnumgen, int minrandval, int maxrandval)
Definition: misc.c:10223
void SCIPregressionRemoveObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:353
void SCIPregressionAddObservation(SCIP_REGRESSION *regression, SCIP_Real x, SCIP_Real y)
Definition: misc.c:385
SCIP_Real SCIPregressionGetIntercept(SCIP_REGRESSION *regression)
Definition: misc.c:278
int SCIPregressionGetNObservations(SCIP_REGRESSION *regression)
Definition: misc.c:258
void SCIPregressionFree(SCIP_REGRESSION **regression)
Definition: misc.c:436
SCIP_RETCODE SCIPregressionCreate(SCIP_REGRESSION **regression)
Definition: misc.c:420
void SCIPregressionReset(SCIP_REGRESSION *regression)
Definition: misc.c:404
SCIP_Real SCIPregressionGetSlope(SCIP_REGRESSION *regression)
Definition: misc.c:268
SCIP_RETCODE SCIPactivityCreate(SCIP_RESOURCEACTIVITY **activity, SCIP_VAR *var, int duration, int demand)
Definition: misc.c:6718
int SCIPactivityGetDuration(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6773
int SCIPactivityGetEnergy(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6793
SCIP_VAR * SCIPactivityGetVar(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6763
int SCIPactivityGetDemand(SCIP_RESOURCEACTIVITY *activity)
Definition: misc.c:6783
void SCIPactivityFree(SCIP_RESOURCEACTIVITY **activity)
Definition: misc.c:6737
SCIP_RETCODE SCIPprofileInsertCore(SCIP_PROFILE *profile, int left, int right, int demand, int *pos, SCIP_Bool *infeasible)
Definition: misc.c:7097
int * SCIPprofileGetTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6904
int SCIPprofileGetLatestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int demand, SCIP_Bool *infeasible)
Definition: misc.c:7366
SCIP_Bool SCIPprofileFindLeft(SCIP_PROFILE *profile, int timepoint, int *pos)
Definition: misc.c:6950
int SCIPprofileGetEarliestFeasibleStart(SCIP_PROFILE *profile, int est, int lst, int duration, int demand, SCIP_Bool *infeasible)
Definition: misc.c:7217
int SCIPprofileGetNTimepoints(SCIP_PROFILE *profile)
Definition: misc.c:6894
void SCIPprofileFree(SCIP_PROFILE **profile)
Definition: misc.c:6846
int SCIPprofileGetLoad(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6936
int * SCIPprofileGetLoads(SCIP_PROFILE *profile)
Definition: misc.c:6914
SCIP_RETCODE SCIPprofileCreate(SCIP_PROFILE **profile, int capacity)
Definition: misc.c:6832
int SCIPprofileGetTime(SCIP_PROFILE *profile, int pos)
Definition: misc.c:6924
int SCIPprofileGetCapacity(SCIP_PROFILE *profile)
Definition: misc.c:6884
SCIP_RETCODE SCIPprofileDeleteCore(SCIP_PROFILE *profile, int left, int right, int demand)
Definition: misc.c:7127
void SCIPprofilePrint(SCIP_PROFILE *profile, SCIP_MESSAGEHDLR *messagehdlr, FILE *file)
Definition: misc.c:6862
SCIP_Real SCIPnormalCDF(SCIP_Real mean, SCIP_Real variance, SCIP_Real value)
Definition: misc.c:200
SCIP_Real SCIPcomputeTwoSampleTTestValue(SCIP_Real meanx, SCIP_Real meany, SCIP_Real variancex, SCIP_Real variancey, SCIP_Real countx, SCIP_Real county)
Definition: misc.c:127
SCIP_Real SCIPnormalGetCriticalValue(SCIP_CONFIDENCELEVEL clevel)
Definition: misc.c:187
SCIP_Real SCIPstudentTGetCriticalValue(SCIP_CONFIDENCELEVEL clevel, int df)
Definition: misc.c:110
SCIP_Real SCIPerf(SCIP_Real x)
Definition: misc.c:160
int SCIPsparseSolGetNVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:841
SCIP_Longint * SCIPsparseSolGetLbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:851
void SCIPsparseSolGetFirstSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:871
SCIP_RETCODE SCIPsparseSolCreate(SCIP_SPARSESOL **sparsesol, SCIP_VAR **vars, int nvars, SCIP_Bool cleared)
Definition: misc.c:767
SCIP_Longint * SCIPsparseSolGetUbs(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:861
void SCIPsparseSolFree(SCIP_SPARSESOL **sparsesol)
Definition: misc.c:817
SCIP_Bool SCIPsparseSolGetNextSol(SCIP_SPARSESOL *sparsesol, SCIP_Longint *sol, int nvars)
Definition: misc.c:894
SCIP_VAR ** SCIPsparseSolGetVars(SCIP_SPARSESOL *sparsesol)
Definition: misc.c:831
SCIP_Bool SCIPstrToIntValue(const char *str, int *value, char **endptr)
Definition: misc.c:10924
int SCIPstrcasecmp(const char *s1, const char *s2)
Definition: misc.c:10863
int SCIPsnprintf(char *t, int len, const char *s,...)
Definition: misc.c:10827
SCIP_Bool SCIPstrToRealValue(const char *str, SCIP_Real *value, char **endptr)
Definition: misc.c:10955
void SCIPescapeString(char *t, int bufsize, const char *s)
Definition: misc.c:10782
void SCIPstrCopySection(const char *str, char startchar, char endchar, char *token, int size, char **endptr)
Definition: misc.c:10985
void SCIPprintSysError(const char *message)
Definition: misc.c:10719
SCIP_Bool SCIPstrAtStart(const char *s, const char *t, size_t tlen)
Definition: misc.c:11364
SCIP_RETCODE SCIPskipSpace(char **s)
Definition: misc.c:10816
int SCIPstrncpy(char *t, const char *s, int size)
Definition: misc.c:10897
int SCIPstrncasecmp(const char *s1, const char *s2, int length)
Definition: misc.c:10876
char * SCIPstrtok(char *s, const char *delim, char **ptrptr)
Definition: misc.c:10768
int SCIPmemccpy(char *dest, const char *src, char stop, unsigned int cnt)
Definition: misc.c:10694
memory allocation routines
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:437
SCIP_Longint denominator(Rational &r)
SCIP_Longint numerator(Rational &r)
real eps
#define SCIPisFinite(x)
Definition: pub_misc.h:82
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
Definition: heur_padm.c:135
type definitions for message output methods
type definitions for miscellaneous datastructures
#define SCIP_DECL_PQUEUEELEMCHGPOS(x)
Definition: type_misc.h:209
#define SCIP_DECL_SORTPTRCOMP(x)
Definition: type_misc.h:189
#define SCIP_DECL_NEWTONEVAL(x)
Definition: type_misc.h:206
enum SCIP_Confidencelevel SCIP_CONFIDENCELEVEL
Definition: type_misc.h:53
type definitions for return codes for SCIP methods
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:63
type definitions for problem variables