Scippy

SCIP

Solving Constraint Integer Programs

scip_datastructures.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-2019 Konrad-Zuse-Zentrum */
7 /* fuer Informationstechnik Berlin */
8 /* */
9 /* SCIP is distributed under the terms of the ZIB Academic License. */
10 /* */
11 /* You should have received a copy of the ZIB Academic License */
12 /* along with SCIP; see the file COPYING. If not visit scip.zib.de. */
13 /* */
14 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
15 
16 /**@file scip_datastructures.h
17  * @ingroup PUBLICCOREAPI
18  * @brief public methods for data structures
19  * @author Tobias Achterberg
20  * @author Timo Berthold
21  * @author Thorsten Koch
22  * @author Alexander Martin
23  * @author Marc Pfetsch
24  * @author Kati Wolter
25  * @author Gregor Hendel
26  * @author Robert Lion Gottwald
27  */
28 
29 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
30 
31 #ifndef __SCIP_SCIP_DATASTRUCTURES_H__
32 #define __SCIP_SCIP_DATASTRUCTURES_H__
33 
34 
35 #include "scip/def.h"
36 #include "scip/type_misc.h"
37 #include "scip/type_retcode.h"
38 #include "scip/type_scip.h"
39 
40 #ifdef __cplusplus
41 extern "C" {
42 #endif
43 
44 /**@addtogroup PublicDynamicArrayMethods
45  *
46  * @{
47  */
48 
49 /** creates a dynamic array of real values
50  *
51  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
52  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
53  */
56  SCIP* scip, /**< SCIP data structure */
57  SCIP_REALARRAY** realarray /**< pointer to store the real array */
58  );
59 
60 /** frees a dynamic array of real values
61  *
62  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
63  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
64  */
67  SCIP* scip, /**< SCIP data structure */
68  SCIP_REALARRAY** realarray /**< pointer to the real array */
69  );
70 
71 /** extends dynamic array to be able to store indices from minidx to maxidx
72  *
73  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
74  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
75  */
78  SCIP* scip, /**< SCIP data structure */
79  SCIP_REALARRAY* realarray, /**< dynamic real array */
80  int minidx, /**< smallest index to allocate storage for */
81  int maxidx /**< largest index to allocate storage for */
82  );
83 
84 /** clears a dynamic real array
85  *
86  * @return clears a dynamic real array
87  */
90  SCIP* scip, /**< SCIP data structure */
91  SCIP_REALARRAY* realarray /**< dynamic real array */
92  );
93 
94 /** gets value of entry in dynamic array */
97  SCIP* scip, /**< SCIP data structure */
98  SCIP_REALARRAY* realarray, /**< dynamic real array */
99  int idx /**< array index to get value for */
100  );
101 
102 /** sets value of entry in dynamic array
103  *
104  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
105  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
106  */
109  SCIP* scip, /**< SCIP data structure */
110  SCIP_REALARRAY* realarray, /**< dynamic real array */
111  int idx, /**< array index to set value for */
112  SCIP_Real val /**< value to set array index to */
113  );
114 
115 /** increases value of entry in dynamic array
116  *
117  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
118  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
119  */
122  SCIP* scip, /**< SCIP data structure */
123  SCIP_REALARRAY* realarray, /**< dynamic real array */
124  int idx, /**< array index to increase value for */
125  SCIP_Real incval /**< value to increase array index */
126  );
127 
128 /** returns the minimal index of all stored non-zero elements
129  *
130  * @return the minimal index of all stored non-zero elements
131  */
134  SCIP* scip, /**< SCIP data structure */
135  SCIP_REALARRAY* realarray /**< dynamic real array */
136  );
137 
138 /** returns the maximal index of all stored non-zero elements
139  *
140  * @return the maximal index of all stored non-zero elements
141  */
144  SCIP* scip, /**< SCIP data structure */
145  SCIP_REALARRAY* realarray /**< dynamic real array */
146  );
147 
148 /** creates a dynamic array of int values
149  *
150  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
151  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
152  */
155  SCIP* scip, /**< SCIP data structure */
156  SCIP_INTARRAY** intarray /**< pointer to store the int array */
157  );
158 
159 /** frees a dynamic array of int values
160  *
161  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
162  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
163  */
166  SCIP* scip, /**< SCIP data structure */
167  SCIP_INTARRAY** intarray /**< pointer to the int array */
168  );
169 
170 /** extends dynamic array to be able to store indices from minidx to maxidx
171  *
172  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
173  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
174  */
177  SCIP* scip, /**< SCIP data structure */
178  SCIP_INTARRAY* intarray, /**< dynamic int array */
179  int minidx, /**< smallest index to allocate storage for */
180  int maxidx /**< largest index to allocate storage for */
181  );
182 
183 /** clears a dynamic int array
184  *
185  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
186  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
187  */
190  SCIP* scip, /**< SCIP data structure */
191  SCIP_INTARRAY* intarray /**< dynamic int array */
192  );
193 
194 /** gets value of entry in dynamic array
195  *
196  * @return value of entry in dynamic array
197  */
200  SCIP* scip, /**< SCIP data structure */
201  SCIP_INTARRAY* intarray, /**< dynamic int array */
202  int idx /**< array index to get value for */
203  );
204 
205 /** sets value of entry in dynamic array
206  *
207  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
208  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
209  */
212  SCIP* scip, /**< SCIP data structure */
213  SCIP_INTARRAY* intarray, /**< dynamic int array */
214  int idx, /**< array index to set value for */
215  int val /**< value to set array index to */
216  );
217 
218 /** increases value of entry in dynamic array
219  *
220  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
221  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
222  */
225  SCIP* scip, /**< SCIP data structure */
226  SCIP_INTARRAY* intarray, /**< dynamic int array */
227  int idx, /**< array index to increase value for */
228  int incval /**< value to increase array index */
229  );
230 
231 /** returns the minimal index of all stored non-zero elements
232  *
233  * @return the minimal index of all stored non-zero elements
234  */
237  SCIP* scip, /**< SCIP data structure */
238  SCIP_INTARRAY* intarray /**< dynamic int array */
239  );
240 
241 /** returns the maximal index of all stored non-zero elements
242  *
243  * @return the maximal index of all stored non-zero elements
244  */
247  SCIP* scip, /**< SCIP data structure */
248  SCIP_INTARRAY* intarray /**< dynamic int array */
249  );
250 
251 /** creates a dynamic array of bool values
252  *
253  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
254  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
255  */
258  SCIP* scip, /**< SCIP data structure */
259  SCIP_BOOLARRAY** boolarray /**< pointer to store the bool array */
260  );
261 
262 /** frees a dynamic array of bool values
263  *
264  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
265  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
266  */
269  SCIP* scip, /**< SCIP data structure */
270  SCIP_BOOLARRAY** boolarray /**< pointer to the bool array */
271  );
272 
273 /** extends dynamic array to be able to store indices from minidx to maxidx
274  *
275  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
276  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
277  */
280  SCIP* scip, /**< SCIP data structure */
281  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
282  int minidx, /**< smallest index to allocate storage for */
283  int maxidx /**< largest index to allocate storage for */
284  );
285 
286 /** clears a dynamic bool array
287  *
288  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
289  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
290  */
293  SCIP* scip, /**< SCIP data structure */
294  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
295  );
296 
297 /** gets value of entry in dynamic array
298  *
299  * @return value of entry in dynamic array at position idx
300  */
303  SCIP* scip, /**< SCIP data structure */
304  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
305  int idx /**< array index to get value for */
306  );
307 
308 /** sets value of entry in dynamic array
309  *
310  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
311  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
312  */
315  SCIP* scip, /**< SCIP data structure */
316  SCIP_BOOLARRAY* boolarray, /**< dynamic bool array */
317  int idx, /**< array index to set value for */
318  SCIP_Bool val /**< value to set array index to */
319  );
320 
321 /** returns the minimal index of all stored non-zero elements
322  *
323  * @return the minimal index of all stored non-zero elements
324  */
327  SCIP* scip, /**< SCIP data structure */
328  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
329  );
330 
331 /** returns the maximal index of all stored non-zero elements
332  *
333  * @return the maximal index of all stored non-zero elements
334  */
337  SCIP* scip, /**< SCIP data structure */
338  SCIP_BOOLARRAY* boolarray /**< dynamic bool array */
339  );
340 
341 /** creates a dynamic array of pointers
342  *
343  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
344  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
345  */
348  SCIP* scip, /**< SCIP data structure */
349  SCIP_PTRARRAY** ptrarray /**< pointer to store the int array */
350  );
351 
352 /** frees a dynamic array of pointers
353  *
354  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
355  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
356  */
359  SCIP* scip, /**< SCIP data structure */
360  SCIP_PTRARRAY** ptrarray /**< pointer to the int array */
361  );
362 
363 /** extends dynamic array to be able to store indices from minidx to maxidx
364  *
365  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
366  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
367  */
370  SCIP* scip, /**< SCIP data structure */
371  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
372  int minidx, /**< smallest index to allocate storage for */
373  int maxidx /**< largest index to allocate storage for */
374  );
375 
376 /** clears a dynamic pointer array
377  *
378  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
379  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
380  */
383  SCIP* scip, /**< SCIP data structure */
384  SCIP_PTRARRAY* ptrarray /**< dynamic int array */
385  );
386 
387 /** gets value of entry in dynamic array */
389 void* SCIPgetPtrarrayVal(
390  SCIP* scip, /**< SCIP data structure */
391  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
392  int idx /**< array index to get value for */
393  );
394 
395 /** sets value of entry in dynamic array
396  *
397  * @return \ref SCIP_OKAY is returned if everything worked. Otherwise a suitable error code is passed. See \ref
398  * SCIP_Retcode "SCIP_RETCODE" for a complete list of error codes.
399  */
402  SCIP* scip, /**< SCIP data structure */
403  SCIP_PTRARRAY* ptrarray, /**< dynamic int array */
404  int idx, /**< array index to set value for */
405  void* val /**< value to set array index to */
406  );
407 
408 /** returns the minimal index of all stored non-zero elements
409  *
410  * @return the minimal index of all stored non-zero elements
411  */
414  SCIP* scip, /**< SCIP data structure */
415  SCIP_PTRARRAY* ptrarray /**< dynamic ptr array */
416  );
417 
418 /** returns the maximal index of all stored non-zero elements
419  *
420  * @return the maximal index of all stored non-zero elements
421  */
424  SCIP* scip, /**< SCIP data structure */
425  SCIP_PTRARRAY* ptrarray /**< dynamic ptr array */
426  );
427 
428 /**@} */
429 
430 /**@addtogroup DisjointSet
431  *
432  * @{
433  */
434 
435 /** creates a disjoint set (union find) structure \p djset for \p ncomponents many components (of size one) */
438  SCIP* scip, /**< SCIP data structure */
439  SCIP_DISJOINTSET** djset, /**< disjoint set (union find) data structure */
440  int ncomponents /**< number of components */
441  );
442 
443 /** frees the disjoint set (union find) data structure */
446  SCIP* scip, /**< SCIP data structure */
447  SCIP_DISJOINTSET** djset /**< pointer to disjoint set (union find) data structure */
448  );
449 
450 /* @} */
451 
452 /**@addtogroup DirectedGraph
453  *
454  * @{
455  */
456 
457 /** creates directed graph structure */
460  SCIP* scip, /**< SCIP data structure */
461  SCIP_DIGRAPH** digraph, /**< pointer to store the created directed graph */
462  int nnodes /**< number of nodes */
463  );
464 
465 /**! [SnippetCodeStyleComment] */
466 
467 /** copies directed graph structure
468  *
469  * The copying procedure uses the memory of the passed SCIP instance. The user must ensure that the digraph lives
470  * as most as long as the SCIP instance.
471  *
472  * @note The data in nodedata is copied verbatim. This possibly has to be adapted by the user.
473  */
476  SCIP* scip, /**< SCIP data structure */
477  SCIP_DIGRAPH** targetdigraph, /**< pointer to store the copied directed graph */
478  SCIP_DIGRAPH* sourcedigraph /**< source directed graph */
479  );
480 
481 /**! [SnippetCodeStyleComment] */
482 /**@} */
483 
484 #ifdef __cplusplus
485 }
486 #endif
487 
488 #endif
SCIP_EXPORT int SCIPgetIntarrayMinIdx(SCIP *scip, SCIP_INTARRAY *intarray)
SCIP_EXPORT SCIP_RETCODE SCIPcreateDigraph(SCIP *scip, SCIP_DIGRAPH **digraph, int nnodes)
SCIP_EXPORT int SCIPgetRealarrayMaxIdx(SCIP *scip, SCIP_REALARRAY *realarray)
type definitions for miscellaneous datastructures
SCIP_EXPORT SCIP_RETCODE SCIPcreatePtrarray(SCIP *scip, SCIP_PTRARRAY **ptrarray)
SCIP_EXPORT SCIP_RETCODE SCIPsetPtrarrayVal(SCIP *scip, SCIP_PTRARRAY *ptrarray, int idx, void *val)
SCIP_EXPORT SCIP_RETCODE SCIPsetBoolarrayVal(SCIP *scip, SCIP_BOOLARRAY *boolarray, int idx, SCIP_Bool val)
SCIP_EXPORT SCIP_RETCODE SCIPincIntarrayVal(SCIP *scip, SCIP_INTARRAY *intarray, int idx, int incval)
SCIP_EXPORT SCIP_Bool SCIPgetBoolarrayVal(SCIP *scip, SCIP_BOOLARRAY *boolarray, int idx)
#define SCIP_EXPORT
Definition: def.h:98
SCIP_EXPORT SCIP_RETCODE SCIPcreateIntarray(SCIP *scip, SCIP_INTARRAY **intarray)
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_EXPORT int SCIPgetBoolarrayMaxIdx(SCIP *scip, SCIP_BOOLARRAY *boolarray)
SCIP_EXPORT SCIP_RETCODE SCIPincRealarrayVal(SCIP *scip, SCIP_REALARRAY *realarray, int idx, SCIP_Real incval)
type definitions for return codes for SCIP methods
SCIP_EXPORT SCIP_RETCODE SCIPclearRealarray(SCIP *scip, SCIP_REALARRAY *realarray)
SCIP_EXPORT SCIP_RETCODE SCIPcreateDisjointset(SCIP *scip, SCIP_DISJOINTSET **djset, int ncomponents)
SCIP_EXPORT SCIP_RETCODE SCIPextendRealarray(SCIP *scip, SCIP_REALARRAY *realarray, int minidx, int maxidx)
SCIP_EXPORT void SCIPfreeDisjointset(SCIP *scip, SCIP_DISJOINTSET **djset)
SCIP_EXPORT SCIP_RETCODE SCIPcreateRealarray(SCIP *scip, SCIP_REALARRAY **realarray)
SCIP_EXPORT SCIP_RETCODE SCIPsetIntarrayVal(SCIP *scip, SCIP_INTARRAY *intarray, int idx, int val)
SCIP_EXPORT SCIP_RETCODE SCIPextendIntarray(SCIP *scip, SCIP_INTARRAY *intarray, int minidx, int maxidx)
type definitions for SCIP&#39;s main datastructure
SCIP_EXPORT SCIP_RETCODE SCIPclearIntarray(SCIP *scip, SCIP_INTARRAY *intarray)
SCIP_EXPORT SCIP_RETCODE SCIPsetRealarrayVal(SCIP *scip, SCIP_REALARRAY *realarray, int idx, SCIP_Real val)
SCIP_EXPORT SCIP_RETCODE SCIPcopyDigraph(SCIP *scip, SCIP_DIGRAPH **targetdigraph, SCIP_DIGRAPH *sourcedigraph)
SCIP_EXPORT SCIP_RETCODE SCIPfreeIntarray(SCIP *scip, SCIP_INTARRAY **intarray)
#define SCIP_Bool
Definition: def.h:70
SCIP_EXPORT int SCIPgetPtrarrayMaxIdx(SCIP *scip, SCIP_PTRARRAY *ptrarray)
SCIP_EXPORT SCIP_RETCODE SCIPclearPtrarray(SCIP *scip, SCIP_PTRARRAY *ptrarray)
SCIP_EXPORT SCIP_Real SCIPgetRealarrayVal(SCIP *scip, SCIP_REALARRAY *realarray, int idx)
SCIP_EXPORT void * SCIPgetPtrarrayVal(SCIP *scip, SCIP_PTRARRAY *ptrarray, int idx)
SCIP_EXPORT int SCIPgetIntarrayVal(SCIP *scip, SCIP_INTARRAY *intarray, int idx)
SCIP_EXPORT SCIP_RETCODE SCIPfreeRealarray(SCIP *scip, SCIP_REALARRAY **realarray)
SCIP_EXPORT SCIP_RETCODE SCIPfreePtrarray(SCIP *scip, SCIP_PTRARRAY **ptrarray)
#define SCIP_Real
Definition: def.h:164
SCIP_EXPORT SCIP_RETCODE SCIPcreateBoolarray(SCIP *scip, SCIP_BOOLARRAY **boolarray)
SCIP_EXPORT int SCIPgetPtrarrayMinIdx(SCIP *scip, SCIP_PTRARRAY *ptrarray)
SCIP_EXPORT SCIP_RETCODE SCIPextendPtrarray(SCIP *scip, SCIP_PTRARRAY *ptrarray, int minidx, int maxidx)
SCIP_EXPORT int SCIPgetIntarrayMaxIdx(SCIP *scip, SCIP_INTARRAY *intarray)
#define nnodes
Definition: gastrans.c:65
common defines and data types used in all packages of SCIP
SCIP_EXPORT SCIP_RETCODE SCIPfreeBoolarray(SCIP *scip, SCIP_BOOLARRAY **boolarray)
SCIP_EXPORT int SCIPgetBoolarrayMinIdx(SCIP *scip, SCIP_BOOLARRAY *boolarray)
SCIP_EXPORT SCIP_RETCODE SCIPextendBoolarray(SCIP *scip, SCIP_BOOLARRAY *boolarray, int minidx, int maxidx)
SCIP_EXPORT int SCIPgetRealarrayMinIdx(SCIP *scip, SCIP_REALARRAY *realarray)
SCIP_EXPORT SCIP_RETCODE SCIPclearBoolarray(SCIP *scip, SCIP_BOOLARRAY *boolarray)