Biddy  1.7.1
An academic Binary Decision Diagrams package
biddy-example-independence-europe.c
1 /* $Revision: 171 $ */
2 /* $Date: 2016-07-02 17:41:54 +0200 (sob, 02 jul 2016) $ */
3 /* This file (biddy-example-independence-europe.c) is a C file */
4 /* Author: Robert Meolic (robert.meolic@um.si) */
5 /* This file has been released into the public domain by the author. */
6 
7 /* data were composed by Robert Meolic, 2016 */
8 
9 /* CODES IN ALPHABETICAL ORDER */
10 #define CODES "AD,AL,AT,AZ,BA,BE,BG,BY,CH,CZ,DE,DK,EE,ES,FI,FR,GB,GE,GR,HR,HU,IE,IT,KZ,LI,LT,LU,LV,MC,MD,ME,MK,NL,NO,PL,PT,RO,RS,RU,SE,SI,SK,SM,TR,UA,VA"
11 
12 /* THIS LIST MUST BE IN THE SAME (ALPHABETICAL) ORDER */
13 #define AD 0
14 #define AL 1
15 #define AT 2
16 #define AZ 3
17 #define BA 4
18 #define BE 5
19 #define BG 6
20 #define BY 7
21 #define CH 8
22 #define CZ 9
23 #define DE 10
24 #define DK 11
25 #define EE 12
26 #define ES 13
27 #define FI 14
28 #define FR 15
29 #define GB 16
30 #define GE 17
31 #define GR 18
32 #define HR 19
33 #define HU 20
34 #define IE 21
35 #define IT 22
36 #define KZ 23
37 #define LI 24
38 #define LT 25
39 #define LU 26
40 #define LV 27
41 #define MC 28
42 #define MD 29
43 #define ME 30
44 #define MK 31
45 #define NL 32
46 #define NO 33
47 #define PL 34
48 #define PT 35
49 #define RO 36
50 #define RS 37
51 #define RU 38
52 #define SE 39
53 #define SI 40
54 #define SK 41
55 #define SM 42
56 #define TR 43
57 #define UA 44
58 #define VA 45
59 
60 # include <stdio.h>
61 # include <stdlib.h>
62 # include <stdint.h>
63 # include <string.h>
64 # include <ctype.h>
65 # include <stdarg.h>
66 
67 void setDataEurope(unsigned int *size, unsigned int ***europe, unsigned int **order, char **codes) {
68 
69  unsigned int i,j;
70 
71  /* initialorder1: ALPHABETICAL ORDER - THERE ARE xxxxxx NODES (xxxxxx IF USING COMPLEMENT EDGES) IN BDD FOR INDEPENDENCE SETS */
72 
73  unsigned int initialorder1[] = {AD,AL,AT,AZ,BA,BE,BG,BY,CH,CZ,DE,DK,EE,ES,FI,FR,GB,GE,GR,HR,HU,IE,IT,KZ,LI,LT,LU,LV,MC,MD,ME,MK,NL,NO,PL,PT,RO,RS,RU,SE,SI,SK,SM,TR,UA,VA};
74 
75  *size = 46;
76 
77  /* THIS LIST MUST BE IN ALPHABETICAL ORDER */
78  *codes = strdup(CODES);
79 
80  *order = (unsigned int *) malloc((*size)*sizeof(unsigned int));
81  for (i=0; i<(*size); i++) {
82  (*order)[i] = initialorder1[i];
83  }
84 
85  *europe = (unsigned int **) malloc((*size)*sizeof(unsigned int *));
86  for (i=0; i<(*size); i++) {
87  (*europe)[i] = (unsigned int *) malloc((*size)*sizeof(unsigned int));
88  }
89 
90  for (i=0; i<(*size); i++) {
91  for (j=0; j<(*size); j++) {
92  (*europe)[i][j] = 0;
93  }
94  }
95 
96 
97  (*europe)[AD][ES]=1;
98  (*europe)[AD][FR]=1;
99  (*europe)[AL][GR]=1;
100  (*europe)[AL][ME]=1;
101  (*europe)[AL][MK]=1;
102  (*europe)[AL][RS]=1;
103  (*europe)[AT][CH]=1;
104  (*europe)[AT][CZ]=1;
105  (*europe)[AT][DE]=1;
106  (*europe)[AT][HU]=1;
107  (*europe)[AT][IT]=1;
108  (*europe)[AT][LI]=1;
109  (*europe)[AT][SI]=1;
110  (*europe)[AT][SK]=1;
111  (*europe)[AZ][GE]=1;
112  (*europe)[AZ][RU]=1;
113  (*europe)[BA][HR]=1;
114  (*europe)[BA][ME]=1;
115  (*europe)[BA][RS]=1;
116  (*europe)[BE][DE]=1;
117  (*europe)[BE][FR]=1;
118  (*europe)[BE][LU]=1;
119  (*europe)[BE][NL]=1;
120  (*europe)[BG][GR]=1;
121  (*europe)[BG][MK]=1;
122  (*europe)[BG][RO]=1;
123  (*europe)[BG][RS]=1;
124  (*europe)[BG][TR]=1;
125  (*europe)[BY][LT]=1;
126  (*europe)[BY][LV]=1;
127  (*europe)[BY][PL]=1;
128  (*europe)[BY][RU]=1;
129  (*europe)[BY][UA]=1;
130  (*europe)[CH][DE]=1;
131  (*europe)[CH][FR]=1;
132  (*europe)[CH][IT]=1;
133  (*europe)[CH][LI]=1;
134  (*europe)[CZ][DE]=1;
135  (*europe)[CZ][PL]=1;
136  (*europe)[CZ][SK]=1;
137  (*europe)[DE][DK]=1;
138  (*europe)[DE][FR]=1;
139  (*europe)[DE][LU]=1;
140  (*europe)[DE][NL]=1;
141  (*europe)[DE][PL]=1;
142  (*europe)[EE][LV]=1;
143  (*europe)[EE][RU]=1;
144  (*europe)[ES][FR]=1;
145  (*europe)[ES][PT]=1;
146  (*europe)[FI][NO]=1;
147  (*europe)[FI][RU]=1;
148  (*europe)[FI][SE]=1;
149  (*europe)[FR][IT]=1;
150  (*europe)[FR][LU]=1;
151  (*europe)[FR][MC]=1;
152  (*europe)[GB][IE]=1;
153  (*europe)[GE][RU]=1;
154  (*europe)[GE][TR]=1;
155  (*europe)[GR][MK]=1;
156  (*europe)[GR][TR]=1;
157  (*europe)[HR][HU]=1;
158  (*europe)[HR][ME]=1;
159  (*europe)[HR][RS]=1;
160  (*europe)[HR][SI]=1;
161  (*europe)[HU][RO]=1;
162  (*europe)[HU][RS]=1;
163  (*europe)[HU][SI]=1;
164  (*europe)[HU][SK]=1;
165  (*europe)[HU][UA]=1;
166  (*europe)[IT][SI]=1;
167  (*europe)[IT][SM]=1;
168  (*europe)[IT][VA]=1;
169  (*europe)[KZ][RU]=1;
170  (*europe)[LT][LV]=1;
171  (*europe)[LT][PL]=1;
172  (*europe)[LT][RU]=1;
173  (*europe)[LV][RU]=1;
174  (*europe)[MD][RO]=1;
175  (*europe)[MD][UA]=1;
176  (*europe)[ME][RS]=1;
177  (*europe)[MK][RS]=1;
178  (*europe)[NO][RU]=1;
179  (*europe)[NO][SE]=1;
180  (*europe)[PL][RU]=1;
181  (*europe)[PL][SK]=1;
182  (*europe)[PL][UA]=1;
183  (*europe)[RO][RS]=1;
184  (*europe)[RO][UA]=1;
185  (*europe)[RU][UA]=1;
186  (*europe)[SE][FI]=1;
187  (*europe)[SE][NO]=1;
188  (*europe)[SK][UA]=1;
189 
190  for (i=0; i<(*size); i++) {
191  for (j=0; j<(*size); j++) {
192  if ((*europe)[j][i]) (*europe)[i][j]=1;
193  }
194  }
195 
196 }