Scippy

SCIP

Solving Constraint Integer Programs

pattern.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-2018 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 pattern.h
17  * @brief pattern data for ringpacking problem
18  * @author Benjamin Mueller
19  */
20 
21 /*---+----1----+----2----+----3----+----4----+----5----+----6----+----7----+----8----+----9----+----0----+----1----+----2*/
22 
23 #ifndef __SCIP_PATTERN__
24 #define __SCIP_PATTERN__
25 
26 #include "scip/scip.h"
27 
28 /*
29  * data structures
30  */
31 
33 {
34  SCIP_PACKABLE_NO = 0, /**< pattern is definitely packable */
35  SCIP_PACKABLE_YES = 1, /**< pattern is definitely not packable */
36  SCIP_PACKABLE_UNKNOWN = 2 /**< it is unknown whether pattern is packable */
37 };
39 
41 {
42  SCIP_PATTERNTYPE_CIRCULAR = 0, /**< circular pattern */
43  SCIP_PATTERNTYPE_RECTANGULAR = 1 /**< rectangular pattern */
44 };
46 
48 {
49  BMS_BLKMEM* blkmem; /**< block memory */
50  SCIP_PATTERNTYPE patterntype; /**< pattern type */
51  SCIP_PACKABLE packable; /**< packable status */
52  SCIP_Real* xs; /**< array containing the x-coordinate of each element */
53  SCIP_Real* ys; /**< array containing the y-coordinate of each element */
54  int* types; /**< array storing the type of each element */
55  int size; /**< size of types, xs, and ys arrays */
56  int nelems; /**< number of elements stored */
57  int nlocks; /**< number of locks */
58  int type; /**< type of the boundary circle */
59 };
60 typedef struct SCIP_Pattern SCIP_PATTERN;
61 
62 /** creates an empty circular pattern */
63 extern
65  SCIP* scip, /**< SCIP data structure */
66  SCIP_PATTERN** pattern, /**< pointer to store pattern */
67  int type /**< circle type (not needed for rectangular patterns) */
68  );
69 
70 /** creates an empty rectangular pattern */
71 extern
73  SCIP* scip, /**< SCIP data structure */
74  SCIP_PATTERN** pattern /**< pointer to store pattern */
75  );
76 
77 /** captures a pattern */
78 extern
80  SCIP_PATTERN* pattern /**< pattern */
81  );
82 
83 /* frees a pattern */
84 extern
86  SCIP* scip, /**< SCIP data structure */
87  SCIP_PATTERN** pattern /**< pointer to free pattern */
88  );
89 
90 /** copies a pattern */
91 extern
93  SCIP* scip, /**< SCIP data structure */
94  SCIP_PATTERN* pattern, /**< pattern to copy */
95  SCIP_PATTERN** copy /**< pointer to store the copy */
96  );
97 
98 /** adds an element of a given type to a pattern; packable status does not change */
99 extern
101  SCIP_PATTERN* pattern, /**< pattern */
102  int type, /**< element of a given type */
103  SCIP_Real x, /**< x-coordinate (SCIP_INVALID: unknown) */
104  SCIP_Real y /**< y-coordinate (SCIP_INVALID: unknown) */
105  );
106 
107 /** removes the last k elements */
108 extern
110  SCIP_PATTERN* pattern, /**< pattern */
111  int k /**< number of elements to remove */
112  );
113 
114 /** returns the total number of elements of a given type in the pattern */
115 extern
117  SCIP_PATTERN* pattern /**< pattern */
118  );
119 
120 /** returns the type of the i-th element */
121 extern
123  SCIP_PATTERN* pattern, /**< pattern */
124  int i /**< i-th element */
125  );
126 
127 /** returns the total number of elements of a given type */
128 extern
130  SCIP_PATTERN* pattern, /**< pattern */
131  int type /**< type */
132  );
133 
134 /** returns the x-coordinate of an element */
135 extern
137  SCIP_PATTERN* pattern, /**< pattern */
138  int elem /**< index of the element */
139  );
140 
141 /** returns the y-coordinate of an element */
143  SCIP_PATTERN* pattern, /**< pattern */
144  int elem /**< index of the element */
145  );
146 
147 /** sets the (x,y) position of an element */
148 extern
150  SCIP_PATTERN* pattern, /**< pattern */
151  int elem, /**< index of the element */
152  SCIP_Real x, /**< x-coordinate */
153  SCIP_Real y /**< y-coordinate */
154  );
155 
156 /** returns the type of a pattern */
157 extern
159  SCIP_PATTERN* pattern /**< pattern */
160  );
161 
162 /** returns the type of the boundary circle
163  *
164  * @note this function can only be called for circular patterns
165  */
166 extern
168  SCIP_PATTERN *pattern /**< pattern */
169 );
170 
171 /** sets the type of the boundary circle
172  *
173  * @note this function can only be called for circular patterns
174  */
175 extern
176 void SCIPpatternSetType(
177  SCIP_PATTERN* pattern, /**< pattern */
178  int type /**< type */
179  );
180 
181 /** returns the packable status of a pattern */
182 extern
184  SCIP_PATTERN* pattern /**< pattern */
185  );
186 
187 /** sets the packable status of a pattern */
188 extern
190  SCIP_PATTERN* pattern, /**< pattern */
191  SCIP_PACKABLE packable /**< packable status */
192  );
193 
194 #endif /* __SCIP_PATTERN__ */
SCIP_RETCODE SCIPpatternCreateCircular(SCIP *scip, SCIP_PATTERN **pattern, int type)
Definition: pattern.c:88
int SCIPpatternGetCircleType(SCIP_PATTERN *pattern)
Definition: pattern.c:300
int SCIPpatternGetNElemens(SCIP_PATTERN *pattern)
Definition: pattern.c:206
SCIP_PACKABLE packable
Definition: pattern.h:51
SCIP_Patterntype
Definition: pattern.h:40
enum SCIP_Packable SCIP_PACKABLE
Definition: pattern.h:38
enum SCIP_Patterntype SCIP_PATTERNTYPE
Definition: pattern.h:45
void SCIPpatternCapture(SCIP_PATTERN *pattern)
Definition: pattern.c:107
int type
Definition: pattern.h:58
SCIP_PACKABLE SCIPpatternGetPackableStatus(SCIP_PATTERN *pattern)
Definition: pattern.c:326
SCIP_PATTERNTYPE patterntype
Definition: pattern.h:50
enum SCIP_Retcode SCIP_RETCODE
Definition: type_retcode.h:53
SCIP_RETCODE SCIPpatternCopy(SCIP *scip, SCIP_PATTERN *pattern, SCIP_PATTERN **copy)
Definition: pattern.c:143
SCIP_Real * xs
Definition: pattern.h:52
int nlocks
Definition: pattern.h:57
SCIP_VAR ** x
Definition: circlepacking.c:54
SCIP_Real * ys
Definition: pattern.h:53
SCIP_Real SCIPpatternGetElementPosY(SCIP_PATTERN *pattern, int elem)
Definition: pattern.c:260
int * types
Definition: pattern.h:54
void SCIPpatternRelease(SCIP *scip, SCIP_PATTERN **pattern)
Definition: pattern.c:117
int SCIPpatternCountElements(SCIP_PATTERN *pattern, int type)
Definition: pattern.c:228
void SCIPpatternRemoveLastElements(SCIP_PATTERN *pattern, int k)
Definition: pattern.c:194
void SCIPpatternSetType(SCIP_PATTERN *pattern, int type)
Definition: pattern.c:314
int SCIPpatternGetElementType(SCIP_PATTERN *pattern, int i)
Definition: pattern.c:216
SCIP_Real SCIPpatternGetElementPosX(SCIP_PATTERN *pattern, int elem)
Definition: pattern.c:248
SCIP_RETCODE SCIPpatternAddElement(SCIP_PATTERN *pattern, int type, SCIP_Real x, SCIP_Real y)
Definition: pattern.c:173
#define SCIP_Real
Definition: def.h:150
SCIP_VAR ** y
Definition: circlepacking.c:55
void SCIPpatternSetElementPos(SCIP_PATTERN *pattern, int elem, SCIP_Real x, SCIP_Real y)
Definition: pattern.c:272
SCIP_RETCODE SCIPpatternCreateRectangular(SCIP *scip, SCIP_PATTERN **pattern)
Definition: pattern.c:98
SCIP_Packable
Definition: pattern.h:32
struct BMS_BlkMem BMS_BLKMEM
Definition: memory.h:419
int size
Definition: pattern.h:55
void SCIPpatternSetPackableStatus(SCIP_PATTERN *pattern, SCIP_PACKABLE packable)
Definition: pattern.c:336
SCIP callable library.
BMS_BLKMEM * blkmem
Definition: pattern.h:49
int nelems
Definition: pattern.h:56
SCIP_PATTERNTYPE SCIPpatternGetPatternType(SCIP_PATTERN *pattern)
Definition: pattern.c:287