0
64
6
| 1 |
%!PS-Adobe-3.0 EPSF-3.0 |
|
| 2 |
%%BoundingBox: 15 18 829 570 |
|
| 3 |
%%HiResBoundingBox: 15.1913 18.4493 828.078 569.438 |
|
| 4 |
%%Creator: Karbon14 EPS Exportfilter 0.5 |
|
| 5 |
%%CreationDate: (04/15/06 15:20:26) |
|
| 6 |
%%For: (Balazs Dezso) () |
|
| 7 |
%%Title: () |
|
| 8 |
|
|
| 9 |
/N {newpath} def
|
|
| 10 |
/C {closepath} def
|
|
| 11 |
/m {moveto} def
|
|
| 12 |
/c {curveto} def
|
|
| 13 |
/l {lineto} def
|
|
| 14 |
/s {stroke} def
|
|
| 15 |
/f {fill} def
|
|
| 16 |
/w {setlinewidth} def
|
|
| 17 |
/d {setdash} def
|
|
| 18 |
/r {setrgbcolor} def
|
|
| 19 |
/S {gsave} def
|
|
| 20 |
/R {grestore} def
|
|
| 21 |
|
|
| 22 |
N |
|
| 23 |
251.402 32.047 m |
|
| 24 |
532.945 293.946 814.484 555.844 814.484 555.844 c |
|
| 25 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 26 |
|
|
| 27 |
N |
|
| 28 |
749.012 32.047 m |
|
| 29 |
742.465 293.946 735.918 555.844 735.918 555.844 c |
|
| 30 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 31 |
|
|
| 32 |
N |
|
| 33 |
539.492 32.047 m |
|
| 34 |
637.703 293.946 735.918 555.844 735.918 555.844 c |
|
| 35 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 36 |
|
|
| 37 |
N |
|
| 38 |
172.832 32.047 m |
|
| 39 |
454.375 293.946 735.918 555.844 735.918 555.844 c |
|
| 40 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 41 |
|
|
| 42 |
N |
|
| 43 |
107.355 32.047 m |
|
| 44 |
421.637 293.946 735.918 555.844 735.918 555.844 c |
|
| 45 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 46 |
|
|
| 47 |
N |
|
| 48 |
644.25 555.844 m |
|
| 49 |
696.633 293.946 749.012 32.047 749.012 32.047 c |
|
| 50 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 51 |
|
|
| 52 |
N |
|
| 53 |
474.016 555.844 m |
|
| 54 |
611.516 293.946 749.012 32.047 749.012 32.047 c |
|
| 55 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 56 |
|
|
| 57 |
N |
|
| 58 |
683.535 32.047 m |
|
| 59 |
663.894 293.946 644.25 555.844 644.25 555.844 c |
|
| 60 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 61 |
|
|
| 62 |
N |
|
| 63 |
120.453 555.844 m |
|
| 64 |
401.992 293.946 683.535 32.047 683.535 32.047 c |
|
| 65 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 66 |
|
|
| 67 |
N |
|
| 68 |
28.7853 555.844 m |
|
| 69 |
356.16 293.946 683.535 32.047 683.535 32.047 c |
|
| 70 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 71 |
|
|
| 72 |
N |
|
| 73 |
539.492 32.047 m |
|
| 74 |
546.039 293.946 552.586 555.844 552.586 555.844 c |
|
| 75 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 76 |
|
|
| 77 |
N |
|
| 78 |
316.875 32.047 m |
|
| 79 |
349.613 293.946 382.351 555.844 382.351 555.844 c |
|
| 80 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 81 |
|
|
| 82 |
N |
|
| 83 |
107.355 32.047 m |
|
| 84 |
244.855 293.946 382.351 555.844 382.351 555.844 c |
|
| 85 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 86 |
|
|
| 87 |
N |
|
| 88 |
290.687 555.844 m |
|
| 89 |
375.805 293.946 460.922 32.047 460.922 32.047 c |
|
| 90 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 91 |
|
|
| 92 |
N |
|
| 93 |
120.453 555.844 m |
|
| 94 |
290.687 293.946 460.922 32.047 460.922 32.047 c |
|
| 95 |
[] 0 d 0 0 0 r 1.96407 w s |
|
| 96 |
|
|
| 97 |
N |
|
| 98 |
172.832 32.047 m |
|
| 99 |
146.64 293.946 120.453 555.844 120.453 555.844 c |
|
| 100 |
[] 0 d 1 0 0 r 3.92814 w s |
|
| 101 |
|
|
| 102 |
N |
|
| 103 |
15.6913 555.844 m |
|
| 104 |
15.6913 555.844 l |
|
| 105 |
15.6913 548.614 21.5553 542.75 28.7853 542.75 c |
|
| 106 |
36.0163 542.75 41.8833 548.614 41.8833 555.844 c |
|
| 107 |
41.8833 563.075 36.0163 568.938 28.7853 568.938 c |
|
| 108 |
21.5553 568.938 15.6913 563.075 15.6913 555.844 c |
|
| 109 |
15.6913 555.844 l |
|
| 110 |
C |
|
| 111 |
S 0 0 0 r f R |
|
| 112 |
|
|
| 113 |
N |
|
| 114 |
16.8833 555.844 m |
|
| 115 |
16.8833 555.844 l |
|
| 116 |
16.8833 549.27 22.2113 543.942 28.7853 543.942 c |
|
| 117 |
35.3593 543.942 40.6913 549.27 40.6913 555.844 c |
|
| 118 |
40.6913 562.418 35.3593 567.747 28.7853 567.747 c |
|
| 119 |
22.2113 567.747 16.8833 562.418 16.8833 555.844 c |
|
| 120 |
16.8833 555.844 l |
|
| 121 |
C |
|
| 122 |
S 1 0.5 1 r f R |
|
| 123 |
|
|
| 124 |
N |
|
| 125 |
107.355 555.844 m |
|
| 126 |
107.355 555.844 l |
|
| 127 |
107.355 548.614 113.223 542.75 120.453 542.75 c |
|
| 128 |
127.683 542.75 133.547 548.614 133.547 555.844 c |
|
| 129 |
133.547 563.075 127.683 568.938 120.453 568.938 c |
|
| 130 |
113.223 568.938 107.355 563.075 107.355 555.844 c |
|
| 131 |
107.355 555.844 l |
|
| 132 |
C |
|
| 133 |
S 0 0 0 r f R |
|
| 134 |
|
|
| 135 |
N |
|
| 136 |
108.547 555.844 m |
|
| 137 |
108.547 555.844 l |
|
| 138 |
108.547 549.27 113.879 543.942 120.453 543.942 c |
|
| 139 |
127.027 543.942 132.355 549.27 132.355 555.844 c |
|
| 140 |
132.355 562.418 127.027 567.747 120.453 567.747 c |
|
| 141 |
113.879 567.747 108.547 562.418 108.547 555.844 c |
|
| 142 |
108.547 555.844 l |
|
| 143 |
C |
|
| 144 |
S 1 0 1 r f R |
|
| 145 |
|
|
| 146 |
N |
|
| 147 |
199.019 555.844 m |
|
| 148 |
199.019 555.844 l |
|
| 149 |
199.019 548.614 204.887 542.75 212.117 542.75 c |
|
| 150 |
219.348 542.75 225.211 548.614 225.211 555.844 c |
|
| 151 |
225.211 563.075 219.348 568.938 212.117 568.938 c |
|
| 152 |
204.887 568.938 199.019 563.075 199.019 555.844 c |
|
| 153 |
199.019 555.844 l |
|
| 154 |
C |
|
| 155 |
S 0 0 0 r f R |
|
| 156 |
|
|
| 157 |
N |
|
| 158 |
200.211 555.844 m |
|
| 159 |
200.211 555.844 l |
|
| 160 |
200.211 549.27 205.543 543.942 212.117 543.942 c |
|
| 161 |
218.691 543.942 224.019 549.27 224.019 555.844 c |
|
| 162 |
224.019 562.418 218.691 567.747 212.117 567.747 c |
|
| 163 |
205.543 567.747 200.211 562.418 200.211 555.844 c |
|
| 164 |
200.211 555.844 l |
|
| 165 |
C |
|
| 166 |
S 1 0.5 1 r f R |
|
| 167 |
|
|
| 168 |
N |
|
| 169 |
277.59 555.844 m |
|
| 170 |
277.59 555.844 l |
|
| 171 |
277.59 548.614 283.457 542.75 290.687 542.75 c |
|
| 172 |
297.918 542.75 303.781 548.614 303.781 555.844 c |
|
| 173 |
303.781 563.075 297.918 568.938 290.687 568.938 c |
|
| 174 |
283.457 568.938 277.59 563.075 277.59 555.844 c |
|
| 175 |
277.59 555.844 l |
|
| 176 |
C |
|
| 177 |
S 0 0 0 r f R |
|
| 178 |
|
|
| 179 |
N |
|
| 180 |
278.781 555.844 m |
|
| 181 |
278.781 555.844 l |
|
| 182 |
278.781 549.27 284.113 543.942 290.687 543.942 c |
|
| 183 |
297.262 543.942 302.59 549.27 302.59 555.844 c |
|
| 184 |
302.59 562.418 297.262 567.747 290.687 567.747 c |
|
| 185 |
284.113 567.747 278.781 562.418 278.781 555.844 c |
|
| 186 |
278.781 555.844 l |
|
| 187 |
C |
|
| 188 |
S 1 0 1 r f R |
|
| 189 |
|
|
| 190 |
N |
|
| 191 |
369.258 555.844 m |
|
| 192 |
369.258 555.844 l |
|
| 193 |
369.258 548.614 375.121 542.75 382.351 542.75 c |
|
| 194 |
389.582 542.75 395.445 548.614 395.445 555.844 c |
|
| 195 |
395.445 563.075 389.582 568.938 382.351 568.938 c |
|
| 196 |
375.121 568.938 369.258 563.075 369.258 555.844 c |
|
| 197 |
369.258 555.844 l |
|
| 198 |
C |
|
| 199 |
S 0 0 0 r f R |
|
| 200 |
|
|
| 201 |
N |
|
| 202 |
370.445 555.844 m |
|
| 203 |
370.445 555.844 l |
|
| 204 |
370.445 549.27 375.777 543.942 382.351 543.942 c |
|
| 205 |
388.926 543.942 394.258 549.27 394.258 555.844 c |
|
| 206 |
394.258 562.418 388.926 567.747 382.351 567.747 c |
|
| 207 |
375.777 567.747 370.445 562.418 370.445 555.844 c |
|
| 208 |
370.445 555.844 l |
|
| 209 |
C |
|
| 210 |
S 1 0 1 r f R |
|
| 211 |
|
|
| 212 |
N |
|
| 213 |
460.922 555.844 m |
|
| 214 |
460.922 555.844 l |
|
| 215 |
460.922 548.614 466.785 542.75 474.016 542.75 c |
|
| 216 |
481.246 542.75 487.109 548.614 487.109 555.844 c |
|
| 217 |
487.109 563.075 481.246 568.938 474.016 568.938 c |
|
| 218 |
466.785 568.938 460.922 563.075 460.922 555.844 c |
|
| 219 |
460.922 555.844 l |
|
| 220 |
C |
|
| 221 |
S 0 0 0 r f R |
|
| 222 |
|
|
| 223 |
N |
|
| 224 |
462.113 555.844 m |
|
| 225 |
462.113 555.844 l |
|
| 226 |
462.113 549.27 467.441 543.942 474.016 543.942 c |
|
| 227 |
480.59 543.942 485.922 549.27 485.922 555.844 c |
|
| 228 |
485.922 562.418 480.59 567.747 474.016 567.747 c |
|
| 229 |
467.441 567.747 462.113 562.418 462.113 555.844 c |
|
| 230 |
462.113 555.844 l |
|
| 231 |
C |
|
| 232 |
S 1 0.5 1 r f R |
|
| 233 |
|
|
| 234 |
N |
|
| 235 |
539.492 555.844 m |
|
| 236 |
539.492 555.844 l |
|
| 237 |
539.492 548.614 545.355 542.75 552.586 542.75 c |
|
| 238 |
559.816 542.75 565.68 548.614 565.68 555.844 c |
|
| 239 |
565.68 563.075 559.816 568.938 552.586 568.938 c |
|
| 240 |
545.355 568.938 539.492 563.075 539.492 555.844 c |
|
| 241 |
539.492 555.844 l |
|
| 242 |
C |
|
| 243 |
S 0 0 0 r f R |
|
| 244 |
|
|
| 245 |
N |
|
| 246 |
540.683 555.844 m |
|
| 247 |
540.683 555.844 l |
|
| 248 |
540.683 549.27 546.012 543.942 552.586 543.942 c |
|
| 249 |
559.16 543.942 564.492 549.27 564.492 555.844 c |
|
| 250 |
564.492 562.418 559.16 567.747 552.586 567.747 c |
|
| 251 |
546.012 567.747 540.683 562.418 540.683 555.844 c |
|
| 252 |
540.683 555.844 l |
|
| 253 |
C |
|
| 254 |
S 1 0 1 r f R |
|
| 255 |
|
|
| 256 |
N |
|
| 257 |
631.156 555.844 m |
|
| 258 |
631.156 555.844 l |
|
| 259 |
631.156 548.614 637.019 542.75 644.25 542.75 c |
|
| 260 |
651.48 542.75 657.348 548.614 657.348 555.844 c |
|
| 261 |
657.348 563.075 651.48 568.938 644.25 568.938 c |
|
| 262 |
637.019 568.938 631.156 563.075 631.156 555.844 c |
|
| 263 |
631.156 555.844 l |
|
| 264 |
C |
|
| 265 |
S 0 0 0 r f R |
|
| 266 |
|
|
| 267 |
N |
|
| 268 |
632.348 555.844 m |
|
| 269 |
632.348 555.844 l |
|
| 270 |
632.348 549.27 637.676 543.942 644.25 543.942 c |
|
| 271 |
650.824 543.942 656.156 549.27 656.156 555.844 c |
|
| 272 |
656.156 562.418 650.824 567.747 644.25 567.747 c |
|
| 273 |
637.676 567.747 632.348 562.418 632.348 555.844 c |
|
| 274 |
632.348 555.844 l |
|
| 275 |
C |
|
| 276 |
S 1 0.5 1 r f R |
|
| 277 |
|
|
| 278 |
N |
|
| 279 |
722.82 555.844 m |
|
| 280 |
722.82 555.844 l |
|
| 281 |
722.82 548.614 728.687 542.75 735.918 542.75 c |
|
| 282 |
743.149 542.75 749.012 548.614 749.012 555.844 c |
|
| 283 |
749.012 563.075 743.149 568.938 735.918 568.938 c |
|
| 284 |
728.687 568.938 722.82 563.075 722.82 555.844 c |
|
| 285 |
722.82 555.844 l |
|
| 286 |
C |
|
| 287 |
S 0 0 0 r f R |
|
| 288 |
|
|
| 289 |
N |
|
| 290 |
724.012 555.844 m |
|
| 291 |
724.012 555.844 l |
|
| 292 |
724.012 549.27 729.344 543.942 735.918 543.942 c |
|
| 293 |
742.492 543.942 747.82 549.27 747.82 555.844 c |
|
| 294 |
747.82 562.418 742.492 567.747 735.918 567.747 c |
|
| 295 |
729.344 567.747 724.012 562.418 724.012 555.844 c |
|
| 296 |
724.012 555.844 l |
|
| 297 |
C |
|
| 298 |
S 1 0 1 r f R |
|
| 299 |
|
|
| 300 |
N |
|
| 301 |
801.391 555.844 m |
|
| 302 |
801.391 555.844 l |
|
| 303 |
801.391 548.614 807.254 542.75 814.484 542.75 c |
|
| 304 |
821.715 542.75 827.578 548.614 827.578 555.844 c |
|
| 305 |
827.578 563.075 821.715 568.938 814.484 568.938 c |
|
| 306 |
807.254 568.938 801.391 563.075 801.391 555.844 c |
|
| 307 |
801.391 555.844 l |
|
| 308 |
C |
|
| 309 |
S 0 0 0 r f R |
|
| 310 |
|
|
| 311 |
N |
|
| 312 |
802.582 555.844 m |
|
| 313 |
802.582 555.844 l |
|
| 314 |
802.582 549.27 807.91 543.942 814.484 543.942 c |
|
| 315 |
821.059 543.942 826.387 549.27 826.387 555.844 c |
|
| 316 |
826.387 562.418 821.059 567.747 814.484 567.747 c |
|
| 317 |
807.91 567.747 802.582 562.418 802.582 555.844 c |
|
| 318 |
802.582 555.844 l |
|
| 319 |
C |
|
| 320 |
S 1 0 1 r f R |
|
| 321 |
|
|
| 322 |
N |
|
| 323 |
15.6913 32.047 m |
|
| 324 |
15.6913 32.047 l |
|
| 325 |
15.6913 24.8165 21.5553 18.9493 28.7853 18.9493 c |
|
| 326 |
36.0163 18.9493 41.8833 24.8165 41.8833 32.047 c |
|
| 327 |
41.8833 39.2775 36.0163 45.1407 28.7853 45.1407 c |
|
| 328 |
21.5553 45.1407 15.6913 39.2775 15.6913 32.047 c |
|
| 329 |
15.6913 32.047 l |
|
| 330 |
C |
|
| 331 |
S 0 0 0 r f R |
|
| 332 |
|
|
| 333 |
N |
|
| 334 |
16.8833 32.047 m |
|
| 335 |
16.8833 32.047 l |
|
| 336 |
16.8833 25.4728 22.2113 20.1407 28.7853 20.1407 c |
|
| 337 |
35.3593 20.1407 40.6913 25.4728 40.6913 32.047 c |
|
| 338 |
40.6913 38.6212 35.3593 43.9493 28.7853 43.9493 c |
|
| 339 |
22.2113 43.9493 16.8833 38.6212 16.8833 32.047 c |
|
| 340 |
16.8833 32.047 l |
|
| 341 |
C |
|
| 342 |
S 0.5 0.5 1 r f R |
|
| 343 |
|
|
| 344 |
N |
|
| 345 |
94.2623 32.047 m |
|
| 346 |
94.2623 32.047 l |
|
| 347 |
94.2623 24.8165 100.125 18.9493 107.355 18.9493 c |
|
| 348 |
114.586 18.9493 120.453 24.8165 120.453 32.047 c |
|
| 349 |
120.453 39.2775 114.586 45.1407 107.355 45.1407 c |
|
| 350 |
100.125 45.1407 94.2623 39.2775 94.2623 32.047 c |
|
| 351 |
94.2623 32.047 l |
|
| 352 |
C |
|
| 353 |
S 0 0 0 r f R |
|
| 354 |
|
|
| 355 |
N |
|
| 356 |
95.4533 32.047 m |
|
| 357 |
95.4533 32.047 l |
|
| 358 |
95.4533 25.4728 100.781 20.1407 107.355 20.1407 c |
|
| 359 |
113.93 20.1407 119.262 25.4728 119.262 32.047 c |
|
| 360 |
119.262 38.6212 113.93 43.9493 107.355 43.9493 c |
|
| 361 |
100.781 43.9493 95.4533 38.6212 95.4533 32.047 c |
|
| 362 |
95.4533 32.047 l |
|
| 363 |
C |
|
| 364 |
S 0.5 0.5 1 r f R |
|
| 365 |
|
|
| 366 |
N |
|
| 367 |
159.734 32.047 m |
|
| 368 |
159.734 32.047 l |
|
| 369 |
159.734 24.8165 165.601 18.9493 172.832 18.9493 c |
|
| 370 |
180.062 18.9493 185.926 24.8165 185.926 32.047 c |
|
| 371 |
185.926 39.2775 180.062 45.1407 172.832 45.1407 c |
|
| 372 |
165.601 45.1407 159.734 39.2775 159.734 32.047 c |
|
| 373 |
159.734 32.047 l |
|
| 374 |
C |
|
| 375 |
S 0 0 0 r f R |
|
| 376 |
|
|
| 377 |
N |
|
| 378 |
160.926 32.047 m |
|
| 379 |
160.926 32.047 l |
|
| 380 |
160.926 25.4728 166.258 20.1407 172.832 20.1407 c |
|
| 381 |
179.406 20.1407 184.734 25.4728 184.734 32.047 c |
|
| 382 |
184.734 38.6212 179.406 43.9493 172.832 43.9493 c |
|
| 383 |
166.258 43.9493 160.926 38.6212 160.926 32.047 c |
|
| 384 |
160.926 32.047 l |
|
| 385 |
C |
|
| 386 |
S 0.5 0.5 1 r f R |
|
| 387 |
|
|
| 388 |
N |
|
| 389 |
238.305 32.047 m |
|
| 390 |
238.305 32.047 l |
|
| 391 |
238.305 24.8165 244.172 18.9493 251.402 18.9493 c |
|
| 392 |
258.633 18.9493 264.496 24.8165 264.496 32.047 c |
|
| 393 |
264.496 39.2775 258.633 45.1407 251.402 45.1407 c |
|
| 394 |
244.172 45.1407 238.305 39.2775 238.305 32.047 c |
|
| 395 |
238.305 32.047 l |
|
| 396 |
C |
|
| 397 |
S 0 0 0 r f R |
|
| 398 |
|
|
| 399 |
N |
|
| 400 |
239.496 32.047 m |
|
| 401 |
239.496 32.047 l |
|
| 402 |
239.496 25.4728 244.828 20.1407 251.402 20.1407 c |
|
| 403 |
257.976 20.1407 263.305 25.4728 263.305 32.047 c |
|
| 404 |
263.305 38.6212 257.976 43.9493 251.402 43.9493 c |
|
| 405 |
244.828 43.9493 239.496 38.6212 239.496 32.047 c |
|
| 406 |
239.496 32.047 l |
|
| 407 |
C |
|
| 408 |
S 0.5 0.5 1 r f R |
|
| 409 |
|
|
| 410 |
N |
|
| 411 |
303.781 32.047 m |
|
| 412 |
303.781 32.047 l |
|
| 413 |
303.781 24.8165 309.644 18.9493 316.875 18.9493 c |
|
| 414 |
324.105 18.9493 329.973 24.8165 329.973 32.047 c |
|
| 415 |
329.973 39.2775 324.105 45.1407 316.875 45.1407 c |
|
| 416 |
309.644 45.1407 303.781 39.2775 303.781 32.047 c |
|
| 417 |
303.781 32.047 l |
|
| 418 |
C |
|
| 419 |
S 0 0 0 r f R |
|
| 420 |
|
|
| 421 |
N |
|
| 422 |
304.973 32.047 m |
|
| 423 |
304.973 32.047 l |
|
| 424 |
304.973 25.4728 310.301 20.1407 316.875 20.1407 c |
|
| 425 |
323.449 20.1407 328.781 25.4728 328.781 32.047 c |
|
| 426 |
328.781 38.6212 323.449 43.9493 316.875 43.9493 c |
|
| 427 |
310.301 43.9493 304.973 38.6212 304.973 32.047 c |
|
| 428 |
304.973 32.047 l |
|
| 429 |
C |
|
| 430 |
S 0.5 0.5 1 r f R |
|
| 431 |
|
|
| 432 |
N |
|
| 433 |
382.351 32.047 m |
|
| 434 |
382.351 32.047 l |
|
| 435 |
382.351 24.8165 388.215 18.9493 395.445 18.9493 c |
|
| 436 |
402.676 18.9493 408.543 24.8165 408.543 32.047 c |
|
| 437 |
408.543 39.2775 402.676 45.1407 395.445 45.1407 c |
|
| 438 |
388.215 45.1407 382.351 39.2775 382.351 32.047 c |
|
| 439 |
382.351 32.047 l |
|
| 440 |
C |
|
| 441 |
S 0 0 0 r f R |
|
| 442 |
|
|
| 443 |
N |
|
| 444 |
383.543 32.047 m |
|
| 445 |
383.543 32.047 l |
|
| 446 |
383.543 25.4728 388.871 20.1407 395.445 20.1407 c |
|
| 447 |
402.019 20.1407 407.351 25.4728 407.351 32.047 c |
|
| 448 |
407.351 38.6212 402.019 43.9493 395.445 43.9493 c |
|
| 449 |
388.871 43.9493 383.543 38.6212 383.543 32.047 c |
|
| 450 |
383.543 32.047 l |
|
| 451 |
C |
|
| 452 |
S 0.5 0.5 1 r f R |
|
| 453 |
|
|
| 454 |
N |
|
| 455 |
447.828 32.047 m |
|
| 456 |
447.828 32.047 l |
|
| 457 |
447.828 24.8165 453.691 18.9493 460.922 18.9493 c |
|
| 458 |
468.152 18.9493 474.016 24.8165 474.016 32.047 c |
|
| 459 |
474.016 39.2775 468.152 45.1407 460.922 45.1407 c |
|
| 460 |
453.691 45.1407 447.828 39.2775 447.828 32.047 c |
|
| 461 |
447.828 32.047 l |
|
| 462 |
C |
|
| 463 |
S 0 0 0 r f R |
|
| 464 |
|
|
| 465 |
N |
|
| 466 |
449.016 32.047 m |
|
| 467 |
449.016 32.047 l |
|
| 468 |
449.016 25.4728 454.348 20.1407 460.922 20.1407 c |
|
| 469 |
467.496 20.1407 472.824 25.4728 472.824 32.047 c |
|
| 470 |
472.824 38.6212 467.496 43.9493 460.922 43.9493 c |
|
| 471 |
454.348 43.9493 449.016 38.6212 449.016 32.047 c |
|
| 472 |
449.016 32.047 l |
|
| 473 |
C |
|
| 474 |
S 0.5 0.5 1 r f R |
|
| 475 |
|
|
| 476 |
N |
|
| 477 |
526.394 32.047 m |
|
| 478 |
526.394 32.047 l |
|
| 479 |
526.394 24.8165 532.262 18.9493 539.492 18.9493 c |
|
| 480 |
546.723 18.9493 552.586 24.8165 552.586 32.047 c |
|
| 481 |
552.586 39.2775 546.723 45.1407 539.492 45.1407 c |
|
| 482 |
532.262 45.1407 526.394 39.2775 526.394 32.047 c |
|
| 483 |
526.394 32.047 l |
|
| 484 |
C |
|
| 485 |
S 0 0 0 r f R |
|
| 486 |
|
|
| 487 |
N |
|
| 488 |
527.586 32.047 m |
|
| 489 |
527.586 32.047 l |
|
| 490 |
527.586 25.4728 532.918 20.1407 539.492 20.1407 c |
|
| 491 |
546.066 20.1407 551.394 25.4728 551.394 32.047 c |
|
| 492 |
551.394 38.6212 546.066 43.9493 539.492 43.9493 c |
|
| 493 |
532.918 43.9493 527.586 38.6212 527.586 32.047 c |
|
| 494 |
527.586 32.047 l |
|
| 495 |
C |
|
| 496 |
S 0.5 0.5 1 r f R |
|
| 497 |
|
|
| 498 |
N |
|
| 499 |
591.871 32.047 m |
|
| 500 |
591.871 32.047 l |
|
| 501 |
591.871 24.8165 597.734 18.9493 604.965 18.9493 c |
|
| 502 |
612.195 18.9493 618.062 24.8165 618.062 32.047 c |
|
| 503 |
618.062 39.2775 612.195 45.1407 604.965 45.1407 c |
|
| 504 |
597.734 45.1407 591.871 39.2775 591.871 32.047 c |
|
| 505 |
591.871 32.047 l |
|
| 506 |
C |
|
| 507 |
S 0 0 0 r f R |
|
| 508 |
|
|
| 509 |
N |
|
| 510 |
593.062 32.047 m |
|
| 511 |
593.062 32.047 l |
|
| 512 |
593.062 25.4728 598.39 20.1407 604.965 20.1407 c |
|
| 513 |
611.539 20.1407 616.871 25.4728 616.871 32.047 c |
|
| 514 |
616.871 38.6212 611.539 43.9493 604.965 43.9493 c |
|
| 515 |
598.39 43.9493 593.062 38.6212 593.062 32.047 c |
|
| 516 |
593.062 32.047 l |
|
| 517 |
C |
|
| 518 |
S 0.5 0.5 1 r f R |
|
| 519 |
|
|
| 520 |
N |
|
| 521 |
670.441 32.047 m |
|
| 522 |
670.441 32.047 l |
|
| 523 |
670.441 24.8165 676.305 18.9493 683.535 18.9493 c |
|
| 524 |
690.766 18.9493 696.633 24.8165 696.633 32.047 c |
|
| 525 |
696.633 39.2775 690.766 45.1407 683.535 45.1407 c |
|
| 526 |
676.305 45.1407 670.441 39.2775 670.441 32.047 c |
|
| 527 |
670.441 32.047 l |
|
| 528 |
C |
|
| 529 |
S 0 0 0 r f R |
|
| 530 |
|
|
| 531 |
N |
|
| 532 |
671.633 32.047 m |
|
| 533 |
671.633 32.047 l |
|
| 534 |
671.633 25.4728 676.961 20.1407 683.535 20.1407 c |
|
| 535 |
690.109 20.1407 695.441 25.4728 695.441 32.047 c |
|
| 536 |
695.441 38.6212 690.109 43.9493 683.535 43.9493 c |
|
| 537 |
676.961 43.9493 671.633 38.6212 671.633 32.047 c |
|
| 538 |
671.633 32.047 l |
|
| 539 |
C |
|
| 540 |
S 0 0 1 r f R |
|
| 541 |
|
|
| 542 |
N |
|
| 543 |
735.918 32.047 m |
|
| 544 |
735.918 32.047 l |
|
| 545 |
735.918 24.8165 741.781 18.9493 749.012 18.9493 c |
|
| 546 |
756.242 18.9493 762.106 24.8165 762.106 32.047 c |
|
| 547 |
762.106 39.2775 756.242 45.1407 749.012 45.1407 c |
|
| 548 |
741.781 45.1407 735.918 39.2775 735.918 32.047 c |
|
| 549 |
735.918 32.047 l |
|
| 550 |
C |
|
| 551 |
S 0 0 0 r f R |
|
| 552 |
|
|
| 553 |
N |
|
| 554 |
737.105 32.047 m |
|
| 555 |
737.105 32.047 l |
|
| 556 |
737.105 25.4728 742.437 20.1407 749.012 20.1407 c |
|
| 557 |
755.586 20.1407 760.914 25.4728 760.914 32.047 c |
|
| 558 |
760.914 38.6212 755.586 43.9493 749.012 43.9493 c |
|
| 559 |
742.437 43.9493 737.105 38.6212 737.105 32.047 c |
|
| 560 |
737.105 32.047 l |
|
| 561 |
C |
|
| 562 |
S 0 0 1 r f R |
|
| 563 |
|
|
| 564 |
N |
|
| 565 |
801.391 32.047 m |
|
| 566 |
801.391 32.047 l |
|
| 567 |
801.391 24.8165 807.254 18.9493 814.484 18.9493 c |
|
| 568 |
821.715 18.9493 827.578 24.8165 827.578 32.047 c |
|
| 569 |
827.578 39.2775 821.715 45.1407 814.484 45.1407 c |
|
| 570 |
807.254 45.1407 801.391 39.2775 801.391 32.047 c |
|
| 571 |
801.391 32.047 l |
|
| 572 |
C |
|
| 573 |
S 0 0 0 r f R |
|
| 574 |
|
|
| 575 |
N |
|
| 576 |
802.582 32.047 m |
|
| 577 |
802.582 32.047 l |
|
| 578 |
802.582 25.4728 807.91 20.1407 814.484 20.1407 c |
|
| 579 |
821.059 20.1407 826.387 25.4728 826.387 32.047 c |
|
| 580 |
826.387 38.6212 821.059 43.9493 814.484 43.9493 c |
|
| 581 |
807.91 43.9493 802.582 38.6212 802.582 32.047 c |
|
| 582 |
802.582 32.047 l |
|
| 583 |
C |
|
| 584 |
S 0.5 0.5 1 r f R |
|
| 585 |
|
|
| 586 |
%%EOF |
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Tue Nov 15 16:51:43 2005 |
|
| 4 |
%%BoundingBox: 0 0 842 596 |
|
| 5 |
%%EndComments |
|
| 6 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 7 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 8 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 9 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 10 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 11 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 12 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 13 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 14 |
closepath pop pop pop} bind def |
|
| 15 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 16 |
2 index 2 index 2 index add lineto |
|
| 17 |
2 index 1 index sub 2 index lineto |
|
| 18 |
2 index 2 index 2 index sub lineto |
|
| 19 |
closepath pop pop pop} bind def |
|
| 20 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 21 |
setrgbcolor 1.1 div c fill |
|
| 22 |
} bind def |
|
| 23 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 24 |
setrgbcolor 1.1 div sq fill |
|
| 25 |
} bind def |
|
| 26 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 27 |
setrgbcolor 1.1 div di fill |
|
| 28 |
} bind def |
|
| 29 |
/arrl 1 def |
|
| 30 |
/arrw 0.3 def |
|
| 31 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 32 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 33 |
/w exch def /len exch def |
|
| 34 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 35 |
len w sub arrl sub dx dy lrl |
|
| 36 |
arrw dy dx neg lrl |
|
| 37 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 38 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 39 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 40 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 41 |
arrw dy dx neg lrl |
|
| 42 |
len w sub arrl sub neg dx dy lrl |
|
| 43 |
closepath fill } bind def |
|
| 44 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 45 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 46 |
|
|
| 47 |
gsave |
|
| 48 |
90 rotate |
|
| 49 |
0 -842 translate |
|
| 50 |
71.6378 15 translate |
|
| 51 |
0.389093 dup scale |
|
| 52 |
90 rotate |
|
| 53 |
1197.47 -613.138 translate |
|
| 54 |
%Edges: |
|
| 55 |
gsave |
|
| 56 |
513.857 -446.322 296.569 -487.43 79.2808 -528.539 0 0 0 2 lb |
|
| 57 |
513.857 -446.322 575.52 -315.655 637.183 -184.989 0 0 0 2 lb |
|
| 58 |
393.468 566.711 494.771 434.577 596.074 302.442 0 0 0 2 lb |
|
| 59 |
393.468 566.711 155.625 579.925 -82.2171 593.138 0 0 0 2 lb |
|
| 60 |
393.468 566.711 251.056 450.726 108.644 334.741 0 0 0 2 lb |
|
| 61 |
869.153 52.8539 732.613 177.648 596.074 302.442 0 0 0 2 lb |
|
| 62 |
869.153 52.8539 753.168 -66.0676 637.183 -184.989 0 0 0 2 lb |
|
| 63 |
-82.2171 593.138 -91.0261 346.487 -99.8351 99.8351 0 0 0 2 lb |
|
| 64 |
-663.61 546.157 -753.168 394.936 -842.726 243.715 0 0 0 2 lb |
|
| 65 |
-663.61 546.157 -574.052 437.513 -484.494 328.869 0 0 0 2 lb |
|
| 66 |
-1077.63 161.498 -960.178 202.606 -842.726 243.715 0 0 0 2 lb |
|
| 67 |
-1077.63 161.498 -968.987 66.0674 -860.344 -29.3633 0 0 0 2 lb |
|
| 68 |
-1177.47 -234.906 -1029.18 -381.722 -880.898 -528.539 0 0 0 2 lb |
|
| 69 |
-1177.47 -234.906 -1018.91 -132.135 -860.344 -29.3633 0 0 0 2 lb |
|
| 70 |
-880.898 -528.539 -744.359 -387.595 -607.82 -246.651 0 0 0 2 lb |
|
| 71 |
-499.175 -499.175 -355.295 -475.685 -211.415 -452.194 0 0 0 2 lb |
|
| 72 |
-499.175 -499.175 -553.498 -372.913 -607.82 -246.651 0 0 0 2 lb |
|
| 73 |
-499.175 -499.175 -386.587 -315.087 -274 -131 0 0 0 2 lb |
|
| 74 |
79.2808 -528.539 -66.0671 -490.366 -211.415 -452.194 0 0 0 2 lb |
|
| 75 |
637.183 -184.989 421.363 -253.993 205.543 -322.996 0 0 0 2 lb |
|
| 76 |
205.543 -322.996 162.966 -226.097 120.389 -129.198 0 0 0 2 lb |
|
| 77 |
399.34 88.0898 259.865 -20.5541 120.389 -129.198 0 0 0 2 lb |
|
| 78 |
399.34 88.0898 253.992 211.415 108.644 334.741 0 0 0 2 lb |
|
| 79 |
-842.726 243.715 -471.281 171.775 -99.8351 99.8351 0 0 0 2 lb |
|
| 80 |
-842.726 243.715 -558.363 56.3575 -274 -131 0 0 0 2 lb |
|
| 81 |
-860.344 -29.3633 -734.082 -138.007 -607.82 -246.651 0 0 0 2 lb |
|
| 82 |
-211.415 -452.194 -45.513 -290.696 120.389 -129.198 0 0 0 2 lb |
|
| 83 |
-99.8351 99.8351 4.40445 217.288 108.644 334.741 0 0 0 2 lb |
|
| 84 |
-99.8351 99.8351 -292.165 214.352 -484.494 328.869 0 0 0 2 lb |
|
| 85 |
120.389 -129.198 -76.8055 -130.099 -274 -131 0 0 0 2 lb |
|
| 86 |
grestore |
|
| 87 |
%Nodes: |
|
| 88 |
gsave |
|
| 89 |
-274 -131 20 1 0 0 nc |
|
| 90 |
-607.82 -246.651 20 1 0 0 nc |
|
| 91 |
-484.494 328.869 20 0 0 1 nc |
|
| 92 |
108.644 334.741 20 0 0 1 nc |
|
| 93 |
120.389 -129.198 20 0 0 1 nc |
|
| 94 |
-99.8351 99.8351 20 1 0 0 nc |
|
| 95 |
-211.415 -452.194 20 1 0 0 nc |
|
| 96 |
-860.344 -29.3633 20 0 0 1 nc |
|
| 97 |
-842.726 243.715 20 0 0 1 nc |
|
| 98 |
399.34 88.0898 20 1 0 0 nc |
|
| 99 |
205.543 -322.996 20 1 0 0 nc |
|
| 100 |
637.183 -184.989 20 0 0 1 nc |
|
| 101 |
79.2808 -528.539 20 0 0 1 nc |
|
| 102 |
-499.175 -499.175 20 0 0 1 nc |
|
| 103 |
-880.898 -528.539 20 0 0 1 nc |
|
| 104 |
-1177.47 -234.906 20 1 0 0 nc |
|
| 105 |
-1077.63 161.498 20 1 0 0 nc |
|
| 106 |
-663.61 546.157 20 1 0 0 nc |
|
| 107 |
-82.2171 593.138 20 0 0 1 nc |
|
| 108 |
596.074 302.442 20 0 0 1 nc |
|
| 109 |
869.153 52.8539 20 1 0 0 nc |
|
| 110 |
393.468 566.711 20 1 0 0 nc |
|
| 111 |
513.857 -446.322 20 1 0 0 nc |
|
| 112 |
grestore |
|
| 113 |
grestore |
|
| 114 |
showpage |
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Fri Nov 4 13:47:12 2005 |
|
| 4 |
%%BoundingBox: 0 0 842 596 |
|
| 5 |
%%EndComments |
|
| 6 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 7 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 8 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 9 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 10 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 11 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 12 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 13 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 14 |
closepath pop pop pop} bind def |
|
| 15 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 16 |
2 index 2 index 2 index add lineto |
|
| 17 |
2 index 1 index sub 2 index lineto |
|
| 18 |
2 index 2 index 2 index sub lineto |
|
| 19 |
closepath pop pop pop} bind def |
|
| 20 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 21 |
setrgbcolor 1.1 div c fill |
|
| 22 |
} bind def |
|
| 23 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 24 |
setrgbcolor 1.1 div sq fill |
|
| 25 |
} bind def |
|
| 26 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 27 |
setrgbcolor 1.1 div di fill |
|
| 28 |
} bind def |
|
| 29 |
/arrl 1 def |
|
| 30 |
/arrw 0.3 def |
|
| 31 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 32 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 33 |
/w exch def /len exch def |
|
| 34 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 35 |
len w sub arrl sub dx dy lrl |
|
| 36 |
arrw dy dx neg lrl |
|
| 37 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 38 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 39 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 40 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 41 |
arrw dy dx neg lrl |
|
| 42 |
len w sub arrl sub neg dx dy lrl |
|
| 43 |
closepath fill } bind def |
|
| 44 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 45 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 46 |
|
|
| 47 |
gsave |
|
| 48 |
90 rotate |
|
| 49 |
0 -842 translate |
|
| 50 |
71.0944 15 translate |
|
| 51 |
0.434694 dup scale |
|
| 52 |
90 rotate |
|
| 53 |
860.856 -588.349 translate |
|
| 54 |
%Edges: |
|
| 55 |
gsave |
|
| 56 |
574.035 177.301 622.149 225.748 670.264 274.195 0 0 0 2 lb |
|
| 57 |
694.579 115.483 682.421 194.839 670.264 274.195 0 0 0 2 lb |
|
| 58 |
280.402 10.3938 246.402 -6.60595 212.403 -23.6057 0 0 0 2 lb |
|
| 59 |
280.402 10.3938 283.493 -18.9695 286.584 -48.3327 0 0 0 2 lb |
|
| 60 |
212.403 -23.6057 249.493 -35.9692 286.584 -48.3327 0 0 0 2 lb |
|
| 61 |
286.584 -48.3327 326.765 -79.2414 366.947 -110.15 0 0 0 2 lb |
|
| 62 |
286.584 -48.3327 278.857 -111.695 271.13 -175.058 0 0 0 2 lb |
|
| 63 |
438.037 -88.514 417.946 -142.604 397.855 -196.694 0 0 0 2 lb |
|
| 64 |
438.037 -88.514 402.492 -99.332 366.947 -110.15 0 0 0 2 lb |
|
| 65 |
397.855 -196.694 382.401 -153.422 366.947 -110.15 0 0 0 2 lb |
|
| 66 |
366.947 -110.15 319.038 -142.604 271.13 -175.058 0 0 0 2 lb |
|
| 67 |
271.13 -175.058 274.221 -213.694 277.311 -252.33 0 0 0 2 lb |
|
| 68 |
271.13 -175.058 238.675 -190.512 206.221 -205.967 0 0 0 2 lb |
|
| 69 |
277.311 -252.33 241.766 -229.149 206.221 -205.967 0 0 0 2 lb |
|
| 70 |
-840.856 -246.718 -804.351 -66.7145 -767.847 113.289 0 0 0 2 lb |
|
| 71 |
-579.033 445.603 -673.44 279.446 -767.847 113.289 0 0 0 2 lb |
|
| 72 |
-579.033 445.603 -524.906 302.104 -470.779 158.605 0 0 0 2 lb |
|
| 73 |
-767.847 113.289 -619.313 135.947 -470.779 158.605 0 0 0 2 lb |
|
| 74 |
906.312 201.403 946.592 42.798 986.873 -115.807 0 0 0 2 lb |
|
| 75 |
906.312 201.403 834.562 91.8901 762.812 -17.6227 0 0 0 2 lb |
|
| 76 |
986.873 -115.807 874.842 -66.7148 762.812 -17.6227 0 0 0 2 lb |
|
| 77 |
-470.779 158.605 -390.218 50.3508 -309.657 -57.9033 0 0 0 2 lb |
|
| 78 |
422.945 521.129 208.955 541.269 -5.03507 561.41 0 0 0 2 lb |
|
| 79 |
422.945 521.129 376.371 417.911 329.797 314.692 0 0 0 2 lb |
|
| 80 |
422.945 521.129 474.554 276.928 526.164 32.7279 0 0 0 2 lb |
|
| 81 |
-5.03507 561.41 -36.5042 440.568 -67.9734 319.727 0 0 0 2 lb |
|
| 82 |
329.797 314.692 130.912 317.209 -67.9734 319.727 0 0 0 2 lb |
|
| 83 |
-67.9734 319.727 229.095 176.227 526.164 32.7279 0 0 0 2 lb |
|
| 84 |
762.812 -17.6227 644.488 7.5526 526.164 32.7279 0 0 0 2 lb |
|
| 85 |
762.812 -17.6227 746.448 -162.381 730.084 -307.139 0 0 0 2 lb |
|
| 86 |
526.164 32.7279 470.779 -128.394 415.393 -289.516 0 0 0 2 lb |
|
| 87 |
730.084 -307.139 572.738 -298.327 415.393 -289.516 0 0 0 2 lb |
|
| 88 |
415.393 -289.516 173.71 -318.468 -67.9734 -347.42 0 0 0 2 lb |
|
| 89 |
-67.9734 -347.42 -188.815 -202.662 -309.657 -57.9033 0 0 0 2 lb |
|
| 90 |
-67.9734 -347.42 -195.758 -390.692 -323.543 -433.964 0 0 0 2 lb |
|
| 91 |
-309.657 -57.9033 -424.775 -160.272 -539.894 -262.64 0 0 0 2 lb |
|
| 92 |
-323.543 -433.964 -431.719 -348.302 -539.894 -262.64 0 0 0 2 lb |
|
| 93 |
-26.6953 -19.9585 44.8558 -96.8093 116.407 -173.66 0 0 0 2 lb |
|
| 94 |
-26.6953 -19.9585 87.2563 9.19185 201.208 38.3422 0 0 0 2 lb |
|
| 95 |
-26.6953 -19.9585 -144.622 43.6422 -262.548 107.243 0 0 0 2 lb |
|
| 96 |
-26.6953 -19.9585 -20.0703 56.8923 -13.4452 133.743 0 0 0 2 lb |
|
| 97 |
116.407 -173.66 158.808 -67.6589 201.208 38.3422 0 0 0 2 lb |
|
| 98 |
-262.548 107.243 -137.997 120.493 -13.4452 133.743 0 0 0 2 lb |
|
| 99 |
-262.548 107.243 -221.472 176.144 -180.397 245.045 0 0 0 2 lb |
|
| 100 |
-13.4452 133.743 -96.9211 189.394 -180.397 245.045 0 0 0 2 lb |
|
| 101 |
-180.397 245.045 -142.256 345.099 -132.697 451.748 0 0 0 2 lb |
|
| 102 |
-180.397 245.045 -170.838 351.694 -132.697 451.748 0 0 0 2 lb |
|
| 103 |
-416.25 345.746 -274.474 398.747 -132.697 451.748 0 0 0 2 lb |
|
| 104 |
-416.25 345.746 -393.725 457.048 -371.2 568.349 0 0 0 2 lb |
|
| 105 |
-132.697 451.748 -251.948 510.048 -371.2 568.349 0 0 0 2 lb |
|
| 106 |
670.264 274.195 629.188 409.347 588.113 544.499 0 0 0 2 lb |
|
| 107 |
670.264 274.195 797.466 341.771 924.667 409.347 0 0 0 2 lb |
|
| 108 |
588.113 544.499 756.39 476.923 924.667 409.347 0 0 0 2 lb |
|
| 109 |
-689.204 -237.261 -614.799 -102.648 -567.302 43.6423 0 0 0 2 lb |
|
| 110 |
-689.204 -237.261 -641.707 -90.9706 -567.302 43.6423 0 0 0 2 lb |
|
| 111 |
grestore |
|
| 112 |
%Nodes: |
|
| 113 |
gsave |
|
| 114 |
-567.302 43.6423 20 0 0 0 nc |
|
| 115 |
-689.204 -237.261 20 0 0 0 nc |
|
| 116 |
924.667 409.347 20 1 0 0 nc |
|
| 117 |
588.113 544.499 20 1 0 0 nc |
|
| 118 |
670.264 274.195 20 1 0 0 nc |
|
| 119 |
-371.2 568.349 20 0 1 0 nc |
|
| 120 |
-132.697 451.748 20 0 1 0 nc |
|
| 121 |
-416.25 345.746 20 0 1 0 nc |
|
| 122 |
-180.397 245.045 20 0 1 0 nc |
|
| 123 |
-13.4452 133.743 20 0 1 0 nc |
|
| 124 |
-262.548 107.243 20 0 1 0 nc |
|
| 125 |
201.208 38.3422 20 0 1 0 nc |
|
| 126 |
116.407 -173.66 20 0 1 0 nc |
|
| 127 |
-26.6953 -19.9585 20 0 1 0 nc |
|
| 128 |
-539.894 -262.64 20 0 0 1 nc |
|
| 129 |
-323.543 -433.964 20 0 0 1 nc |
|
| 130 |
-309.657 -57.9033 20 0 0 1 nc |
|
| 131 |
-67.9734 -347.42 20 0 0 1 nc |
|
| 132 |
415.393 -289.516 20 0 0 1 nc |
|
| 133 |
730.084 -307.139 20 0 0 1 nc |
|
| 134 |
526.164 32.7279 20 0 0 1 nc |
|
| 135 |
762.812 -17.6227 20 0 0 1 nc |
|
| 136 |
-67.9734 319.727 20 0 0 1 nc |
|
| 137 |
329.797 314.692 20 0 0 1 nc |
|
| 138 |
-5.03507 561.41 20 0 0 1 nc |
|
| 139 |
422.945 521.129 20 0 0 1 nc |
|
| 140 |
-470.779 158.605 20 0 0 1 nc |
|
| 141 |
986.873 -115.807 20 0 0 1 nc |
|
| 142 |
906.312 201.403 20 0 0 1 nc |
|
| 143 |
-767.847 113.289 20 0 0 1 nc |
|
| 144 |
-579.033 445.603 20 0 0 1 nc |
|
| 145 |
-840.856 -246.718 20 0 0 1 nc |
|
| 146 |
206.221 -205.967 20 1 1 0 nc |
|
| 147 |
277.311 -252.33 20 1 1 0 nc |
|
| 148 |
271.13 -175.058 20 1 1 0 nc |
|
| 149 |
366.947 -110.15 20 1 1 0 nc |
|
| 150 |
397.855 -196.694 20 1 1 0 nc |
|
| 151 |
438.037 -88.514 20 1 1 0 nc |
|
| 152 |
286.584 -48.3327 20 1 1 0 nc |
|
| 153 |
212.403 -23.6057 20 1 1 0 nc |
|
| 154 |
280.402 10.3938 20 1 1 0 nc |
|
| 155 |
694.579 115.483 20 1 0 0 nc |
|
| 156 |
574.035 177.301 20 1 0 0 nc |
|
| 157 |
grestore |
|
| 158 |
grestore |
|
| 159 |
showpage |
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Fri Nov 4 13:47:12 2005 |
|
| 4 |
%%BoundingBox: 0 0 842 596 |
|
| 5 |
%%EndComments |
|
| 6 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 7 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 8 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 9 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 10 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 11 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 12 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 13 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 14 |
closepath pop pop pop} bind def |
|
| 15 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 16 |
2 index 2 index 2 index add lineto |
|
| 17 |
2 index 1 index sub 2 index lineto |
|
| 18 |
2 index 2 index 2 index sub lineto |
|
| 19 |
closepath pop pop pop} bind def |
|
| 20 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 21 |
setrgbcolor 1.1 div c fill |
|
| 22 |
} bind def |
|
| 23 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 24 |
setrgbcolor 1.1 div sq fill |
|
| 25 |
} bind def |
|
| 26 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 27 |
setrgbcolor 1.1 div di fill |
|
| 28 |
} bind def |
|
| 29 |
/arrl 1 def |
|
| 30 |
/arrw 0.3 def |
|
| 31 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 32 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 33 |
/w exch def /len exch def |
|
| 34 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 35 |
len w sub arrl sub dx dy lrl |
|
| 36 |
arrw dy dx neg lrl |
|
| 37 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 38 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 39 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 40 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 41 |
arrw dy dx neg lrl |
|
| 42 |
len w sub arrl sub neg dx dy lrl |
|
| 43 |
closepath fill } bind def |
|
| 44 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 45 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 46 |
|
|
| 47 |
gsave |
|
| 48 |
90 rotate |
|
| 49 |
0 -842 translate |
|
| 50 |
71.0944 15 translate |
|
| 51 |
0.434694 dup scale |
|
| 52 |
90 rotate |
|
| 53 |
860.856 -588.349 translate |
|
| 54 |
%Edges: |
|
| 55 |
gsave |
|
| 56 |
574.035 177.301 622.149 225.748 670.264 274.195 1 0 0 2 lb |
|
| 57 |
694.579 115.483 682.421 194.839 670.264 274.195 1 0 0 2 lb |
|
| 58 |
280.402 10.3938 246.402 -6.60595 212.403 -23.6057 0 0 1 2 lb |
|
| 59 |
280.402 10.3938 283.493 -18.9695 286.584 -48.3327 0 0 1 2 lb |
|
| 60 |
212.403 -23.6057 249.493 -35.9692 286.584 -48.3327 0 0 1 2 lb |
|
| 61 |
286.584 -48.3327 326.765 -79.2414 366.947 -110.15 0 0 1 2 lb |
|
| 62 |
286.584 -48.3327 278.857 -111.695 271.13 -175.058 0 0 1 2 lb |
|
| 63 |
438.037 -88.514 417.946 -142.604 397.855 -196.694 0 0 1 2 lb |
|
| 64 |
438.037 -88.514 402.492 -99.332 366.947 -110.15 0 0 1 2 lb |
|
| 65 |
397.855 -196.694 382.401 -153.422 366.947 -110.15 0 0 1 2 lb |
|
| 66 |
366.947 -110.15 319.038 -142.604 271.13 -175.058 0 0 1 2 lb |
|
| 67 |
271.13 -175.058 274.221 -213.694 277.311 -252.33 0 0 1 2 lb |
|
| 68 |
271.13 -175.058 238.675 -190.512 206.221 -205.967 0 0 1 2 lb |
|
| 69 |
277.311 -252.33 241.766 -229.149 206.221 -205.967 0 0 1 2 lb |
|
| 70 |
-840.856 -246.718 -804.351 -66.7145 -767.847 113.289 1 0 0 2 lb |
|
| 71 |
-579.033 445.603 -673.44 279.446 -767.847 113.289 0 0 1 2 lb |
|
| 72 |
-579.033 445.603 -524.906 302.104 -470.779 158.605 0 0 1 2 lb |
|
| 73 |
-767.847 113.289 -619.313 135.947 -470.779 158.605 0 0 1 2 lb |
|
| 74 |
906.312 201.403 946.592 42.798 986.873 -115.807 0 0 1 2 lb |
|
| 75 |
906.312 201.403 834.562 91.8901 762.812 -17.6227 0 0 1 2 lb |
|
| 76 |
986.873 -115.807 874.842 -66.7148 762.812 -17.6227 0 0 1 2 lb |
|
| 77 |
-470.779 158.605 -390.218 50.3508 -309.657 -57.9033 1 0 0 2 lb |
|
| 78 |
422.945 521.129 208.955 541.269 -5.03507 561.41 0 0 1 2 lb |
|
| 79 |
422.945 521.129 376.371 417.911 329.797 314.692 0 0 1 2 lb |
|
| 80 |
422.945 521.129 474.554 276.928 526.164 32.7279 0 0 1 2 lb |
|
| 81 |
-5.03507 561.41 -36.5042 440.568 -67.9734 319.727 0 0 1 2 lb |
|
| 82 |
329.797 314.692 130.912 317.209 -67.9734 319.727 0 0 1 2 lb |
|
| 83 |
-67.9734 319.727 229.095 176.227 526.164 32.7279 0 0 1 2 lb |
|
| 84 |
762.812 -17.6227 644.488 7.5526 526.164 32.7279 0 0 1 2 lb |
|
| 85 |
762.812 -17.6227 746.448 -162.381 730.084 -307.139 0 0 1 2 lb |
|
| 86 |
526.164 32.7279 470.779 -128.394 415.393 -289.516 0 0 1 2 lb |
|
| 87 |
730.084 -307.139 572.738 -298.327 415.393 -289.516 0 0 1 2 lb |
|
| 88 |
415.393 -289.516 173.71 -318.468 -67.9734 -347.42 1 0 0 2 lb |
|
| 89 |
-67.9734 -347.42 -188.815 -202.662 -309.657 -57.9033 0 0 1 2 lb |
|
| 90 |
-67.9734 -347.42 -195.758 -390.692 -323.543 -433.964 0 0 1 2 lb |
|
| 91 |
-309.657 -57.9033 -424.775 -160.272 -539.894 -262.64 0 0 1 2 lb |
|
| 92 |
-323.543 -433.964 -431.719 -348.302 -539.894 -262.64 0 0 1 2 lb |
|
| 93 |
-26.6953 -19.9585 44.8558 -96.8093 116.407 -173.66 0 0 1 2 lb |
|
| 94 |
-26.6953 -19.9585 87.2563 9.19185 201.208 38.3422 0 0 1 2 lb |
|
| 95 |
-26.6953 -19.9585 -144.622 43.6422 -262.548 107.243 0 0 1 2 lb |
|
| 96 |
-26.6953 -19.9585 -20.0703 56.8923 -13.4452 133.743 0 0 1 2 lb |
|
| 97 |
116.407 -173.66 158.808 -67.6589 201.208 38.3422 0 0 1 2 lb |
|
| 98 |
-262.548 107.243 -137.997 120.493 -13.4452 133.743 0 0 1 2 lb |
|
| 99 |
-262.548 107.243 -221.472 176.144 -180.397 245.045 0 0 1 2 lb |
|
| 100 |
-13.4452 133.743 -96.9211 189.394 -180.397 245.045 0 0 1 2 lb |
|
| 101 |
-180.397 245.045 -142.256 345.099 -132.697 451.748 0 0 1 2 lb |
|
| 102 |
-180.397 245.045 -170.838 351.694 -132.697 451.748 0 0 1 2 lb |
|
| 103 |
-416.25 345.746 -274.474 398.747 -132.697 451.748 0 0 1 2 lb |
|
| 104 |
-416.25 345.746 -393.725 457.048 -371.2 568.349 0 0 1 2 lb |
|
| 105 |
-132.697 451.748 -251.948 510.048 -371.2 568.349 0 0 1 2 lb |
|
| 106 |
670.264 274.195 629.188 409.347 588.113 544.499 0 0 1 2 lb |
|
| 107 |
670.264 274.195 797.466 341.771 924.667 409.347 0 0 1 2 lb |
|
| 108 |
588.113 544.499 756.39 476.923 924.667 409.347 0 0 1 2 lb |
|
| 109 |
-689.204 -237.261 -614.799 -102.648 -567.302 43.6423 0 0 1 2 lb |
|
| 110 |
-689.204 -237.261 -641.707 -90.9706 -567.302 43.6423 0 0 1 2 lb |
|
| 111 |
grestore |
|
| 112 |
%Nodes: |
|
| 113 |
gsave |
|
| 114 |
-567.302 43.6423 20 0 0 0 nc |
|
| 115 |
-689.204 -237.261 20 0 0 0 nc |
|
| 116 |
924.667 409.347 20 0 0 1 nc |
|
| 117 |
588.113 544.499 20 0 0 1 nc |
|
| 118 |
670.264 274.195 20 0 0 1 nc |
|
| 119 |
-371.2 568.349 20 1 1 0 nc |
|
| 120 |
-132.697 451.748 20 1 1 0 nc |
|
| 121 |
-416.25 345.746 20 1 1 0 nc |
|
| 122 |
-180.397 245.045 20 1 1 0 nc |
|
| 123 |
-13.4452 133.743 20 1 1 0 nc |
|
| 124 |
-262.548 107.243 20 1 1 0 nc |
|
| 125 |
201.208 38.3422 20 1 1 0 nc |
|
| 126 |
116.407 -173.66 20 1 1 0 nc |
|
| 127 |
-26.6953 -19.9585 20 1 1 0 nc |
|
| 128 |
-539.894 -262.64 20 0 0.5 0 nc |
|
| 129 |
-323.543 -433.964 20 0 0.5 0 nc |
|
| 130 |
-309.657 -57.9033 20 0 0.5 0 nc |
|
| 131 |
-67.9734 -347.42 20 0 0.5 0 nc |
|
| 132 |
415.393 -289.516 20 0.5 0 0 nc |
|
| 133 |
730.084 -307.139 20 0.5 0 0 nc |
|
| 134 |
526.164 32.7279 20 0.5 0 0 nc |
|
| 135 |
762.812 -17.6227 20 0.5 0 0 nc |
|
| 136 |
-67.9734 319.727 20 0.5 0 0 nc |
|
| 137 |
329.797 314.692 20 0.5 0 0 nc |
|
| 138 |
-5.03507 561.41 20 0.5 0 0 nc |
|
| 139 |
422.945 521.129 20 0.5 0 0 nc |
|
| 140 |
-470.779 158.605 20 0 1 1 nc |
|
| 141 |
986.873 -115.807 20 0.5 0 0 nc |
|
| 142 |
906.312 201.403 20 0.5 0 0 nc |
|
| 143 |
-767.847 113.289 20 0 1 1 nc |
|
| 144 |
-579.033 445.603 20 0 1 1 nc |
|
| 145 |
-840.856 -246.718 20 1 0 1 nc |
|
| 146 |
206.221 -205.967 20 0 0 0.5 nc |
|
| 147 |
277.311 -252.33 20 0 0 0.5 nc |
|
| 148 |
271.13 -175.058 20 0 0 0.5 nc |
|
| 149 |
366.947 -110.15 20 0 0 0.5 nc |
|
| 150 |
397.855 -196.694 20 0 0 0.5 nc |
|
| 151 |
438.037 -88.514 20 0 0 0.5 nc |
|
| 152 |
286.584 -48.3327 20 0 0 0.5 nc |
|
| 153 |
212.403 -23.6057 20 0 0 0.5 nc |
|
| 154 |
280.402 10.3938 20 0 0 0.5 nc |
|
| 155 |
694.579 115.483 20 1 0 0 nc |
|
| 156 |
574.035 177.301 20 0 1 0 nc |
|
| 157 |
grestore |
|
| 158 |
grestore |
|
| 159 |
showpage |
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Fri Nov 4 13:47:12 2005 |
|
| 4 |
%%BoundingBox: 0 0 842 596 |
|
| 5 |
%%EndComments |
|
| 6 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 7 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 8 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 9 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 10 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 11 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 12 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 13 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 14 |
closepath pop pop pop} bind def |
|
| 15 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 16 |
2 index 2 index 2 index add lineto |
|
| 17 |
2 index 1 index sub 2 index lineto |
|
| 18 |
2 index 2 index 2 index sub lineto |
|
| 19 |
closepath pop pop pop} bind def |
|
| 20 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 21 |
setrgbcolor 1.1 div c fill |
|
| 22 |
} bind def |
|
| 23 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 24 |
setrgbcolor 1.1 div sq fill |
|
| 25 |
} bind def |
|
| 26 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 27 |
setrgbcolor 1.1 div di fill |
|
| 28 |
} bind def |
|
| 29 |
/arrl 1 def |
|
| 30 |
/arrw 0.3 def |
|
| 31 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 32 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 33 |
/w exch def /len exch def |
|
| 34 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 35 |
len w sub arrl sub dx dy lrl |
|
| 36 |
arrw dy dx neg lrl |
|
| 37 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 38 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 39 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 40 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 41 |
arrw dy dx neg lrl |
|
| 42 |
len w sub arrl sub neg dx dy lrl |
|
| 43 |
closepath fill } bind def |
|
| 44 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 45 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 46 |
|
|
| 47 |
gsave |
|
| 48 |
90 rotate |
|
| 49 |
0 -842 translate |
|
| 50 |
71.0944 15 translate |
|
| 51 |
0.434694 dup scale |
|
| 52 |
90 rotate |
|
| 53 |
860.856 -588.349 translate |
|
| 54 |
%Edges: |
|
| 55 |
gsave |
|
| 56 |
574.035 177.301 622.149 225.748 670.264 274.195 0 1 0 5 lb |
|
| 57 |
694.579 115.483 682.421 194.839 670.264 274.195 1 0 0 5 lb |
|
| 58 |
280.402 10.3938 246.402 -6.60595 212.403 -23.6057 1 1 0.5 5 lb |
|
| 59 |
280.402 10.3938 283.493 -18.9695 286.584 -48.3327 1 1 0.5 5 lb |
|
| 60 |
212.403 -23.6057 249.493 -35.9692 286.584 -48.3327 1 1 0.5 5 lb |
|
| 61 |
286.584 -48.3327 326.765 -79.2414 366.947 -110.15 1 0.5 1 5 lb |
|
| 62 |
286.584 -48.3327 278.857 -111.695 271.13 -175.058 1 0.5 1 5 lb |
|
| 63 |
438.037 -88.514 417.946 -142.604 397.855 -196.694 0.5 0.5 1 5 lb |
|
| 64 |
438.037 -88.514 402.492 -99.332 366.947 -110.15 0.5 0.5 1 5 lb |
|
| 65 |
397.855 -196.694 382.401 -153.422 366.947 -110.15 0.5 0.5 1 5 lb |
|
| 66 |
366.947 -110.15 319.038 -142.604 271.13 -175.058 1 0.5 1 5 lb |
|
| 67 |
271.13 -175.058 274.221 -213.694 277.311 -252.33 0.5 1 1 5 lb |
|
| 68 |
271.13 -175.058 238.675 -190.512 206.221 -205.967 0.5 1 1 5 lb |
|
| 69 |
277.311 -252.33 241.766 -229.149 206.221 -205.967 0.5 1 1 5 lb |
|
| 70 |
-840.856 -246.718 -804.351 -66.7145 -767.847 113.289 0 0.5 0 5 lb |
|
| 71 |
-579.033 445.603 -673.44 279.446 -767.847 113.289 0 0 0.5 5 lb |
|
| 72 |
-579.033 445.603 -524.906 302.104 -470.779 158.605 0 0 0.5 5 lb |
|
| 73 |
-767.847 113.289 -619.313 135.947 -470.779 158.605 0 0 0.5 5 lb |
|
| 74 |
906.312 201.403 946.592 42.798 986.873 -115.807 0 0.5 0.5 5 lb |
|
| 75 |
906.312 201.403 834.562 91.8901 762.812 -17.6227 0 0.5 0.5 5 lb |
|
| 76 |
986.873 -115.807 874.842 -66.7148 762.812 -17.6227 0 0.5 0.5 5 lb |
|
| 77 |
-470.779 158.605 -390.218 50.3508 -309.657 -57.9033 0.5 0.5 0 5 lb |
|
| 78 |
422.945 521.129 208.955 541.269 -5.03507 561.41 0.5 0 0.5 5 lb |
|
| 79 |
422.945 521.129 376.371 417.911 329.797 314.692 0.5 0 0.5 5 lb |
|
| 80 |
422.945 521.129 474.554 276.928 526.164 32.7279 0.5 0 0.5 5 lb |
|
| 81 |
-5.03507 561.41 -36.5042 440.568 -67.9734 319.727 0.5 0 0.5 5 lb |
|
| 82 |
329.797 314.692 130.912 317.209 -67.9734 319.727 0.5 0 0.5 5 lb |
|
| 83 |
-67.9734 319.727 229.095 176.227 526.164 32.7279 0.5 0 0.5 5 lb |
|
| 84 |
762.812 -17.6227 644.488 7.5526 526.164 32.7279 0.5 0.5 0.5 5 lb |
|
| 85 |
762.812 -17.6227 746.448 -162.381 730.084 -307.139 0.5 0.5 0.5 5 lb |
|
| 86 |
526.164 32.7279 470.779 -128.394 415.393 -289.516 0.5 0.5 0.5 5 lb |
|
| 87 |
730.084 -307.139 572.738 -298.327 415.393 -289.516 0.5 0.5 0.5 5 lb |
|
| 88 |
415.393 -289.516 173.71 -318.468 -67.9734 -347.42 1 0.5 0.5 5 lb |
|
| 89 |
-67.9734 -347.42 -188.815 -202.662 -309.657 -57.9033 0.5 1 0.5 5 lb |
|
| 90 |
-67.9734 -347.42 -195.758 -390.692 -323.543 -433.964 0.5 1 0.5 5 lb |
|
| 91 |
-309.657 -57.9033 -424.775 -160.272 -539.894 -262.64 0.5 1 0.5 5 lb |
|
| 92 |
-323.543 -433.964 -431.719 -348.302 -539.894 -262.64 0.5 1 0.5 5 lb |
|
| 93 |
-26.6953 -19.9585 44.8558 -96.8093 116.407 -173.66 1 1 0 5 lb |
|
| 94 |
-26.6953 -19.9585 87.2563 9.19185 201.208 38.3422 1 1 0 5 lb |
|
| 95 |
-26.6953 -19.9585 -144.622 43.6422 -262.548 107.243 1 0 1 5 lb |
|
| 96 |
-26.6953 -19.9585 -20.0703 56.8923 -13.4452 133.743 1 0 1 5 lb |
|
| 97 |
116.407 -173.66 158.808 -67.6589 201.208 38.3422 1 1 0 5 lb |
|
| 98 |
-262.548 107.243 -137.997 120.493 -13.4452 133.743 1 0 1 5 lb |
|
| 99 |
-262.548 107.243 -221.472 176.144 -180.397 245.045 1 0 1 5 lb |
|
| 100 |
-13.4452 133.743 -96.9211 189.394 -180.397 245.045 1 0 1 5 lb |
|
| 101 |
-180.397 245.045 -140.307 344.649 -132.697 451.748 0 1 1 5 lb |
|
| 102 |
-180.397 245.045 -172.787 352.144 -132.697 451.748 0 1 1 5 lb |
|
| 103 |
-416.25 345.746 -274.474 398.747 -132.697 451.748 0.5 0 0 5 lb |
|
| 104 |
-416.25 345.746 -393.725 457.048 -371.2 568.349 0.5 0 0 5 lb |
|
| 105 |
-132.697 451.748 -251.948 510.048 -371.2 568.349 0.5 0 0 5 lb |
|
| 106 |
670.264 274.195 629.188 409.347 588.113 544.499 0 0 1 5 lb |
|
| 107 |
670.264 274.195 797.466 341.771 924.667 409.347 0 0 1 5 lb |
|
| 108 |
588.113 544.499 756.39 476.923 924.667 409.347 0 0 1 5 lb |
|
| 109 |
-689.204 -237.261 -612.964 -103.444 -567.302 43.6423 0 0 0 5 lb |
|
| 110 |
-689.204 -237.261 -643.542 -90.1744 -567.302 43.6423 0 0 0 5 lb |
|
| 111 |
grestore |
|
| 112 |
%Nodes: |
|
| 113 |
gsave |
|
| 114 |
-567.302 43.6423 20 0 0 1 nc |
|
| 115 |
-689.204 -237.261 20 0 0 1 nc |
|
| 116 |
924.667 409.347 20 0 0 1 nc |
|
| 117 |
588.113 544.499 20 0 0 1 nc |
|
| 118 |
670.264 274.195 20 1 0 0 nc |
|
| 119 |
-371.2 568.349 20 0 0 1 nc |
|
| 120 |
-132.697 451.748 20 1 0 0 nc |
|
| 121 |
-416.25 345.746 20 0 0 1 nc |
|
| 122 |
-180.397 245.045 20 1 0 0 nc |
|
| 123 |
-13.4452 133.743 20 0 0 1 nc |
|
| 124 |
-262.548 107.243 20 0 0 1 nc |
|
| 125 |
201.208 38.3422 20 0 0 1 nc |
|
| 126 |
116.407 -173.66 20 0 0 1 nc |
|
| 127 |
-26.6953 -19.9585 20 1 0 0 nc |
|
| 128 |
-539.894 -262.64 20 0 0 1 nc |
|
| 129 |
-323.543 -433.964 20 0 0 1 nc |
|
| 130 |
-309.657 -57.9033 20 1 0 0 nc |
|
| 131 |
-67.9734 -347.42 20 1 0 0 nc |
|
| 132 |
415.393 -289.516 20 1 0 0 nc |
|
| 133 |
730.084 -307.139 20 0 0 1 nc |
|
| 134 |
526.164 32.7279 20 1 0 0 nc |
|
| 135 |
762.812 -17.6227 20 1 0 0 nc |
|
| 136 |
-67.9734 319.727 20 0 0 1 nc |
|
| 137 |
329.797 314.692 20 0 0 1 nc |
|
| 138 |
-5.03507 561.41 20 0 0 1 nc |
|
| 139 |
422.945 521.129 20 0 0 1 nc |
|
| 140 |
-470.779 158.605 20 1 0 0 nc |
|
| 141 |
986.873 -115.807 20 0 0 1 nc |
|
| 142 |
906.312 201.403 20 0 0 1 nc |
|
| 143 |
-767.847 113.289 20 1 0 0 nc |
|
| 144 |
-579.033 445.603 20 0 0 1 nc |
|
| 145 |
-840.856 -246.718 20 0 0 1 nc |
|
| 146 |
206.221 -205.967 20 0 0 1 nc |
|
| 147 |
277.311 -252.33 20 0 0 1 nc |
|
| 148 |
271.13 -175.058 20 1 0 0 nc |
|
| 149 |
366.947 -110.15 20 1 0 0 nc |
|
| 150 |
397.855 -196.694 20 0 0 1 nc |
|
| 151 |
438.037 -88.514 20 0 0 1 nc |
|
| 152 |
286.584 -48.3327 20 1 0 0 nc |
|
| 153 |
212.403 -23.6057 20 0 0 1 nc |
|
| 154 |
280.402 10.3938 20 0 0 1 nc |
|
| 155 |
694.579 115.483 20 0 0 1 nc |
|
| 156 |
574.035 177.301 20 0 0 1 nc |
|
| 157 |
grestore |
|
| 158 |
grestore |
|
| 159 |
showpage |
| 1 |
%!PS-Adobe-2.0 EPSF-2.0 |
|
| 2 |
%%Creator: LEMON, graphToEps() |
|
| 3 |
%%CreationDate: Fri Nov 4 13:47:12 2005 |
|
| 4 |
%%BoundingBox: 0 0 842 596 |
|
| 5 |
%%EndComments |
|
| 6 |
/lb { setlinewidth setrgbcolor newpath moveto
|
|
| 7 |
4 2 roll 1 index 1 index curveto stroke } bind def |
|
| 8 |
/l { setlinewidth setrgbcolor newpath moveto lineto stroke } bind def
|
|
| 9 |
/c { newpath dup 3 index add 2 index moveto 0 360 arc closepath } bind def
|
|
| 10 |
/sq { newpath 2 index 1 index add 2 index 2 index add moveto
|
|
| 11 |
2 index 1 index sub 2 index 2 index add lineto |
|
| 12 |
2 index 1 index sub 2 index 2 index sub lineto |
|
| 13 |
2 index 1 index add 2 index 2 index sub lineto |
|
| 14 |
closepath pop pop pop} bind def |
|
| 15 |
/di { newpath 2 index 1 index add 2 index moveto
|
|
| 16 |
2 index 2 index 2 index add lineto |
|
| 17 |
2 index 1 index sub 2 index lineto |
|
| 18 |
2 index 2 index 2 index sub lineto |
|
| 19 |
closepath pop pop pop} bind def |
|
| 20 |
/nc { 0 0 0 setrgbcolor 5 index 5 index 5 index c fill
|
|
| 21 |
setrgbcolor 1.1 div c fill |
|
| 22 |
} bind def |
|
| 23 |
/nsq { 0 0 0 setrgbcolor 5 index 5 index 5 index sq fill
|
|
| 24 |
setrgbcolor 1.1 div sq fill |
|
| 25 |
} bind def |
|
| 26 |
/ndi { 0 0 0 setrgbcolor 5 index 5 index 5 index di fill
|
|
| 27 |
setrgbcolor 1.1 div di fill |
|
| 28 |
} bind def |
|
| 29 |
/arrl 10 def |
|
| 30 |
/arrw 3 def |
|
| 31 |
/lrl { 2 index mul exch 2 index mul exch rlineto pop} bind def
|
|
| 32 |
/arr { setrgbcolor /y1 exch def /x1 exch def /dy exch def /dx exch def
|
|
| 33 |
/w exch def /len exch def |
|
| 34 |
newpath x1 dy w 2 div mul add y1 dx w 2 div mul sub moveto |
|
| 35 |
len w sub arrl sub dx dy lrl |
|
| 36 |
arrw dy dx neg lrl |
|
| 37 |
dx arrl w add mul dy w 2 div arrw add mul sub |
|
| 38 |
dy arrl w add mul dx w 2 div arrw add mul add rlineto |
|
| 39 |
dx arrl w add mul neg dy w 2 div arrw add mul sub |
|
| 40 |
dy arrl w add mul neg dx w 2 div arrw add mul add rlineto |
|
| 41 |
arrw dy dx neg lrl |
|
| 42 |
len w sub arrl sub neg dx dy lrl |
|
| 43 |
closepath fill } bind def |
|
| 44 |
/cshow { 2 index 2 index moveto dup stringwidth pop
|
|
| 45 |
neg 2 div fosi .35 mul neg rmoveto show pop pop} def |
|
| 46 |
|
|
| 47 |
gsave |
|
| 48 |
90 rotate |
|
| 49 |
0 -842 translate |
|
| 50 |
77.1122 15 translate |
|
| 51 |
0.585745 dup scale |
|
| 52 |
90 rotate |
|
| 53 |
695.963 -397.916 translate |
|
| 54 |
%Edges: |
|
| 55 |
gsave |
|
| 56 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 57 |
218.178 27.2723 moveto |
|
| 58 |
192.373 -40.1551 188.622 -49.9556 169.228 -100.631 curveto stroke |
|
| 59 |
newpath 164.939 -111.838 moveto 165.492 -99.2013 lineto 172.964 -102.061 lineto closepath fill |
|
| 60 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 61 |
44.8044 15.5841 moveto |
|
| 62 |
119.293 20.6059 129.775 21.3125 186.25 25.1199 curveto stroke |
|
| 63 |
newpath 198.223 25.927 moveto 186.519 21.1289 lineto 185.981 29.1108 lineto closepath fill |
|
| 64 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 65 |
218.178 27.2723 moveto |
|
| 66 |
285.395 -87.4449 290.763 -96.6058 348.102 -194.464 curveto stroke |
|
| 67 |
newpath 354.169 -204.818 moveto 344.651 -196.487 lineto 351.554 -192.442 lineto closepath fill |
|
| 68 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 69 |
157.79 -130.517 moveto |
|
| 70 |
108.71 -67.0521 102.27 -58.7243 64.3804 -9.72954 curveto stroke |
|
| 71 |
newpath 57.0394 -0.236898 moveto 67.5446 -7.28254 lineto 61.2162 -12.1765 lineto closepath fill |
|
| 72 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 73 |
-105.193 -261.035 moveto |
|
| 74 |
-35.6576 -132.801 -30.5923 -123.459 29.5506 -12.5464 curveto stroke |
|
| 75 |
newpath 35.2708 -1.99743 moveto 33.0669 -14.4531 lineto 26.0343 -10.6397 lineto closepath fill |
|
| 76 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 77 |
-465.576 -42.8564 moveto |
|
| 78 |
-559.078 -25.5413 -569.47 -23.6169 -644.498 -9.72286 curveto stroke |
|
| 79 |
newpath -656.297 -7.5378 moveto -643.77 -5.78973 lineto -645.226 -13.656 lineto closepath fill |
|
| 80 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 81 |
-574.666 -153.893 moveto |
|
| 82 |
-528.842 -107.252 -521.515 -99.794 -488.002 -65.683 curveto stroke |
|
| 83 |
newpath -479.592 -57.123 moveto -485.149 -68.4863 lineto -490.856 -62.8797 lineto closepath fill |
|
| 84 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 85 |
-490.901 120.777 moveto |
|
| 86 |
-480.122 51.1328 -478.519 40.7713 -470.47 -11.2329 curveto stroke |
|
| 87 |
newpath -468.635 -23.0917 moveto -474.423 -11.8447 lineto -466.517 -10.6212 lineto closepath fill |
|
| 88 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 89 |
-675.963 -3.89604 moveto |
|
| 90 |
-632.116 -68.8235 -626.228 -77.5422 -592.575 -127.374 curveto stroke |
|
| 91 |
newpath -585.859 -137.319 moveto -595.89 -129.612 lineto -589.26 -125.135 lineto closepath fill |
|
| 92 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 93 |
-490.901 120.777 moveto |
|
| 94 |
-435.445 215.844 -430.107 224.995 -384.3 303.522 curveto stroke |
|
| 95 |
newpath -378.253 313.887 moveto -380.845 301.507 lineto -387.755 305.537 lineto closepath fill |
|
| 96 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 97 |
-266.879 114.933 moveto |
|
| 98 |
-367.067 117.547 -377.642 117.822 -458.912 119.943 curveto stroke |
|
| 99 |
newpath -470.908 120.255 moveto -458.807 123.941 lineto -459.016 115.944 lineto closepath fill |
|
| 100 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 101 |
-368.176 331.163 moveto |
|
| 102 |
-322.511 233.685 -318.018 224.095 -280.454 143.911 curveto stroke |
|
| 103 |
newpath -275.364 133.044 moveto -284.076 142.214 lineto -276.832 145.608 lineto closepath fill |
|
| 104 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 105 |
-266.879 114.933 moveto |
|
| 106 |
-224.004 235.52 -220.448 245.52 -184.094 347.765 curveto stroke |
|
| 107 |
newpath -180.074 359.072 moveto -180.325 346.425 lineto -187.863 349.105 lineto closepath fill |
|
| 108 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 109 |
-251.294 -335.059 moveto |
|
| 110 |
-189.25 -303.624 -179.902 -298.887 -133.738 -275.498 curveto stroke |
|
| 111 |
newpath -123.034 -270.074 moveto -131.93 -279.066 lineto -135.546 -271.93 lineto closepath fill |
|
| 112 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 113 |
-389.604 -136.361 moveto |
|
| 114 |
-327.15 -226.083 -321.098 -234.777 -269.576 -308.795 curveto stroke |
|
| 115 |
newpath -262.72 -318.644 moveto -272.859 -311.081 lineto -266.293 -306.51 lineto closepath fill |
|
| 116 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 117 |
5.84406 175.322 moveto |
|
| 118 |
-76.0754 267.926 -83.1051 275.873 -152.172 353.948 curveto stroke |
|
| 119 |
newpath -160.122 362.936 moveto -149.176 356.598 lineto -155.168 351.298 lineto closepath fill |
|
| 120 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 121 |
169.478 311.683 moveto |
|
| 122 |
96.8003 251.119 88.6819 244.353 30.4273 195.808 curveto stroke |
|
| 123 |
newpath 21.2086 188.126 moveto 27.8666 198.881 lineto 32.988 192.735 lineto closepath fill |
|
| 124 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 125 |
342.851 111.037 moveto |
|
| 126 |
263.766 202.563 256.831 210.589 190.4 287.47 curveto stroke |
|
| 127 |
newpath 182.554 296.55 moveto 193.427 290.085 lineto 187.373 284.855 lineto closepath fill |
|
| 128 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 129 |
5.84406 175.322 moveto |
|
| 130 |
163.16 145.314 173.605 143.321 311.418 117.033 curveto stroke |
|
| 131 |
newpath 323.205 114.784 moveto 310.668 113.104 lineto 312.167 120.962 lineto closepath fill |
|
| 132 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 133 |
342.851 111.037 moveto |
|
| 134 |
497.255 2.58683 505.964 -3.53033 643.932 -100.436 curveto stroke |
|
| 135 |
newpath 653.752 -107.334 moveto 641.633 -103.71 lineto 646.231 -97.163 lineto closepath fill |
|
| 136 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 137 |
364.28 -222.074 moveto |
|
| 138 |
354.298 -66.9063 353.616 -56.2971 344.905 79.1029 curveto stroke |
|
| 139 |
newpath 344.135 91.0781 moveto 348.897 79.3597 lineto 340.914 78.8461 lineto closepath fill |
|
| 140 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 141 |
670.118 -118.829 moveto |
|
| 142 |
528.037 -166.793 517.967 -170.192 394.599 -211.839 curveto stroke |
|
| 143 |
newpath 383.229 -215.677 moveto 393.32 -208.049 lineto 395.878 -215.629 lineto closepath fill |
|
| 144 |
2 setlinewidth 1 0 0 setrgbcolor newpath |
|
| 145 |
-105.193 -261.035 moveto |
|
| 146 |
118.401 -242.479 129.015 -241.598 332.39 -224.721 curveto stroke |
|
| 147 |
newpath 344.348 -223.728 moveto 332.72 -228.707 lineto 332.059 -220.734 lineto closepath fill |
|
| 148 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 149 |
-105.193 -261.035 moveto |
|
| 150 |
-160.867 -161.176 -166.028 -151.918 -212.336 -68.858 curveto stroke |
|
| 151 |
newpath -218.179 -58.3769 moveto -208.842 -66.9102 lineto -215.829 -70.8058 lineto closepath fill |
|
| 152 |
2 setlinewidth 0 0 1 setrgbcolor newpath |
|
| 153 |
-227.918 -40.9084 moveto |
|
| 154 |
-298.35 -82.4884 -307.42 -87.8432 -362.048 -120.093 curveto stroke |
|
| 155 |
newpath -372.381 -126.193 moveto -364.081 -116.648 lineto -360.014 -123.537 lineto closepath fill |
|
| 156 |
grestore |
|
| 157 |
%Nodes: |
|
| 158 |
gsave |
|
| 159 |
-389.604 -136.361 20 0 1 0 nc |
|
| 160 |
-227.918 -40.9084 20 0 1 0 nc |
|
| 161 |
-105.193 -261.035 20 0 1 0 nc |
|
| 162 |
364.28 -222.074 20 1 1 0 nc |
|
| 163 |
670.118 -118.829 20 1 1 0 nc |
|
| 164 |
342.851 111.037 20 1 1 0 nc |
|
| 165 |
5.84406 175.322 20 1 1 0 nc |
|
| 166 |
169.478 311.683 20 1 1 0 nc |
|
| 167 |
-173.374 377.916 20 1 0 1 nc |
|
| 168 |
-251.294 -335.059 20 0 1 0 nc |
|
| 169 |
-266.879 114.933 20 0 0 0 nc |
|
| 170 |
-368.176 331.163 20 0 0 0 nc |
|
| 171 |
-490.901 120.777 20 0 0 0 nc |
|
| 172 |
-574.666 -153.893 20 1 0 0 nc |
|
| 173 |
-675.963 -3.89604 20 1 0 0 nc |
|
| 174 |
-465.576 -42.8564 20 1 0 0 nc |
|
| 175 |
44.8044 15.5841 20 0 0 1 nc |
|
| 176 |
157.79 -130.517 20 0 0 1 nc |
|
| 177 |
218.178 27.2723 20 0 0 1 nc |
|
| 178 |
grestore |
|
| 179 |
grestore |
|
| 180 |
showpage |
| 1 | 1 |
SET(PACKAGE_NAME ${PROJECT_NAME})
|
| 2 | 2 |
SET(PACKAGE_VERSION ${PROJECT_VERSION})
|
| 3 | 3 |
SET(abs_top_srcdir ${PROJECT_SOURCE_DIR})
|
| 4 | 4 |
SET(abs_top_builddir ${PROJECT_BINARY_DIR})
|
| 5 | 5 |
|
| 6 | 6 |
CONFIGURE_FILE( |
| 7 | 7 |
${PROJECT_SOURCE_DIR}/doc/Doxyfile.in
|
| 8 | 8 |
${PROJECT_BINARY_DIR}/doc/Doxyfile
|
| 9 | 9 |
@ONLY) |
| 10 | 10 |
|
| 11 | 11 |
IF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) |
| 12 | 12 |
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/)
|
| 13 | 13 |
IF(UNIX) |
| 14 | 14 |
ADD_CUSTOM_TARGET(html |
| 15 | 15 |
COMMAND rm -rf gen-images |
| 16 | 16 |
COMMAND mkdir gen-images |
| 17 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
|
|
| 18 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
|
|
| 19 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
|
|
| 20 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
|
|
| 17 | 21 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
|
| 22 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
|
|
| 18 | 23 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
|
| 19 | 24 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
|
| 20 | 25 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps
|
| 21 | 26 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
|
| 22 | 27 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
|
| 28 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
|
|
| 23 | 29 |
COMMAND rm -rf html |
| 24 | 30 |
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
|
| 25 | 31 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
| 26 | 32 |
ELSEIF(WIN32) |
| 27 | 33 |
ADD_CUSTOM_TARGET(html |
| 28 | 34 |
COMMAND if exist gen-images rmdir /s /q gen-images |
| 29 | 35 |
COMMAND mkdir gen-images |
| 36 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_matching.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_matching.eps
|
|
| 37 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/bipartite_partitions.png ${CMAKE_CURRENT_SOURCE_DIR}/images/bipartite_partitions.eps
|
|
| 38 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/connected_components.eps
|
|
| 39 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/edge_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/edge_biconnected_components.eps
|
|
| 40 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/grid_graph.png ${CMAKE_CURRENT_SOURCE_DIR}/images/grid_graph.eps
|
|
| 41 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/node_biconnected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/node_biconnected_components.eps
|
|
| 30 | 42 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_0.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_0.eps
|
| 31 | 43 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_1.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_1.eps
|
| 32 | 44 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_2.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_2.eps
|
| 33 | 45 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_3.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_3.eps
|
| 34 | 46 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/nodeshape_4.png ${CMAKE_CURRENT_SOURCE_DIR}/images/nodeshape_4.eps
|
| 47 |
COMMAND ${GHOSTSCRIPT_EXECUTABLE} -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 -sDEVICE=pngalpha -r18 -sOutputFile=gen-images/strongly_connected_components.png ${CMAKE_CURRENT_SOURCE_DIR}/images/strongly_connected_components.eps
|
|
| 35 | 48 |
COMMAND if exist html rmdir /s /q html |
| 36 | 49 |
COMMAND ${DOXYGEN_EXECUTABLE} Doxyfile
|
| 37 | 50 |
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
| 38 | 51 |
ENDIF(UNIX) |
| 39 | 52 |
INSTALL( |
| 40 | 53 |
DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/html/
|
| 41 | 54 |
DESTINATION share/doc |
| 42 | 55 |
COMPONENT html_documentation) |
| 43 | 56 |
ENDIF(DOXYGEN_EXECUTABLE AND GHOSTSCRIPT_EXECUTABLE) |
| 1 | 1 |
EXTRA_DIST += \ |
| 2 | 2 |
doc/Doxyfile.in \ |
| 3 | 3 |
doc/DoxygenLayout.xml \ |
| 4 | 4 |
doc/coding_style.dox \ |
| 5 | 5 |
doc/dirs.dox \ |
| 6 | 6 |
doc/groups.dox \ |
| 7 | 7 |
doc/lgf.dox \ |
| 8 | 8 |
doc/license.dox \ |
| 9 | 9 |
doc/mainpage.dox \ |
| 10 | 10 |
doc/migration.dox \ |
| 11 | 11 |
doc/named-param.dox \ |
| 12 | 12 |
doc/namespaces.dox \ |
| 13 | 13 |
doc/html \ |
| 14 | 14 |
doc/CMakeLists.txt |
| 15 | 15 |
|
| 16 | 16 |
DOC_EPS_IMAGES18 = \ |
| 17 | 17 |
grid_graph.eps \ |
| 18 | 18 |
nodeshape_0.eps \ |
| 19 | 19 |
nodeshape_1.eps \ |
| 20 | 20 |
nodeshape_2.eps \ |
| 21 | 21 |
nodeshape_3.eps \ |
| 22 | 22 |
nodeshape_4.eps |
| 23 | 23 |
|
| 24 |
DOC_EPS_IMAGES27 = \ |
|
| 25 |
bipartite_matching.eps \ |
|
| 26 |
bipartite_partitions.eps \ |
|
| 27 |
connected_components.eps \ |
|
| 28 |
edge_biconnected_components.eps \ |
|
| 29 |
node_biconnected_components.eps \ |
|
| 30 |
strongly_connected_components.eps |
|
| 31 |
|
|
| 24 | 32 |
DOC_EPS_IMAGES = \ |
| 25 |
$(DOC_EPS_IMAGES18) |
|
| 33 |
$(DOC_EPS_IMAGES18) \ |
|
| 34 |
$(DOC_EPS_IMAGES27) |
|
| 26 | 35 |
|
| 27 | 36 |
DOC_PNG_IMAGES = \ |
| 28 | 37 |
$(DOC_EPS_IMAGES:%.eps=doc/gen-images/%.png) |
| 29 | 38 |
|
| 30 | 39 |
EXTRA_DIST += $(DOC_EPS_IMAGES:%=doc/images/%) |
| 31 | 40 |
|
| 32 | 41 |
doc/html: |
| 33 | 42 |
$(MAKE) $(AM_MAKEFLAGS) html |
| 34 | 43 |
|
| 35 | 44 |
GS_COMMAND=gs -dNOPAUSE -dBATCH -q -dEPSCrop -dTextAlphaBits=4 -dGraphicsAlphaBits=4 |
| 36 | 45 |
|
| 37 | 46 |
$(DOC_EPS_IMAGES18:%.eps=doc/gen-images/%.png): doc/gen-images/%.png: doc/images/%.eps |
| 38 | 47 |
-mkdir doc/gen-images |
| 39 | 48 |
if test ${gs_found} = yes; then \
|
| 40 | 49 |
$(GS_COMMAND) -sDEVICE=pngalpha -r18 -sOutputFile=$@ $<; \ |
| 41 | 50 |
else \ |
| 42 | 51 |
echo; \ |
| 43 | 52 |
echo "Ghostscript not found."; \ |
| 44 | 53 |
echo; \ |
| 45 | 54 |
exit 1; \ |
| 46 | 55 |
fi |
| 47 | 56 |
|
| 57 |
$(DOC_EPS_IMAGES27:%.eps=doc/gen-images/%.png): doc/gen-images/%.png: doc/images/%.eps |
|
| 58 |
-mkdir doc/gen-images |
|
| 59 |
if test ${gs_found} = yes; then \
|
|
| 60 |
$(GS_COMMAND) -sDEVICE=pngalpha -r27 -sOutputFile=$@ $<; \ |
|
| 61 |
else \ |
|
| 62 |
echo; \ |
|
| 63 |
echo "Ghostscript not found."; \ |
|
| 64 |
echo; \ |
|
| 65 |
exit 1; \ |
|
| 66 |
fi |
|
| 67 |
|
|
| 48 | 68 |
html-local: $(DOC_PNG_IMAGES) |
| 49 | 69 |
if test ${doxygen_found} = yes; then \
|
| 50 | 70 |
cd doc; \ |
| 51 | 71 |
doxygen Doxyfile; \ |
| 52 | 72 |
cd ..; \ |
| 53 | 73 |
else \ |
| 54 | 74 |
echo; \ |
| 55 | 75 |
echo "Doxygen not found."; \ |
| 56 | 76 |
echo; \ |
| 57 | 77 |
exit 1; \ |
| 58 | 78 |
fi |
| 59 | 79 |
|
| 60 | 80 |
clean-local: |
| 61 | 81 |
-rm -rf doc/html |
| 62 | 82 |
-rm -f doc/doxygen.log |
| 63 | 83 |
-rm -f $(DOC_PNG_IMAGES) |
| 64 | 84 |
-rm -rf doc/gen-images |
| 65 | 85 |
|
| 66 | 86 |
update-external-tags: |
| 67 | 87 |
wget -O doc/libstdc++.tag.tmp http://gcc.gnu.org/onlinedocs/libstdc++/latest-doxygen/libstdc++.tag && \ |
| 68 | 88 |
mv doc/libstdc++.tag.tmp doc/libstdc++.tag || \ |
| 69 | 89 |
rm doc/libstdc++.tag.tmp |
| 70 | 90 |
|
| 71 | 91 |
install-html-local: doc/html |
| 72 | 92 |
@$(NORMAL_INSTALL) |
| 73 | 93 |
$(mkinstalldirs) $(DESTDIR)$(htmldir)/docs |
| 74 | 94 |
for p in doc/html/*.{html,css,png,map,gif,tag} ; do \
|
| 75 | 95 |
f="`echo $$p | sed -e 's|^.*/||'`"; \ |
| 76 | 96 |
echo " $(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/docs/$$f"; \ |
| 77 | 97 |
$(INSTALL_DATA) $$p $(DESTDIR)$(htmldir)/docs/$$f; \ |
| 78 | 98 |
done |
| 79 | 99 |
|
| 80 | 100 |
uninstall-local: |
| 81 | 101 |
@$(NORMAL_UNINSTALL) |
| 82 | 102 |
for p in doc/html/*.{html,css,png,map,gif,tag} ; do \
|
| 83 | 103 |
f="`echo $$p | sed -e 's|^.*/||'`"; \ |
| 84 | 104 |
echo " rm -f $(DESTDIR)$(htmldir)/docs/$$f"; \ |
| 85 | 105 |
rm -f $(DESTDIR)$(htmldir)/docs/$$f; \ |
| 86 | 106 |
done |
| 87 | 107 |
|
| 88 | 108 |
.PHONY: update-external-tags |
| ... | ... |
@@ -26,662 +26,662 @@ |
| 26 | 26 |
/** |
| 27 | 27 |
@defgroup graphs Graph Structures |
| 28 | 28 |
@ingroup datas |
| 29 | 29 |
\brief Graph structures implemented in LEMON. |
| 30 | 30 |
|
| 31 | 31 |
The implementation of combinatorial algorithms heavily relies on |
| 32 | 32 |
efficient graph implementations. LEMON offers data structures which are |
| 33 | 33 |
planned to be easily used in an experimental phase of implementation studies, |
| 34 | 34 |
and thereafter the program code can be made efficient by small modifications. |
| 35 | 35 |
|
| 36 | 36 |
The most efficient implementation of diverse applications require the |
| 37 | 37 |
usage of different physical graph implementations. These differences |
| 38 | 38 |
appear in the size of graph we require to handle, memory or time usage |
| 39 | 39 |
limitations or in the set of operations through which the graph can be |
| 40 | 40 |
accessed. LEMON provides several physical graph structures to meet |
| 41 | 41 |
the diverging requirements of the possible users. In order to save on |
| 42 | 42 |
running time or on memory usage, some structures may fail to provide |
| 43 | 43 |
some graph features like arc/edge or node deletion. |
| 44 | 44 |
|
| 45 | 45 |
Alteration of standard containers need a very limited number of |
| 46 | 46 |
operations, these together satisfy the everyday requirements. |
| 47 | 47 |
In the case of graph structures, different operations are needed which do |
| 48 | 48 |
not alter the physical graph, but gives another view. If some nodes or |
| 49 | 49 |
arcs have to be hidden or the reverse oriented graph have to be used, then |
| 50 | 50 |
this is the case. It also may happen that in a flow implementation |
| 51 | 51 |
the residual graph can be accessed by another algorithm, or a node-set |
| 52 | 52 |
is to be shrunk for another algorithm. |
| 53 | 53 |
LEMON also provides a variety of graphs for these requirements called |
| 54 | 54 |
\ref graph_adaptors "graph adaptors". Adaptors cannot be used alone but only |
| 55 | 55 |
in conjunction with other graph representations. |
| 56 | 56 |
|
| 57 | 57 |
You are free to use the graph structure that fit your requirements |
| 58 | 58 |
the best, most graph algorithms and auxiliary data structures can be used |
| 59 | 59 |
with any graph structure. |
| 60 | 60 |
|
| 61 | 61 |
<b>See also:</b> \ref graph_concepts "Graph Structure Concepts". |
| 62 | 62 |
*/ |
| 63 | 63 |
|
| 64 | 64 |
/** |
| 65 | 65 |
@defgroup graph_adaptors Adaptor Classes for Graphs |
| 66 | 66 |
@ingroup graphs |
| 67 | 67 |
\brief Adaptor classes for digraphs and graphs |
| 68 | 68 |
|
| 69 | 69 |
This group contains several useful adaptor classes for digraphs and graphs. |
| 70 | 70 |
|
| 71 | 71 |
The main parts of LEMON are the different graph structures, generic |
| 72 | 72 |
graph algorithms, graph concepts, which couple them, and graph |
| 73 | 73 |
adaptors. While the previous notions are more or less clear, the |
| 74 | 74 |
latter one needs further explanation. Graph adaptors are graph classes |
| 75 | 75 |
which serve for considering graph structures in different ways. |
| 76 | 76 |
|
| 77 | 77 |
A short example makes this much clearer. Suppose that we have an |
| 78 | 78 |
instance \c g of a directed graph type, say ListDigraph and an algorithm |
| 79 | 79 |
\code |
| 80 | 80 |
template <typename Digraph> |
| 81 | 81 |
int algorithm(const Digraph&); |
| 82 | 82 |
\endcode |
| 83 | 83 |
is needed to run on the reverse oriented graph. It may be expensive |
| 84 | 84 |
(in time or in memory usage) to copy \c g with the reversed |
| 85 | 85 |
arcs. In this case, an adaptor class is used, which (according |
| 86 | 86 |
to LEMON \ref concepts::Digraph "digraph concepts") works as a digraph. |
| 87 | 87 |
The adaptor uses the original digraph structure and digraph operations when |
| 88 | 88 |
methods of the reversed oriented graph are called. This means that the adaptor |
| 89 | 89 |
have minor memory usage, and do not perform sophisticated algorithmic |
| 90 | 90 |
actions. The purpose of it is to give a tool for the cases when a |
| 91 | 91 |
graph have to be used in a specific alteration. If this alteration is |
| 92 | 92 |
obtained by a usual construction like filtering the node or the arc set or |
| 93 | 93 |
considering a new orientation, then an adaptor is worthwhile to use. |
| 94 | 94 |
To come back to the reverse oriented graph, in this situation |
| 95 | 95 |
\code |
| 96 | 96 |
template<typename Digraph> class ReverseDigraph; |
| 97 | 97 |
\endcode |
| 98 | 98 |
template class can be used. The code looks as follows |
| 99 | 99 |
\code |
| 100 | 100 |
ListDigraph g; |
| 101 | 101 |
ReverseDigraph<ListDigraph> rg(g); |
| 102 | 102 |
int result = algorithm(rg); |
| 103 | 103 |
\endcode |
| 104 | 104 |
During running the algorithm, the original digraph \c g is untouched. |
| 105 | 105 |
This techniques give rise to an elegant code, and based on stable |
| 106 | 106 |
graph adaptors, complex algorithms can be implemented easily. |
| 107 | 107 |
|
| 108 | 108 |
In flow, circulation and matching problems, the residual |
| 109 | 109 |
graph is of particular importance. Combining an adaptor implementing |
| 110 | 110 |
this with shortest path algorithms or minimum mean cycle algorithms, |
| 111 | 111 |
a range of weighted and cardinality optimization algorithms can be |
| 112 | 112 |
obtained. For other examples, the interested user is referred to the |
| 113 | 113 |
detailed documentation of particular adaptors. |
| 114 | 114 |
|
| 115 | 115 |
The behavior of graph adaptors can be very different. Some of them keep |
| 116 | 116 |
capabilities of the original graph while in other cases this would be |
| 117 | 117 |
meaningless. This means that the concepts that they meet depend |
| 118 | 118 |
on the graph adaptor, and the wrapped graph. |
| 119 | 119 |
For example, if an arc of a reversed digraph is deleted, this is carried |
| 120 | 120 |
out by deleting the corresponding arc of the original digraph, thus the |
| 121 | 121 |
adaptor modifies the original digraph. |
| 122 | 122 |
However in case of a residual digraph, this operation has no sense. |
| 123 | 123 |
|
| 124 | 124 |
Let us stand one more example here to simplify your work. |
| 125 | 125 |
ReverseDigraph has constructor |
| 126 | 126 |
\code |
| 127 | 127 |
ReverseDigraph(Digraph& digraph); |
| 128 | 128 |
\endcode |
| 129 | 129 |
This means that in a situation, when a <tt>const %ListDigraph&</tt> |
| 130 | 130 |
reference to a graph is given, then it have to be instantiated with |
| 131 | 131 |
<tt>Digraph=const %ListDigraph</tt>. |
| 132 | 132 |
\code |
| 133 | 133 |
int algorithm1(const ListDigraph& g) {
|
| 134 | 134 |
ReverseDigraph<const ListDigraph> rg(g); |
| 135 | 135 |
return algorithm2(rg); |
| 136 | 136 |
} |
| 137 | 137 |
\endcode |
| 138 | 138 |
*/ |
| 139 | 139 |
|
| 140 | 140 |
/** |
| 141 | 141 |
@defgroup semi_adaptors Semi-Adaptor Classes for Graphs |
| 142 | 142 |
@ingroup graphs |
| 143 | 143 |
\brief Graph types between real graphs and graph adaptors. |
| 144 | 144 |
|
| 145 | 145 |
This group contains some graph types between real graphs and graph adaptors. |
| 146 | 146 |
These classes wrap graphs to give new functionality as the adaptors do it. |
| 147 | 147 |
On the other hand they are not light-weight structures as the adaptors. |
| 148 | 148 |
*/ |
| 149 | 149 |
|
| 150 | 150 |
/** |
| 151 | 151 |
@defgroup maps Maps |
| 152 | 152 |
@ingroup datas |
| 153 | 153 |
\brief Map structures implemented in LEMON. |
| 154 | 154 |
|
| 155 | 155 |
This group contains the map structures implemented in LEMON. |
| 156 | 156 |
|
| 157 | 157 |
LEMON provides several special purpose maps and map adaptors that e.g. combine |
| 158 | 158 |
new maps from existing ones. |
| 159 | 159 |
|
| 160 | 160 |
<b>See also:</b> \ref map_concepts "Map Concepts". |
| 161 | 161 |
*/ |
| 162 | 162 |
|
| 163 | 163 |
/** |
| 164 | 164 |
@defgroup graph_maps Graph Maps |
| 165 | 165 |
@ingroup maps |
| 166 | 166 |
\brief Special graph-related maps. |
| 167 | 167 |
|
| 168 | 168 |
This group contains maps that are specifically designed to assign |
| 169 | 169 |
values to the nodes and arcs/edges of graphs. |
| 170 | 170 |
|
| 171 | 171 |
If you are looking for the standard graph maps (\c NodeMap, \c ArcMap, |
| 172 | 172 |
\c EdgeMap), see the \ref graph_concepts "Graph Structure Concepts". |
| 173 | 173 |
*/ |
| 174 | 174 |
|
| 175 | 175 |
/** |
| 176 | 176 |
\defgroup map_adaptors Map Adaptors |
| 177 | 177 |
\ingroup maps |
| 178 | 178 |
\brief Tools to create new maps from existing ones |
| 179 | 179 |
|
| 180 | 180 |
This group contains map adaptors that are used to create "implicit" |
| 181 | 181 |
maps from other maps. |
| 182 | 182 |
|
| 183 | 183 |
Most of them are \ref concepts::ReadMap "read-only maps". |
| 184 | 184 |
They can make arithmetic and logical operations between one or two maps |
| 185 | 185 |
(negation, shifting, addition, multiplication, logical 'and', 'or', |
| 186 | 186 |
'not' etc.) or e.g. convert a map to another one of different Value type. |
| 187 | 187 |
|
| 188 | 188 |
The typical usage of this classes is passing implicit maps to |
| 189 | 189 |
algorithms. If a function type algorithm is called then the function |
| 190 | 190 |
type map adaptors can be used comfortable. For example let's see the |
| 191 | 191 |
usage of map adaptors with the \c graphToEps() function. |
| 192 | 192 |
\code |
| 193 | 193 |
Color nodeColor(int deg) {
|
| 194 | 194 |
if (deg >= 2) {
|
| 195 | 195 |
return Color(0.5, 0.0, 0.5); |
| 196 | 196 |
} else if (deg == 1) {
|
| 197 | 197 |
return Color(1.0, 0.5, 1.0); |
| 198 | 198 |
} else {
|
| 199 | 199 |
return Color(0.0, 0.0, 0.0); |
| 200 | 200 |
} |
| 201 | 201 |
} |
| 202 | 202 |
|
| 203 | 203 |
Digraph::NodeMap<int> degree_map(graph); |
| 204 | 204 |
|
| 205 | 205 |
graphToEps(graph, "graph.eps") |
| 206 | 206 |
.coords(coords).scaleToA4().undirected() |
| 207 | 207 |
.nodeColors(composeMap(functorToMap(nodeColor), degree_map)) |
| 208 | 208 |
.run(); |
| 209 | 209 |
\endcode |
| 210 | 210 |
The \c functorToMap() function makes an \c int to \c Color map from the |
| 211 | 211 |
\c nodeColor() function. The \c composeMap() compose the \c degree_map |
| 212 | 212 |
and the previously created map. The composed map is a proper function to |
| 213 | 213 |
get the color of each node. |
| 214 | 214 |
|
| 215 | 215 |
The usage with class type algorithms is little bit harder. In this |
| 216 | 216 |
case the function type map adaptors can not be used, because the |
| 217 | 217 |
function map adaptors give back temporary objects. |
| 218 | 218 |
\code |
| 219 | 219 |
Digraph graph; |
| 220 | 220 |
|
| 221 | 221 |
typedef Digraph::ArcMap<double> DoubleArcMap; |
| 222 | 222 |
DoubleArcMap length(graph); |
| 223 | 223 |
DoubleArcMap speed(graph); |
| 224 | 224 |
|
| 225 | 225 |
typedef DivMap<DoubleArcMap, DoubleArcMap> TimeMap; |
| 226 | 226 |
TimeMap time(length, speed); |
| 227 | 227 |
|
| 228 | 228 |
Dijkstra<Digraph, TimeMap> dijkstra(graph, time); |
| 229 | 229 |
dijkstra.run(source, target); |
| 230 | 230 |
\endcode |
| 231 | 231 |
We have a length map and a maximum speed map on the arcs of a digraph. |
| 232 | 232 |
The minimum time to pass the arc can be calculated as the division of |
| 233 | 233 |
the two maps which can be done implicitly with the \c DivMap template |
| 234 | 234 |
class. We use the implicit minimum time map as the length map of the |
| 235 | 235 |
\c Dijkstra algorithm. |
| 236 | 236 |
*/ |
| 237 | 237 |
|
| 238 | 238 |
/** |
| 239 | 239 |
@defgroup matrices Matrices |
| 240 | 240 |
@ingroup datas |
| 241 | 241 |
\brief Two dimensional data storages implemented in LEMON. |
| 242 | 242 |
|
| 243 | 243 |
This group contains two dimensional data storages implemented in LEMON. |
| 244 | 244 |
*/ |
| 245 | 245 |
|
| 246 | 246 |
/** |
| 247 | 247 |
@defgroup paths Path Structures |
| 248 | 248 |
@ingroup datas |
| 249 | 249 |
\brief %Path structures implemented in LEMON. |
| 250 | 250 |
|
| 251 | 251 |
This group contains the path structures implemented in LEMON. |
| 252 | 252 |
|
| 253 | 253 |
LEMON provides flexible data structures to work with paths. |
| 254 | 254 |
All of them have similar interfaces and they can be copied easily with |
| 255 | 255 |
assignment operators and copy constructors. This makes it easy and |
| 256 | 256 |
efficient to have e.g. the Dijkstra algorithm to store its result in |
| 257 | 257 |
any kind of path structure. |
| 258 | 258 |
|
| 259 | 259 |
\sa lemon::concepts::Path |
| 260 | 260 |
*/ |
| 261 | 261 |
|
| 262 | 262 |
/** |
| 263 | 263 |
@defgroup auxdat Auxiliary Data Structures |
| 264 | 264 |
@ingroup datas |
| 265 | 265 |
\brief Auxiliary data structures implemented in LEMON. |
| 266 | 266 |
|
| 267 | 267 |
This group contains some data structures implemented in LEMON in |
| 268 | 268 |
order to make it easier to implement combinatorial algorithms. |
| 269 | 269 |
*/ |
| 270 | 270 |
|
| 271 | 271 |
/** |
| 272 | 272 |
@defgroup algs Algorithms |
| 273 | 273 |
\brief This group contains the several algorithms |
| 274 | 274 |
implemented in LEMON. |
| 275 | 275 |
|
| 276 | 276 |
This group contains the several algorithms |
| 277 | 277 |
implemented in LEMON. |
| 278 | 278 |
*/ |
| 279 | 279 |
|
| 280 | 280 |
/** |
| 281 | 281 |
@defgroup search Graph Search |
| 282 | 282 |
@ingroup algs |
| 283 | 283 |
\brief Common graph search algorithms. |
| 284 | 284 |
|
| 285 | 285 |
This group contains the common graph search algorithms, namely |
| 286 | 286 |
\e breadth-first \e search (BFS) and \e depth-first \e search (DFS). |
| 287 | 287 |
*/ |
| 288 | 288 |
|
| 289 | 289 |
/** |
| 290 | 290 |
@defgroup shortest_path Shortest Path Algorithms |
| 291 | 291 |
@ingroup algs |
| 292 | 292 |
\brief Algorithms for finding shortest paths. |
| 293 | 293 |
|
| 294 | 294 |
This group contains the algorithms for finding shortest paths in digraphs. |
| 295 | 295 |
|
| 296 | 296 |
- \ref Dijkstra algorithm for finding shortest paths from a source node |
| 297 | 297 |
when all arc lengths are non-negative. |
| 298 | 298 |
- \ref BellmanFord "Bellman-Ford" algorithm for finding shortest paths |
| 299 | 299 |
from a source node when arc lenghts can be either positive or negative, |
| 300 | 300 |
but the digraph should not contain directed cycles with negative total |
| 301 | 301 |
length. |
| 302 | 302 |
- \ref FloydWarshall "Floyd-Warshall" and \ref Johnson "Johnson" algorithms |
| 303 | 303 |
for solving the \e all-pairs \e shortest \e paths \e problem when arc |
| 304 | 304 |
lenghts can be either positive or negative, but the digraph should |
| 305 | 305 |
not contain directed cycles with negative total length. |
| 306 | 306 |
- \ref Suurballe A successive shortest path algorithm for finding |
| 307 | 307 |
arc-disjoint paths between two nodes having minimum total length. |
| 308 | 308 |
*/ |
| 309 | 309 |
|
| 310 | 310 |
/** |
| 311 | 311 |
@defgroup max_flow Maximum Flow Algorithms |
| 312 | 312 |
@ingroup algs |
| 313 | 313 |
\brief Algorithms for finding maximum flows. |
| 314 | 314 |
|
| 315 | 315 |
This group contains the algorithms for finding maximum flows and |
| 316 | 316 |
feasible circulations. |
| 317 | 317 |
|
| 318 | 318 |
The \e maximum \e flow \e problem is to find a flow of maximum value between |
| 319 | 319 |
a single source and a single target. Formally, there is a \f$G=(V,A)\f$ |
| 320 | 320 |
digraph, a \f$cap:A\rightarrow\mathbf{R}^+_0\f$ capacity function and
|
| 321 | 321 |
\f$s, t \in V\f$ source and target nodes. |
| 322 | 322 |
A maximum flow is an \f$f:A\rightarrow\mathbf{R}^+_0\f$ solution of the
|
| 323 | 323 |
following optimization problem. |
| 324 | 324 |
|
| 325 | 325 |
\f[ \max\sum_{a\in\delta_{out}(s)}f(a) - \sum_{a\in\delta_{in}(s)}f(a) \f]
|
| 326 | 326 |
\f[ \sum_{a\in\delta_{out}(v)} f(a) = \sum_{a\in\delta_{in}(v)} f(a)
|
| 327 | 327 |
\qquad \forall v\in V\setminus\{s,t\} \f]
|
| 328 | 328 |
\f[ 0 \leq f(a) \leq cap(a) \qquad \forall a\in A \f] |
| 329 | 329 |
|
| 330 | 330 |
LEMON contains several algorithms for solving maximum flow problems: |
| 331 | 331 |
- \ref EdmondsKarp Edmonds-Karp algorithm. |
| 332 | 332 |
- \ref Preflow Goldberg-Tarjan's preflow push-relabel algorithm. |
| 333 | 333 |
- \ref DinitzSleatorTarjan Dinitz's blocking flow algorithm with dynamic trees. |
| 334 | 334 |
- \ref GoldbergTarjan Preflow push-relabel algorithm with dynamic trees. |
| 335 | 335 |
|
| 336 | 336 |
In most cases the \ref Preflow "Preflow" algorithm provides the |
| 337 | 337 |
fastest method for computing a maximum flow. All implementations |
| 338 | 338 |
provides functions to also query the minimum cut, which is the dual |
| 339 | 339 |
problem of the maximum flow. |
| 340 | 340 |
*/ |
| 341 | 341 |
|
| 342 | 342 |
/** |
| 343 | 343 |
@defgroup min_cost_flow Minimum Cost Flow Algorithms |
| 344 | 344 |
@ingroup algs |
| 345 | 345 |
|
| 346 | 346 |
\brief Algorithms for finding minimum cost flows and circulations. |
| 347 | 347 |
|
| 348 | 348 |
This group contains the algorithms for finding minimum cost flows and |
| 349 | 349 |
circulations. |
| 350 | 350 |
|
| 351 | 351 |
The \e minimum \e cost \e flow \e problem is to find a feasible flow of |
| 352 | 352 |
minimum total cost from a set of supply nodes to a set of demand nodes |
| 353 | 353 |
in a network with capacity constraints and arc costs. |
| 354 | 354 |
Formally, let \f$G=(V,A)\f$ be a digraph, |
| 355 | 355 |
\f$lower, upper: A\rightarrow\mathbf{Z}^+_0\f$ denote the lower and
|
| 356 | 356 |
upper bounds for the flow values on the arcs, |
| 357 | 357 |
\f$cost: A\rightarrow\mathbf{Z}^+_0\f$ denotes the cost per unit flow
|
| 358 | 358 |
on the arcs, and |
| 359 | 359 |
\f$supply: V\rightarrow\mathbf{Z}\f$ denotes the supply/demand values
|
| 360 | 360 |
of the nodes. |
| 361 | 361 |
A minimum cost flow is an \f$f:A\rightarrow\mathbf{R}^+_0\f$ solution of
|
| 362 | 362 |
the following optimization problem. |
| 363 | 363 |
|
| 364 | 364 |
\f[ \min\sum_{a\in A} f(a) cost(a) \f]
|
| 365 | 365 |
\f[ \sum_{a\in\delta_{out}(v)} f(a) - \sum_{a\in\delta_{in}(v)} f(a) =
|
| 366 | 366 |
supply(v) \qquad \forall v\in V \f] |
| 367 | 367 |
\f[ lower(a) \leq f(a) \leq upper(a) \qquad \forall a\in A \f] |
| 368 | 368 |
|
| 369 | 369 |
LEMON contains several algorithms for solving minimum cost flow problems: |
| 370 | 370 |
- \ref CycleCanceling Cycle-canceling algorithms. |
| 371 | 371 |
- \ref CapacityScaling Successive shortest path algorithm with optional |
| 372 | 372 |
capacity scaling. |
| 373 | 373 |
- \ref CostScaling Push-relabel and augment-relabel algorithms based on |
| 374 | 374 |
cost scaling. |
| 375 | 375 |
- \ref NetworkSimplex Primal network simplex algorithm with various |
| 376 | 376 |
pivot strategies. |
| 377 | 377 |
*/ |
| 378 | 378 |
|
| 379 | 379 |
/** |
| 380 | 380 |
@defgroup min_cut Minimum Cut Algorithms |
| 381 | 381 |
@ingroup algs |
| 382 | 382 |
|
| 383 | 383 |
\brief Algorithms for finding minimum cut in graphs. |
| 384 | 384 |
|
| 385 | 385 |
This group contains the algorithms for finding minimum cut in graphs. |
| 386 | 386 |
|
| 387 | 387 |
The \e minimum \e cut \e problem is to find a non-empty and non-complete |
| 388 | 388 |
\f$X\f$ subset of the nodes with minimum overall capacity on |
| 389 | 389 |
outgoing arcs. Formally, there is a \f$G=(V,A)\f$ digraph, a |
| 390 | 390 |
\f$cap: A\rightarrow\mathbf{R}^+_0\f$ capacity function. The minimum
|
| 391 | 391 |
cut is the \f$X\f$ solution of the next optimization problem: |
| 392 | 392 |
|
| 393 | 393 |
\f[ \min_{X \subset V, X\not\in \{\emptyset, V\}}
|
| 394 | 394 |
\sum_{uv\in A, u\in X, v\not\in X}cap(uv) \f]
|
| 395 | 395 |
|
| 396 | 396 |
LEMON contains several algorithms related to minimum cut problems: |
| 397 | 397 |
|
| 398 | 398 |
- \ref HaoOrlin "Hao-Orlin algorithm" for calculating minimum cut |
| 399 | 399 |
in directed graphs. |
| 400 | 400 |
- \ref NagamochiIbaraki "Nagamochi-Ibaraki algorithm" for |
| 401 | 401 |
calculating minimum cut in undirected graphs. |
| 402 | 402 |
- \ref GomoryHu "Gomory-Hu tree computation" for calculating |
| 403 | 403 |
all-pairs minimum cut in undirected graphs. |
| 404 | 404 |
|
| 405 | 405 |
If you want to find minimum cut just between two distinict nodes, |
| 406 | 406 |
see the \ref max_flow "maximum flow problem". |
| 407 | 407 |
*/ |
| 408 | 408 |
|
| 409 | 409 |
/** |
| 410 |
@defgroup |
|
| 410 |
@defgroup graph_properties Connectivity and Other Graph Properties |
|
| 411 | 411 |
@ingroup algs |
| 412 | 412 |
\brief Algorithms for discovering the graph properties |
| 413 | 413 |
|
| 414 | 414 |
This group contains the algorithms for discovering the graph properties |
| 415 | 415 |
like connectivity, bipartiteness, euler property, simplicity etc. |
| 416 | 416 |
|
| 417 | 417 |
\image html edge_biconnected_components.png |
| 418 | 418 |
\image latex edge_biconnected_components.eps "bi-edge-connected components" width=\textwidth |
| 419 | 419 |
*/ |
| 420 | 420 |
|
| 421 | 421 |
/** |
| 422 | 422 |
@defgroup planar Planarity Embedding and Drawing |
| 423 | 423 |
@ingroup algs |
| 424 | 424 |
\brief Algorithms for planarity checking, embedding and drawing |
| 425 | 425 |
|
| 426 | 426 |
This group contains the algorithms for planarity checking, |
| 427 | 427 |
embedding and drawing. |
| 428 | 428 |
|
| 429 | 429 |
\image html planar.png |
| 430 | 430 |
\image latex planar.eps "Plane graph" width=\textwidth |
| 431 | 431 |
*/ |
| 432 | 432 |
|
| 433 | 433 |
/** |
| 434 | 434 |
@defgroup matching Matching Algorithms |
| 435 | 435 |
@ingroup algs |
| 436 | 436 |
\brief Algorithms for finding matchings in graphs and bipartite graphs. |
| 437 | 437 |
|
| 438 | 438 |
This group contains algorithm objects and functions to calculate |
| 439 | 439 |
matchings in graphs and bipartite graphs. The general matching problem is |
| 440 | 440 |
finding a subset of the arcs which does not shares common endpoints. |
| 441 | 441 |
|
| 442 | 442 |
There are several different algorithms for calculate matchings in |
| 443 | 443 |
graphs. The matching problems in bipartite graphs are generally |
| 444 | 444 |
easier than in general graphs. The goal of the matching optimization |
| 445 | 445 |
can be finding maximum cardinality, maximum weight or minimum cost |
| 446 | 446 |
matching. The search can be constrained to find perfect or |
| 447 | 447 |
maximum cardinality matching. |
| 448 | 448 |
|
| 449 | 449 |
The matching algorithms implemented in LEMON: |
| 450 | 450 |
- \ref MaxBipartiteMatching Hopcroft-Karp augmenting path algorithm |
| 451 | 451 |
for calculating maximum cardinality matching in bipartite graphs. |
| 452 | 452 |
- \ref PrBipartiteMatching Push-relabel algorithm |
| 453 | 453 |
for calculating maximum cardinality matching in bipartite graphs. |
| 454 | 454 |
- \ref MaxWeightedBipartiteMatching |
| 455 | 455 |
Successive shortest path algorithm for calculating maximum weighted |
| 456 | 456 |
matching and maximum weighted bipartite matching in bipartite graphs. |
| 457 | 457 |
- \ref MinCostMaxBipartiteMatching |
| 458 | 458 |
Successive shortest path algorithm for calculating minimum cost maximum |
| 459 | 459 |
matching in bipartite graphs. |
| 460 | 460 |
- \ref MaxMatching Edmond's blossom shrinking algorithm for calculating |
| 461 | 461 |
maximum cardinality matching in general graphs. |
| 462 | 462 |
- \ref MaxWeightedMatching Edmond's blossom shrinking algorithm for calculating |
| 463 | 463 |
maximum weighted matching in general graphs. |
| 464 | 464 |
- \ref MaxWeightedPerfectMatching |
| 465 | 465 |
Edmond's blossom shrinking algorithm for calculating maximum weighted |
| 466 | 466 |
perfect matching in general graphs. |
| 467 | 467 |
|
| 468 | 468 |
\image html bipartite_matching.png |
| 469 | 469 |
\image latex bipartite_matching.eps "Bipartite Matching" width=\textwidth |
| 470 | 470 |
*/ |
| 471 | 471 |
|
| 472 | 472 |
/** |
| 473 | 473 |
@defgroup spantree Minimum Spanning Tree Algorithms |
| 474 | 474 |
@ingroup algs |
| 475 | 475 |
\brief Algorithms for finding a minimum cost spanning tree in a graph. |
| 476 | 476 |
|
| 477 | 477 |
This group contains the algorithms for finding a minimum cost spanning |
| 478 | 478 |
tree in a graph. |
| 479 | 479 |
*/ |
| 480 | 480 |
|
| 481 | 481 |
/** |
| 482 | 482 |
@defgroup auxalg Auxiliary Algorithms |
| 483 | 483 |
@ingroup algs |
| 484 | 484 |
\brief Auxiliary algorithms implemented in LEMON. |
| 485 | 485 |
|
| 486 | 486 |
This group contains some algorithms implemented in LEMON |
| 487 | 487 |
in order to make it easier to implement complex algorithms. |
| 488 | 488 |
*/ |
| 489 | 489 |
|
| 490 | 490 |
/** |
| 491 | 491 |
@defgroup approx Approximation Algorithms |
| 492 | 492 |
@ingroup algs |
| 493 | 493 |
\brief Approximation algorithms. |
| 494 | 494 |
|
| 495 | 495 |
This group contains the approximation and heuristic algorithms |
| 496 | 496 |
implemented in LEMON. |
| 497 | 497 |
*/ |
| 498 | 498 |
|
| 499 | 499 |
/** |
| 500 | 500 |
@defgroup gen_opt_group General Optimization Tools |
| 501 | 501 |
\brief This group contains some general optimization frameworks |
| 502 | 502 |
implemented in LEMON. |
| 503 | 503 |
|
| 504 | 504 |
This group contains some general optimization frameworks |
| 505 | 505 |
implemented in LEMON. |
| 506 | 506 |
*/ |
| 507 | 507 |
|
| 508 | 508 |
/** |
| 509 | 509 |
@defgroup lp_group Lp and Mip Solvers |
| 510 | 510 |
@ingroup gen_opt_group |
| 511 | 511 |
\brief Lp and Mip solver interfaces for LEMON. |
| 512 | 512 |
|
| 513 | 513 |
This group contains Lp and Mip solver interfaces for LEMON. The |
| 514 | 514 |
various LP solvers could be used in the same manner with this |
| 515 | 515 |
interface. |
| 516 | 516 |
*/ |
| 517 | 517 |
|
| 518 | 518 |
/** |
| 519 | 519 |
@defgroup lp_utils Tools for Lp and Mip Solvers |
| 520 | 520 |
@ingroup lp_group |
| 521 | 521 |
\brief Helper tools to the Lp and Mip solvers. |
| 522 | 522 |
|
| 523 | 523 |
This group adds some helper tools to general optimization framework |
| 524 | 524 |
implemented in LEMON. |
| 525 | 525 |
*/ |
| 526 | 526 |
|
| 527 | 527 |
/** |
| 528 | 528 |
@defgroup metah Metaheuristics |
| 529 | 529 |
@ingroup gen_opt_group |
| 530 | 530 |
\brief Metaheuristics for LEMON library. |
| 531 | 531 |
|
| 532 | 532 |
This group contains some metaheuristic optimization tools. |
| 533 | 533 |
*/ |
| 534 | 534 |
|
| 535 | 535 |
/** |
| 536 | 536 |
@defgroup utils Tools and Utilities |
| 537 | 537 |
\brief Tools and utilities for programming in LEMON |
| 538 | 538 |
|
| 539 | 539 |
Tools and utilities for programming in LEMON. |
| 540 | 540 |
*/ |
| 541 | 541 |
|
| 542 | 542 |
/** |
| 543 | 543 |
@defgroup gutils Basic Graph Utilities |
| 544 | 544 |
@ingroup utils |
| 545 | 545 |
\brief Simple basic graph utilities. |
| 546 | 546 |
|
| 547 | 547 |
This group contains some simple basic graph utilities. |
| 548 | 548 |
*/ |
| 549 | 549 |
|
| 550 | 550 |
/** |
| 551 | 551 |
@defgroup misc Miscellaneous Tools |
| 552 | 552 |
@ingroup utils |
| 553 | 553 |
\brief Tools for development, debugging and testing. |
| 554 | 554 |
|
| 555 | 555 |
This group contains several useful tools for development, |
| 556 | 556 |
debugging and testing. |
| 557 | 557 |
*/ |
| 558 | 558 |
|
| 559 | 559 |
/** |
| 560 | 560 |
@defgroup timecount Time Measuring and Counting |
| 561 | 561 |
@ingroup misc |
| 562 | 562 |
\brief Simple tools for measuring the performance of algorithms. |
| 563 | 563 |
|
| 564 | 564 |
This group contains simple tools for measuring the performance |
| 565 | 565 |
of algorithms. |
| 566 | 566 |
*/ |
| 567 | 567 |
|
| 568 | 568 |
/** |
| 569 | 569 |
@defgroup exceptions Exceptions |
| 570 | 570 |
@ingroup utils |
| 571 | 571 |
\brief Exceptions defined in LEMON. |
| 572 | 572 |
|
| 573 | 573 |
This group contains the exceptions defined in LEMON. |
| 574 | 574 |
*/ |
| 575 | 575 |
|
| 576 | 576 |
/** |
| 577 | 577 |
@defgroup io_group Input-Output |
| 578 | 578 |
\brief Graph Input-Output methods |
| 579 | 579 |
|
| 580 | 580 |
This group contains the tools for importing and exporting graphs |
| 581 | 581 |
and graph related data. Now it supports the \ref lgf-format |
| 582 | 582 |
"LEMON Graph Format", the \c DIMACS format and the encapsulated |
| 583 | 583 |
postscript (EPS) format. |
| 584 | 584 |
*/ |
| 585 | 585 |
|
| 586 | 586 |
/** |
| 587 | 587 |
@defgroup lemon_io LEMON Graph Format |
| 588 | 588 |
@ingroup io_group |
| 589 | 589 |
\brief Reading and writing LEMON Graph Format. |
| 590 | 590 |
|
| 591 | 591 |
This group contains methods for reading and writing |
| 592 | 592 |
\ref lgf-format "LEMON Graph Format". |
| 593 | 593 |
*/ |
| 594 | 594 |
|
| 595 | 595 |
/** |
| 596 | 596 |
@defgroup eps_io Postscript Exporting |
| 597 | 597 |
@ingroup io_group |
| 598 | 598 |
\brief General \c EPS drawer and graph exporter |
| 599 | 599 |
|
| 600 | 600 |
This group contains general \c EPS drawing methods and special |
| 601 | 601 |
graph exporting tools. |
| 602 | 602 |
*/ |
| 603 | 603 |
|
| 604 | 604 |
/** |
| 605 | 605 |
@defgroup dimacs_group DIMACS format |
| 606 | 606 |
@ingroup io_group |
| 607 | 607 |
\brief Read and write files in DIMACS format |
| 608 | 608 |
|
| 609 | 609 |
Tools to read a digraph from or write it to a file in DIMACS format data. |
| 610 | 610 |
*/ |
| 611 | 611 |
|
| 612 | 612 |
/** |
| 613 | 613 |
@defgroup nauty_group NAUTY Format |
| 614 | 614 |
@ingroup io_group |
| 615 | 615 |
\brief Read \e Nauty format |
| 616 | 616 |
|
| 617 | 617 |
Tool to read graphs from \e Nauty format data. |
| 618 | 618 |
*/ |
| 619 | 619 |
|
| 620 | 620 |
/** |
| 621 | 621 |
@defgroup concept Concepts |
| 622 | 622 |
\brief Skeleton classes and concept checking classes |
| 623 | 623 |
|
| 624 | 624 |
This group contains the data/algorithm skeletons and concept checking |
| 625 | 625 |
classes implemented in LEMON. |
| 626 | 626 |
|
| 627 | 627 |
The purpose of the classes in this group is fourfold. |
| 628 | 628 |
|
| 629 | 629 |
- These classes contain the documentations of the %concepts. In order |
| 630 | 630 |
to avoid document multiplications, an implementation of a concept |
| 631 | 631 |
simply refers to the corresponding concept class. |
| 632 | 632 |
|
| 633 | 633 |
- These classes declare every functions, <tt>typedef</tt>s etc. an |
| 634 | 634 |
implementation of the %concepts should provide, however completely |
| 635 | 635 |
without implementations and real data structures behind the |
| 636 | 636 |
interface. On the other hand they should provide nothing else. All |
| 637 | 637 |
the algorithms working on a data structure meeting a certain concept |
| 638 | 638 |
should compile with these classes. (Though it will not run properly, |
| 639 | 639 |
of course.) In this way it is easily to check if an algorithm |
| 640 | 640 |
doesn't use any extra feature of a certain implementation. |
| 641 | 641 |
|
| 642 | 642 |
- The concept descriptor classes also provide a <em>checker class</em> |
| 643 | 643 |
that makes it possible to check whether a certain implementation of a |
| 644 | 644 |
concept indeed provides all the required features. |
| 645 | 645 |
|
| 646 | 646 |
- Finally, They can serve as a skeleton of a new implementation of a concept. |
| 647 | 647 |
*/ |
| 648 | 648 |
|
| 649 | 649 |
/** |
| 650 | 650 |
@defgroup graph_concepts Graph Structure Concepts |
| 651 | 651 |
@ingroup concept |
| 652 | 652 |
\brief Skeleton and concept checking classes for graph structures |
| 653 | 653 |
|
| 654 | 654 |
This group contains the skeletons and concept checking classes of LEMON's |
| 655 | 655 |
graph structures and helper classes used to implement these. |
| 656 | 656 |
*/ |
| 657 | 657 |
|
| 658 | 658 |
/** |
| 659 | 659 |
@defgroup map_concepts Map Concepts |
| 660 | 660 |
@ingroup concept |
| 661 | 661 |
\brief Skeleton and concept checking classes for maps |
| 662 | 662 |
|
| 663 | 663 |
This group contains the skeletons and concept checking classes of maps. |
| 664 | 664 |
*/ |
| 665 | 665 |
|
| 666 | 666 |
/** |
| 667 | 667 |
\anchor demoprograms |
| 668 | 668 |
|
| 669 | 669 |
@defgroup demos Demo Programs |
| 670 | 670 |
|
| 671 | 671 |
Some demo programs are listed here. Their full source codes can be found in |
| 672 | 672 |
the \c demo subdirectory of the source tree. |
| 673 | 673 |
|
| 674 | 674 |
In order to compile them, use the <tt>make demo</tt> or the |
| 675 | 675 |
<tt>make check</tt> commands. |
| 676 | 676 |
*/ |
| 677 | 677 |
|
| 678 | 678 |
/** |
| 679 | 679 |
@defgroup tools Standalone Utility Applications |
| 680 | 680 |
|
| 681 | 681 |
Some utility applications are listed here. |
| 682 | 682 |
|
| 683 | 683 |
The standard compilation procedure (<tt>./configure;make</tt>) will compile |
| 684 | 684 |
them, as well. |
| 685 | 685 |
*/ |
| 686 | 686 |
|
| 687 | 687 |
} |
| ... | ... |
@@ -1812,768 +1812,771 @@ |
| 1812 | 1812 |
filterEdges(const GR& graph, const EF& edge_filter) {
|
| 1813 | 1813 |
return FilterEdges<const GR, const EF>(graph, edge_filter); |
| 1814 | 1814 |
} |
| 1815 | 1815 |
|
| 1816 | 1816 |
|
| 1817 | 1817 |
template <typename DGR> |
| 1818 | 1818 |
class UndirectorBase {
|
| 1819 | 1819 |
public: |
| 1820 | 1820 |
typedef DGR Digraph; |
| 1821 | 1821 |
typedef UndirectorBase Adaptor; |
| 1822 | 1822 |
|
| 1823 | 1823 |
typedef True UndirectedTag; |
| 1824 | 1824 |
|
| 1825 | 1825 |
typedef typename Digraph::Arc Edge; |
| 1826 | 1826 |
typedef typename Digraph::Node Node; |
| 1827 | 1827 |
|
| 1828 | 1828 |
class Arc : public Edge {
|
| 1829 | 1829 |
friend class UndirectorBase; |
| 1830 | 1830 |
protected: |
| 1831 | 1831 |
bool _forward; |
| 1832 | 1832 |
|
| 1833 | 1833 |
Arc(const Edge& edge, bool forward) : |
| 1834 | 1834 |
Edge(edge), _forward(forward) {}
|
| 1835 | 1835 |
|
| 1836 | 1836 |
public: |
| 1837 | 1837 |
Arc() {}
|
| 1838 | 1838 |
|
| 1839 | 1839 |
Arc(Invalid) : Edge(INVALID), _forward(true) {}
|
| 1840 | 1840 |
|
| 1841 | 1841 |
bool operator==(const Arc &other) const {
|
| 1842 | 1842 |
return _forward == other._forward && |
| 1843 | 1843 |
static_cast<const Edge&>(*this) == static_cast<const Edge&>(other); |
| 1844 | 1844 |
} |
| 1845 | 1845 |
bool operator!=(const Arc &other) const {
|
| 1846 | 1846 |
return _forward != other._forward || |
| 1847 | 1847 |
static_cast<const Edge&>(*this) != static_cast<const Edge&>(other); |
| 1848 | 1848 |
} |
| 1849 | 1849 |
bool operator<(const Arc &other) const {
|
| 1850 | 1850 |
return _forward < other._forward || |
| 1851 | 1851 |
(_forward == other._forward && |
| 1852 | 1852 |
static_cast<const Edge&>(*this) < static_cast<const Edge&>(other)); |
| 1853 | 1853 |
} |
| 1854 | 1854 |
}; |
| 1855 | 1855 |
|
| 1856 | 1856 |
void first(Node& n) const {
|
| 1857 | 1857 |
_digraph->first(n); |
| 1858 | 1858 |
} |
| 1859 | 1859 |
|
| 1860 | 1860 |
void next(Node& n) const {
|
| 1861 | 1861 |
_digraph->next(n); |
| 1862 | 1862 |
} |
| 1863 | 1863 |
|
| 1864 | 1864 |
void first(Arc& a) const {
|
| 1865 | 1865 |
_digraph->first(a); |
| 1866 | 1866 |
a._forward = true; |
| 1867 | 1867 |
} |
| 1868 | 1868 |
|
| 1869 | 1869 |
void next(Arc& a) const {
|
| 1870 | 1870 |
if (a._forward) {
|
| 1871 | 1871 |
a._forward = false; |
| 1872 | 1872 |
} else {
|
| 1873 | 1873 |
_digraph->next(a); |
| 1874 | 1874 |
a._forward = true; |
| 1875 | 1875 |
} |
| 1876 | 1876 |
} |
| 1877 | 1877 |
|
| 1878 | 1878 |
void first(Edge& e) const {
|
| 1879 | 1879 |
_digraph->first(e); |
| 1880 | 1880 |
} |
| 1881 | 1881 |
|
| 1882 | 1882 |
void next(Edge& e) const {
|
| 1883 | 1883 |
_digraph->next(e); |
| 1884 | 1884 |
} |
| 1885 | 1885 |
|
| 1886 | 1886 |
void firstOut(Arc& a, const Node& n) const {
|
| 1887 | 1887 |
_digraph->firstIn(a, n); |
| 1888 | 1888 |
if( static_cast<const Edge&>(a) != INVALID ) {
|
| 1889 | 1889 |
a._forward = false; |
| 1890 | 1890 |
} else {
|
| 1891 | 1891 |
_digraph->firstOut(a, n); |
| 1892 | 1892 |
a._forward = true; |
| 1893 | 1893 |
} |
| 1894 | 1894 |
} |
| 1895 | 1895 |
void nextOut(Arc &a) const {
|
| 1896 | 1896 |
if (!a._forward) {
|
| 1897 | 1897 |
Node n = _digraph->target(a); |
| 1898 | 1898 |
_digraph->nextIn(a); |
| 1899 | 1899 |
if (static_cast<const Edge&>(a) == INVALID ) {
|
| 1900 | 1900 |
_digraph->firstOut(a, n); |
| 1901 | 1901 |
a._forward = true; |
| 1902 | 1902 |
} |
| 1903 | 1903 |
} |
| 1904 | 1904 |
else {
|
| 1905 | 1905 |
_digraph->nextOut(a); |
| 1906 | 1906 |
} |
| 1907 | 1907 |
} |
| 1908 | 1908 |
|
| 1909 | 1909 |
void firstIn(Arc &a, const Node &n) const {
|
| 1910 | 1910 |
_digraph->firstOut(a, n); |
| 1911 | 1911 |
if (static_cast<const Edge&>(a) != INVALID ) {
|
| 1912 | 1912 |
a._forward = false; |
| 1913 | 1913 |
} else {
|
| 1914 | 1914 |
_digraph->firstIn(a, n); |
| 1915 | 1915 |
a._forward = true; |
| 1916 | 1916 |
} |
| 1917 | 1917 |
} |
| 1918 | 1918 |
void nextIn(Arc &a) const {
|
| 1919 | 1919 |
if (!a._forward) {
|
| 1920 | 1920 |
Node n = _digraph->source(a); |
| 1921 | 1921 |
_digraph->nextOut(a); |
| 1922 | 1922 |
if( static_cast<const Edge&>(a) == INVALID ) {
|
| 1923 | 1923 |
_digraph->firstIn(a, n); |
| 1924 | 1924 |
a._forward = true; |
| 1925 | 1925 |
} |
| 1926 | 1926 |
} |
| 1927 | 1927 |
else {
|
| 1928 | 1928 |
_digraph->nextIn(a); |
| 1929 | 1929 |
} |
| 1930 | 1930 |
} |
| 1931 | 1931 |
|
| 1932 | 1932 |
void firstInc(Edge &e, bool &d, const Node &n) const {
|
| 1933 | 1933 |
d = true; |
| 1934 | 1934 |
_digraph->firstOut(e, n); |
| 1935 | 1935 |
if (e != INVALID) return; |
| 1936 | 1936 |
d = false; |
| 1937 | 1937 |
_digraph->firstIn(e, n); |
| 1938 | 1938 |
} |
| 1939 | 1939 |
|
| 1940 | 1940 |
void nextInc(Edge &e, bool &d) const {
|
| 1941 | 1941 |
if (d) {
|
| 1942 | 1942 |
Node s = _digraph->source(e); |
| 1943 | 1943 |
_digraph->nextOut(e); |
| 1944 | 1944 |
if (e != INVALID) return; |
| 1945 | 1945 |
d = false; |
| 1946 | 1946 |
_digraph->firstIn(e, s); |
| 1947 | 1947 |
} else {
|
| 1948 | 1948 |
_digraph->nextIn(e); |
| 1949 | 1949 |
} |
| 1950 | 1950 |
} |
| 1951 | 1951 |
|
| 1952 | 1952 |
Node u(const Edge& e) const {
|
| 1953 | 1953 |
return _digraph->source(e); |
| 1954 | 1954 |
} |
| 1955 | 1955 |
|
| 1956 | 1956 |
Node v(const Edge& e) const {
|
| 1957 | 1957 |
return _digraph->target(e); |
| 1958 | 1958 |
} |
| 1959 | 1959 |
|
| 1960 | 1960 |
Node source(const Arc &a) const {
|
| 1961 | 1961 |
return a._forward ? _digraph->source(a) : _digraph->target(a); |
| 1962 | 1962 |
} |
| 1963 | 1963 |
|
| 1964 | 1964 |
Node target(const Arc &a) const {
|
| 1965 | 1965 |
return a._forward ? _digraph->target(a) : _digraph->source(a); |
| 1966 | 1966 |
} |
| 1967 | 1967 |
|
| 1968 | 1968 |
static Arc direct(const Edge &e, bool d) {
|
| 1969 | 1969 |
return Arc(e, d); |
| 1970 | 1970 |
} |
| 1971 | 1971 |
Arc direct(const Edge &e, const Node& n) const {
|
| 1972 | 1972 |
return Arc(e, _digraph->source(e) == n); |
| 1973 | 1973 |
} |
| 1974 | 1974 |
|
| 1975 | 1975 |
static bool direction(const Arc &a) { return a._forward; }
|
| 1976 | 1976 |
|
| 1977 | 1977 |
Node nodeFromId(int ix) const { return _digraph->nodeFromId(ix); }
|
| 1978 | 1978 |
Arc arcFromId(int ix) const {
|
| 1979 | 1979 |
return direct(_digraph->arcFromId(ix >> 1), bool(ix & 1)); |
| 1980 | 1980 |
} |
| 1981 | 1981 |
Edge edgeFromId(int ix) const { return _digraph->arcFromId(ix); }
|
| 1982 | 1982 |
|
| 1983 | 1983 |
int id(const Node &n) const { return _digraph->id(n); }
|
| 1984 | 1984 |
int id(const Arc &a) const {
|
| 1985 | 1985 |
return (_digraph->id(a) << 1) | (a._forward ? 1 : 0); |
| 1986 | 1986 |
} |
| 1987 | 1987 |
int id(const Edge &e) const { return _digraph->id(e); }
|
| 1988 | 1988 |
|
| 1989 | 1989 |
int maxNodeId() const { return _digraph->maxNodeId(); }
|
| 1990 | 1990 |
int maxArcId() const { return (_digraph->maxArcId() << 1) | 1; }
|
| 1991 | 1991 |
int maxEdgeId() const { return _digraph->maxArcId(); }
|
| 1992 | 1992 |
|
| 1993 | 1993 |
Node addNode() { return _digraph->addNode(); }
|
| 1994 | 1994 |
Edge addEdge(const Node& u, const Node& v) {
|
| 1995 | 1995 |
return _digraph->addArc(u, v); |
| 1996 | 1996 |
} |
| 1997 | 1997 |
|
| 1998 | 1998 |
void erase(const Node& i) { _digraph->erase(i); }
|
| 1999 | 1999 |
void erase(const Edge& i) { _digraph->erase(i); }
|
| 2000 | 2000 |
|
| 2001 | 2001 |
void clear() { _digraph->clear(); }
|
| 2002 | 2002 |
|
| 2003 | 2003 |
typedef NodeNumTagIndicator<Digraph> NodeNumTag; |
| 2004 | 2004 |
int nodeNum() const { return _digraph->nodeNum(); }
|
| 2005 | 2005 |
|
| 2006 | 2006 |
typedef ArcNumTagIndicator<Digraph> ArcNumTag; |
| 2007 | 2007 |
int arcNum() const { return 2 * _digraph->arcNum(); }
|
| 2008 | 2008 |
|
| 2009 | 2009 |
typedef ArcNumTag EdgeNumTag; |
| 2010 | 2010 |
int edgeNum() const { return _digraph->arcNum(); }
|
| 2011 | 2011 |
|
| 2012 | 2012 |
typedef FindArcTagIndicator<Digraph> FindArcTag; |
| 2013 | 2013 |
Arc findArc(Node s, Node t, Arc p = INVALID) const {
|
| 2014 | 2014 |
if (p == INVALID) {
|
| 2015 | 2015 |
Edge arc = _digraph->findArc(s, t); |
| 2016 | 2016 |
if (arc != INVALID) return direct(arc, true); |
| 2017 | 2017 |
arc = _digraph->findArc(t, s); |
| 2018 | 2018 |
if (arc != INVALID) return direct(arc, false); |
| 2019 | 2019 |
} else if (direction(p)) {
|
| 2020 | 2020 |
Edge arc = _digraph->findArc(s, t, p); |
| 2021 | 2021 |
if (arc != INVALID) return direct(arc, true); |
| 2022 | 2022 |
arc = _digraph->findArc(t, s); |
| 2023 | 2023 |
if (arc != INVALID) return direct(arc, false); |
| 2024 | 2024 |
} else {
|
| 2025 | 2025 |
Edge arc = _digraph->findArc(t, s, p); |
| 2026 | 2026 |
if (arc != INVALID) return direct(arc, false); |
| 2027 | 2027 |
} |
| 2028 | 2028 |
return INVALID; |
| 2029 | 2029 |
} |
| 2030 | 2030 |
|
| 2031 | 2031 |
typedef FindArcTag FindEdgeTag; |
| 2032 | 2032 |
Edge findEdge(Node s, Node t, Edge p = INVALID) const {
|
| 2033 | 2033 |
if (s != t) {
|
| 2034 | 2034 |
if (p == INVALID) {
|
| 2035 | 2035 |
Edge arc = _digraph->findArc(s, t); |
| 2036 | 2036 |
if (arc != INVALID) return arc; |
| 2037 | 2037 |
arc = _digraph->findArc(t, s); |
| 2038 | 2038 |
if (arc != INVALID) return arc; |
| 2039 | 2039 |
} else if (_digraph->source(p) == s) {
|
| 2040 | 2040 |
Edge arc = _digraph->findArc(s, t, p); |
| 2041 | 2041 |
if (arc != INVALID) return arc; |
| 2042 | 2042 |
arc = _digraph->findArc(t, s); |
| 2043 | 2043 |
if (arc != INVALID) return arc; |
| 2044 | 2044 |
} else {
|
| 2045 | 2045 |
Edge arc = _digraph->findArc(t, s, p); |
| 2046 | 2046 |
if (arc != INVALID) return arc; |
| 2047 | 2047 |
} |
| 2048 | 2048 |
} else {
|
| 2049 | 2049 |
return _digraph->findArc(s, t, p); |
| 2050 | 2050 |
} |
| 2051 | 2051 |
return INVALID; |
| 2052 | 2052 |
} |
| 2053 | 2053 |
|
| 2054 | 2054 |
private: |
| 2055 | 2055 |
|
| 2056 | 2056 |
template <typename V> |
| 2057 | 2057 |
class ArcMapBase {
|
| 2058 | 2058 |
private: |
| 2059 | 2059 |
|
| 2060 | 2060 |
typedef typename DGR::template ArcMap<V> MapImpl; |
| 2061 | 2061 |
|
| 2062 | 2062 |
public: |
| 2063 | 2063 |
|
| 2064 | 2064 |
typedef typename MapTraits<MapImpl>::ReferenceMapTag ReferenceMapTag; |
| 2065 | 2065 |
|
| 2066 | 2066 |
typedef V Value; |
| 2067 | 2067 |
typedef Arc Key; |
| 2068 | 2068 |
typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReturnValue; |
| 2069 | 2069 |
typedef typename MapTraits<MapImpl>::ReturnValue ReturnValue; |
| 2070 | 2070 |
typedef typename MapTraits<MapImpl>::ConstReturnValue ConstReference; |
| 2071 | 2071 |
typedef typename MapTraits<MapImpl>::ReturnValue Reference; |
| 2072 | 2072 |
|
| 2073 | 2073 |
ArcMapBase(const UndirectorBase<DGR>& adaptor) : |
| 2074 | 2074 |
_forward(*adaptor._digraph), _backward(*adaptor._digraph) {}
|
| 2075 | 2075 |
|
| 2076 | 2076 |
ArcMapBase(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2077 | 2077 |
: _forward(*adaptor._digraph, value), |
| 2078 | 2078 |
_backward(*adaptor._digraph, value) {}
|
| 2079 | 2079 |
|
| 2080 | 2080 |
void set(const Arc& a, const V& value) {
|
| 2081 | 2081 |
if (direction(a)) {
|
| 2082 | 2082 |
_forward.set(a, value); |
| 2083 | 2083 |
} else {
|
| 2084 | 2084 |
_backward.set(a, value); |
| 2085 | 2085 |
} |
| 2086 | 2086 |
} |
| 2087 | 2087 |
|
| 2088 | 2088 |
ConstReturnValue operator[](const Arc& a) const {
|
| 2089 | 2089 |
if (direction(a)) {
|
| 2090 | 2090 |
return _forward[a]; |
| 2091 | 2091 |
} else {
|
| 2092 | 2092 |
return _backward[a]; |
| 2093 | 2093 |
} |
| 2094 | 2094 |
} |
| 2095 | 2095 |
|
| 2096 | 2096 |
ReturnValue operator[](const Arc& a) {
|
| 2097 | 2097 |
if (direction(a)) {
|
| 2098 | 2098 |
return _forward[a]; |
| 2099 | 2099 |
} else {
|
| 2100 | 2100 |
return _backward[a]; |
| 2101 | 2101 |
} |
| 2102 | 2102 |
} |
| 2103 | 2103 |
|
| 2104 | 2104 |
protected: |
| 2105 | 2105 |
|
| 2106 | 2106 |
MapImpl _forward, _backward; |
| 2107 | 2107 |
|
| 2108 | 2108 |
}; |
| 2109 | 2109 |
|
| 2110 | 2110 |
public: |
| 2111 | 2111 |
|
| 2112 | 2112 |
template <typename V> |
| 2113 | 2113 |
class NodeMap : public DGR::template NodeMap<V> {
|
| 2114 | 2114 |
public: |
| 2115 | 2115 |
|
| 2116 | 2116 |
typedef V Value; |
| 2117 | 2117 |
typedef typename DGR::template NodeMap<Value> Parent; |
| 2118 | 2118 |
|
| 2119 | 2119 |
explicit NodeMap(const UndirectorBase<DGR>& adaptor) |
| 2120 | 2120 |
: Parent(*adaptor._digraph) {}
|
| 2121 | 2121 |
|
| 2122 | 2122 |
NodeMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2123 | 2123 |
: Parent(*adaptor._digraph, value) { }
|
| 2124 | 2124 |
|
| 2125 | 2125 |
private: |
| 2126 | 2126 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 2127 | 2127 |
return operator=<NodeMap>(cmap); |
| 2128 | 2128 |
} |
| 2129 | 2129 |
|
| 2130 | 2130 |
template <typename CMap> |
| 2131 | 2131 |
NodeMap& operator=(const CMap& cmap) {
|
| 2132 | 2132 |
Parent::operator=(cmap); |
| 2133 | 2133 |
return *this; |
| 2134 | 2134 |
} |
| 2135 | 2135 |
|
| 2136 | 2136 |
}; |
| 2137 | 2137 |
|
| 2138 | 2138 |
template <typename V> |
| 2139 | 2139 |
class ArcMap |
| 2140 | 2140 |
: public SubMapExtender<UndirectorBase<DGR>, ArcMapBase<V> > |
| 2141 | 2141 |
{
|
| 2142 | 2142 |
public: |
| 2143 | 2143 |
typedef V Value; |
| 2144 | 2144 |
typedef SubMapExtender<Adaptor, ArcMapBase<V> > Parent; |
| 2145 | 2145 |
|
| 2146 | 2146 |
explicit ArcMap(const UndirectorBase<DGR>& adaptor) |
| 2147 | 2147 |
: Parent(adaptor) {}
|
| 2148 | 2148 |
|
| 2149 | 2149 |
ArcMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2150 | 2150 |
: Parent(adaptor, value) {}
|
| 2151 | 2151 |
|
| 2152 | 2152 |
private: |
| 2153 | 2153 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 2154 | 2154 |
return operator=<ArcMap>(cmap); |
| 2155 | 2155 |
} |
| 2156 | 2156 |
|
| 2157 | 2157 |
template <typename CMap> |
| 2158 | 2158 |
ArcMap& operator=(const CMap& cmap) {
|
| 2159 | 2159 |
Parent::operator=(cmap); |
| 2160 | 2160 |
return *this; |
| 2161 | 2161 |
} |
| 2162 | 2162 |
}; |
| 2163 | 2163 |
|
| 2164 | 2164 |
template <typename V> |
| 2165 | 2165 |
class EdgeMap : public Digraph::template ArcMap<V> {
|
| 2166 | 2166 |
public: |
| 2167 | 2167 |
|
| 2168 | 2168 |
typedef V Value; |
| 2169 | 2169 |
typedef typename Digraph::template ArcMap<V> Parent; |
| 2170 | 2170 |
|
| 2171 | 2171 |
explicit EdgeMap(const UndirectorBase<DGR>& adaptor) |
| 2172 | 2172 |
: Parent(*adaptor._digraph) {}
|
| 2173 | 2173 |
|
| 2174 | 2174 |
EdgeMap(const UndirectorBase<DGR>& adaptor, const V& value) |
| 2175 | 2175 |
: Parent(*adaptor._digraph, value) {}
|
| 2176 | 2176 |
|
| 2177 | 2177 |
private: |
| 2178 | 2178 |
EdgeMap& operator=(const EdgeMap& cmap) {
|
| 2179 | 2179 |
return operator=<EdgeMap>(cmap); |
| 2180 | 2180 |
} |
| 2181 | 2181 |
|
| 2182 | 2182 |
template <typename CMap> |
| 2183 | 2183 |
EdgeMap& operator=(const CMap& cmap) {
|
| 2184 | 2184 |
Parent::operator=(cmap); |
| 2185 | 2185 |
return *this; |
| 2186 | 2186 |
} |
| 2187 | 2187 |
|
| 2188 | 2188 |
}; |
| 2189 | 2189 |
|
| 2190 | 2190 |
typedef typename ItemSetTraits<DGR, Node>::ItemNotifier NodeNotifier; |
| 2191 | 2191 |
NodeNotifier& notifier(Node) const { return _digraph->notifier(Node()); }
|
| 2192 | 2192 |
|
| 2193 | 2193 |
typedef typename ItemSetTraits<DGR, Edge>::ItemNotifier EdgeNotifier; |
| 2194 | 2194 |
EdgeNotifier& notifier(Edge) const { return _digraph->notifier(Edge()); }
|
| 2195 | 2195 |
|
| 2196 |
typedef EdgeNotifier ArcNotifier; |
|
| 2197 |
ArcNotifier& notifier(Arc) const { return _digraph->notifier(Edge()); }
|
|
| 2198 |
|
|
| 2196 | 2199 |
protected: |
| 2197 | 2200 |
|
| 2198 | 2201 |
UndirectorBase() : _digraph(0) {}
|
| 2199 | 2202 |
|
| 2200 | 2203 |
DGR* _digraph; |
| 2201 | 2204 |
|
| 2202 | 2205 |
void initialize(DGR& digraph) {
|
| 2203 | 2206 |
_digraph = &digraph; |
| 2204 | 2207 |
} |
| 2205 | 2208 |
|
| 2206 | 2209 |
}; |
| 2207 | 2210 |
|
| 2208 | 2211 |
/// \ingroup graph_adaptors |
| 2209 | 2212 |
/// |
| 2210 | 2213 |
/// \brief Adaptor class for viewing a digraph as an undirected graph. |
| 2211 | 2214 |
/// |
| 2212 | 2215 |
/// Undirector adaptor can be used for viewing a digraph as an undirected |
| 2213 | 2216 |
/// graph. All arcs of the underlying digraph are showed in the |
| 2214 | 2217 |
/// adaptor as an edge (and also as a pair of arcs, of course). |
| 2215 | 2218 |
/// This adaptor conforms to the \ref concepts::Graph "Graph" concept. |
| 2216 | 2219 |
/// |
| 2217 | 2220 |
/// The adapted digraph can also be modified through this adaptor |
| 2218 | 2221 |
/// by adding or removing nodes or edges, unless the \c GR template |
| 2219 | 2222 |
/// parameter is set to be \c const. |
| 2220 | 2223 |
/// |
| 2221 | 2224 |
/// \tparam DGR The type of the adapted digraph. |
| 2222 | 2225 |
/// It must conform to the \ref concepts::Digraph "Digraph" concept. |
| 2223 | 2226 |
/// It can also be specified to be \c const. |
| 2224 | 2227 |
/// |
| 2225 | 2228 |
/// \note The \c Node type of this adaptor and the adapted digraph are |
| 2226 | 2229 |
/// convertible to each other, moreover the \c Edge type of the adaptor |
| 2227 | 2230 |
/// and the \c Arc type of the adapted digraph are also convertible to |
| 2228 | 2231 |
/// each other. |
| 2229 | 2232 |
/// (Thus the \c Arc type of the adaptor is convertible to the \c Arc type |
| 2230 | 2233 |
/// of the adapted digraph.) |
| 2231 | 2234 |
template<typename DGR> |
| 2232 | 2235 |
#ifdef DOXYGEN |
| 2233 | 2236 |
class Undirector {
|
| 2234 | 2237 |
#else |
| 2235 | 2238 |
class Undirector : |
| 2236 | 2239 |
public GraphAdaptorExtender<UndirectorBase<DGR> > {
|
| 2237 | 2240 |
#endif |
| 2238 | 2241 |
public: |
| 2239 | 2242 |
/// The type of the adapted digraph. |
| 2240 | 2243 |
typedef DGR Digraph; |
| 2241 | 2244 |
typedef GraphAdaptorExtender<UndirectorBase<DGR> > Parent; |
| 2242 | 2245 |
protected: |
| 2243 | 2246 |
Undirector() { }
|
| 2244 | 2247 |
public: |
| 2245 | 2248 |
|
| 2246 | 2249 |
/// \brief Constructor |
| 2247 | 2250 |
/// |
| 2248 | 2251 |
/// Creates an undirected graph from the given digraph. |
| 2249 | 2252 |
Undirector(DGR& digraph) {
|
| 2250 | 2253 |
initialize(digraph); |
| 2251 | 2254 |
} |
| 2252 | 2255 |
|
| 2253 | 2256 |
/// \brief Arc map combined from two original arc maps |
| 2254 | 2257 |
/// |
| 2255 | 2258 |
/// This map adaptor class adapts two arc maps of the underlying |
| 2256 | 2259 |
/// digraph to get an arc map of the undirected graph. |
| 2257 | 2260 |
/// Its value type is inherited from the first arc map type (\c FW). |
| 2258 | 2261 |
/// \tparam FW The type of the "foward" arc map. |
| 2259 | 2262 |
/// \tparam BK The type of the "backward" arc map. |
| 2260 | 2263 |
template <typename FW, typename BK> |
| 2261 | 2264 |
class CombinedArcMap {
|
| 2262 | 2265 |
public: |
| 2263 | 2266 |
|
| 2264 | 2267 |
/// The key type of the map |
| 2265 | 2268 |
typedef typename Parent::Arc Key; |
| 2266 | 2269 |
/// The value type of the map |
| 2267 | 2270 |
typedef typename FW::Value Value; |
| 2268 | 2271 |
|
| 2269 | 2272 |
typedef typename MapTraits<FW>::ReferenceMapTag ReferenceMapTag; |
| 2270 | 2273 |
|
| 2271 | 2274 |
typedef typename MapTraits<FW>::ReturnValue ReturnValue; |
| 2272 | 2275 |
typedef typename MapTraits<FW>::ConstReturnValue ConstReturnValue; |
| 2273 | 2276 |
typedef typename MapTraits<FW>::ReturnValue Reference; |
| 2274 | 2277 |
typedef typename MapTraits<FW>::ConstReturnValue ConstReference; |
| 2275 | 2278 |
|
| 2276 | 2279 |
/// Constructor |
| 2277 | 2280 |
CombinedArcMap(FW& forward, BK& backward) |
| 2278 | 2281 |
: _forward(&forward), _backward(&backward) {}
|
| 2279 | 2282 |
|
| 2280 | 2283 |
/// Sets the value associated with the given key. |
| 2281 | 2284 |
void set(const Key& e, const Value& a) {
|
| 2282 | 2285 |
if (Parent::direction(e)) {
|
| 2283 | 2286 |
_forward->set(e, a); |
| 2284 | 2287 |
} else {
|
| 2285 | 2288 |
_backward->set(e, a); |
| 2286 | 2289 |
} |
| 2287 | 2290 |
} |
| 2288 | 2291 |
|
| 2289 | 2292 |
/// Returns the value associated with the given key. |
| 2290 | 2293 |
ConstReturnValue operator[](const Key& e) const {
|
| 2291 | 2294 |
if (Parent::direction(e)) {
|
| 2292 | 2295 |
return (*_forward)[e]; |
| 2293 | 2296 |
} else {
|
| 2294 | 2297 |
return (*_backward)[e]; |
| 2295 | 2298 |
} |
| 2296 | 2299 |
} |
| 2297 | 2300 |
|
| 2298 | 2301 |
/// Returns a reference to the value associated with the given key. |
| 2299 | 2302 |
ReturnValue operator[](const Key& e) {
|
| 2300 | 2303 |
if (Parent::direction(e)) {
|
| 2301 | 2304 |
return (*_forward)[e]; |
| 2302 | 2305 |
} else {
|
| 2303 | 2306 |
return (*_backward)[e]; |
| 2304 | 2307 |
} |
| 2305 | 2308 |
} |
| 2306 | 2309 |
|
| 2307 | 2310 |
protected: |
| 2308 | 2311 |
|
| 2309 | 2312 |
FW* _forward; |
| 2310 | 2313 |
BK* _backward; |
| 2311 | 2314 |
|
| 2312 | 2315 |
}; |
| 2313 | 2316 |
|
| 2314 | 2317 |
/// \brief Returns a combined arc map |
| 2315 | 2318 |
/// |
| 2316 | 2319 |
/// This function just returns a combined arc map. |
| 2317 | 2320 |
template <typename FW, typename BK> |
| 2318 | 2321 |
static CombinedArcMap<FW, BK> |
| 2319 | 2322 |
combinedArcMap(FW& forward, BK& backward) {
|
| 2320 | 2323 |
return CombinedArcMap<FW, BK>(forward, backward); |
| 2321 | 2324 |
} |
| 2322 | 2325 |
|
| 2323 | 2326 |
template <typename FW, typename BK> |
| 2324 | 2327 |
static CombinedArcMap<const FW, BK> |
| 2325 | 2328 |
combinedArcMap(const FW& forward, BK& backward) {
|
| 2326 | 2329 |
return CombinedArcMap<const FW, BK>(forward, backward); |
| 2327 | 2330 |
} |
| 2328 | 2331 |
|
| 2329 | 2332 |
template <typename FW, typename BK> |
| 2330 | 2333 |
static CombinedArcMap<FW, const BK> |
| 2331 | 2334 |
combinedArcMap(FW& forward, const BK& backward) {
|
| 2332 | 2335 |
return CombinedArcMap<FW, const BK>(forward, backward); |
| 2333 | 2336 |
} |
| 2334 | 2337 |
|
| 2335 | 2338 |
template <typename FW, typename BK> |
| 2336 | 2339 |
static CombinedArcMap<const FW, const BK> |
| 2337 | 2340 |
combinedArcMap(const FW& forward, const BK& backward) {
|
| 2338 | 2341 |
return CombinedArcMap<const FW, const BK>(forward, backward); |
| 2339 | 2342 |
} |
| 2340 | 2343 |
|
| 2341 | 2344 |
}; |
| 2342 | 2345 |
|
| 2343 | 2346 |
/// \brief Returns a read-only Undirector adaptor |
| 2344 | 2347 |
/// |
| 2345 | 2348 |
/// This function just returns a read-only \ref Undirector adaptor. |
| 2346 | 2349 |
/// \ingroup graph_adaptors |
| 2347 | 2350 |
/// \relates Undirector |
| 2348 | 2351 |
template<typename DGR> |
| 2349 | 2352 |
Undirector<const DGR> undirector(const DGR& digraph) {
|
| 2350 | 2353 |
return Undirector<const DGR>(digraph); |
| 2351 | 2354 |
} |
| 2352 | 2355 |
|
| 2353 | 2356 |
|
| 2354 | 2357 |
template <typename GR, typename DM> |
| 2355 | 2358 |
class OrienterBase {
|
| 2356 | 2359 |
public: |
| 2357 | 2360 |
|
| 2358 | 2361 |
typedef GR Graph; |
| 2359 | 2362 |
typedef DM DirectionMap; |
| 2360 | 2363 |
|
| 2361 | 2364 |
typedef typename GR::Node Node; |
| 2362 | 2365 |
typedef typename GR::Edge Arc; |
| 2363 | 2366 |
|
| 2364 | 2367 |
void reverseArc(const Arc& arc) {
|
| 2365 | 2368 |
_direction->set(arc, !(*_direction)[arc]); |
| 2366 | 2369 |
} |
| 2367 | 2370 |
|
| 2368 | 2371 |
void first(Node& i) const { _graph->first(i); }
|
| 2369 | 2372 |
void first(Arc& i) const { _graph->first(i); }
|
| 2370 | 2373 |
void firstIn(Arc& i, const Node& n) const {
|
| 2371 | 2374 |
bool d = true; |
| 2372 | 2375 |
_graph->firstInc(i, d, n); |
| 2373 | 2376 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d); |
| 2374 | 2377 |
} |
| 2375 | 2378 |
void firstOut(Arc& i, const Node& n ) const {
|
| 2376 | 2379 |
bool d = true; |
| 2377 | 2380 |
_graph->firstInc(i, d, n); |
| 2378 | 2381 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d); |
| 2379 | 2382 |
} |
| 2380 | 2383 |
|
| 2381 | 2384 |
void next(Node& i) const { _graph->next(i); }
|
| 2382 | 2385 |
void next(Arc& i) const { _graph->next(i); }
|
| 2383 | 2386 |
void nextIn(Arc& i) const {
|
| 2384 | 2387 |
bool d = !(*_direction)[i]; |
| 2385 | 2388 |
_graph->nextInc(i, d); |
| 2386 | 2389 |
while (i != INVALID && d == (*_direction)[i]) _graph->nextInc(i, d); |
| 2387 | 2390 |
} |
| 2388 | 2391 |
void nextOut(Arc& i) const {
|
| 2389 | 2392 |
bool d = (*_direction)[i]; |
| 2390 | 2393 |
_graph->nextInc(i, d); |
| 2391 | 2394 |
while (i != INVALID && d != (*_direction)[i]) _graph->nextInc(i, d); |
| 2392 | 2395 |
} |
| 2393 | 2396 |
|
| 2394 | 2397 |
Node source(const Arc& e) const {
|
| 2395 | 2398 |
return (*_direction)[e] ? _graph->u(e) : _graph->v(e); |
| 2396 | 2399 |
} |
| 2397 | 2400 |
Node target(const Arc& e) const {
|
| 2398 | 2401 |
return (*_direction)[e] ? _graph->v(e) : _graph->u(e); |
| 2399 | 2402 |
} |
| 2400 | 2403 |
|
| 2401 | 2404 |
typedef NodeNumTagIndicator<Graph> NodeNumTag; |
| 2402 | 2405 |
int nodeNum() const { return _graph->nodeNum(); }
|
| 2403 | 2406 |
|
| 2404 | 2407 |
typedef EdgeNumTagIndicator<Graph> ArcNumTag; |
| 2405 | 2408 |
int arcNum() const { return _graph->edgeNum(); }
|
| 2406 | 2409 |
|
| 2407 | 2410 |
typedef FindEdgeTagIndicator<Graph> FindArcTag; |
| 2408 | 2411 |
Arc findArc(const Node& u, const Node& v, |
| 2409 | 2412 |
const Arc& prev = INVALID) const {
|
| 2410 | 2413 |
Arc arc = _graph->findEdge(u, v, prev); |
| 2411 | 2414 |
while (arc != INVALID && source(arc) != u) {
|
| 2412 | 2415 |
arc = _graph->findEdge(u, v, arc); |
| 2413 | 2416 |
} |
| 2414 | 2417 |
return arc; |
| 2415 | 2418 |
} |
| 2416 | 2419 |
|
| 2417 | 2420 |
Node addNode() {
|
| 2418 | 2421 |
return Node(_graph->addNode()); |
| 2419 | 2422 |
} |
| 2420 | 2423 |
|
| 2421 | 2424 |
Arc addArc(const Node& u, const Node& v) {
|
| 2422 | 2425 |
Arc arc = _graph->addEdge(u, v); |
| 2423 | 2426 |
_direction->set(arc, _graph->u(arc) == u); |
| 2424 | 2427 |
return arc; |
| 2425 | 2428 |
} |
| 2426 | 2429 |
|
| 2427 | 2430 |
void erase(const Node& i) { _graph->erase(i); }
|
| 2428 | 2431 |
void erase(const Arc& i) { _graph->erase(i); }
|
| 2429 | 2432 |
|
| 2430 | 2433 |
void clear() { _graph->clear(); }
|
| 2431 | 2434 |
|
| 2432 | 2435 |
int id(const Node& v) const { return _graph->id(v); }
|
| 2433 | 2436 |
int id(const Arc& e) const { return _graph->id(e); }
|
| 2434 | 2437 |
|
| 2435 | 2438 |
Node nodeFromId(int idx) const { return _graph->nodeFromId(idx); }
|
| 2436 | 2439 |
Arc arcFromId(int idx) const { return _graph->edgeFromId(idx); }
|
| 2437 | 2440 |
|
| 2438 | 2441 |
int maxNodeId() const { return _graph->maxNodeId(); }
|
| 2439 | 2442 |
int maxArcId() const { return _graph->maxEdgeId(); }
|
| 2440 | 2443 |
|
| 2441 | 2444 |
typedef typename ItemSetTraits<GR, Node>::ItemNotifier NodeNotifier; |
| 2442 | 2445 |
NodeNotifier& notifier(Node) const { return _graph->notifier(Node()); }
|
| 2443 | 2446 |
|
| 2444 | 2447 |
typedef typename ItemSetTraits<GR, Arc>::ItemNotifier ArcNotifier; |
| 2445 | 2448 |
ArcNotifier& notifier(Arc) const { return _graph->notifier(Arc()); }
|
| 2446 | 2449 |
|
| 2447 | 2450 |
template <typename V> |
| 2448 | 2451 |
class NodeMap : public GR::template NodeMap<V> {
|
| 2449 | 2452 |
public: |
| 2450 | 2453 |
|
| 2451 | 2454 |
typedef typename GR::template NodeMap<V> Parent; |
| 2452 | 2455 |
|
| 2453 | 2456 |
explicit NodeMap(const OrienterBase<GR, DM>& adapter) |
| 2454 | 2457 |
: Parent(*adapter._graph) {}
|
| 2455 | 2458 |
|
| 2456 | 2459 |
NodeMap(const OrienterBase<GR, DM>& adapter, const V& value) |
| 2457 | 2460 |
: Parent(*adapter._graph, value) {}
|
| 2458 | 2461 |
|
| 2459 | 2462 |
private: |
| 2460 | 2463 |
NodeMap& operator=(const NodeMap& cmap) {
|
| 2461 | 2464 |
return operator=<NodeMap>(cmap); |
| 2462 | 2465 |
} |
| 2463 | 2466 |
|
| 2464 | 2467 |
template <typename CMap> |
| 2465 | 2468 |
NodeMap& operator=(const CMap& cmap) {
|
| 2466 | 2469 |
Parent::operator=(cmap); |
| 2467 | 2470 |
return *this; |
| 2468 | 2471 |
} |
| 2469 | 2472 |
|
| 2470 | 2473 |
}; |
| 2471 | 2474 |
|
| 2472 | 2475 |
template <typename V> |
| 2473 | 2476 |
class ArcMap : public GR::template EdgeMap<V> {
|
| 2474 | 2477 |
public: |
| 2475 | 2478 |
|
| 2476 | 2479 |
typedef typename Graph::template EdgeMap<V> Parent; |
| 2477 | 2480 |
|
| 2478 | 2481 |
explicit ArcMap(const OrienterBase<GR, DM>& adapter) |
| 2479 | 2482 |
: Parent(*adapter._graph) { }
|
| 2480 | 2483 |
|
| 2481 | 2484 |
ArcMap(const OrienterBase<GR, DM>& adapter, const V& value) |
| 2482 | 2485 |
: Parent(*adapter._graph, value) { }
|
| 2483 | 2486 |
|
| 2484 | 2487 |
private: |
| 2485 | 2488 |
ArcMap& operator=(const ArcMap& cmap) {
|
| 2486 | 2489 |
return operator=<ArcMap>(cmap); |
| 2487 | 2490 |
} |
| 2488 | 2491 |
|
| 2489 | 2492 |
template <typename CMap> |
| 2490 | 2493 |
ArcMap& operator=(const CMap& cmap) {
|
| 2491 | 2494 |
Parent::operator=(cmap); |
| 2492 | 2495 |
return *this; |
| 2493 | 2496 |
} |
| 2494 | 2497 |
}; |
| 2495 | 2498 |
|
| 2496 | 2499 |
|
| 2497 | 2500 |
|
| 2498 | 2501 |
protected: |
| 2499 | 2502 |
Graph* _graph; |
| 2500 | 2503 |
DM* _direction; |
| 2501 | 2504 |
|
| 2502 | 2505 |
void initialize(GR& graph, DM& direction) {
|
| 2503 | 2506 |
_graph = &graph; |
| 2504 | 2507 |
_direction = &direction; |
| 2505 | 2508 |
} |
| 2506 | 2509 |
|
| 2507 | 2510 |
}; |
| 2508 | 2511 |
|
| 2509 | 2512 |
/// \ingroup graph_adaptors |
| 2510 | 2513 |
/// |
| 2511 | 2514 |
/// \brief Adaptor class for orienting the edges of a graph to get a digraph |
| 2512 | 2515 |
/// |
| 2513 | 2516 |
/// Orienter adaptor can be used for orienting the edges of a graph to |
| 2514 | 2517 |
/// get a digraph. A \c bool edge map of the underlying graph must be |
| 2515 | 2518 |
/// specified, which define the direction of the arcs in the adaptor. |
| 2516 | 2519 |
/// The arcs can be easily reversed by the \c reverseArc() member function |
| 2517 | 2520 |
/// of the adaptor. |
| 2518 | 2521 |
/// This class conforms to the \ref concepts::Digraph "Digraph" concept. |
| 2519 | 2522 |
/// |
| 2520 | 2523 |
/// The adapted graph can also be modified through this adaptor |
| 2521 | 2524 |
/// by adding or removing nodes or arcs, unless the \c GR template |
| 2522 | 2525 |
/// parameter is set to be \c const. |
| 2523 | 2526 |
/// |
| 2524 | 2527 |
/// \tparam GR The type of the adapted graph. |
| 2525 | 2528 |
/// It must conform to the \ref concepts::Graph "Graph" concept. |
| 2526 | 2529 |
/// It can also be specified to be \c const. |
| 2527 | 2530 |
/// \tparam DM The type of the direction map. |
| 2528 | 2531 |
/// It must be a \c bool (or convertible) edge map of the |
| 2529 | 2532 |
/// adapted graph. The default type is |
| 2530 | 2533 |
/// \ref concepts::Graph::EdgeMap "GR::EdgeMap<bool>". |
| 2531 | 2534 |
/// |
| 2532 | 2535 |
/// \note The \c Node type of this adaptor and the adapted graph are |
| 2533 | 2536 |
/// convertible to each other, moreover the \c Arc type of the adaptor |
| 2534 | 2537 |
/// and the \c Edge type of the adapted graph are also convertible to |
| 2535 | 2538 |
/// each other. |
| 2536 | 2539 |
#ifdef DOXYGEN |
| 2537 | 2540 |
template<typename GR, |
| 2538 | 2541 |
typename DM> |
| 2539 | 2542 |
class Orienter {
|
| 2540 | 2543 |
#else |
| 2541 | 2544 |
template<typename GR, |
| 2542 | 2545 |
typename DM = typename GR::template EdgeMap<bool> > |
| 2543 | 2546 |
class Orienter : |
| 2544 | 2547 |
public DigraphAdaptorExtender<OrienterBase<GR, DM> > {
|
| 2545 | 2548 |
#endif |
| 2546 | 2549 |
public: |
| 2547 | 2550 |
|
| 2548 | 2551 |
/// The type of the adapted graph. |
| 2549 | 2552 |
typedef GR Graph; |
| 2550 | 2553 |
/// The type of the direction edge map. |
| 2551 | 2554 |
typedef DM DirectionMap; |
| 2552 | 2555 |
|
| 2553 | 2556 |
typedef DigraphAdaptorExtender<OrienterBase<GR, DM> > Parent; |
| 2554 | 2557 |
typedef typename Parent::Arc Arc; |
| 2555 | 2558 |
protected: |
| 2556 | 2559 |
Orienter() { }
|
| 2557 | 2560 |
public: |
| 2558 | 2561 |
|
| 2559 | 2562 |
/// \brief Constructor |
| 2560 | 2563 |
/// |
| 2561 | 2564 |
/// Constructor of the adaptor. |
| 2562 | 2565 |
Orienter(GR& graph, DM& direction) {
|
| 2563 | 2566 |
Parent::initialize(graph, direction); |
| 2564 | 2567 |
} |
| 2565 | 2568 |
|
| 2566 | 2569 |
/// \brief Reverses the given arc |
| 2567 | 2570 |
/// |
| 2568 | 2571 |
/// This function reverses the given arc. |
| 2569 | 2572 |
/// It is done by simply negate the assigned value of \c a |
| 2570 | 2573 |
/// in the direction map. |
| 2571 | 2574 |
void reverseArc(const Arc& a) {
|
| 2572 | 2575 |
Parent::reverseArc(a); |
| 2573 | 2576 |
} |
| 2574 | 2577 |
}; |
| 2575 | 2578 |
|
| 2576 | 2579 |
/// \brief Returns a read-only Orienter adaptor |
| 2577 | 2580 |
/// |
| 2578 | 2581 |
/// This function just returns a read-only \ref Orienter adaptor. |
| 2579 | 2582 |
/// \ingroup graph_adaptors |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#ifndef LEMON_BIN_HEAP_H |
| 20 | 20 |
#define LEMON_BIN_HEAP_H |
| 21 | 21 |
|
| 22 | 22 |
///\ingroup auxdat |
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Binary Heap implementation. |
| 25 | 25 |
|
| 26 | 26 |
#include <vector> |
| 27 | 27 |
#include <utility> |
| 28 | 28 |
#include <functional> |
| 29 | 29 |
|
| 30 | 30 |
namespace lemon {
|
| 31 | 31 |
|
| 32 | 32 |
///\ingroup auxdat |
| 33 | 33 |
/// |
| 34 | 34 |
///\brief A Binary Heap implementation. |
| 35 | 35 |
/// |
| 36 | 36 |
///This class implements the \e binary \e heap data structure. |
| 37 | 37 |
/// |
| 38 | 38 |
///A \e heap is a data structure for storing items with specified values |
| 39 | 39 |
///called \e priorities in such a way that finding the item with minimum |
| 40 | 40 |
///priority is efficient. \c Comp specifies the ordering of the priorities. |
| 41 | 41 |
///In a heap one can change the priority of an item, add or erase an |
| 42 | 42 |
///item, etc. |
| 43 | 43 |
/// |
| 44 | 44 |
///\tparam PR Type of the priority of the items. |
| 45 | 45 |
///\tparam IM A read and writable item map with int values, used internally |
| 46 | 46 |
///to handle the cross references. |
| 47 | 47 |
///\tparam Comp A functor class for the ordering of the priorities. |
| 48 | 48 |
///The default is \c std::less<PR>. |
| 49 | 49 |
/// |
| 50 | 50 |
///\sa FibHeap |
| 51 | 51 |
///\sa Dijkstra |
| 52 | 52 |
template <typename PR, typename IM, typename Comp = std::less<PR> > |
| 53 | 53 |
class BinHeap {
|
| 54 | 54 |
|
| 55 | 55 |
public: |
| 56 | 56 |
///\e |
| 57 | 57 |
typedef IM ItemIntMap; |
| 58 | 58 |
///\e |
| 59 | 59 |
typedef PR Prio; |
| 60 | 60 |
///\e |
| 61 | 61 |
typedef typename ItemIntMap::Key Item; |
| 62 | 62 |
///\e |
| 63 | 63 |
typedef std::pair<Item,Prio> Pair; |
| 64 | 64 |
///\e |
| 65 | 65 |
typedef Comp Compare; |
| 66 | 66 |
|
| 67 | 67 |
/// \brief Type to represent the items states. |
| 68 | 68 |
/// |
| 69 | 69 |
/// Each Item element have a state associated to it. It may be "in heap", |
| 70 | 70 |
/// "pre heap" or "post heap". The latter two are indifferent from the |
| 71 | 71 |
/// heap's point of view, but may be useful to the user. |
| 72 | 72 |
/// |
| 73 | 73 |
/// The item-int map must be initialized in such way that it assigns |
| 74 | 74 |
/// \c PRE_HEAP (<tt>-1</tt>) to any element to be put in the heap. |
| 75 | 75 |
enum State {
|
| 76 |
IN_HEAP = 0, ///< \e |
|
| 77 |
PRE_HEAP = -1, ///< \e |
|
| 78 |
|
|
| 76 |
IN_HEAP = 0, ///< = 0. |
|
| 77 |
PRE_HEAP = -1, ///< = -1. |
|
| 78 |
POST_HEAP = -2 ///< = -2. |
|
| 79 | 79 |
}; |
| 80 | 80 |
|
| 81 | 81 |
private: |
| 82 | 82 |
std::vector<Pair> _data; |
| 83 | 83 |
Compare _comp; |
| 84 | 84 |
ItemIntMap &_iim; |
| 85 | 85 |
|
| 86 | 86 |
public: |
| 87 | 87 |
/// \brief The constructor. |
| 88 | 88 |
/// |
| 89 | 89 |
/// The constructor. |
| 90 | 90 |
/// \param map should be given to the constructor, since it is used |
| 91 | 91 |
/// internally to handle the cross references. The value of the map |
| 92 | 92 |
/// must be \c PRE_HEAP (<tt>-1</tt>) for every item. |
| 93 | 93 |
explicit BinHeap(ItemIntMap &map) : _iim(map) {}
|
| 94 | 94 |
|
| 95 | 95 |
/// \brief The constructor. |
| 96 | 96 |
/// |
| 97 | 97 |
/// The constructor. |
| 98 | 98 |
/// \param map should be given to the constructor, since it is used |
| 99 | 99 |
/// internally to handle the cross references. The value of the map |
| 100 | 100 |
/// should be PRE_HEAP (-1) for each element. |
| 101 | 101 |
/// |
| 102 | 102 |
/// \param comp The comparator function object. |
| 103 | 103 |
BinHeap(ItemIntMap &map, const Compare &comp) |
| 104 | 104 |
: _iim(map), _comp(comp) {}
|
| 105 | 105 |
|
| 106 | 106 |
|
| 107 | 107 |
/// The number of items stored in the heap. |
| 108 | 108 |
/// |
| 109 | 109 |
/// \brief Returns the number of items stored in the heap. |
| 110 | 110 |
int size() const { return _data.size(); }
|
| 111 | 111 |
|
| 112 | 112 |
/// \brief Checks if the heap stores no items. |
| 113 | 113 |
/// |
| 114 | 114 |
/// Returns \c true if and only if the heap stores no items. |
| 115 | 115 |
bool empty() const { return _data.empty(); }
|
| 116 | 116 |
|
| 117 | 117 |
/// \brief Make empty this heap. |
| 118 | 118 |
/// |
| 119 | 119 |
/// Make empty this heap. It does not change the cross reference map. |
| 120 | 120 |
/// If you want to reuse what is not surely empty you should first clear |
| 121 | 121 |
/// the heap and after that you should set the cross reference map for |
| 122 | 122 |
/// each item to \c PRE_HEAP. |
| 123 | 123 |
void clear() {
|
| 124 | 124 |
_data.clear(); |
| 125 | 125 |
} |
| 126 | 126 |
|
| 127 | 127 |
private: |
| 128 | 128 |
static int parent(int i) { return (i-1)/2; }
|
| 129 | 129 |
|
| 130 | 130 |
static int second_child(int i) { return 2*i+2; }
|
| 131 | 131 |
bool less(const Pair &p1, const Pair &p2) const {
|
| 132 | 132 |
return _comp(p1.second, p2.second); |
| 133 | 133 |
} |
| 134 | 134 |
|
| 135 | 135 |
int bubble_up(int hole, Pair p) {
|
| 136 | 136 |
int par = parent(hole); |
| 137 | 137 |
while( hole>0 && less(p,_data[par]) ) {
|
| 138 | 138 |
move(_data[par],hole); |
| 139 | 139 |
hole = par; |
| 140 | 140 |
par = parent(hole); |
| 141 | 141 |
} |
| 142 | 142 |
move(p, hole); |
| 143 | 143 |
return hole; |
| 144 | 144 |
} |
| 145 | 145 |
|
| 146 | 146 |
int bubble_down(int hole, Pair p, int length) {
|
| 147 | 147 |
int child = second_child(hole); |
| 148 | 148 |
while(child < length) {
|
| 149 | 149 |
if( less(_data[child-1], _data[child]) ) {
|
| 150 | 150 |
--child; |
| 151 | 151 |
} |
| 152 | 152 |
if( !less(_data[child], p) ) |
| 153 | 153 |
goto ok; |
| 154 | 154 |
move(_data[child], hole); |
| 155 | 155 |
hole = child; |
| 156 | 156 |
child = second_child(hole); |
| 157 | 157 |
} |
| 158 | 158 |
child--; |
| 159 | 159 |
if( child<length && less(_data[child], p) ) {
|
| 160 | 160 |
move(_data[child], hole); |
| 161 | 161 |
hole=child; |
| 162 | 162 |
} |
| 163 | 163 |
ok: |
| 164 | 164 |
move(p, hole); |
| 165 | 165 |
return hole; |
| 166 | 166 |
} |
| 167 | 167 |
|
| 168 | 168 |
void move(const Pair &p, int i) {
|
| 169 | 169 |
_data[i] = p; |
| 170 | 170 |
_iim.set(p.first, i); |
| 171 | 171 |
} |
| 172 | 172 |
|
| 173 | 173 |
public: |
| 174 | 174 |
/// \brief Insert a pair of item and priority into the heap. |
| 175 | 175 |
/// |
| 176 | 176 |
/// Adds \c p.first to the heap with priority \c p.second. |
| 177 | 177 |
/// \param p The pair to insert. |
| 178 | 178 |
void push(const Pair &p) {
|
| 179 | 179 |
int n = _data.size(); |
| 180 | 180 |
_data.resize(n+1); |
| 181 | 181 |
bubble_up(n, p); |
| 182 | 182 |
} |
| 183 | 183 |
|
| 184 | 184 |
/// \brief Insert an item into the heap with the given heap. |
| 185 | 185 |
/// |
| 186 | 186 |
/// Adds \c i to the heap with priority \c p. |
| 187 | 187 |
/// \param i The item to insert. |
| 188 | 188 |
/// \param p The priority of the item. |
| 189 | 189 |
void push(const Item &i, const Prio &p) { push(Pair(i,p)); }
|
| 190 | 190 |
|
| 191 | 191 |
/// \brief Returns the item with minimum priority relative to \c Compare. |
| 192 | 192 |
/// |
| 193 | 193 |
/// This method returns the item with minimum priority relative to \c |
| 194 | 194 |
/// Compare. |
| 195 | 195 |
/// \pre The heap must be nonempty. |
| 196 | 196 |
Item top() const {
|
| 197 | 197 |
return _data[0].first; |
| 198 | 198 |
} |
| 199 | 199 |
|
| 200 | 200 |
/// \brief Returns the minimum priority relative to \c Compare. |
| 201 | 201 |
/// |
| 202 | 202 |
/// It returns the minimum priority relative to \c Compare. |
| 203 | 203 |
/// \pre The heap must be nonempty. |
| 204 | 204 |
Prio prio() const {
|
| 205 | 205 |
return _data[0].second; |
| 206 | 206 |
} |
| 207 | 207 |
|
| 208 | 208 |
/// \brief Deletes the item with minimum priority relative to \c Compare. |
| 209 | 209 |
/// |
| 210 | 210 |
/// This method deletes the item with minimum priority relative to \c |
| 211 | 211 |
/// Compare from the heap. |
| 212 | 212 |
/// \pre The heap must be non-empty. |
| 213 | 213 |
void pop() {
|
| 214 | 214 |
int n = _data.size()-1; |
| 215 | 215 |
_iim.set(_data[0].first, POST_HEAP); |
| 216 | 216 |
if (n > 0) {
|
| 217 | 217 |
bubble_down(0, _data[n], n); |
| 218 | 218 |
} |
| 219 | 219 |
_data.pop_back(); |
| 220 | 220 |
} |
| 221 | 221 |
|
| 222 | 222 |
/// \brief Deletes \c i from the heap. |
| 223 | 223 |
/// |
| 224 | 224 |
/// This method deletes item \c i from the heap. |
| 225 | 225 |
/// \param i The item to erase. |
| 226 | 226 |
/// \pre The item should be in the heap. |
| 227 | 227 |
void erase(const Item &i) {
|
| 228 | 228 |
int h = _iim[i]; |
| 229 | 229 |
int n = _data.size()-1; |
| 230 | 230 |
_iim.set(_data[h].first, POST_HEAP); |
| 231 | 231 |
if( h < n ) {
|
| 232 | 232 |
if ( bubble_up(h, _data[n]) == h) {
|
| 233 | 233 |
bubble_down(h, _data[n], n); |
| 234 | 234 |
} |
| 235 | 235 |
} |
| 236 | 236 |
_data.pop_back(); |
| 237 | 237 |
} |
| 238 | 238 |
|
| 239 | 239 |
|
| 240 | 240 |
/// \brief Returns the priority of \c i. |
| 241 | 241 |
/// |
| 242 | 242 |
/// This function returns the priority of item \c i. |
| 243 | 243 |
/// \param i The item. |
| 244 | 244 |
/// \pre \c i must be in the heap. |
| 245 | 245 |
Prio operator[](const Item &i) const {
|
| 246 | 246 |
int idx = _iim[i]; |
| 247 | 247 |
return _data[idx].second; |
| 248 | 248 |
} |
| 249 | 249 |
|
| 250 | 250 |
/// \brief \c i gets to the heap with priority \c p independently |
| 251 | 251 |
/// if \c i was already there. |
| 252 | 252 |
/// |
| 253 | 253 |
/// This method calls \ref push(\c i, \c p) if \c i is not stored |
| 254 | 254 |
/// in the heap and sets the priority of \c i to \c p otherwise. |
| 255 | 255 |
/// \param i The item. |
| 256 | 256 |
/// \param p The priority. |
| 257 | 257 |
void set(const Item &i, const Prio &p) {
|
| 258 | 258 |
int idx = _iim[i]; |
| 259 | 259 |
if( idx < 0 ) {
|
| 260 | 260 |
push(i,p); |
| 261 | 261 |
} |
| 262 | 262 |
else if( _comp(p, _data[idx].second) ) {
|
| 263 | 263 |
bubble_up(idx, Pair(i,p)); |
| 264 | 264 |
} |
| 265 | 265 |
else {
|
| 266 | 266 |
bubble_down(idx, Pair(i,p), _data.size()); |
| 267 | 267 |
} |
| 268 | 268 |
} |
| 269 | 269 |
|
| 270 | 270 |
/// \brief Decreases the priority of \c i to \c p. |
| 271 | 271 |
/// |
| 272 | 272 |
/// This method decreases the priority of item \c i to \c p. |
| 273 | 273 |
/// \param i The item. |
| 274 | 274 |
/// \param p The priority. |
| 275 | 275 |
/// \pre \c i must be stored in the heap with priority at least \c |
| 276 | 276 |
/// p relative to \c Compare. |
| 277 | 277 |
void decrease(const Item &i, const Prio &p) {
|
| 278 | 278 |
int idx = _iim[i]; |
| 279 | 279 |
bubble_up(idx, Pair(i,p)); |
| 280 | 280 |
} |
| 281 | 281 |
|
| 282 | 282 |
/// \brief Increases the priority of \c i to \c p. |
| 283 | 283 |
/// |
| 284 | 284 |
/// This method sets the priority of item \c i to \c p. |
| 285 | 285 |
/// \param i The item. |
| 286 | 286 |
/// \param p The priority. |
| 287 | 287 |
/// \pre \c i must be stored in the heap with priority at most \c |
| 288 | 288 |
/// p relative to \c Compare. |
| 289 | 289 |
void increase(const Item &i, const Prio &p) {
|
| 290 | 290 |
int idx = _iim[i]; |
| 291 | 291 |
bubble_down(idx, Pair(i,p), _data.size()); |
| 292 | 292 |
} |
| 293 | 293 |
|
| 294 | 294 |
/// \brief Returns if \c item is in, has already been in, or has |
| 295 | 295 |
/// never been in the heap. |
| 296 | 296 |
/// |
| 297 | 297 |
/// This method returns PRE_HEAP if \c item has never been in the |
| 298 | 298 |
/// heap, IN_HEAP if it is in the heap at the moment, and POST_HEAP |
| 299 | 299 |
/// otherwise. In the latter case it is possible that \c item will |
| 300 | 300 |
/// get back to the heap again. |
| 301 | 301 |
/// \param i The item. |
| 302 | 302 |
State state(const Item &i) const {
|
| 303 | 303 |
int s = _iim[i]; |
| 304 | 304 |
if( s>=0 ) |
| 305 | 305 |
s=0; |
| 306 | 306 |
return State(s); |
| 307 | 307 |
} |
| 308 | 308 |
|
| 309 | 309 |
/// \brief Sets the state of the \c item in the heap. |
| 310 | 310 |
/// |
| 311 | 311 |
/// Sets the state of the \c item in the heap. It can be used to |
| 312 | 312 |
/// manually clear the heap when it is important to achive the |
| 313 | 313 |
/// better time complexity. |
| 314 | 314 |
/// \param i The item. |
| 315 | 315 |
/// \param st The state. It should not be \c IN_HEAP. |
| 316 | 316 |
void state(const Item& i, State st) {
|
| 317 | 317 |
switch (st) {
|
| 318 | 318 |
case POST_HEAP: |
| 319 | 319 |
case PRE_HEAP: |
| 320 | 320 |
if (state(i) == IN_HEAP) {
|
| 321 | 321 |
erase(i); |
| 322 | 322 |
} |
| 323 | 323 |
_iim[i] = st; |
| 324 | 324 |
break; |
| 325 | 325 |
case IN_HEAP: |
| 326 | 326 |
break; |
| 327 | 327 |
} |
| 328 | 328 |
} |
| 329 | 329 |
|
| 330 | 330 |
/// \brief Replaces an item in the heap. |
| 331 | 331 |
/// |
| 332 | 332 |
/// The \c i item is replaced with \c j item. The \c i item should |
| 333 | 333 |
/// be in the heap, while the \c j should be out of the heap. The |
| 334 | 334 |
/// \c i item will out of the heap and \c j will be in the heap |
| 335 | 335 |
/// with the same prioriority as prevoiusly the \c i item. |
| 336 | 336 |
void replace(const Item& i, const Item& j) {
|
| 337 | 337 |
int idx = _iim[i]; |
| 338 | 338 |
_iim.set(i, _iim[j]); |
| 339 | 339 |
_iim.set(j, idx); |
| 340 | 340 |
_data[idx].first = j; |
| 341 | 341 |
} |
| 342 | 342 |
|
| 343 | 343 |
}; // class BinHeap |
| 344 | 344 |
|
| 345 | 345 |
} // namespace lemon |
| 346 | 346 |
|
| 347 | 347 |
#endif // LEMON_BIN_HEAP_H |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#ifndef LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_GRAPH_ADAPTOR_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <lemon/core.h> |
| 23 | 23 |
#include <lemon/error.h> |
| 24 | 24 |
|
| 25 |
#include <lemon/bits/default_map.h> |
|
| 26 |
|
|
| 27 | 25 |
namespace lemon {
|
| 28 | 26 |
|
| 29 | 27 |
template <typename _Digraph> |
| 30 | 28 |
class DigraphAdaptorExtender : public _Digraph {
|
| 31 | 29 |
public: |
| 32 | 30 |
|
| 33 | 31 |
typedef _Digraph Parent; |
| 34 | 32 |
typedef _Digraph Digraph; |
| 35 | 33 |
typedef DigraphAdaptorExtender Adaptor; |
| 36 | 34 |
|
| 37 | 35 |
// Base extensions |
| 38 | 36 |
|
| 39 | 37 |
typedef typename Parent::Node Node; |
| 40 | 38 |
typedef typename Parent::Arc Arc; |
| 41 | 39 |
|
| 42 | 40 |
int maxId(Node) const {
|
| 43 | 41 |
return Parent::maxNodeId(); |
| 44 | 42 |
} |
| 45 | 43 |
|
| 46 | 44 |
int maxId(Arc) const {
|
| 47 | 45 |
return Parent::maxArcId(); |
| 48 | 46 |
} |
| 49 | 47 |
|
| 50 | 48 |
Node fromId(int id, Node) const {
|
| 51 | 49 |
return Parent::nodeFromId(id); |
| 52 | 50 |
} |
| 53 | 51 |
|
| 54 | 52 |
Arc fromId(int id, Arc) const {
|
| 55 | 53 |
return Parent::arcFromId(id); |
| 56 | 54 |
} |
| 57 | 55 |
|
| 58 | 56 |
Node oppositeNode(const Node &n, const Arc &e) const {
|
| 59 | 57 |
if (n == Parent::source(e)) |
| 60 | 58 |
return Parent::target(e); |
| 61 | 59 |
else if(n==Parent::target(e)) |
| 62 | 60 |
return Parent::source(e); |
| 63 | 61 |
else |
| 64 | 62 |
return INVALID; |
| 65 | 63 |
} |
| 66 | 64 |
|
| 67 | 65 |
class NodeIt : public Node {
|
| 68 | 66 |
const Adaptor* _adaptor; |
| 69 | 67 |
public: |
| 70 | 68 |
|
| 71 | 69 |
NodeIt() {}
|
| 72 | 70 |
|
| 73 | 71 |
NodeIt(Invalid i) : Node(i) { }
|
| 74 | 72 |
|
| 75 | 73 |
explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
|
| 76 | 74 |
_adaptor->first(static_cast<Node&>(*this)); |
| 77 | 75 |
} |
| 78 | 76 |
|
| 79 | 77 |
NodeIt(const Adaptor& adaptor, const Node& node) |
| 80 | 78 |
: Node(node), _adaptor(&adaptor) {}
|
| 81 | 79 |
|
| 82 | 80 |
NodeIt& operator++() {
|
| 83 | 81 |
_adaptor->next(*this); |
| 84 | 82 |
return *this; |
| 85 | 83 |
} |
| 86 | 84 |
|
| 87 | 85 |
}; |
| 88 | 86 |
|
| 89 | 87 |
|
| 90 | 88 |
class ArcIt : public Arc {
|
| 91 | 89 |
const Adaptor* _adaptor; |
| 92 | 90 |
public: |
| 93 | 91 |
|
| 94 | 92 |
ArcIt() { }
|
| 95 | 93 |
|
| 96 | 94 |
ArcIt(Invalid i) : Arc(i) { }
|
| 97 | 95 |
|
| 98 | 96 |
explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
|
| 99 | 97 |
_adaptor->first(static_cast<Arc&>(*this)); |
| 100 | 98 |
} |
| 101 | 99 |
|
| 102 | 100 |
ArcIt(const Adaptor& adaptor, const Arc& e) : |
| 103 | 101 |
Arc(e), _adaptor(&adaptor) { }
|
| 104 | 102 |
|
| 105 | 103 |
ArcIt& operator++() {
|
| 106 | 104 |
_adaptor->next(*this); |
| 107 | 105 |
return *this; |
| 108 | 106 |
} |
| 109 | 107 |
|
| 110 | 108 |
}; |
| 111 | 109 |
|
| 112 | 110 |
|
| 113 | 111 |
class OutArcIt : public Arc {
|
| 114 | 112 |
const Adaptor* _adaptor; |
| 115 | 113 |
public: |
| 116 | 114 |
|
| 117 | 115 |
OutArcIt() { }
|
| 118 | 116 |
|
| 119 | 117 |
OutArcIt(Invalid i) : Arc(i) { }
|
| 120 | 118 |
|
| 121 | 119 |
OutArcIt(const Adaptor& adaptor, const Node& node) |
| 122 | 120 |
: _adaptor(&adaptor) {
|
| 123 | 121 |
_adaptor->firstOut(*this, node); |
| 124 | 122 |
} |
| 125 | 123 |
|
| 126 | 124 |
OutArcIt(const Adaptor& adaptor, const Arc& arc) |
| 127 | 125 |
: Arc(arc), _adaptor(&adaptor) {}
|
| 128 | 126 |
|
| 129 | 127 |
OutArcIt& operator++() {
|
| 130 | 128 |
_adaptor->nextOut(*this); |
| 131 | 129 |
return *this; |
| 132 | 130 |
} |
| 133 | 131 |
|
| 134 | 132 |
}; |
| 135 | 133 |
|
| 136 | 134 |
|
| 137 | 135 |
class InArcIt : public Arc {
|
| 138 | 136 |
const Adaptor* _adaptor; |
| 139 | 137 |
public: |
| 140 | 138 |
|
| 141 | 139 |
InArcIt() { }
|
| 142 | 140 |
|
| 143 | 141 |
InArcIt(Invalid i) : Arc(i) { }
|
| 144 | 142 |
|
| 145 | 143 |
InArcIt(const Adaptor& adaptor, const Node& node) |
| 146 | 144 |
: _adaptor(&adaptor) {
|
| 147 | 145 |
_adaptor->firstIn(*this, node); |
| 148 | 146 |
} |
| 149 | 147 |
|
| 150 | 148 |
InArcIt(const Adaptor& adaptor, const Arc& arc) : |
| 151 | 149 |
Arc(arc), _adaptor(&adaptor) {}
|
| 152 | 150 |
|
| 153 | 151 |
InArcIt& operator++() {
|
| 154 | 152 |
_adaptor->nextIn(*this); |
| 155 | 153 |
return *this; |
| 156 | 154 |
} |
| 157 | 155 |
|
| 158 | 156 |
}; |
| 159 | 157 |
|
| 160 | 158 |
Node baseNode(const OutArcIt &e) const {
|
| 161 | 159 |
return Parent::source(e); |
| 162 | 160 |
} |
| 163 | 161 |
Node runningNode(const OutArcIt &e) const {
|
| 164 | 162 |
return Parent::target(e); |
| 165 | 163 |
} |
| 166 | 164 |
|
| 167 | 165 |
Node baseNode(const InArcIt &e) const {
|
| 168 | 166 |
return Parent::target(e); |
| 169 | 167 |
} |
| 170 | 168 |
Node runningNode(const InArcIt &e) const {
|
| 171 | 169 |
return Parent::source(e); |
| 172 | 170 |
} |
| 173 | 171 |
|
| 174 | 172 |
}; |
| 175 | 173 |
|
| 176 | 174 |
template <typename _Graph> |
| 177 | 175 |
class GraphAdaptorExtender : public _Graph {
|
| 178 | 176 |
public: |
| 179 | 177 |
|
| 180 | 178 |
typedef _Graph Parent; |
| 181 | 179 |
typedef _Graph Graph; |
| 182 | 180 |
typedef GraphAdaptorExtender Adaptor; |
| 183 | 181 |
|
| 184 | 182 |
typedef typename Parent::Node Node; |
| 185 | 183 |
typedef typename Parent::Arc Arc; |
| 186 | 184 |
typedef typename Parent::Edge Edge; |
| 187 | 185 |
|
| 188 | 186 |
// Graph extension |
| 189 | 187 |
|
| 190 | 188 |
int maxId(Node) const {
|
| 191 | 189 |
return Parent::maxNodeId(); |
| 192 | 190 |
} |
| 193 | 191 |
|
| 194 | 192 |
int maxId(Arc) const {
|
| 195 | 193 |
return Parent::maxArcId(); |
| 196 | 194 |
} |
| 197 | 195 |
|
| 198 | 196 |
int maxId(Edge) const {
|
| 199 | 197 |
return Parent::maxEdgeId(); |
| 200 | 198 |
} |
| 201 | 199 |
|
| 202 | 200 |
Node fromId(int id, Node) const {
|
| 203 | 201 |
return Parent::nodeFromId(id); |
| 204 | 202 |
} |
| 205 | 203 |
|
| 206 | 204 |
Arc fromId(int id, Arc) const {
|
| 207 | 205 |
return Parent::arcFromId(id); |
| 208 | 206 |
} |
| 209 | 207 |
|
| 210 | 208 |
Edge fromId(int id, Edge) const {
|
| 211 | 209 |
return Parent::edgeFromId(id); |
| 212 | 210 |
} |
| 213 | 211 |
|
| 214 | 212 |
Node oppositeNode(const Node &n, const Edge &e) const {
|
| 215 | 213 |
if( n == Parent::u(e)) |
| 216 | 214 |
return Parent::v(e); |
| 217 | 215 |
else if( n == Parent::v(e)) |
| 218 | 216 |
return Parent::u(e); |
| 219 | 217 |
else |
| 220 | 218 |
return INVALID; |
| 221 | 219 |
} |
| 222 | 220 |
|
| 223 | 221 |
Arc oppositeArc(const Arc &a) const {
|
| 224 | 222 |
return Parent::direct(a, !Parent::direction(a)); |
| 225 | 223 |
} |
| 226 | 224 |
|
| 227 | 225 |
using Parent::direct; |
| 228 | 226 |
Arc direct(const Edge &e, const Node &s) const {
|
| 229 | 227 |
return Parent::direct(e, Parent::u(e) == s); |
| 230 | 228 |
} |
| 231 | 229 |
|
| 232 | 230 |
|
| 233 | 231 |
class NodeIt : public Node {
|
| 234 | 232 |
const Adaptor* _adaptor; |
| 235 | 233 |
public: |
| 236 | 234 |
|
| 237 | 235 |
NodeIt() {}
|
| 238 | 236 |
|
| 239 | 237 |
NodeIt(Invalid i) : Node(i) { }
|
| 240 | 238 |
|
| 241 | 239 |
explicit NodeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
|
| 242 | 240 |
_adaptor->first(static_cast<Node&>(*this)); |
| 243 | 241 |
} |
| 244 | 242 |
|
| 245 | 243 |
NodeIt(const Adaptor& adaptor, const Node& node) |
| 246 | 244 |
: Node(node), _adaptor(&adaptor) {}
|
| 247 | 245 |
|
| 248 | 246 |
NodeIt& operator++() {
|
| 249 | 247 |
_adaptor->next(*this); |
| 250 | 248 |
return *this; |
| 251 | 249 |
} |
| 252 | 250 |
|
| 253 | 251 |
}; |
| 254 | 252 |
|
| 255 | 253 |
|
| 256 | 254 |
class ArcIt : public Arc {
|
| 257 | 255 |
const Adaptor* _adaptor; |
| 258 | 256 |
public: |
| 259 | 257 |
|
| 260 | 258 |
ArcIt() { }
|
| 261 | 259 |
|
| 262 | 260 |
ArcIt(Invalid i) : Arc(i) { }
|
| 263 | 261 |
|
| 264 | 262 |
explicit ArcIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
|
| 265 | 263 |
_adaptor->first(static_cast<Arc&>(*this)); |
| 266 | 264 |
} |
| 267 | 265 |
|
| 268 | 266 |
ArcIt(const Adaptor& adaptor, const Arc& e) : |
| 269 | 267 |
Arc(e), _adaptor(&adaptor) { }
|
| 270 | 268 |
|
| 271 | 269 |
ArcIt& operator++() {
|
| 272 | 270 |
_adaptor->next(*this); |
| 273 | 271 |
return *this; |
| 274 | 272 |
} |
| 275 | 273 |
|
| 276 | 274 |
}; |
| 277 | 275 |
|
| 278 | 276 |
|
| 279 | 277 |
class OutArcIt : public Arc {
|
| 280 | 278 |
const Adaptor* _adaptor; |
| 281 | 279 |
public: |
| 282 | 280 |
|
| 283 | 281 |
OutArcIt() { }
|
| 284 | 282 |
|
| 285 | 283 |
OutArcIt(Invalid i) : Arc(i) { }
|
| 286 | 284 |
|
| 287 | 285 |
OutArcIt(const Adaptor& adaptor, const Node& node) |
| 288 | 286 |
: _adaptor(&adaptor) {
|
| 289 | 287 |
_adaptor->firstOut(*this, node); |
| 290 | 288 |
} |
| 291 | 289 |
|
| 292 | 290 |
OutArcIt(const Adaptor& adaptor, const Arc& arc) |
| 293 | 291 |
: Arc(arc), _adaptor(&adaptor) {}
|
| 294 | 292 |
|
| 295 | 293 |
OutArcIt& operator++() {
|
| 296 | 294 |
_adaptor->nextOut(*this); |
| 297 | 295 |
return *this; |
| 298 | 296 |
} |
| 299 | 297 |
|
| 300 | 298 |
}; |
| 301 | 299 |
|
| 302 | 300 |
|
| 303 | 301 |
class InArcIt : public Arc {
|
| 304 | 302 |
const Adaptor* _adaptor; |
| 305 | 303 |
public: |
| 306 | 304 |
|
| 307 | 305 |
InArcIt() { }
|
| 308 | 306 |
|
| 309 | 307 |
InArcIt(Invalid i) : Arc(i) { }
|
| 310 | 308 |
|
| 311 | 309 |
InArcIt(const Adaptor& adaptor, const Node& node) |
| 312 | 310 |
: _adaptor(&adaptor) {
|
| 313 | 311 |
_adaptor->firstIn(*this, node); |
| 314 | 312 |
} |
| 315 | 313 |
|
| 316 | 314 |
InArcIt(const Adaptor& adaptor, const Arc& arc) : |
| 317 | 315 |
Arc(arc), _adaptor(&adaptor) {}
|
| 318 | 316 |
|
| 319 | 317 |
InArcIt& operator++() {
|
| 320 | 318 |
_adaptor->nextIn(*this); |
| 321 | 319 |
return *this; |
| 322 | 320 |
} |
| 323 | 321 |
|
| 324 | 322 |
}; |
| 325 | 323 |
|
| 326 | 324 |
class EdgeIt : public Parent::Edge {
|
| 327 | 325 |
const Adaptor* _adaptor; |
| 328 | 326 |
public: |
| 329 | 327 |
|
| 330 | 328 |
EdgeIt() { }
|
| 331 | 329 |
|
| 332 | 330 |
EdgeIt(Invalid i) : Edge(i) { }
|
| 333 | 331 |
|
| 334 | 332 |
explicit EdgeIt(const Adaptor& adaptor) : _adaptor(&adaptor) {
|
| 335 | 333 |
_adaptor->first(static_cast<Edge&>(*this)); |
| 336 | 334 |
} |
| 337 | 335 |
|
| 338 | 336 |
EdgeIt(const Adaptor& adaptor, const Edge& e) : |
| 339 | 337 |
Edge(e), _adaptor(&adaptor) { }
|
| 340 | 338 |
|
| 341 | 339 |
EdgeIt& operator++() {
|
| 342 | 340 |
_adaptor->next(*this); |
| 343 | 341 |
return *this; |
| 344 | 342 |
} |
| 345 | 343 |
|
| 346 | 344 |
}; |
| 347 | 345 |
|
| 348 | 346 |
class IncEdgeIt : public Edge {
|
| 349 | 347 |
friend class GraphAdaptorExtender; |
| 350 | 348 |
const Adaptor* _adaptor; |
| 351 | 349 |
bool direction; |
| 352 | 350 |
public: |
| 353 | 351 |
|
| 354 | 352 |
IncEdgeIt() { }
|
| 355 | 353 |
|
| 356 | 354 |
IncEdgeIt(Invalid i) : Edge(i), direction(false) { }
|
| 357 | 355 |
|
| 358 | 356 |
IncEdgeIt(const Adaptor& adaptor, const Node &n) : _adaptor(&adaptor) {
|
| 359 | 357 |
_adaptor->firstInc(static_cast<Edge&>(*this), direction, n); |
| 360 | 358 |
} |
| 361 | 359 |
|
| 362 | 360 |
IncEdgeIt(const Adaptor& adaptor, const Edge &e, const Node &n) |
| 363 | 361 |
: _adaptor(&adaptor), Edge(e) {
|
| 364 | 362 |
direction = (_adaptor->u(e) == n); |
| 365 | 363 |
} |
| 366 | 364 |
|
| 367 | 365 |
IncEdgeIt& operator++() {
|
| 368 | 366 |
_adaptor->nextInc(*this, direction); |
| 369 | 367 |
return *this; |
| 370 | 368 |
} |
| 371 | 369 |
}; |
| 372 | 370 |
|
| 373 | 371 |
Node baseNode(const OutArcIt &a) const {
|
| 374 | 372 |
return Parent::source(a); |
| 375 | 373 |
} |
| 376 | 374 |
Node runningNode(const OutArcIt &a) const {
|
| 377 | 375 |
return Parent::target(a); |
| 378 | 376 |
} |
| 379 | 377 |
|
| 380 | 378 |
Node baseNode(const InArcIt &a) const {
|
| 381 | 379 |
return Parent::target(a); |
| 382 | 380 |
} |
| 383 | 381 |
Node runningNode(const InArcIt &a) const {
|
| 384 | 382 |
return Parent::source(a); |
| 385 | 383 |
} |
| 386 | 384 |
|
| 387 | 385 |
Node baseNode(const IncEdgeIt &e) const {
|
| 388 | 386 |
return e.direction ? Parent::u(e) : Parent::v(e); |
| 389 | 387 |
} |
| 390 | 388 |
Node runningNode(const IncEdgeIt &e) const {
|
| 391 | 389 |
return e.direction ? Parent::v(e) : Parent::u(e); |
| 392 | 390 |
} |
| 393 | 391 |
|
| 394 | 392 |
}; |
| 395 | 393 |
|
| 396 | 394 |
} |
| 397 | 395 |
|
| 398 | 396 |
|
| 399 | 397 |
#endif |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#ifndef LEMON_BITS_MAP_EXTENDER_H |
| 20 | 20 |
#define LEMON_BITS_MAP_EXTENDER_H |
| 21 | 21 |
|
| 22 | 22 |
#include <iterator> |
| 23 | 23 |
|
| 24 | 24 |
#include <lemon/bits/traits.h> |
| 25 | 25 |
|
| 26 | 26 |
#include <lemon/concept_check.h> |
| 27 | 27 |
#include <lemon/concepts/maps.h> |
| 28 | 28 |
|
| 29 | 29 |
//\file |
| 30 | 30 |
//\brief Extenders for iterable maps. |
| 31 | 31 |
|
| 32 | 32 |
namespace lemon {
|
| 33 | 33 |
|
| 34 | 34 |
// \ingroup graphbits |
| 35 | 35 |
// |
| 36 | 36 |
// \brief Extender for maps |
| 37 | 37 |
template <typename _Map> |
| 38 | 38 |
class MapExtender : public _Map {
|
| 39 | 39 |
public: |
| 40 | 40 |
|
| 41 | 41 |
typedef _Map Parent; |
| 42 | 42 |
typedef MapExtender Map; |
| 43 | 43 |
|
| 44 | 44 |
|
| 45 | 45 |
typedef typename Parent::Graph Graph; |
| 46 | 46 |
typedef typename Parent::Key Item; |
| 47 | 47 |
|
| 48 | 48 |
typedef typename Parent::Key Key; |
| 49 | 49 |
typedef typename Parent::Value Value; |
| 50 |
typedef typename Parent::Reference Reference; |
|
| 51 |
typedef typename Parent::ConstReference ConstReference; |
|
| 50 | 52 |
|
| 51 | 53 |
class MapIt; |
| 52 | 54 |
class ConstMapIt; |
| 53 | 55 |
|
| 54 | 56 |
friend class MapIt; |
| 55 | 57 |
friend class ConstMapIt; |
| 56 | 58 |
|
| 57 | 59 |
public: |
| 58 | 60 |
|
| 59 | 61 |
MapExtender(const Graph& graph) |
| 60 | 62 |
: Parent(graph) {}
|
| 61 | 63 |
|
| 62 | 64 |
MapExtender(const Graph& graph, const Value& value) |
| 63 | 65 |
: Parent(graph, value) {}
|
| 64 | 66 |
|
| 65 | 67 |
private: |
| 66 | 68 |
MapExtender& operator=(const MapExtender& cmap) {
|
| 67 | 69 |
return operator=<MapExtender>(cmap); |
| 68 | 70 |
} |
| 69 | 71 |
|
| 70 | 72 |
template <typename CMap> |
| 71 | 73 |
MapExtender& operator=(const CMap& cmap) {
|
| 72 | 74 |
Parent::operator=(cmap); |
| 73 | 75 |
return *this; |
| 74 | 76 |
} |
| 75 | 77 |
|
| 76 | 78 |
public: |
| 77 | 79 |
class MapIt : public Item {
|
| 78 | 80 |
public: |
| 79 | 81 |
|
| 80 | 82 |
typedef Item Parent; |
| 81 | 83 |
typedef typename Map::Value Value; |
| 82 | 84 |
|
| 83 | 85 |
MapIt() {}
|
| 84 | 86 |
|
| 85 | 87 |
MapIt(Invalid i) : Parent(i) { }
|
| 86 | 88 |
|
| 87 | 89 |
explicit MapIt(Map& _map) : map(_map) {
|
| 88 | 90 |
map.notifier()->first(*this); |
| 89 | 91 |
} |
| 90 | 92 |
|
| 91 | 93 |
MapIt(const Map& _map, const Item& item) |
| 92 | 94 |
: Parent(item), map(_map) {}
|
| 93 | 95 |
|
| 94 | 96 |
MapIt& operator++() {
|
| 95 | 97 |
map.notifier()->next(*this); |
| 96 | 98 |
return *this; |
| 97 | 99 |
} |
| 98 | 100 |
|
| 99 | 101 |
typename MapTraits<Map>::ConstReturnValue operator*() const {
|
| 100 | 102 |
return map[*this]; |
| 101 | 103 |
} |
| 102 | 104 |
|
| 103 | 105 |
typename MapTraits<Map>::ReturnValue operator*() {
|
| 104 | 106 |
return map[*this]; |
| 105 | 107 |
} |
| 106 | 108 |
|
| 107 | 109 |
void set(const Value& value) {
|
| 108 | 110 |
map.set(*this, value); |
| 109 | 111 |
} |
| 110 | 112 |
|
| 111 | 113 |
protected: |
| 112 | 114 |
Map& map; |
| 113 | 115 |
|
| 114 | 116 |
}; |
| 115 | 117 |
|
| 116 | 118 |
class ConstMapIt : public Item {
|
| 117 | 119 |
public: |
| 118 | 120 |
|
| 119 | 121 |
typedef Item Parent; |
| 120 | 122 |
|
| 121 | 123 |
typedef typename Map::Value Value; |
| 122 | 124 |
|
| 123 | 125 |
ConstMapIt() {}
|
| 124 | 126 |
|
| 125 | 127 |
ConstMapIt(Invalid i) : Parent(i) { }
|
| 126 | 128 |
|
| 127 | 129 |
explicit ConstMapIt(Map& _map) : map(_map) {
|
| 128 | 130 |
map.notifier()->first(*this); |
| 129 | 131 |
} |
| 130 | 132 |
|
| 131 | 133 |
ConstMapIt(const Map& _map, const Item& item) |
| 132 | 134 |
: Parent(item), map(_map) {}
|
| 133 | 135 |
|
| 134 | 136 |
ConstMapIt& operator++() {
|
| 135 | 137 |
map.notifier()->next(*this); |
| 136 | 138 |
return *this; |
| 137 | 139 |
} |
| 138 | 140 |
|
| 139 | 141 |
typename MapTraits<Map>::ConstReturnValue operator*() const {
|
| 140 | 142 |
return map[*this]; |
| 141 | 143 |
} |
| 142 | 144 |
|
| 143 | 145 |
protected: |
| 144 | 146 |
const Map& map; |
| 145 | 147 |
}; |
| 146 | 148 |
|
| 147 | 149 |
class ItemIt : public Item {
|
| 148 | 150 |
public: |
| 149 | 151 |
|
| 150 | 152 |
typedef Item Parent; |
| 151 | 153 |
|
| 152 | 154 |
ItemIt() {}
|
| 153 | 155 |
|
| 154 | 156 |
ItemIt(Invalid i) : Parent(i) { }
|
| 155 | 157 |
|
| 156 | 158 |
explicit ItemIt(Map& _map) : map(_map) {
|
| 157 | 159 |
map.notifier()->first(*this); |
| 158 | 160 |
} |
| 159 | 161 |
|
| 160 | 162 |
ItemIt(const Map& _map, const Item& item) |
| 161 | 163 |
: Parent(item), map(_map) {}
|
| 162 | 164 |
|
| 163 | 165 |
ItemIt& operator++() {
|
| 164 | 166 |
map.notifier()->next(*this); |
| 165 | 167 |
return *this; |
| 166 | 168 |
} |
| 167 | 169 |
|
| 168 | 170 |
protected: |
| 169 | 171 |
const Map& map; |
| 170 | 172 |
|
| 171 | 173 |
}; |
| 172 | 174 |
}; |
| 173 | 175 |
|
| 174 | 176 |
// \ingroup graphbits |
| 175 | 177 |
// |
| 176 | 178 |
// \brief Extender for maps which use a subset of the items. |
| 177 | 179 |
template <typename _Graph, typename _Map> |
| 178 | 180 |
class SubMapExtender : public _Map {
|
| 179 | 181 |
public: |
| 180 | 182 |
|
| 181 | 183 |
typedef _Map Parent; |
| 182 | 184 |
typedef SubMapExtender Map; |
| 183 | 185 |
|
| 184 | 186 |
typedef _Graph Graph; |
| 185 | 187 |
|
| 186 | 188 |
typedef typename Parent::Key Item; |
| 187 | 189 |
|
| 188 | 190 |
typedef typename Parent::Key Key; |
| 189 | 191 |
typedef typename Parent::Value Value; |
| 192 |
typedef typename Parent::Reference Reference; |
|
| 193 |
typedef typename Parent::ConstReference ConstReference; |
|
| 190 | 194 |
|
| 191 | 195 |
class MapIt; |
| 192 | 196 |
class ConstMapIt; |
| 193 | 197 |
|
| 194 | 198 |
friend class MapIt; |
| 195 | 199 |
friend class ConstMapIt; |
| 196 | 200 |
|
| 197 | 201 |
public: |
| 198 | 202 |
|
| 199 | 203 |
SubMapExtender(const Graph& _graph) |
| 200 | 204 |
: Parent(_graph), graph(_graph) {}
|
| 201 | 205 |
|
| 202 | 206 |
SubMapExtender(const Graph& _graph, const Value& _value) |
| 203 | 207 |
: Parent(_graph, _value), graph(_graph) {}
|
| 204 | 208 |
|
| 205 | 209 |
private: |
| 206 | 210 |
SubMapExtender& operator=(const SubMapExtender& cmap) {
|
| 207 | 211 |
return operator=<MapExtender>(cmap); |
| 208 | 212 |
} |
| 209 | 213 |
|
| 210 | 214 |
template <typename CMap> |
| 211 | 215 |
SubMapExtender& operator=(const CMap& cmap) {
|
| 212 | 216 |
checkConcept<concepts::ReadMap<Key, Value>, CMap>(); |
| 213 | 217 |
Item it; |
| 214 | 218 |
for (graph.first(it); it != INVALID; graph.next(it)) {
|
| 215 | 219 |
Parent::set(it, cmap[it]); |
| 216 | 220 |
} |
| 217 | 221 |
return *this; |
| 218 | 222 |
} |
| 219 | 223 |
|
| 220 | 224 |
public: |
| 221 | 225 |
class MapIt : public Item {
|
| 222 | 226 |
public: |
| 223 | 227 |
|
| 224 | 228 |
typedef Item Parent; |
| 225 | 229 |
typedef typename Map::Value Value; |
| 226 | 230 |
|
| 227 | 231 |
MapIt() {}
|
| 228 | 232 |
|
| 229 | 233 |
MapIt(Invalid i) : Parent(i) { }
|
| 230 | 234 |
|
| 231 | 235 |
explicit MapIt(Map& _map) : map(_map) {
|
| 232 | 236 |
map.graph.first(*this); |
| 233 | 237 |
} |
| 234 | 238 |
|
| 235 | 239 |
MapIt(const Map& _map, const Item& item) |
| 236 | 240 |
: Parent(item), map(_map) {}
|
| 237 | 241 |
|
| 238 | 242 |
MapIt& operator++() {
|
| 239 | 243 |
map.graph.next(*this); |
| 240 | 244 |
return *this; |
| 241 | 245 |
} |
| 242 | 246 |
|
| 243 | 247 |
typename MapTraits<Map>::ConstReturnValue operator*() const {
|
| 244 | 248 |
return map[*this]; |
| 245 | 249 |
} |
| 246 | 250 |
|
| 247 | 251 |
typename MapTraits<Map>::ReturnValue operator*() {
|
| 248 | 252 |
return map[*this]; |
| 249 | 253 |
} |
| 250 | 254 |
|
| 251 | 255 |
void set(const Value& value) {
|
| 252 | 256 |
map.set(*this, value); |
| 253 | 257 |
} |
| 254 | 258 |
|
| 255 | 259 |
protected: |
| 256 | 260 |
Map& map; |
| 257 | 261 |
|
| 258 | 262 |
}; |
| 259 | 263 |
|
| 260 | 264 |
class ConstMapIt : public Item {
|
| 261 | 265 |
public: |
| 262 | 266 |
|
| 263 | 267 |
typedef Item Parent; |
| 264 | 268 |
|
| 265 | 269 |
typedef typename Map::Value Value; |
| 266 | 270 |
|
| 267 | 271 |
ConstMapIt() {}
|
| 268 | 272 |
|
| 269 | 273 |
ConstMapIt(Invalid i) : Parent(i) { }
|
| 270 | 274 |
|
| 271 | 275 |
explicit ConstMapIt(Map& _map) : map(_map) {
|
| 272 | 276 |
map.graph.first(*this); |
| 273 | 277 |
} |
| 274 | 278 |
|
| 275 | 279 |
ConstMapIt(const Map& _map, const Item& item) |
| 276 | 280 |
: Parent(item), map(_map) {}
|
| 277 | 281 |
|
| 278 | 282 |
ConstMapIt& operator++() {
|
| 279 | 283 |
map.graph.next(*this); |
| 280 | 284 |
return *this; |
| 281 | 285 |
} |
| 282 | 286 |
|
| 283 | 287 |
typename MapTraits<Map>::ConstReturnValue operator*() const {
|
| 284 | 288 |
return map[*this]; |
| 285 | 289 |
} |
| 286 | 290 |
|
| 287 | 291 |
protected: |
| 288 | 292 |
const Map& map; |
| 289 | 293 |
}; |
| 290 | 294 |
|
| 291 | 295 |
class ItemIt : public Item {
|
| 292 | 296 |
public: |
| 293 | 297 |
|
| 294 | 298 |
typedef Item Parent; |
| 295 | 299 |
|
| 296 | 300 |
ItemIt() {}
|
| 297 | 301 |
|
| 298 | 302 |
ItemIt(Invalid i) : Parent(i) { }
|
| 299 | 303 |
|
| 300 | 304 |
explicit ItemIt(Map& _map) : map(_map) {
|
| 301 | 305 |
map.graph.first(*this); |
| 302 | 306 |
} |
| 303 | 307 |
|
| 304 | 308 |
ItemIt(const Map& _map, const Item& item) |
| 305 | 309 |
: Parent(item), map(_map) {}
|
| 306 | 310 |
|
| 307 | 311 |
ItemIt& operator++() {
|
| 308 | 312 |
map.graph.next(*this); |
| 309 | 313 |
return *this; |
| 310 | 314 |
} |
| 311 | 315 |
|
| 312 | 316 |
protected: |
| 313 | 317 |
const Map& map; |
| 314 | 318 |
|
| 315 | 319 |
}; |
| 316 | 320 |
|
| 317 | 321 |
private: |
| 318 | 322 |
|
| 319 | 323 |
const Graph& graph; |
| 320 | 324 |
|
| 321 | 325 |
}; |
| 322 | 326 |
|
| 323 | 327 |
} |
| 324 | 328 |
|
| 325 | 329 |
#endif |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
///\file |
| 20 | 20 |
///\brief Implementation of the CBC MIP solver interface. |
| 21 | 21 |
|
| 22 | 22 |
#include "cbc.h" |
| 23 | 23 |
|
| 24 | 24 |
#include <coin/CoinModel.hpp> |
| 25 | 25 |
#include <coin/CbcModel.hpp> |
| 26 | 26 |
#include <coin/OsiSolverInterface.hpp> |
| 27 | 27 |
|
| 28 | 28 |
#ifdef COIN_HAS_CLP |
| 29 | 29 |
#include "coin/OsiClpSolverInterface.hpp" |
| 30 | 30 |
#endif |
| 31 | 31 |
#ifdef COIN_HAS_OSL |
| 32 | 32 |
#include "coin/OsiOslSolverInterface.hpp" |
| 33 | 33 |
#endif |
| 34 | 34 |
|
| 35 | 35 |
#include "coin/CbcCutGenerator.hpp" |
| 36 | 36 |
#include "coin/CbcHeuristicLocal.hpp" |
| 37 | 37 |
#include "coin/CbcHeuristicGreedy.hpp" |
| 38 | 38 |
#include "coin/CbcHeuristicFPump.hpp" |
| 39 | 39 |
#include "coin/CbcHeuristicRINS.hpp" |
| 40 | 40 |
|
| 41 | 41 |
#include "coin/CglGomory.hpp" |
| 42 | 42 |
#include "coin/CglProbing.hpp" |
| 43 | 43 |
#include "coin/CglKnapsackCover.hpp" |
| 44 | 44 |
#include "coin/CglOddHole.hpp" |
| 45 | 45 |
#include "coin/CglClique.hpp" |
| 46 | 46 |
#include "coin/CglFlowCover.hpp" |
| 47 | 47 |
#include "coin/CglMixedIntegerRounding.hpp" |
| 48 | 48 |
|
| 49 | 49 |
#include "coin/CbcHeuristic.hpp" |
| 50 | 50 |
|
| 51 | 51 |
namespace lemon {
|
| 52 | 52 |
|
| 53 | 53 |
CbcMip::CbcMip() {
|
| 54 | 54 |
_prob = new CoinModel(); |
| 55 | 55 |
_prob->setProblemName("LEMON");
|
| 56 | 56 |
_osi_solver = 0; |
| 57 | 57 |
_cbc_model = 0; |
| 58 |
messageLevel(MESSAGE_NOTHING); |
|
| 58 | 59 |
} |
| 59 | 60 |
|
| 60 | 61 |
CbcMip::CbcMip(const CbcMip& other) {
|
| 61 | 62 |
_prob = new CoinModel(*other._prob); |
| 63 |
_prob->setProblemName("LEMON");
|
|
| 62 | 64 |
_osi_solver = 0; |
| 63 | 65 |
_cbc_model = 0; |
| 66 |
messageLevel(MESSAGE_NOTHING); |
|
| 64 | 67 |
} |
| 65 | 68 |
|
| 66 | 69 |
CbcMip::~CbcMip() {
|
| 67 | 70 |
delete _prob; |
| 68 | 71 |
if (_osi_solver) delete _osi_solver; |
| 69 | 72 |
if (_cbc_model) delete _cbc_model; |
| 70 | 73 |
} |
| 71 | 74 |
|
| 72 | 75 |
const char* CbcMip::_solverName() const { return "CbcMip"; }
|
| 73 | 76 |
|
| 74 | 77 |
int CbcMip::_addCol() {
|
| 75 | 78 |
_prob->addColumn(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX, 0.0, 0, false); |
| 76 | 79 |
return _prob->numberColumns() - 1; |
| 77 | 80 |
} |
| 78 | 81 |
|
| 79 | 82 |
CbcMip* CbcMip::newSolver() const {
|
| 80 | 83 |
CbcMip* newlp = new CbcMip; |
| 81 | 84 |
return newlp; |
| 82 | 85 |
} |
| 83 | 86 |
|
| 84 | 87 |
CbcMip* CbcMip::cloneSolver() const {
|
| 85 | 88 |
CbcMip* copylp = new CbcMip(*this); |
| 86 | 89 |
return copylp; |
| 87 | 90 |
} |
| 88 | 91 |
|
| 89 | 92 |
int CbcMip::_addRow() {
|
| 90 | 93 |
_prob->addRow(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX); |
| 91 | 94 |
return _prob->numberRows() - 1; |
| 92 | 95 |
} |
| 93 | 96 |
|
| 94 | 97 |
|
| 95 | 98 |
void CbcMip::_eraseCol(int i) {
|
| 96 | 99 |
_prob->deleteColumn(i); |
| 97 | 100 |
} |
| 98 | 101 |
|
| 99 | 102 |
void CbcMip::_eraseRow(int i) {
|
| 100 | 103 |
_prob->deleteRow(i); |
| 101 | 104 |
} |
| 102 | 105 |
|
| 103 | 106 |
void CbcMip::_eraseColId(int i) {
|
| 104 | 107 |
cols.eraseIndex(i); |
| 105 | 108 |
} |
| 106 | 109 |
|
| 107 | 110 |
void CbcMip::_eraseRowId(int i) {
|
| 108 | 111 |
rows.eraseIndex(i); |
| 109 | 112 |
} |
| 110 | 113 |
|
| 111 | 114 |
void CbcMip::_getColName(int c, std::string& name) const {
|
| 112 | 115 |
name = _prob->getColumnName(c); |
| 113 | 116 |
} |
| 114 | 117 |
|
| 115 | 118 |
void CbcMip::_setColName(int c, const std::string& name) {
|
| 116 | 119 |
_prob->setColumnName(c, name.c_str()); |
| 117 | 120 |
} |
| 118 | 121 |
|
| 119 | 122 |
int CbcMip::_colByName(const std::string& name) const {
|
| 120 | 123 |
return _prob->column(name.c_str()); |
| 121 | 124 |
} |
| 122 | 125 |
|
| 123 | 126 |
void CbcMip::_getRowName(int r, std::string& name) const {
|
| 124 | 127 |
name = _prob->getRowName(r); |
| 125 | 128 |
} |
| 126 | 129 |
|
| 127 | 130 |
void CbcMip::_setRowName(int r, const std::string& name) {
|
| 128 | 131 |
_prob->setRowName(r, name.c_str()); |
| 129 | 132 |
} |
| 130 | 133 |
|
| 131 | 134 |
int CbcMip::_rowByName(const std::string& name) const {
|
| 132 | 135 |
return _prob->row(name.c_str()); |
| 133 | 136 |
} |
| 134 | 137 |
|
| 135 | 138 |
void CbcMip::_setRowCoeffs(int i, ExprIterator b, ExprIterator e) {
|
| 136 | 139 |
for (ExprIterator it = b; it != e; ++it) {
|
| 137 | 140 |
_prob->setElement(i, it->first, it->second); |
| 138 | 141 |
} |
| 139 | 142 |
} |
| 140 | 143 |
|
| 141 | 144 |
void CbcMip::_getRowCoeffs(int ix, InsertIterator b) const {
|
| 142 | 145 |
int length = _prob->numberRows(); |
| 143 | 146 |
|
| 144 | 147 |
std::vector<int> indices(length); |
| 145 | 148 |
std::vector<Value> values(length); |
| 146 | 149 |
|
| 147 | 150 |
length = _prob->getRow(ix, &indices[0], &values[0]); |
| 148 | 151 |
|
| 149 | 152 |
for (int i = 0; i < length; ++i) {
|
| 150 | 153 |
*b = std::make_pair(indices[i], values[i]); |
| 151 | 154 |
++b; |
| 152 | 155 |
} |
| 153 | 156 |
} |
| 154 | 157 |
|
| 155 | 158 |
void CbcMip::_setColCoeffs(int ix, ExprIterator b, ExprIterator e) {
|
| 156 | 159 |
for (ExprIterator it = b; it != e; ++it) {
|
| 157 | 160 |
_prob->setElement(it->first, ix, it->second); |
| 158 | 161 |
} |
| 159 | 162 |
} |
| 160 | 163 |
|
| 161 | 164 |
void CbcMip::_getColCoeffs(int ix, InsertIterator b) const {
|
| 162 | 165 |
int length = _prob->numberColumns(); |
| 163 | 166 |
|
| 164 | 167 |
std::vector<int> indices(length); |
| 165 | 168 |
std::vector<Value> values(length); |
| 166 | 169 |
|
| 167 | 170 |
length = _prob->getColumn(ix, &indices[0], &values[0]); |
| 168 | 171 |
|
| 169 | 172 |
for (int i = 0; i < length; ++i) {
|
| 170 | 173 |
*b = std::make_pair(indices[i], values[i]); |
| 171 | 174 |
++b; |
| 172 | 175 |
} |
| 173 | 176 |
} |
| 174 | 177 |
|
| 175 | 178 |
void CbcMip::_setCoeff(int ix, int jx, Value value) {
|
| 176 | 179 |
_prob->setElement(ix, jx, value); |
| 177 | 180 |
} |
| 178 | 181 |
|
| 179 | 182 |
CbcMip::Value CbcMip::_getCoeff(int ix, int jx) const {
|
| 180 | 183 |
return _prob->getElement(ix, jx); |
| 181 | 184 |
} |
| 182 | 185 |
|
| 183 | 186 |
|
| 184 | 187 |
void CbcMip::_setColLowerBound(int i, Value lo) {
|
| 185 | 188 |
LEMON_ASSERT(lo != INF, "Invalid bound"); |
| 186 | 189 |
_prob->setColumnLower(i, lo == - INF ? - COIN_DBL_MAX : lo); |
| 187 | 190 |
} |
| 188 | 191 |
|
| 189 | 192 |
CbcMip::Value CbcMip::_getColLowerBound(int i) const {
|
| 190 | 193 |
double val = _prob->getColumnLower(i); |
| 191 | 194 |
return val == - COIN_DBL_MAX ? - INF : val; |
| 192 | 195 |
} |
| 193 | 196 |
|
| 194 | 197 |
void CbcMip::_setColUpperBound(int i, Value up) {
|
| 195 | 198 |
LEMON_ASSERT(up != -INF, "Invalid bound"); |
| 196 | 199 |
_prob->setColumnUpper(i, up == INF ? COIN_DBL_MAX : up); |
| 197 | 200 |
} |
| 198 | 201 |
|
| 199 | 202 |
CbcMip::Value CbcMip::_getColUpperBound(int i) const {
|
| 200 | 203 |
double val = _prob->getColumnUpper(i); |
| 201 | 204 |
return val == COIN_DBL_MAX ? INF : val; |
| 202 | 205 |
} |
| 203 | 206 |
|
| 204 | 207 |
void CbcMip::_setRowLowerBound(int i, Value lo) {
|
| 205 | 208 |
LEMON_ASSERT(lo != INF, "Invalid bound"); |
| 206 | 209 |
_prob->setRowLower(i, lo == - INF ? - COIN_DBL_MAX : lo); |
| 207 | 210 |
} |
| 208 | 211 |
|
| 209 | 212 |
CbcMip::Value CbcMip::_getRowLowerBound(int i) const {
|
| 210 | 213 |
double val = _prob->getRowLower(i); |
| 211 | 214 |
return val == - COIN_DBL_MAX ? - INF : val; |
| 212 | 215 |
} |
| 213 | 216 |
|
| 214 | 217 |
void CbcMip::_setRowUpperBound(int i, Value up) {
|
| 215 | 218 |
LEMON_ASSERT(up != -INF, "Invalid bound"); |
| 216 | 219 |
_prob->setRowUpper(i, up == INF ? COIN_DBL_MAX : up); |
| 217 | 220 |
} |
| 218 | 221 |
|
| 219 | 222 |
CbcMip::Value CbcMip::_getRowUpperBound(int i) const {
|
| 220 | 223 |
double val = _prob->getRowUpper(i); |
| 221 | 224 |
return val == COIN_DBL_MAX ? INF : val; |
| 222 | 225 |
} |
| 223 | 226 |
|
| 224 | 227 |
void CbcMip::_setObjCoeffs(ExprIterator b, ExprIterator e) {
|
| 225 | 228 |
int num = _prob->numberColumns(); |
| 226 | 229 |
for (int i = 0; i < num; ++i) {
|
| 227 | 230 |
_prob->setColumnObjective(i, 0.0); |
| 228 | 231 |
} |
| 229 | 232 |
for (ExprIterator it = b; it != e; ++it) {
|
| 230 | 233 |
_prob->setColumnObjective(it->first, it->second); |
| 231 | 234 |
} |
| 232 | 235 |
} |
| 233 | 236 |
|
| 234 | 237 |
void CbcMip::_getObjCoeffs(InsertIterator b) const {
|
| 235 | 238 |
int num = _prob->numberColumns(); |
| 236 | 239 |
for (int i = 0; i < num; ++i) {
|
| 237 | 240 |
Value coef = _prob->getColumnObjective(i); |
| 238 | 241 |
if (coef != 0.0) {
|
| 239 | 242 |
*b = std::make_pair(i, coef); |
| 240 | 243 |
++b; |
| 241 | 244 |
} |
| 242 | 245 |
} |
| 243 | 246 |
} |
| 244 | 247 |
|
| 245 | 248 |
void CbcMip::_setObjCoeff(int i, Value obj_coef) {
|
| 246 | 249 |
_prob->setColumnObjective(i, obj_coef); |
| 247 | 250 |
} |
| 248 | 251 |
|
| 249 | 252 |
CbcMip::Value CbcMip::_getObjCoeff(int i) const {
|
| 250 | 253 |
return _prob->getColumnObjective(i); |
| 251 | 254 |
} |
| 252 | 255 |
|
| 253 | 256 |
CbcMip::SolveExitStatus CbcMip::_solve() {
|
| 254 | 257 |
|
| 255 | 258 |
if (_osi_solver) {
|
| 256 | 259 |
delete _osi_solver; |
| 257 | 260 |
} |
| 258 | 261 |
#ifdef COIN_HAS_CLP |
| 259 | 262 |
_osi_solver = new OsiClpSolverInterface(); |
| 260 | 263 |
#elif COIN_HAS_OSL |
| 261 | 264 |
_osi_solver = new OsiOslSolverInterface(); |
| 262 | 265 |
#else |
| 263 | 266 |
#error Cannot instantiate Osi solver |
| 264 | 267 |
#endif |
| 265 | 268 |
|
| 266 | 269 |
_osi_solver->loadFromCoinModel(*_prob); |
| 267 | 270 |
|
| 268 | 271 |
if (_cbc_model) {
|
| 269 | 272 |
delete _cbc_model; |
| 270 | 273 |
} |
| 271 | 274 |
_cbc_model= new CbcModel(*_osi_solver); |
| 272 | 275 |
|
| 273 |
switch (_message_level) {
|
|
| 274 |
case MESSAGE_NO_OUTPUT: |
|
| 275 |
_osi_solver->messageHandler()->setLogLevel(0); |
|
| 276 |
_cbc_model->setLogLevel(0); |
|
| 277 |
break; |
|
| 278 |
case MESSAGE_ERROR_MESSAGE: |
|
| 279 |
_osi_solver->messageHandler()->setLogLevel(1); |
|
| 280 |
_cbc_model->setLogLevel(1); |
|
| 281 |
break; |
|
| 282 |
case MESSAGE_NORMAL_OUTPUT: |
|
| 283 |
_osi_solver->messageHandler()->setLogLevel(2); |
|
| 284 |
_cbc_model->setLogLevel(2); |
|
| 285 |
break; |
|
| 286 |
case MESSAGE_FULL_OUTPUT: |
|
| 287 |
_osi_solver->messageHandler()->setLogLevel(3); |
|
| 288 |
_cbc_model->setLogLevel(3); |
|
| 289 |
break; |
|
| 290 |
} |
|
| 276 |
_osi_solver->messageHandler()->setLogLevel(_message_level); |
|
| 277 |
_cbc_model->setLogLevel(_message_level); |
|
| 291 | 278 |
|
| 292 | 279 |
_cbc_model->initialSolve(); |
| 293 | 280 |
_cbc_model->solver()->setHintParam(OsiDoReducePrint, true, OsiHintTry); |
| 294 | 281 |
|
| 295 | 282 |
if (!_cbc_model->isInitialSolveAbandoned() && |
| 296 | 283 |
_cbc_model->isInitialSolveProvenOptimal() && |
| 297 | 284 |
!_cbc_model->isInitialSolveProvenPrimalInfeasible() && |
| 298 | 285 |
!_cbc_model->isInitialSolveProvenDualInfeasible()) {
|
| 299 | 286 |
|
| 300 | 287 |
CglProbing generator1; |
| 301 | 288 |
generator1.setUsingObjective(true); |
| 302 | 289 |
generator1.setMaxPass(3); |
| 303 | 290 |
generator1.setMaxProbe(100); |
| 304 | 291 |
generator1.setMaxLook(50); |
| 305 | 292 |
generator1.setRowCuts(3); |
| 306 | 293 |
_cbc_model->addCutGenerator(&generator1, -1, "Probing"); |
| 307 | 294 |
|
| 308 | 295 |
CglGomory generator2; |
| 309 | 296 |
generator2.setLimit(300); |
| 310 | 297 |
_cbc_model->addCutGenerator(&generator2, -1, "Gomory"); |
| 311 | 298 |
|
| 312 | 299 |
CglKnapsackCover generator3; |
| 313 | 300 |
_cbc_model->addCutGenerator(&generator3, -1, "Knapsack"); |
| 314 | 301 |
|
| 315 | 302 |
CglOddHole generator4; |
| 316 | 303 |
generator4.setMinimumViolation(0.005); |
| 317 | 304 |
generator4.setMinimumViolationPer(0.00002); |
| 318 | 305 |
generator4.setMaximumEntries(200); |
| 319 | 306 |
_cbc_model->addCutGenerator(&generator4, -1, "OddHole"); |
| 320 | 307 |
|
| 321 | 308 |
CglClique generator5; |
| 322 | 309 |
generator5.setStarCliqueReport(false); |
| 323 | 310 |
generator5.setRowCliqueReport(false); |
| 324 | 311 |
_cbc_model->addCutGenerator(&generator5, -1, "Clique"); |
| 325 | 312 |
|
| 326 | 313 |
CglMixedIntegerRounding mixedGen; |
| 327 | 314 |
_cbc_model->addCutGenerator(&mixedGen, -1, "MixedIntegerRounding"); |
| 328 | 315 |
|
| 329 | 316 |
CglFlowCover flowGen; |
| 330 | 317 |
_cbc_model->addCutGenerator(&flowGen, -1, "FlowCover"); |
| 331 | 318 |
|
| 332 | 319 |
#ifdef COIN_HAS_CLP |
| 333 | 320 |
OsiClpSolverInterface* osiclp = |
| 334 | 321 |
dynamic_cast<OsiClpSolverInterface*>(_cbc_model->solver()); |
| 335 | 322 |
if (osiclp->getNumRows() < 300 && osiclp->getNumCols() < 500) {
|
| 336 | 323 |
osiclp->setupForRepeatedUse(2, 0); |
| 337 | 324 |
} |
| 338 | 325 |
#endif |
| 339 | 326 |
|
| 340 | 327 |
CbcRounding heuristic1(*_cbc_model); |
| 341 | 328 |
heuristic1.setWhen(3); |
| 342 | 329 |
_cbc_model->addHeuristic(&heuristic1); |
| 343 | 330 |
|
| 344 | 331 |
CbcHeuristicLocal heuristic2(*_cbc_model); |
| 345 | 332 |
heuristic2.setWhen(3); |
| 346 | 333 |
_cbc_model->addHeuristic(&heuristic2); |
| 347 | 334 |
|
| 348 | 335 |
CbcHeuristicGreedyCover heuristic3(*_cbc_model); |
| 349 | 336 |
heuristic3.setAlgorithm(11); |
| 350 | 337 |
heuristic3.setWhen(3); |
| 351 | 338 |
_cbc_model->addHeuristic(&heuristic3); |
| 352 | 339 |
|
| 353 | 340 |
CbcHeuristicFPump heuristic4(*_cbc_model); |
| 354 | 341 |
heuristic4.setWhen(3); |
| 355 | 342 |
_cbc_model->addHeuristic(&heuristic4); |
| 356 | 343 |
|
| 357 | 344 |
CbcHeuristicRINS heuristic5(*_cbc_model); |
| 358 | 345 |
heuristic5.setWhen(3); |
| 359 | 346 |
_cbc_model->addHeuristic(&heuristic5); |
| 360 | 347 |
|
| 361 | 348 |
if (_cbc_model->getNumCols() < 500) {
|
| 362 | 349 |
_cbc_model->setMaximumCutPassesAtRoot(-100); |
| 363 | 350 |
} else if (_cbc_model->getNumCols() < 5000) {
|
| 364 | 351 |
_cbc_model->setMaximumCutPassesAtRoot(100); |
| 365 | 352 |
} else {
|
| 366 | 353 |
_cbc_model->setMaximumCutPassesAtRoot(20); |
| 367 | 354 |
} |
| 368 | 355 |
|
| 369 | 356 |
if (_cbc_model->getNumCols() < 5000) {
|
| 370 | 357 |
_cbc_model->setNumberStrong(10); |
| 371 | 358 |
} |
| 372 | 359 |
|
| 373 | 360 |
_cbc_model->solver()->setIntParam(OsiMaxNumIterationHotStart, 100); |
| 374 | 361 |
_cbc_model->branchAndBound(); |
| 375 | 362 |
} |
| 376 | 363 |
|
| 377 | 364 |
if (_cbc_model->isAbandoned()) {
|
| 378 | 365 |
return UNSOLVED; |
| 379 | 366 |
} else {
|
| 380 | 367 |
return SOLVED; |
| 381 | 368 |
} |
| 382 | 369 |
} |
| 383 | 370 |
|
| 384 | 371 |
CbcMip::Value CbcMip::_getSol(int i) const {
|
| 385 | 372 |
return _cbc_model->getColSolution()[i]; |
| 386 | 373 |
} |
| 387 | 374 |
|
| 388 | 375 |
CbcMip::Value CbcMip::_getSolValue() const {
|
| 389 | 376 |
return _cbc_model->getObjValue(); |
| 390 | 377 |
} |
| 391 | 378 |
|
| 392 | 379 |
CbcMip::ProblemType CbcMip::_getType() const {
|
| 393 | 380 |
if (_cbc_model->isProvenOptimal()) {
|
| 394 | 381 |
return OPTIMAL; |
| 395 | 382 |
} else if (_cbc_model->isContinuousUnbounded()) {
|
| 396 | 383 |
return UNBOUNDED; |
| 397 | 384 |
} |
| 398 | 385 |
return FEASIBLE; |
| 399 | 386 |
} |
| 400 | 387 |
|
| 401 | 388 |
void CbcMip::_setSense(Sense sense) {
|
| 402 | 389 |
switch (sense) {
|
| 403 | 390 |
case MIN: |
| 404 | 391 |
_prob->setOptimizationDirection(1.0); |
| 405 | 392 |
break; |
| 406 | 393 |
case MAX: |
| 407 | 394 |
_prob->setOptimizationDirection(- 1.0); |
| 408 | 395 |
break; |
| 409 | 396 |
} |
| 410 | 397 |
} |
| 411 | 398 |
|
| 412 | 399 |
CbcMip::Sense CbcMip::_getSense() const {
|
| 413 | 400 |
if (_prob->optimizationDirection() > 0.0) {
|
| 414 | 401 |
return MIN; |
| 415 | 402 |
} else if (_prob->optimizationDirection() < 0.0) {
|
| 416 | 403 |
return MAX; |
| 417 | 404 |
} else {
|
| 418 | 405 |
LEMON_ASSERT(false, "Wrong sense"); |
| 419 | 406 |
return CbcMip::Sense(); |
| 420 | 407 |
} |
| 421 | 408 |
} |
| 422 | 409 |
|
| 423 | 410 |
void CbcMip::_setColType(int i, CbcMip::ColTypes col_type) {
|
| 424 | 411 |
switch (col_type){
|
| 425 | 412 |
case INTEGER: |
| 426 | 413 |
_prob->setInteger(i); |
| 427 | 414 |
break; |
| 428 | 415 |
case REAL: |
| 429 | 416 |
_prob->setContinuous(i); |
| 430 | 417 |
break; |
| 431 | 418 |
default:; |
| 432 | 419 |
LEMON_ASSERT(false, "Wrong sense"); |
| 433 | 420 |
} |
| 434 | 421 |
} |
| 435 | 422 |
|
| 436 | 423 |
CbcMip::ColTypes CbcMip::_getColType(int i) const {
|
| 437 | 424 |
return _prob->getColumnIsInteger(i) ? INTEGER : REAL; |
| 438 | 425 |
} |
| 439 | 426 |
|
| 440 | 427 |
void CbcMip::_clear() {
|
| 441 | 428 |
delete _prob; |
| 442 | 429 |
if (_osi_solver) {
|
| 443 | 430 |
delete _osi_solver; |
| 444 | 431 |
_osi_solver = 0; |
| 445 | 432 |
} |
| 446 | 433 |
if (_cbc_model) {
|
| 447 | 434 |
delete _cbc_model; |
| 448 | 435 |
_cbc_model = 0; |
| 449 | 436 |
} |
| 450 | 437 |
|
| 451 | 438 |
_prob = new CoinModel(); |
| 452 | 439 |
rows.clear(); |
| 453 | 440 |
cols.clear(); |
| 454 | 441 |
} |
| 455 | 442 |
|
| 456 |
void CbcMip::messageLevel(MessageLevel m) {
|
|
| 457 |
_message_level = m; |
|
| 443 |
void CbcMip::_messageLevel(MessageLevel level) {
|
|
| 444 |
switch (level) {
|
|
| 445 |
case MESSAGE_NOTHING: |
|
| 446 |
_message_level = 0; |
|
| 447 |
break; |
|
| 448 |
case MESSAGE_ERROR: |
|
| 449 |
_message_level = 1; |
|
| 450 |
break; |
|
| 451 |
case MESSAGE_WARNING: |
|
| 452 |
_message_level = 1; |
|
| 453 |
break; |
|
| 454 |
case MESSAGE_NORMAL: |
|
| 455 |
_message_level = 2; |
|
| 456 |
break; |
|
| 457 |
case MESSAGE_VERBOSE: |
|
| 458 |
_message_level = 3; |
|
| 459 |
break; |
|
| 460 |
} |
|
| 458 | 461 |
} |
| 459 | 462 |
|
| 460 | 463 |
} //END OF NAMESPACE LEMON |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2009 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
// -*- C++ -*- |
| 20 | 20 |
#ifndef LEMON_CBC_H |
| 21 | 21 |
#define LEMON_CBC_H |
| 22 | 22 |
|
| 23 | 23 |
///\file |
| 24 | 24 |
///\brief Header of the LEMON-CBC mip solver interface. |
| 25 | 25 |
///\ingroup lp_group |
| 26 | 26 |
|
| 27 | 27 |
#include <lemon/lp_base.h> |
| 28 | 28 |
|
| 29 | 29 |
class CoinModel; |
| 30 | 30 |
class OsiSolverInterface; |
| 31 | 31 |
class CbcModel; |
| 32 | 32 |
|
| 33 | 33 |
namespace lemon {
|
| 34 | 34 |
|
| 35 | 35 |
/// \brief Interface for the CBC MIP solver |
| 36 | 36 |
/// |
| 37 | 37 |
/// This class implements an interface for the CBC MIP solver. |
| 38 | 38 |
///\ingroup lp_group |
| 39 | 39 |
class CbcMip : public MipSolver {
|
| 40 | 40 |
protected: |
| 41 | 41 |
|
| 42 | 42 |
CoinModel *_prob; |
| 43 | 43 |
OsiSolverInterface *_osi_solver; |
| 44 | 44 |
CbcModel *_cbc_model; |
| 45 | 45 |
|
| 46 | 46 |
public: |
| 47 | 47 |
|
| 48 | 48 |
/// \e |
| 49 | 49 |
CbcMip(); |
| 50 | 50 |
/// \e |
| 51 | 51 |
CbcMip(const CbcMip&); |
| 52 | 52 |
/// \e |
| 53 | 53 |
~CbcMip(); |
| 54 | 54 |
/// \e |
| 55 | 55 |
virtual CbcMip* newSolver() const; |
| 56 | 56 |
/// \e |
| 57 | 57 |
virtual CbcMip* cloneSolver() const; |
| 58 | 58 |
|
| 59 | 59 |
protected: |
| 60 | 60 |
|
| 61 | 61 |
virtual const char* _solverName() const; |
| 62 | 62 |
|
| 63 | 63 |
virtual int _addCol(); |
| 64 | 64 |
virtual int _addRow(); |
| 65 | 65 |
|
| 66 | 66 |
virtual void _eraseCol(int i); |
| 67 | 67 |
virtual void _eraseRow(int i); |
| 68 | 68 |
|
| 69 | 69 |
virtual void _eraseColId(int i); |
| 70 | 70 |
virtual void _eraseRowId(int i); |
| 71 | 71 |
|
| 72 | 72 |
virtual void _getColName(int col, std::string& name) const; |
| 73 | 73 |
virtual void _setColName(int col, const std::string& name); |
| 74 | 74 |
virtual int _colByName(const std::string& name) const; |
| 75 | 75 |
|
| 76 | 76 |
virtual void _getRowName(int row, std::string& name) const; |
| 77 | 77 |
virtual void _setRowName(int row, const std::string& name); |
| 78 | 78 |
virtual int _rowByName(const std::string& name) const; |
| 79 | 79 |
|
| 80 | 80 |
virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e); |
| 81 | 81 |
virtual void _getRowCoeffs(int i, InsertIterator b) const; |
| 82 | 82 |
|
| 83 | 83 |
virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e); |
| 84 | 84 |
virtual void _getColCoeffs(int i, InsertIterator b) const; |
| 85 | 85 |
|
| 86 | 86 |
virtual void _setCoeff(int row, int col, Value value); |
| 87 | 87 |
virtual Value _getCoeff(int row, int col) const; |
| 88 | 88 |
|
| 89 | 89 |
virtual void _setColLowerBound(int i, Value value); |
| 90 | 90 |
virtual Value _getColLowerBound(int i) const; |
| 91 | 91 |
virtual void _setColUpperBound(int i, Value value); |
| 92 | 92 |
virtual Value _getColUpperBound(int i) const; |
| 93 | 93 |
|
| 94 | 94 |
virtual void _setRowLowerBound(int i, Value value); |
| 95 | 95 |
virtual Value _getRowLowerBound(int i) const; |
| 96 | 96 |
virtual void _setRowUpperBound(int i, Value value); |
| 97 | 97 |
virtual Value _getRowUpperBound(int i) const; |
| 98 | 98 |
|
| 99 | 99 |
virtual void _setObjCoeffs(ExprIterator b, ExprIterator e); |
| 100 | 100 |
virtual void _getObjCoeffs(InsertIterator b) const; |
| 101 | 101 |
|
| 102 | 102 |
virtual void _setObjCoeff(int i, Value obj_coef); |
| 103 | 103 |
virtual Value _getObjCoeff(int i) const; |
| 104 | 104 |
|
| 105 | 105 |
virtual void _setSense(Sense sense); |
| 106 | 106 |
virtual Sense _getSense() const; |
| 107 | 107 |
|
| 108 | 108 |
virtual ColTypes _getColType(int col) const; |
| 109 | 109 |
virtual void _setColType(int col, ColTypes col_type); |
| 110 | 110 |
|
| 111 | 111 |
virtual SolveExitStatus _solve(); |
| 112 | 112 |
virtual ProblemType _getType() const; |
| 113 | 113 |
virtual Value _getSol(int i) const; |
| 114 | 114 |
virtual Value _getSolValue() const; |
| 115 | 115 |
|
| 116 | 116 |
virtual void _clear(); |
| 117 | 117 |
|
| 118 |
|
|
| 118 |
virtual void _messageLevel(MessageLevel level); |
|
| 119 |
void _applyMessageLevel(); |
|
| 119 | 120 |
|
| 120 |
///Enum for \c messageLevel() parameter |
|
| 121 |
enum MessageLevel {
|
|
| 122 |
/// no output (default value) |
|
| 123 |
MESSAGE_NO_OUTPUT = 0, |
|
| 124 |
/// error messages only |
|
| 125 |
MESSAGE_ERROR_MESSAGE = 1, |
|
| 126 |
/// normal output |
|
| 127 |
MESSAGE_NORMAL_OUTPUT = 2, |
|
| 128 |
/// full output (includes informational messages) |
|
| 129 |
MESSAGE_FULL_OUTPUT = 3 |
|
| 130 |
|
|
| 121 |
int _message_level; |
|
| 131 | 122 |
|
| 132 |
private: |
|
| 133 |
|
|
| 134 |
MessageLevel _message_level; |
|
| 135 |
|
|
| 136 |
public: |
|
| 137 |
|
|
| 138 |
///Set the verbosity of the messages |
|
| 139 |
|
|
| 140 |
///Set the verbosity of the messages |
|
| 141 |
/// |
|
| 142 |
///\param m is the level of the messages output by the solver routines. |
|
| 143 |
void messageLevel(MessageLevel m); |
|
| 144 | 123 |
|
| 145 | 124 |
|
| 146 | 125 |
}; |
| 147 | 126 |
|
| 148 | 127 |
} |
| 149 | 128 |
|
| 150 | 129 |
#endif |
| ... | ... |
@@ -72,682 +72,682 @@ |
| 72 | 72 |
/// The type of the map that stores the flow values. |
| 73 | 73 |
/// It must meet the \ref concepts::ReadWriteMap "ReadWriteMap" concept. |
| 74 | 74 |
typedef typename Digraph::template ArcMap<Value> FlowMap; |
| 75 | 75 |
|
| 76 | 76 |
/// \brief Instantiates a FlowMap. |
| 77 | 77 |
/// |
| 78 | 78 |
/// This function instantiates a \ref FlowMap. |
| 79 | 79 |
/// \param digraph The digraph, to which we would like to define |
| 80 | 80 |
/// the flow map. |
| 81 | 81 |
static FlowMap* createFlowMap(const Digraph& digraph) {
|
| 82 | 82 |
return new FlowMap(digraph); |
| 83 | 83 |
} |
| 84 | 84 |
|
| 85 | 85 |
/// \brief The elevator type used by the algorithm. |
| 86 | 86 |
/// |
| 87 | 87 |
/// The elevator type used by the algorithm. |
| 88 | 88 |
/// |
| 89 | 89 |
/// \sa Elevator |
| 90 | 90 |
/// \sa LinkedElevator |
| 91 | 91 |
typedef lemon::Elevator<Digraph, typename Digraph::Node> Elevator; |
| 92 | 92 |
|
| 93 | 93 |
/// \brief Instantiates an Elevator. |
| 94 | 94 |
/// |
| 95 | 95 |
/// This function instantiates an \ref Elevator. |
| 96 | 96 |
/// \param digraph The digraph, to which we would like to define |
| 97 | 97 |
/// the elevator. |
| 98 | 98 |
/// \param max_level The maximum level of the elevator. |
| 99 | 99 |
static Elevator* createElevator(const Digraph& digraph, int max_level) {
|
| 100 | 100 |
return new Elevator(digraph, max_level); |
| 101 | 101 |
} |
| 102 | 102 |
|
| 103 | 103 |
/// \brief The tolerance used by the algorithm |
| 104 | 104 |
/// |
| 105 | 105 |
/// The tolerance used by the algorithm to handle inexact computation. |
| 106 | 106 |
typedef lemon::Tolerance<Value> Tolerance; |
| 107 | 107 |
|
| 108 | 108 |
}; |
| 109 | 109 |
|
| 110 | 110 |
/** |
| 111 | 111 |
\brief Push-relabel algorithm for the network circulation problem. |
| 112 | 112 |
|
| 113 | 113 |
\ingroup max_flow |
| 114 | 114 |
This class implements a push-relabel algorithm for the network |
| 115 | 115 |
circulation problem. |
| 116 | 116 |
It is to find a feasible circulation when lower and upper bounds |
| 117 | 117 |
are given for the flow values on the arcs and lower bounds |
| 118 | 118 |
are given for the supply values of the nodes. |
| 119 | 119 |
|
| 120 | 120 |
The exact formulation of this problem is the following. |
| 121 | 121 |
Let \f$G=(V,A)\f$ be a digraph, |
| 122 | 122 |
\f$lower, upper: A\rightarrow\mathbf{R}^+_0\f$,
|
| 123 | 123 |
\f$delta: V\rightarrow\mathbf{R}\f$. Find a feasible circulation
|
| 124 | 124 |
\f$f: A\rightarrow\mathbf{R}^+_0\f$ so that
|
| 125 | 125 |
\f[ \sum_{a\in\delta_{out}(v)} f(a) - \sum_{a\in\delta_{in}(v)} f(a)
|
| 126 | 126 |
\geq delta(v) \quad \forall v\in V, \f] |
| 127 | 127 |
\f[ lower(a)\leq f(a) \leq upper(a) \quad \forall a\in A. \f] |
| 128 | 128 |
\note \f$delta(v)\f$ specifies a lower bound for the supply of node |
| 129 | 129 |
\f$v\f$. It can be either positive or negative, however note that |
| 130 | 130 |
\f$\sum_{v\in V}delta(v)\f$ should be zero or negative in order to
|
| 131 | 131 |
have a feasible solution. |
| 132 | 132 |
|
| 133 | 133 |
\note A special case of this problem is when |
| 134 | 134 |
\f$\sum_{v\in V}delta(v) = 0\f$. Then the supply of each node \f$v\f$
|
| 135 | 135 |
will be \e equal \e to \f$delta(v)\f$, if a circulation can be found. |
| 136 | 136 |
Thus a feasible solution for the |
| 137 | 137 |
\ref min_cost_flow "minimum cost flow" problem can be calculated |
| 138 | 138 |
in this way. |
| 139 | 139 |
|
| 140 | 140 |
\tparam GR The type of the digraph the algorithm runs on. |
| 141 | 141 |
\tparam LM The type of the lower bound capacity map. The default |
| 142 | 142 |
map type is \ref concepts::Digraph::ArcMap "GR::ArcMap<int>". |
| 143 | 143 |
\tparam UM The type of the upper bound capacity map. The default |
| 144 | 144 |
map type is \c LM. |
| 145 | 145 |
\tparam DM The type of the map that stores the lower bound |
| 146 | 146 |
for the supply of the nodes. The default map type is |
| 147 | 147 |
\ref concepts::Digraph::NodeMap "GR::NodeMap<UM::Value>". |
| 148 | 148 |
*/ |
| 149 | 149 |
#ifdef DOXYGEN |
| 150 | 150 |
template< typename GR, |
| 151 | 151 |
typename LM, |
| 152 | 152 |
typename UM, |
| 153 | 153 |
typename DM, |
| 154 | 154 |
typename TR > |
| 155 | 155 |
#else |
| 156 | 156 |
template< typename GR, |
| 157 | 157 |
typename LM = typename GR::template ArcMap<int>, |
| 158 | 158 |
typename UM = LM, |
| 159 | 159 |
typename DM = typename GR::template NodeMap<typename UM::Value>, |
| 160 | 160 |
typename TR = CirculationDefaultTraits<GR, LM, UM, DM> > |
| 161 | 161 |
#endif |
| 162 | 162 |
class Circulation {
|
| 163 | 163 |
public: |
| 164 | 164 |
|
| 165 | 165 |
///The \ref CirculationDefaultTraits "traits class" of the algorithm. |
| 166 | 166 |
typedef TR Traits; |
| 167 | 167 |
///The type of the digraph the algorithm runs on. |
| 168 | 168 |
typedef typename Traits::Digraph Digraph; |
| 169 | 169 |
///The type of the flow values. |
| 170 | 170 |
typedef typename Traits::Value Value; |
| 171 | 171 |
|
| 172 | 172 |
/// The type of the lower bound capacity map. |
| 173 | 173 |
typedef typename Traits::LCapMap LCapMap; |
| 174 | 174 |
/// The type of the upper bound capacity map. |
| 175 | 175 |
typedef typename Traits::UCapMap UCapMap; |
| 176 | 176 |
/// \brief The type of the map that stores the lower bound for |
| 177 | 177 |
/// the supply of the nodes. |
| 178 | 178 |
typedef typename Traits::DeltaMap DeltaMap; |
| 179 | 179 |
///The type of the flow map. |
| 180 | 180 |
typedef typename Traits::FlowMap FlowMap; |
| 181 | 181 |
|
| 182 | 182 |
///The type of the elevator. |
| 183 | 183 |
typedef typename Traits::Elevator Elevator; |
| 184 | 184 |
///The type of the tolerance. |
| 185 | 185 |
typedef typename Traits::Tolerance Tolerance; |
| 186 | 186 |
|
| 187 | 187 |
private: |
| 188 | 188 |
|
| 189 | 189 |
TEMPLATE_DIGRAPH_TYPEDEFS(Digraph); |
| 190 | 190 |
|
| 191 | 191 |
const Digraph &_g; |
| 192 | 192 |
int _node_num; |
| 193 | 193 |
|
| 194 | 194 |
const LCapMap *_lo; |
| 195 | 195 |
const UCapMap *_up; |
| 196 | 196 |
const DeltaMap *_delta; |
| 197 | 197 |
|
| 198 | 198 |
FlowMap *_flow; |
| 199 | 199 |
bool _local_flow; |
| 200 | 200 |
|
| 201 | 201 |
Elevator* _level; |
| 202 | 202 |
bool _local_level; |
| 203 | 203 |
|
| 204 | 204 |
typedef typename Digraph::template NodeMap<Value> ExcessMap; |
| 205 | 205 |
ExcessMap* _excess; |
| 206 | 206 |
|
| 207 | 207 |
Tolerance _tol; |
| 208 | 208 |
int _el; |
| 209 | 209 |
|
| 210 | 210 |
public: |
| 211 | 211 |
|
| 212 | 212 |
typedef Circulation Create; |
| 213 | 213 |
|
| 214 | 214 |
///\name Named Template Parameters |
| 215 | 215 |
|
| 216 | 216 |
///@{
|
| 217 | 217 |
|
| 218 | 218 |
template <typename T> |
| 219 | 219 |
struct SetFlowMapTraits : public Traits {
|
| 220 | 220 |
typedef T FlowMap; |
| 221 | 221 |
static FlowMap *createFlowMap(const Digraph&) {
|
| 222 | 222 |
LEMON_ASSERT(false, "FlowMap is not initialized"); |
| 223 | 223 |
return 0; // ignore warnings |
| 224 | 224 |
} |
| 225 | 225 |
}; |
| 226 | 226 |
|
| 227 | 227 |
/// \brief \ref named-templ-param "Named parameter" for setting |
| 228 | 228 |
/// FlowMap type |
| 229 | 229 |
/// |
| 230 | 230 |
/// \ref named-templ-param "Named parameter" for setting FlowMap |
| 231 | 231 |
/// type. |
| 232 | 232 |
template <typename T> |
| 233 | 233 |
struct SetFlowMap |
| 234 | 234 |
: public Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 235 | 235 |
SetFlowMapTraits<T> > {
|
| 236 | 236 |
typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 237 | 237 |
SetFlowMapTraits<T> > Create; |
| 238 | 238 |
}; |
| 239 | 239 |
|
| 240 | 240 |
template <typename T> |
| 241 | 241 |
struct SetElevatorTraits : public Traits {
|
| 242 | 242 |
typedef T Elevator; |
| 243 | 243 |
static Elevator *createElevator(const Digraph&, int) {
|
| 244 | 244 |
LEMON_ASSERT(false, "Elevator is not initialized"); |
| 245 | 245 |
return 0; // ignore warnings |
| 246 | 246 |
} |
| 247 | 247 |
}; |
| 248 | 248 |
|
| 249 | 249 |
/// \brief \ref named-templ-param "Named parameter" for setting |
| 250 | 250 |
/// Elevator type |
| 251 | 251 |
/// |
| 252 | 252 |
/// \ref named-templ-param "Named parameter" for setting Elevator |
| 253 | 253 |
/// type. If this named parameter is used, then an external |
| 254 | 254 |
/// elevator object must be passed to the algorithm using the |
| 255 | 255 |
/// \ref elevator(Elevator&) "elevator()" function before calling |
| 256 | 256 |
/// \ref run() or \ref init(). |
| 257 | 257 |
/// \sa SetStandardElevator |
| 258 | 258 |
template <typename T> |
| 259 | 259 |
struct SetElevator |
| 260 | 260 |
: public Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 261 | 261 |
SetElevatorTraits<T> > {
|
| 262 | 262 |
typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 263 | 263 |
SetElevatorTraits<T> > Create; |
| 264 | 264 |
}; |
| 265 | 265 |
|
| 266 | 266 |
template <typename T> |
| 267 | 267 |
struct SetStandardElevatorTraits : public Traits {
|
| 268 | 268 |
typedef T Elevator; |
| 269 | 269 |
static Elevator *createElevator(const Digraph& digraph, int max_level) {
|
| 270 | 270 |
return new Elevator(digraph, max_level); |
| 271 | 271 |
} |
| 272 | 272 |
}; |
| 273 | 273 |
|
| 274 | 274 |
/// \brief \ref named-templ-param "Named parameter" for setting |
| 275 | 275 |
/// Elevator type with automatic allocation |
| 276 | 276 |
/// |
| 277 | 277 |
/// \ref named-templ-param "Named parameter" for setting Elevator |
| 278 | 278 |
/// type with automatic allocation. |
| 279 | 279 |
/// The Elevator should have standard constructor interface to be |
| 280 | 280 |
/// able to automatically created by the algorithm (i.e. the |
| 281 | 281 |
/// digraph and the maximum level should be passed to it). |
| 282 | 282 |
/// However an external elevator object could also be passed to the |
| 283 | 283 |
/// algorithm with the \ref elevator(Elevator&) "elevator()" function |
| 284 | 284 |
/// before calling \ref run() or \ref init(). |
| 285 | 285 |
/// \sa SetElevator |
| 286 | 286 |
template <typename T> |
| 287 | 287 |
struct SetStandardElevator |
| 288 | 288 |
: public Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 289 | 289 |
SetStandardElevatorTraits<T> > {
|
| 290 | 290 |
typedef Circulation<Digraph, LCapMap, UCapMap, DeltaMap, |
| 291 | 291 |
SetStandardElevatorTraits<T> > Create; |
| 292 | 292 |
}; |
| 293 | 293 |
|
| 294 | 294 |
/// @} |
| 295 | 295 |
|
| 296 | 296 |
protected: |
| 297 | 297 |
|
| 298 | 298 |
Circulation() {}
|
| 299 | 299 |
|
| 300 | 300 |
public: |
| 301 | 301 |
|
| 302 | 302 |
/// The constructor of the class. |
| 303 | 303 |
|
| 304 | 304 |
/// The constructor of the class. |
| 305 | 305 |
/// \param g The digraph the algorithm runs on. |
| 306 | 306 |
/// \param lo The lower bound capacity of the arcs. |
| 307 | 307 |
/// \param up The upper bound capacity of the arcs. |
| 308 | 308 |
/// \param delta The lower bound for the supply of the nodes. |
| 309 | 309 |
Circulation(const Digraph &g,const LCapMap &lo, |
| 310 | 310 |
const UCapMap &up,const DeltaMap &delta) |
| 311 | 311 |
: _g(g), _node_num(), |
| 312 | 312 |
_lo(&lo),_up(&up),_delta(&delta),_flow(0),_local_flow(false), |
| 313 | 313 |
_level(0), _local_level(false), _excess(0), _el() {}
|
| 314 | 314 |
|
| 315 | 315 |
/// Destructor. |
| 316 | 316 |
~Circulation() {
|
| 317 | 317 |
destroyStructures(); |
| 318 | 318 |
} |
| 319 | 319 |
|
| 320 | 320 |
|
| 321 | 321 |
private: |
| 322 | 322 |
|
| 323 | 323 |
void createStructures() {
|
| 324 | 324 |
_node_num = _el = countNodes(_g); |
| 325 | 325 |
|
| 326 | 326 |
if (!_flow) {
|
| 327 | 327 |
_flow = Traits::createFlowMap(_g); |
| 328 | 328 |
_local_flow = true; |
| 329 | 329 |
} |
| 330 | 330 |
if (!_level) {
|
| 331 | 331 |
_level = Traits::createElevator(_g, _node_num); |
| 332 | 332 |
_local_level = true; |
| 333 | 333 |
} |
| 334 | 334 |
if (!_excess) {
|
| 335 | 335 |
_excess = new ExcessMap(_g); |
| 336 | 336 |
} |
| 337 | 337 |
} |
| 338 | 338 |
|
| 339 | 339 |
void destroyStructures() {
|
| 340 | 340 |
if (_local_flow) {
|
| 341 | 341 |
delete _flow; |
| 342 | 342 |
} |
| 343 | 343 |
if (_local_level) {
|
| 344 | 344 |
delete _level; |
| 345 | 345 |
} |
| 346 | 346 |
if (_excess) {
|
| 347 | 347 |
delete _excess; |
| 348 | 348 |
} |
| 349 | 349 |
} |
| 350 | 350 |
|
| 351 | 351 |
public: |
| 352 | 352 |
|
| 353 | 353 |
/// Sets the lower bound capacity map. |
| 354 | 354 |
|
| 355 | 355 |
/// Sets the lower bound capacity map. |
| 356 | 356 |
/// \return <tt>(*this)</tt> |
| 357 | 357 |
Circulation& lowerCapMap(const LCapMap& map) {
|
| 358 | 358 |
_lo = ↦ |
| 359 | 359 |
return *this; |
| 360 | 360 |
} |
| 361 | 361 |
|
| 362 | 362 |
/// Sets the upper bound capacity map. |
| 363 | 363 |
|
| 364 | 364 |
/// Sets the upper bound capacity map. |
| 365 | 365 |
/// \return <tt>(*this)</tt> |
| 366 | 366 |
Circulation& upperCapMap(const LCapMap& map) {
|
| 367 | 367 |
_up = ↦ |
| 368 | 368 |
return *this; |
| 369 | 369 |
} |
| 370 | 370 |
|
| 371 | 371 |
/// Sets the lower bound map for the supply of the nodes. |
| 372 | 372 |
|
| 373 | 373 |
/// Sets the lower bound map for the supply of the nodes. |
| 374 | 374 |
/// \return <tt>(*this)</tt> |
| 375 | 375 |
Circulation& deltaMap(const DeltaMap& map) {
|
| 376 | 376 |
_delta = ↦ |
| 377 | 377 |
return *this; |
| 378 | 378 |
} |
| 379 | 379 |
|
| 380 | 380 |
/// \brief Sets the flow map. |
| 381 | 381 |
/// |
| 382 | 382 |
/// Sets the flow map. |
| 383 | 383 |
/// If you don't use this function before calling \ref run() or |
| 384 | 384 |
/// \ref init(), an instance will be allocated automatically. |
| 385 | 385 |
/// The destructor deallocates this automatically allocated map, |
| 386 | 386 |
/// of course. |
| 387 | 387 |
/// \return <tt>(*this)</tt> |
| 388 | 388 |
Circulation& flowMap(FlowMap& map) {
|
| 389 | 389 |
if (_local_flow) {
|
| 390 | 390 |
delete _flow; |
| 391 | 391 |
_local_flow = false; |
| 392 | 392 |
} |
| 393 | 393 |
_flow = ↦ |
| 394 | 394 |
return *this; |
| 395 | 395 |
} |
| 396 | 396 |
|
| 397 | 397 |
/// \brief Sets the elevator used by algorithm. |
| 398 | 398 |
/// |
| 399 | 399 |
/// Sets the elevator used by algorithm. |
| 400 | 400 |
/// If you don't use this function before calling \ref run() or |
| 401 | 401 |
/// \ref init(), an instance will be allocated automatically. |
| 402 | 402 |
/// The destructor deallocates this automatically allocated elevator, |
| 403 | 403 |
/// of course. |
| 404 | 404 |
/// \return <tt>(*this)</tt> |
| 405 | 405 |
Circulation& elevator(Elevator& elevator) {
|
| 406 | 406 |
if (_local_level) {
|
| 407 | 407 |
delete _level; |
| 408 | 408 |
_local_level = false; |
| 409 | 409 |
} |
| 410 | 410 |
_level = &elevator; |
| 411 | 411 |
return *this; |
| 412 | 412 |
} |
| 413 | 413 |
|
| 414 | 414 |
/// \brief Returns a const reference to the elevator. |
| 415 | 415 |
/// |
| 416 | 416 |
/// Returns a const reference to the elevator. |
| 417 | 417 |
/// |
| 418 | 418 |
/// \pre Either \ref run() or \ref init() must be called before |
| 419 | 419 |
/// using this function. |
| 420 | 420 |
const Elevator& elevator() const {
|
| 421 | 421 |
return *_level; |
| 422 | 422 |
} |
| 423 | 423 |
|
| 424 | 424 |
/// \brief Sets the tolerance used by algorithm. |
| 425 | 425 |
/// |
| 426 | 426 |
/// Sets the tolerance used by algorithm. |
| 427 | 427 |
Circulation& tolerance(const Tolerance& tolerance) const {
|
| 428 | 428 |
_tol = tolerance; |
| 429 | 429 |
return *this; |
| 430 | 430 |
} |
| 431 | 431 |
|
| 432 | 432 |
/// \brief Returns a const reference to the tolerance. |
| 433 | 433 |
/// |
| 434 | 434 |
/// Returns a const reference to the tolerance. |
| 435 | 435 |
const Tolerance& tolerance() const {
|
| 436 | 436 |
return tolerance; |
| 437 | 437 |
} |
| 438 | 438 |
|
| 439 | 439 |
/// \name Execution Control |
| 440 | 440 |
/// The simplest way to execute the algorithm is to call \ref run().\n |
| 441 | 441 |
/// If you need more control on the initial solution or the execution, |
| 442 | 442 |
/// first you have to call one of the \ref init() functions, then |
| 443 | 443 |
/// the \ref start() function. |
| 444 | 444 |
|
| 445 | 445 |
///@{
|
| 446 | 446 |
|
| 447 | 447 |
/// Initializes the internal data structures. |
| 448 | 448 |
|
| 449 | 449 |
/// Initializes the internal data structures and sets all flow values |
| 450 | 450 |
/// to the lower bound. |
| 451 | 451 |
void init() |
| 452 | 452 |
{
|
| 453 | 453 |
createStructures(); |
| 454 | 454 |
|
| 455 | 455 |
for(NodeIt n(_g);n!=INVALID;++n) {
|
| 456 |
_excess |
|
| 456 |
(*_excess)[n] = (*_delta)[n]; |
|
| 457 | 457 |
} |
| 458 | 458 |
|
| 459 | 459 |
for (ArcIt e(_g);e!=INVALID;++e) {
|
| 460 | 460 |
_flow->set(e, (*_lo)[e]); |
| 461 |
_excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_flow)[e]); |
|
| 462 |
_excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_flow)[e]); |
|
| 461 |
(*_excess)[_g.target(e)] += (*_flow)[e]; |
|
| 462 |
(*_excess)[_g.source(e)] -= (*_flow)[e]; |
|
| 463 | 463 |
} |
| 464 | 464 |
|
| 465 | 465 |
// global relabeling tested, but in general case it provides |
| 466 | 466 |
// worse performance for random digraphs |
| 467 | 467 |
_level->initStart(); |
| 468 | 468 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 469 | 469 |
_level->initAddItem(n); |
| 470 | 470 |
_level->initFinish(); |
| 471 | 471 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 472 | 472 |
if(_tol.positive((*_excess)[n])) |
| 473 | 473 |
_level->activate(n); |
| 474 | 474 |
} |
| 475 | 475 |
|
| 476 | 476 |
/// Initializes the internal data structures using a greedy approach. |
| 477 | 477 |
|
| 478 | 478 |
/// Initializes the internal data structures using a greedy approach |
| 479 | 479 |
/// to construct the initial solution. |
| 480 | 480 |
void greedyInit() |
| 481 | 481 |
{
|
| 482 | 482 |
createStructures(); |
| 483 | 483 |
|
| 484 | 484 |
for(NodeIt n(_g);n!=INVALID;++n) {
|
| 485 |
_excess |
|
| 485 |
(*_excess)[n] = (*_delta)[n]; |
|
| 486 | 486 |
} |
| 487 | 487 |
|
| 488 | 488 |
for (ArcIt e(_g);e!=INVALID;++e) {
|
| 489 | 489 |
if (!_tol.positive((*_excess)[_g.target(e)] + (*_up)[e])) {
|
| 490 | 490 |
_flow->set(e, (*_up)[e]); |
| 491 |
_excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_up)[e]); |
|
| 492 |
_excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_up)[e]); |
|
| 491 |
(*_excess)[_g.target(e)] += (*_up)[e]; |
|
| 492 |
(*_excess)[_g.source(e)] -= (*_up)[e]; |
|
| 493 | 493 |
} else if (_tol.positive((*_excess)[_g.target(e)] + (*_lo)[e])) {
|
| 494 | 494 |
_flow->set(e, (*_lo)[e]); |
| 495 |
_excess->set(_g.target(e), (*_excess)[_g.target(e)] + (*_lo)[e]); |
|
| 496 |
_excess->set(_g.source(e), (*_excess)[_g.source(e)] - (*_lo)[e]); |
|
| 495 |
(*_excess)[_g.target(e)] += (*_lo)[e]; |
|
| 496 |
(*_excess)[_g.source(e)] -= (*_lo)[e]; |
|
| 497 | 497 |
} else {
|
| 498 | 498 |
Value fc = -(*_excess)[_g.target(e)]; |
| 499 | 499 |
_flow->set(e, fc); |
| 500 |
_excess->set(_g.target(e), 0); |
|
| 501 |
_excess->set(_g.source(e), (*_excess)[_g.source(e)] - fc); |
|
| 500 |
(*_excess)[_g.target(e)] = 0; |
|
| 501 |
(*_excess)[_g.source(e)] -= fc; |
|
| 502 | 502 |
} |
| 503 | 503 |
} |
| 504 | 504 |
|
| 505 | 505 |
_level->initStart(); |
| 506 | 506 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 507 | 507 |
_level->initAddItem(n); |
| 508 | 508 |
_level->initFinish(); |
| 509 | 509 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 510 | 510 |
if(_tol.positive((*_excess)[n])) |
| 511 | 511 |
_level->activate(n); |
| 512 | 512 |
} |
| 513 | 513 |
|
| 514 | 514 |
///Executes the algorithm |
| 515 | 515 |
|
| 516 | 516 |
///This function executes the algorithm. |
| 517 | 517 |
/// |
| 518 | 518 |
///\return \c true if a feasible circulation is found. |
| 519 | 519 |
/// |
| 520 | 520 |
///\sa barrier() |
| 521 | 521 |
///\sa barrierMap() |
| 522 | 522 |
bool start() |
| 523 | 523 |
{
|
| 524 | 524 |
|
| 525 | 525 |
Node act; |
| 526 | 526 |
Node bact=INVALID; |
| 527 | 527 |
Node last_activated=INVALID; |
| 528 | 528 |
while((act=_level->highestActive())!=INVALID) {
|
| 529 | 529 |
int actlevel=(*_level)[act]; |
| 530 | 530 |
int mlevel=_node_num; |
| 531 | 531 |
Value exc=(*_excess)[act]; |
| 532 | 532 |
|
| 533 | 533 |
for(OutArcIt e(_g,act);e!=INVALID; ++e) {
|
| 534 | 534 |
Node v = _g.target(e); |
| 535 | 535 |
Value fc=(*_up)[e]-(*_flow)[e]; |
| 536 | 536 |
if(!_tol.positive(fc)) continue; |
| 537 | 537 |
if((*_level)[v]<actlevel) {
|
| 538 | 538 |
if(!_tol.less(fc, exc)) {
|
| 539 | 539 |
_flow->set(e, (*_flow)[e] + exc); |
| 540 |
|
|
| 540 |
(*_excess)[v] += exc; |
|
| 541 | 541 |
if(!_level->active(v) && _tol.positive((*_excess)[v])) |
| 542 | 542 |
_level->activate(v); |
| 543 |
|
|
| 543 |
(*_excess)[act] = 0; |
|
| 544 | 544 |
_level->deactivate(act); |
| 545 | 545 |
goto next_l; |
| 546 | 546 |
} |
| 547 | 547 |
else {
|
| 548 | 548 |
_flow->set(e, (*_up)[e]); |
| 549 |
|
|
| 549 |
(*_excess)[v] += fc; |
|
| 550 | 550 |
if(!_level->active(v) && _tol.positive((*_excess)[v])) |
| 551 | 551 |
_level->activate(v); |
| 552 | 552 |
exc-=fc; |
| 553 | 553 |
} |
| 554 | 554 |
} |
| 555 | 555 |
else if((*_level)[v]<mlevel) mlevel=(*_level)[v]; |
| 556 | 556 |
} |
| 557 | 557 |
for(InArcIt e(_g,act);e!=INVALID; ++e) {
|
| 558 | 558 |
Node v = _g.source(e); |
| 559 | 559 |
Value fc=(*_flow)[e]-(*_lo)[e]; |
| 560 | 560 |
if(!_tol.positive(fc)) continue; |
| 561 | 561 |
if((*_level)[v]<actlevel) {
|
| 562 | 562 |
if(!_tol.less(fc, exc)) {
|
| 563 | 563 |
_flow->set(e, (*_flow)[e] - exc); |
| 564 |
|
|
| 564 |
(*_excess)[v] += exc; |
|
| 565 | 565 |
if(!_level->active(v) && _tol.positive((*_excess)[v])) |
| 566 | 566 |
_level->activate(v); |
| 567 |
|
|
| 567 |
(*_excess)[act] = 0; |
|
| 568 | 568 |
_level->deactivate(act); |
| 569 | 569 |
goto next_l; |
| 570 | 570 |
} |
| 571 | 571 |
else {
|
| 572 | 572 |
_flow->set(e, (*_lo)[e]); |
| 573 |
|
|
| 573 |
(*_excess)[v] += fc; |
|
| 574 | 574 |
if(!_level->active(v) && _tol.positive((*_excess)[v])) |
| 575 | 575 |
_level->activate(v); |
| 576 | 576 |
exc-=fc; |
| 577 | 577 |
} |
| 578 | 578 |
} |
| 579 | 579 |
else if((*_level)[v]<mlevel) mlevel=(*_level)[v]; |
| 580 | 580 |
} |
| 581 | 581 |
|
| 582 |
_excess |
|
| 582 |
(*_excess)[act] = exc; |
|
| 583 | 583 |
if(!_tol.positive(exc)) _level->deactivate(act); |
| 584 | 584 |
else if(mlevel==_node_num) {
|
| 585 | 585 |
_level->liftHighestActiveToTop(); |
| 586 | 586 |
_el = _node_num; |
| 587 | 587 |
return false; |
| 588 | 588 |
} |
| 589 | 589 |
else {
|
| 590 | 590 |
_level->liftHighestActive(mlevel+1); |
| 591 | 591 |
if(_level->onLevel(actlevel)==0) {
|
| 592 | 592 |
_el = actlevel; |
| 593 | 593 |
return false; |
| 594 | 594 |
} |
| 595 | 595 |
} |
| 596 | 596 |
next_l: |
| 597 | 597 |
; |
| 598 | 598 |
} |
| 599 | 599 |
return true; |
| 600 | 600 |
} |
| 601 | 601 |
|
| 602 | 602 |
/// Runs the algorithm. |
| 603 | 603 |
|
| 604 | 604 |
/// This function runs the algorithm. |
| 605 | 605 |
/// |
| 606 | 606 |
/// \return \c true if a feasible circulation is found. |
| 607 | 607 |
/// |
| 608 | 608 |
/// \note Apart from the return value, c.run() is just a shortcut of |
| 609 | 609 |
/// the following code. |
| 610 | 610 |
/// \code |
| 611 | 611 |
/// c.greedyInit(); |
| 612 | 612 |
/// c.start(); |
| 613 | 613 |
/// \endcode |
| 614 | 614 |
bool run() {
|
| 615 | 615 |
greedyInit(); |
| 616 | 616 |
return start(); |
| 617 | 617 |
} |
| 618 | 618 |
|
| 619 | 619 |
/// @} |
| 620 | 620 |
|
| 621 | 621 |
/// \name Query Functions |
| 622 | 622 |
/// The results of the circulation algorithm can be obtained using |
| 623 | 623 |
/// these functions.\n |
| 624 | 624 |
/// Either \ref run() or \ref start() should be called before |
| 625 | 625 |
/// using them. |
| 626 | 626 |
|
| 627 | 627 |
///@{
|
| 628 | 628 |
|
| 629 | 629 |
/// \brief Returns the flow on the given arc. |
| 630 | 630 |
/// |
| 631 | 631 |
/// Returns the flow on the given arc. |
| 632 | 632 |
/// |
| 633 | 633 |
/// \pre Either \ref run() or \ref init() must be called before |
| 634 | 634 |
/// using this function. |
| 635 | 635 |
Value flow(const Arc& arc) const {
|
| 636 | 636 |
return (*_flow)[arc]; |
| 637 | 637 |
} |
| 638 | 638 |
|
| 639 | 639 |
/// \brief Returns a const reference to the flow map. |
| 640 | 640 |
/// |
| 641 | 641 |
/// Returns a const reference to the arc map storing the found flow. |
| 642 | 642 |
/// |
| 643 | 643 |
/// \pre Either \ref run() or \ref init() must be called before |
| 644 | 644 |
/// using this function. |
| 645 | 645 |
const FlowMap& flowMap() const {
|
| 646 | 646 |
return *_flow; |
| 647 | 647 |
} |
| 648 | 648 |
|
| 649 | 649 |
/** |
| 650 | 650 |
\brief Returns \c true if the given node is in a barrier. |
| 651 | 651 |
|
| 652 | 652 |
Barrier is a set \e B of nodes for which |
| 653 | 653 |
|
| 654 | 654 |
\f[ \sum_{a\in\delta_{out}(B)} upper(a) -
|
| 655 | 655 |
\sum_{a\in\delta_{in}(B)} lower(a) < \sum_{v\in B}delta(v) \f]
|
| 656 | 656 |
|
| 657 | 657 |
holds. The existence of a set with this property prooves that a |
| 658 | 658 |
feasible circualtion cannot exist. |
| 659 | 659 |
|
| 660 | 660 |
This function returns \c true if the given node is in the found |
| 661 | 661 |
barrier. If a feasible circulation is found, the function |
| 662 | 662 |
gives back \c false for every node. |
| 663 | 663 |
|
| 664 | 664 |
\pre Either \ref run() or \ref init() must be called before |
| 665 | 665 |
using this function. |
| 666 | 666 |
|
| 667 | 667 |
\sa barrierMap() |
| 668 | 668 |
\sa checkBarrier() |
| 669 | 669 |
*/ |
| 670 | 670 |
bool barrier(const Node& node) const |
| 671 | 671 |
{
|
| 672 | 672 |
return (*_level)[node] >= _el; |
| 673 | 673 |
} |
| 674 | 674 |
|
| 675 | 675 |
/// \brief Gives back a barrier. |
| 676 | 676 |
/// |
| 677 | 677 |
/// This function sets \c bar to the characteristic vector of the |
| 678 | 678 |
/// found barrier. \c bar should be a \ref concepts::WriteMap "writable" |
| 679 | 679 |
/// node map with \c bool (or convertible) value type. |
| 680 | 680 |
/// |
| 681 | 681 |
/// If a feasible circulation is found, the function gives back an |
| 682 | 682 |
/// empty set, so \c bar[v] will be \c false for all nodes \c v. |
| 683 | 683 |
/// |
| 684 | 684 |
/// \note This function calls \ref barrier() for each node, |
| 685 | 685 |
/// so it runs in O(n) time. |
| 686 | 686 |
/// |
| 687 | 687 |
/// \pre Either \ref run() or \ref init() must be called before |
| 688 | 688 |
/// using this function. |
| 689 | 689 |
/// |
| 690 | 690 |
/// \sa barrier() |
| 691 | 691 |
/// \sa checkBarrier() |
| 692 | 692 |
template<class BarrierMap> |
| 693 | 693 |
void barrierMap(BarrierMap &bar) const |
| 694 | 694 |
{
|
| 695 | 695 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 696 | 696 |
bar.set(n, (*_level)[n] >= _el); |
| 697 | 697 |
} |
| 698 | 698 |
|
| 699 | 699 |
/// @} |
| 700 | 700 |
|
| 701 | 701 |
/// \name Checker Functions |
| 702 | 702 |
/// The feasibility of the results can be checked using |
| 703 | 703 |
/// these functions.\n |
| 704 | 704 |
/// Either \ref run() or \ref start() should be called before |
| 705 | 705 |
/// using them. |
| 706 | 706 |
|
| 707 | 707 |
///@{
|
| 708 | 708 |
|
| 709 | 709 |
///Check if the found flow is a feasible circulation |
| 710 | 710 |
|
| 711 | 711 |
///Check if the found flow is a feasible circulation, |
| 712 | 712 |
/// |
| 713 | 713 |
bool checkFlow() const {
|
| 714 | 714 |
for(ArcIt e(_g);e!=INVALID;++e) |
| 715 | 715 |
if((*_flow)[e]<(*_lo)[e]||(*_flow)[e]>(*_up)[e]) return false; |
| 716 | 716 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 717 | 717 |
{
|
| 718 | 718 |
Value dif=-(*_delta)[n]; |
| 719 | 719 |
for(InArcIt e(_g,n);e!=INVALID;++e) dif-=(*_flow)[e]; |
| 720 | 720 |
for(OutArcIt e(_g,n);e!=INVALID;++e) dif+=(*_flow)[e]; |
| 721 | 721 |
if(_tol.negative(dif)) return false; |
| 722 | 722 |
} |
| 723 | 723 |
return true; |
| 724 | 724 |
} |
| 725 | 725 |
|
| 726 | 726 |
///Check whether or not the last execution provides a barrier |
| 727 | 727 |
|
| 728 | 728 |
///Check whether or not the last execution provides a barrier. |
| 729 | 729 |
///\sa barrier() |
| 730 | 730 |
///\sa barrierMap() |
| 731 | 731 |
bool checkBarrier() const |
| 732 | 732 |
{
|
| 733 | 733 |
Value delta=0; |
| 734 | 734 |
for(NodeIt n(_g);n!=INVALID;++n) |
| 735 | 735 |
if(barrier(n)) |
| 736 | 736 |
delta-=(*_delta)[n]; |
| 737 | 737 |
for(ArcIt e(_g);e!=INVALID;++e) |
| 738 | 738 |
{
|
| 739 | 739 |
Node s=_g.source(e); |
| 740 | 740 |
Node t=_g.target(e); |
| 741 | 741 |
if(barrier(s)&&!barrier(t)) delta+=(*_up)[e]; |
| 742 | 742 |
else if(barrier(t)&&!barrier(s)) delta-=(*_lo)[e]; |
| 743 | 743 |
} |
| 744 | 744 |
return _tol.negative(delta); |
| 745 | 745 |
} |
| 746 | 746 |
|
| 747 | 747 |
/// @} |
| 748 | 748 |
|
| 749 | 749 |
}; |
| 750 | 750 |
|
| 751 | 751 |
} |
| 752 | 752 |
|
| 753 | 753 |
#endif |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2008 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#include <lemon/clp.h> |
| 20 | 20 |
#include <coin/ClpSimplex.hpp> |
| 21 | 21 |
|
| 22 | 22 |
namespace lemon {
|
| 23 | 23 |
|
| 24 | 24 |
ClpLp::ClpLp() {
|
| 25 | 25 |
_prob = new ClpSimplex(); |
| 26 | 26 |
_init_temporals(); |
| 27 |
messageLevel( |
|
| 27 |
messageLevel(MESSAGE_NOTHING); |
|
| 28 | 28 |
} |
| 29 | 29 |
|
| 30 | 30 |
ClpLp::ClpLp(const ClpLp& other) {
|
| 31 | 31 |
_prob = new ClpSimplex(*other._prob); |
| 32 | 32 |
rows = other.rows; |
| 33 | 33 |
cols = other.cols; |
| 34 | 34 |
_init_temporals(); |
| 35 |
messageLevel( |
|
| 35 |
messageLevel(MESSAGE_NOTHING); |
|
| 36 | 36 |
} |
| 37 | 37 |
|
| 38 | 38 |
ClpLp::~ClpLp() {
|
| 39 | 39 |
delete _prob; |
| 40 | 40 |
_clear_temporals(); |
| 41 | 41 |
} |
| 42 | 42 |
|
| 43 | 43 |
void ClpLp::_init_temporals() {
|
| 44 | 44 |
_primal_ray = 0; |
| 45 | 45 |
_dual_ray = 0; |
| 46 | 46 |
} |
| 47 | 47 |
|
| 48 | 48 |
void ClpLp::_clear_temporals() {
|
| 49 | 49 |
if (_primal_ray) {
|
| 50 | 50 |
delete[] _primal_ray; |
| 51 | 51 |
_primal_ray = 0; |
| 52 | 52 |
} |
| 53 | 53 |
if (_dual_ray) {
|
| 54 | 54 |
delete[] _dual_ray; |
| 55 | 55 |
_dual_ray = 0; |
| 56 | 56 |
} |
| 57 | 57 |
} |
| 58 | 58 |
|
| 59 | 59 |
ClpLp* ClpLp::newSolver() const {
|
| 60 | 60 |
ClpLp* newlp = new ClpLp; |
| 61 | 61 |
return newlp; |
| 62 | 62 |
} |
| 63 | 63 |
|
| 64 | 64 |
ClpLp* ClpLp::cloneSolver() const {
|
| 65 | 65 |
ClpLp* copylp = new ClpLp(*this); |
| 66 | 66 |
return copylp; |
| 67 | 67 |
} |
| 68 | 68 |
|
| 69 | 69 |
const char* ClpLp::_solverName() const { return "ClpLp"; }
|
| 70 | 70 |
|
| 71 | 71 |
int ClpLp::_addCol() {
|
| 72 | 72 |
_prob->addColumn(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX, 0.0); |
| 73 | 73 |
return _prob->numberColumns() - 1; |
| 74 | 74 |
} |
| 75 | 75 |
|
| 76 | 76 |
int ClpLp::_addRow() {
|
| 77 | 77 |
_prob->addRow(0, 0, 0, -COIN_DBL_MAX, COIN_DBL_MAX); |
| 78 | 78 |
return _prob->numberRows() - 1; |
| 79 | 79 |
} |
| 80 | 80 |
|
| 81 | 81 |
|
| 82 | 82 |
void ClpLp::_eraseCol(int c) {
|
| 83 | 83 |
_col_names_ref.erase(_prob->getColumnName(c)); |
| 84 | 84 |
_prob->deleteColumns(1, &c); |
| 85 | 85 |
} |
| 86 | 86 |
|
| 87 | 87 |
void ClpLp::_eraseRow(int r) {
|
| 88 | 88 |
_row_names_ref.erase(_prob->getRowName(r)); |
| 89 | 89 |
_prob->deleteRows(1, &r); |
| 90 | 90 |
} |
| 91 | 91 |
|
| 92 | 92 |
void ClpLp::_eraseColId(int i) {
|
| 93 | 93 |
cols.eraseIndex(i); |
| 94 | 94 |
cols.shiftIndices(i); |
| 95 | 95 |
} |
| 96 | 96 |
|
| 97 | 97 |
void ClpLp::_eraseRowId(int i) {
|
| 98 | 98 |
rows.eraseIndex(i); |
| 99 | 99 |
rows.shiftIndices(i); |
| 100 | 100 |
} |
| 101 | 101 |
|
| 102 | 102 |
void ClpLp::_getColName(int c, std::string& name) const {
|
| 103 | 103 |
name = _prob->getColumnName(c); |
| 104 | 104 |
} |
| 105 | 105 |
|
| 106 | 106 |
void ClpLp::_setColName(int c, const std::string& name) {
|
| 107 | 107 |
_prob->setColumnName(c, const_cast<std::string&>(name)); |
| 108 | 108 |
_col_names_ref[name] = c; |
| 109 | 109 |
} |
| 110 | 110 |
|
| 111 | 111 |
int ClpLp::_colByName(const std::string& name) const {
|
| 112 | 112 |
std::map<std::string, int>::const_iterator it = _col_names_ref.find(name); |
| 113 | 113 |
return it != _col_names_ref.end() ? it->second : -1; |
| 114 | 114 |
} |
| 115 | 115 |
|
| 116 | 116 |
void ClpLp::_getRowName(int r, std::string& name) const {
|
| 117 | 117 |
name = _prob->getRowName(r); |
| 118 | 118 |
} |
| 119 | 119 |
|
| 120 | 120 |
void ClpLp::_setRowName(int r, const std::string& name) {
|
| 121 | 121 |
_prob->setRowName(r, const_cast<std::string&>(name)); |
| 122 | 122 |
_row_names_ref[name] = r; |
| 123 | 123 |
} |
| 124 | 124 |
|
| 125 | 125 |
int ClpLp::_rowByName(const std::string& name) const {
|
| 126 | 126 |
std::map<std::string, int>::const_iterator it = _row_names_ref.find(name); |
| 127 | 127 |
return it != _row_names_ref.end() ? it->second : -1; |
| 128 | 128 |
} |
| 129 | 129 |
|
| 130 | 130 |
|
| 131 | 131 |
void ClpLp::_setRowCoeffs(int ix, ExprIterator b, ExprIterator e) {
|
| 132 | 132 |
std::map<int, Value> coeffs; |
| 133 | 133 |
|
| 134 | 134 |
int n = _prob->clpMatrix()->getNumCols(); |
| 135 | 135 |
|
| 136 | 136 |
const int* indices = _prob->clpMatrix()->getIndices(); |
| 137 | 137 |
const double* elements = _prob->clpMatrix()->getElements(); |
| 138 | 138 |
|
| 139 | 139 |
for (int i = 0; i < n; ++i) {
|
| 140 | 140 |
CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[i]; |
| 141 | 141 |
CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[i]; |
| 142 | 142 |
|
| 143 | 143 |
const int* it = std::lower_bound(indices + begin, indices + end, ix); |
| 144 | 144 |
if (it != indices + end && *it == ix && elements[it - indices] != 0.0) {
|
| 145 | 145 |
coeffs[i] = 0.0; |
| 146 | 146 |
} |
| 147 | 147 |
} |
| 148 | 148 |
|
| 149 | 149 |
for (ExprIterator it = b; it != e; ++it) {
|
| 150 | 150 |
coeffs[it->first] = it->second; |
| 151 | 151 |
} |
| 152 | 152 |
|
| 153 | 153 |
for (std::map<int, Value>::iterator it = coeffs.begin(); |
| 154 | 154 |
it != coeffs.end(); ++it) {
|
| 155 | 155 |
_prob->modifyCoefficient(ix, it->first, it->second); |
| 156 | 156 |
} |
| 157 | 157 |
} |
| 158 | 158 |
|
| 159 | 159 |
void ClpLp::_getRowCoeffs(int ix, InsertIterator b) const {
|
| 160 | 160 |
int n = _prob->clpMatrix()->getNumCols(); |
| 161 | 161 |
|
| 162 | 162 |
const int* indices = _prob->clpMatrix()->getIndices(); |
| 163 | 163 |
const double* elements = _prob->clpMatrix()->getElements(); |
| 164 | 164 |
|
| 165 | 165 |
for (int i = 0; i < n; ++i) {
|
| 166 | 166 |
CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[i]; |
| 167 | 167 |
CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[i]; |
| 168 | 168 |
|
| 169 | 169 |
const int* it = std::lower_bound(indices + begin, indices + end, ix); |
| 170 | 170 |
if (it != indices + end && *it == ix) {
|
| 171 | 171 |
*b = std::make_pair(i, elements[it - indices]); |
| 172 | 172 |
} |
| 173 | 173 |
} |
| 174 | 174 |
} |
| 175 | 175 |
|
| 176 | 176 |
void ClpLp::_setColCoeffs(int ix, ExprIterator b, ExprIterator e) {
|
| 177 | 177 |
std::map<int, Value> coeffs; |
| 178 | 178 |
|
| 179 | 179 |
CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix]; |
| 180 | 180 |
CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix]; |
| 181 | 181 |
|
| 182 | 182 |
const int* indices = _prob->clpMatrix()->getIndices(); |
| 183 | 183 |
const double* elements = _prob->clpMatrix()->getElements(); |
| 184 | 184 |
|
| 185 | 185 |
for (CoinBigIndex i = begin; i != end; ++i) {
|
| 186 | 186 |
if (elements[i] != 0.0) {
|
| 187 | 187 |
coeffs[indices[i]] = 0.0; |
| 188 | 188 |
} |
| 189 | 189 |
} |
| 190 | 190 |
for (ExprIterator it = b; it != e; ++it) {
|
| 191 | 191 |
coeffs[it->first] = it->second; |
| 192 | 192 |
} |
| 193 | 193 |
for (std::map<int, Value>::iterator it = coeffs.begin(); |
| 194 | 194 |
it != coeffs.end(); ++it) {
|
| 195 | 195 |
_prob->modifyCoefficient(it->first, ix, it->second); |
| 196 | 196 |
} |
| 197 | 197 |
} |
| 198 | 198 |
|
| 199 | 199 |
void ClpLp::_getColCoeffs(int ix, InsertIterator b) const {
|
| 200 | 200 |
CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix]; |
| 201 | 201 |
CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix]; |
| 202 | 202 |
|
| 203 | 203 |
const int* indices = _prob->clpMatrix()->getIndices(); |
| 204 | 204 |
const double* elements = _prob->clpMatrix()->getElements(); |
| 205 | 205 |
|
| 206 | 206 |
for (CoinBigIndex i = begin; i != end; ++i) {
|
| 207 | 207 |
*b = std::make_pair(indices[i], elements[i]); |
| 208 | 208 |
++b; |
| 209 | 209 |
} |
| 210 | 210 |
} |
| 211 | 211 |
|
| 212 | 212 |
void ClpLp::_setCoeff(int ix, int jx, Value value) {
|
| 213 | 213 |
_prob->modifyCoefficient(ix, jx, value); |
| 214 | 214 |
} |
| 215 | 215 |
|
| 216 | 216 |
ClpLp::Value ClpLp::_getCoeff(int ix, int jx) const {
|
| 217 | 217 |
CoinBigIndex begin = _prob->clpMatrix()->getVectorStarts()[ix]; |
| 218 | 218 |
CoinBigIndex end = begin + _prob->clpMatrix()->getVectorLengths()[ix]; |
| 219 | 219 |
|
| 220 | 220 |
const int* indices = _prob->clpMatrix()->getIndices(); |
| 221 | 221 |
const double* elements = _prob->clpMatrix()->getElements(); |
| 222 | 222 |
|
| 223 | 223 |
const int* it = std::lower_bound(indices + begin, indices + end, jx); |
| 224 | 224 |
if (it != indices + end && *it == jx) {
|
| 225 | 225 |
return elements[it - indices]; |
| 226 | 226 |
} else {
|
| 227 | 227 |
return 0.0; |
| 228 | 228 |
} |
| 229 | 229 |
} |
| 230 | 230 |
|
| 231 | 231 |
void ClpLp::_setColLowerBound(int i, Value lo) {
|
| 232 | 232 |
_prob->setColumnLower(i, lo == - INF ? - COIN_DBL_MAX : lo); |
| 233 | 233 |
} |
| 234 | 234 |
|
| 235 | 235 |
ClpLp::Value ClpLp::_getColLowerBound(int i) const {
|
| 236 | 236 |
double val = _prob->getColLower()[i]; |
| 237 | 237 |
return val == - COIN_DBL_MAX ? - INF : val; |
| 238 | 238 |
} |
| 239 | 239 |
|
| 240 | 240 |
void ClpLp::_setColUpperBound(int i, Value up) {
|
| 241 | 241 |
_prob->setColumnUpper(i, up == INF ? COIN_DBL_MAX : up); |
| 242 | 242 |
} |
| 243 | 243 |
|
| 244 | 244 |
ClpLp::Value ClpLp::_getColUpperBound(int i) const {
|
| 245 | 245 |
double val = _prob->getColUpper()[i]; |
| 246 | 246 |
return val == COIN_DBL_MAX ? INF : val; |
| 247 | 247 |
} |
| 248 | 248 |
|
| 249 | 249 |
void ClpLp::_setRowLowerBound(int i, Value lo) {
|
| 250 | 250 |
_prob->setRowLower(i, lo == - INF ? - COIN_DBL_MAX : lo); |
| 251 | 251 |
} |
| 252 | 252 |
|
| 253 | 253 |
ClpLp::Value ClpLp::_getRowLowerBound(int i) const {
|
| 254 | 254 |
double val = _prob->getRowLower()[i]; |
| 255 | 255 |
return val == - COIN_DBL_MAX ? - INF : val; |
| 256 | 256 |
} |
| 257 | 257 |
|
| 258 | 258 |
void ClpLp::_setRowUpperBound(int i, Value up) {
|
| 259 | 259 |
_prob->setRowUpper(i, up == INF ? COIN_DBL_MAX : up); |
| 260 | 260 |
} |
| 261 | 261 |
|
| 262 | 262 |
ClpLp::Value ClpLp::_getRowUpperBound(int i) const {
|
| 263 | 263 |
double val = _prob->getRowUpper()[i]; |
| 264 | 264 |
return val == COIN_DBL_MAX ? INF : val; |
| 265 | 265 |
} |
| 266 | 266 |
|
| 267 | 267 |
void ClpLp::_setObjCoeffs(ExprIterator b, ExprIterator e) {
|
| 268 | 268 |
int num = _prob->clpMatrix()->getNumCols(); |
| 269 | 269 |
for (int i = 0; i < num; ++i) {
|
| 270 | 270 |
_prob->setObjectiveCoefficient(i, 0.0); |
| 271 | 271 |
} |
| 272 | 272 |
for (ExprIterator it = b; it != e; ++it) {
|
| 273 | 273 |
_prob->setObjectiveCoefficient(it->first, it->second); |
| 274 | 274 |
} |
| 275 | 275 |
} |
| 276 | 276 |
|
| 277 | 277 |
void ClpLp::_getObjCoeffs(InsertIterator b) const {
|
| 278 | 278 |
int num = _prob->clpMatrix()->getNumCols(); |
| 279 | 279 |
for (int i = 0; i < num; ++i) {
|
| 280 | 280 |
Value coef = _prob->getObjCoefficients()[i]; |
| 281 | 281 |
if (coef != 0.0) {
|
| 282 | 282 |
*b = std::make_pair(i, coef); |
| 283 | 283 |
++b; |
| 284 | 284 |
} |
| 285 | 285 |
} |
| 286 | 286 |
} |
| 287 | 287 |
|
| 288 | 288 |
void ClpLp::_setObjCoeff(int i, Value obj_coef) {
|
| 289 | 289 |
_prob->setObjectiveCoefficient(i, obj_coef); |
| 290 | 290 |
} |
| 291 | 291 |
|
| 292 | 292 |
ClpLp::Value ClpLp::_getObjCoeff(int i) const {
|
| 293 | 293 |
return _prob->getObjCoefficients()[i]; |
| 294 | 294 |
} |
| 295 | 295 |
|
| 296 | 296 |
ClpLp::SolveExitStatus ClpLp::_solve() {
|
| 297 | 297 |
return _prob->primal() >= 0 ? SOLVED : UNSOLVED; |
| 298 | 298 |
} |
| 299 | 299 |
|
| 300 | 300 |
ClpLp::SolveExitStatus ClpLp::solvePrimal() {
|
| 301 | 301 |
return _prob->primal() >= 0 ? SOLVED : UNSOLVED; |
| 302 | 302 |
} |
| 303 | 303 |
|
| 304 | 304 |
ClpLp::SolveExitStatus ClpLp::solveDual() {
|
| 305 | 305 |
return _prob->dual() >= 0 ? SOLVED : UNSOLVED; |
| 306 | 306 |
} |
| 307 | 307 |
|
| 308 | 308 |
ClpLp::SolveExitStatus ClpLp::solveBarrier() {
|
| 309 | 309 |
return _prob->barrier() >= 0 ? SOLVED : UNSOLVED; |
| 310 | 310 |
} |
| 311 | 311 |
|
| 312 | 312 |
ClpLp::Value ClpLp::_getPrimal(int i) const {
|
| 313 | 313 |
return _prob->primalColumnSolution()[i]; |
| 314 | 314 |
} |
| 315 | 315 |
ClpLp::Value ClpLp::_getPrimalValue() const {
|
| 316 | 316 |
return _prob->objectiveValue(); |
| 317 | 317 |
} |
| 318 | 318 |
|
| 319 | 319 |
ClpLp::Value ClpLp::_getDual(int i) const {
|
| 320 | 320 |
return _prob->dualRowSolution()[i]; |
| 321 | 321 |
} |
| 322 | 322 |
|
| 323 | 323 |
ClpLp::Value ClpLp::_getPrimalRay(int i) const {
|
| 324 | 324 |
if (!_primal_ray) {
|
| 325 | 325 |
_primal_ray = _prob->unboundedRay(); |
| 326 | 326 |
LEMON_ASSERT(_primal_ray != 0, "Primal ray is not provided"); |
| 327 | 327 |
} |
| 328 | 328 |
return _primal_ray[i]; |
| 329 | 329 |
} |
| 330 | 330 |
|
| 331 | 331 |
ClpLp::Value ClpLp::_getDualRay(int i) const {
|
| 332 | 332 |
if (!_dual_ray) {
|
| 333 | 333 |
_dual_ray = _prob->infeasibilityRay(); |
| 334 | 334 |
LEMON_ASSERT(_dual_ray != 0, "Dual ray is not provided"); |
| 335 | 335 |
} |
| 336 | 336 |
return _dual_ray[i]; |
| 337 | 337 |
} |
| 338 | 338 |
|
| 339 | 339 |
ClpLp::VarStatus ClpLp::_getColStatus(int i) const {
|
| 340 | 340 |
switch (_prob->getColumnStatus(i)) {
|
| 341 | 341 |
case ClpSimplex::basic: |
| 342 | 342 |
return BASIC; |
| 343 | 343 |
case ClpSimplex::isFree: |
| 344 | 344 |
return FREE; |
| 345 | 345 |
case ClpSimplex::atUpperBound: |
| 346 | 346 |
return UPPER; |
| 347 | 347 |
case ClpSimplex::atLowerBound: |
| 348 | 348 |
return LOWER; |
| 349 | 349 |
case ClpSimplex::isFixed: |
| 350 | 350 |
return FIXED; |
| 351 | 351 |
case ClpSimplex::superBasic: |
| 352 | 352 |
return FREE; |
| 353 | 353 |
default: |
| 354 | 354 |
LEMON_ASSERT(false, "Wrong column status"); |
| 355 | 355 |
return VarStatus(); |
| 356 | 356 |
} |
| 357 | 357 |
} |
| 358 | 358 |
|
| 359 | 359 |
ClpLp::VarStatus ClpLp::_getRowStatus(int i) const {
|
| 360 | 360 |
switch (_prob->getColumnStatus(i)) {
|
| 361 | 361 |
case ClpSimplex::basic: |
| 362 | 362 |
return BASIC; |
| 363 | 363 |
case ClpSimplex::isFree: |
| 364 | 364 |
return FREE; |
| 365 | 365 |
case ClpSimplex::atUpperBound: |
| 366 | 366 |
return UPPER; |
| 367 | 367 |
case ClpSimplex::atLowerBound: |
| 368 | 368 |
return LOWER; |
| 369 | 369 |
case ClpSimplex::isFixed: |
| 370 | 370 |
return FIXED; |
| 371 | 371 |
case ClpSimplex::superBasic: |
| 372 | 372 |
return FREE; |
| 373 | 373 |
default: |
| 374 | 374 |
LEMON_ASSERT(false, "Wrong row status"); |
| 375 | 375 |
return VarStatus(); |
| 376 | 376 |
} |
| 377 | 377 |
} |
| 378 | 378 |
|
| 379 | 379 |
|
| 380 | 380 |
ClpLp::ProblemType ClpLp::_getPrimalType() const {
|
| 381 | 381 |
if (_prob->isProvenOptimal()) {
|
| 382 | 382 |
return OPTIMAL; |
| 383 | 383 |
} else if (_prob->isProvenPrimalInfeasible()) {
|
| 384 | 384 |
return INFEASIBLE; |
| 385 | 385 |
} else if (_prob->isProvenDualInfeasible()) {
|
| 386 | 386 |
return UNBOUNDED; |
| 387 | 387 |
} else {
|
| 388 | 388 |
return UNDEFINED; |
| 389 | 389 |
} |
| 390 | 390 |
} |
| 391 | 391 |
|
| 392 | 392 |
ClpLp::ProblemType ClpLp::_getDualType() const {
|
| 393 | 393 |
if (_prob->isProvenOptimal()) {
|
| 394 | 394 |
return OPTIMAL; |
| 395 | 395 |
} else if (_prob->isProvenDualInfeasible()) {
|
| 396 | 396 |
return INFEASIBLE; |
| 397 | 397 |
} else if (_prob->isProvenPrimalInfeasible()) {
|
| 398 | 398 |
return INFEASIBLE; |
| 399 | 399 |
} else {
|
| 400 | 400 |
return UNDEFINED; |
| 401 | 401 |
} |
| 402 | 402 |
} |
| 403 | 403 |
|
| 404 | 404 |
void ClpLp::_setSense(ClpLp::Sense sense) {
|
| 405 | 405 |
switch (sense) {
|
| 406 | 406 |
case MIN: |
| 407 | 407 |
_prob->setOptimizationDirection(1); |
| 408 | 408 |
break; |
| 409 | 409 |
case MAX: |
| 410 | 410 |
_prob->setOptimizationDirection(-1); |
| 411 | 411 |
break; |
| 412 | 412 |
} |
| 413 | 413 |
} |
| 414 | 414 |
|
| 415 | 415 |
ClpLp::Sense ClpLp::_getSense() const {
|
| 416 | 416 |
double dir = _prob->optimizationDirection(); |
| 417 | 417 |
if (dir > 0.0) {
|
| 418 | 418 |
return MIN; |
| 419 | 419 |
} else {
|
| 420 | 420 |
return MAX; |
| 421 | 421 |
} |
| 422 | 422 |
} |
| 423 | 423 |
|
| 424 | 424 |
void ClpLp::_clear() {
|
| 425 | 425 |
delete _prob; |
| 426 | 426 |
_prob = new ClpSimplex(); |
| 427 | 427 |
rows.clear(); |
| 428 | 428 |
cols.clear(); |
| 429 | 429 |
_col_names_ref.clear(); |
| 430 | 430 |
_clear_temporals(); |
| 431 | 431 |
} |
| 432 | 432 |
|
| 433 |
void ClpLp::messageLevel(MessageLevel m) {
|
|
| 434 |
_prob->setLogLevel(static_cast<int>(m)); |
|
| 433 |
void ClpLp::_messageLevel(MessageLevel level) {
|
|
| 434 |
switch (level) {
|
|
| 435 |
case MESSAGE_NOTHING: |
|
| 436 |
_prob->setLogLevel(0); |
|
| 437 |
break; |
|
| 438 |
case MESSAGE_ERROR: |
|
| 439 |
_prob->setLogLevel(1); |
|
| 440 |
break; |
|
| 441 |
case MESSAGE_WARNING: |
|
| 442 |
_prob->setLogLevel(2); |
|
| 443 |
break; |
|
| 444 |
case MESSAGE_NORMAL: |
|
| 445 |
_prob->setLogLevel(3); |
|
| 446 |
break; |
|
| 447 |
case MESSAGE_VERBOSE: |
|
| 448 |
_prob->setLogLevel(4); |
|
| 449 |
break; |
|
| 450 |
} |
|
| 435 | 451 |
} |
| 436 | 452 |
|
| 437 | 453 |
} //END OF NAMESPACE LEMON |
| 1 | 1 |
/* -*- mode: C++; indent-tabs-mode: nil; -*- |
| 2 | 2 |
* |
| 3 | 3 |
* This file is a part of LEMON, a generic C++ optimization library. |
| 4 | 4 |
* |
| 5 | 5 |
* Copyright (C) 2003-2008 |
| 6 | 6 |
* Egervary Jeno Kombinatorikus Optimalizalasi Kutatocsoport |
| 7 | 7 |
* (Egervary Research Group on Combinatorial Optimization, EGRES). |
| 8 | 8 |
* |
| 9 | 9 |
* Permission to use, modify and distribute this software is granted |
| 10 | 10 |
* provided that this copyright notice appears in all copies. For |
| 11 | 11 |
* precise terms see the accompanying LICENSE file. |
| 12 | 12 |
* |
| 13 | 13 |
* This software is provided "AS IS" with no warranty of any kind, |
| 14 | 14 |
* express or implied, and with no claim as to its suitability for any |
| 15 | 15 |
* purpose. |
| 16 | 16 |
* |
| 17 | 17 |
*/ |
| 18 | 18 |
|
| 19 | 19 |
#ifndef LEMON_CLP_H |
| 20 | 20 |
#define LEMON_CLP_H |
| 21 | 21 |
|
| 22 | 22 |
///\file |
| 23 | 23 |
///\brief Header of the LEMON-CLP lp solver interface. |
| 24 | 24 |
|
| 25 | 25 |
#include <vector> |
| 26 | 26 |
#include <string> |
| 27 | 27 |
|
| 28 | 28 |
#include <lemon/lp_base.h> |
| 29 | 29 |
|
| 30 | 30 |
class ClpSimplex; |
| 31 | 31 |
|
| 32 | 32 |
namespace lemon {
|
| 33 | 33 |
|
| 34 | 34 |
/// \ingroup lp_group |
| 35 | 35 |
/// |
| 36 | 36 |
/// \brief Interface for the CLP solver |
| 37 | 37 |
/// |
| 38 | 38 |
/// This class implements an interface for the Clp LP solver. The |
| 39 | 39 |
/// Clp library is an object oriented lp solver library developed at |
| 40 | 40 |
/// the IBM. The CLP is part of the COIN-OR package and it can be |
| 41 | 41 |
/// used with Common Public License. |
| 42 | 42 |
class ClpLp : public LpSolver {
|
| 43 | 43 |
protected: |
| 44 | 44 |
|
| 45 | 45 |
ClpSimplex* _prob; |
| 46 | 46 |
|
| 47 | 47 |
std::map<std::string, int> _col_names_ref; |
| 48 | 48 |
std::map<std::string, int> _row_names_ref; |
| 49 | 49 |
|
| 50 | 50 |
public: |
| 51 | 51 |
|
| 52 | 52 |
/// \e |
| 53 | 53 |
ClpLp(); |
| 54 | 54 |
/// \e |
| 55 | 55 |
ClpLp(const ClpLp&); |
| 56 | 56 |
/// \e |
| 57 | 57 |
~ClpLp(); |
| 58 | 58 |
|
| 59 | 59 |
/// \e |
| 60 | 60 |
virtual ClpLp* newSolver() const; |
| 61 | 61 |
/// \e |
| 62 | 62 |
virtual ClpLp* cloneSolver() const; |
| 63 | 63 |
|
| 64 | 64 |
protected: |
| 65 | 65 |
|
| 66 | 66 |
mutable double* _primal_ray; |
| 67 | 67 |
mutable double* _dual_ray; |
| 68 | 68 |
|
| 69 | 69 |
void _init_temporals(); |
| 70 | 70 |
void _clear_temporals(); |
| 71 | 71 |
|
| 72 | 72 |
protected: |
| 73 | 73 |
|
| 74 | 74 |
virtual const char* _solverName() const; |
| 75 | 75 |
|
| 76 | 76 |
virtual int _addCol(); |
| 77 | 77 |
virtual int _addRow(); |
| 78 | 78 |
|
| 79 | 79 |
virtual void _eraseCol(int i); |
| 80 | 80 |
virtual void _eraseRow(int i); |
| 81 | 81 |
|
| 82 | 82 |
virtual void _eraseColId(int i); |
| 83 | 83 |
virtual void _eraseRowId(int i); |
| 84 | 84 |
|
| 85 | 85 |
virtual void _getColName(int col, std::string& name) const; |
| 86 | 86 |
virtual void _setColName(int col, const std::string& name); |
| 87 | 87 |
virtual int _colByName(const std::string& name) const; |
| 88 | 88 |
|
| 89 | 89 |
virtual void _getRowName(int row, std::string& name) const; |
| 90 | 90 |
virtual void _setRowName(int row, const std::string& name); |
| 91 | 91 |
virtual int _rowByName(const std::string& name) const; |
| 92 | 92 |
|
| 93 | 93 |
virtual void _setRowCoeffs(int i, ExprIterator b, ExprIterator e); |
| 94 | 94 |
virtual void _getRowCoeffs(int i, InsertIterator b) const; |
| 95 | 95 |
|
| 96 | 96 |
virtual void _setColCoeffs(int i, ExprIterator b, ExprIterator e); |
| 97 | 97 |
virtual void _getColCoeffs(int i, InsertIterator b) const; |
| 98 | 98 |
|
| 99 | 99 |
virtual void _setCoeff(int row, int col, Value value); |
| 100 | 100 |
virtual Value _getCoeff(int row, int col) const; |
| 101 | 101 |
|
| 102 | 102 |
virtual void _setColLowerBound(int i, Value value); |
| 103 | 103 |
virtual Value _getColLowerBound(int i) const; |
| 104 | 104 |
virtual void _setColUpperBound(int i, Value value); |
| 105 | 105 |
virtual Value _getColUpperBound(int i) const; |
| 106 | 106 |
|
| 107 | 107 |
virtual void _setRowLowerBound(int i, Value value); |
| 108 | 108 |
virtual Value _getRowLowerBound(int i) const; |
| 109 | 109 |
virtual void _setRowUpperBound(int i, Value value); |
| 110 | 110 |
virtual Value _getRowUpperBound(int i) const; |
| 111 | 111 |
|
| 112 | 112 |
virtual void _setObjCoeffs(ExprIterator, ExprIterator); |
| 113 | 113 |
virtual void _getObjCoeffs(InsertIterator) const; |
| 114 | 114 |
|
| 115 | 115 |
virtual void _setObjCoeff(int i, Value obj_coef); |
| 116 | 116 |
virtual Value _getObjCoeff(int i) const; |
| 117 | 117 |
|
| 118 | 118 |
virtual void _setSense(Sense sense); |
| 119 | 119 |
virtual Sense _getSense() const; |
| 120 | 120 |
|
| 121 | 121 |
virtual SolveExitStatus _solve(); |
| 122 | 122 |
|
| 123 | 123 |
virtual Value _getPrimal(int i) const; |
| 124 | 124 |
virtual Value _getDual(int i) const; |
| 125 | 125 |
|
| 126 | 126 |
virtual Value _getPrimalValue() const; |
| 127 | 127 |
|
| 128 | 128 |
virtual Value _getPrimalRay(int i) const; |
| 129 | 129 |
virtual Value _getDualRay(int i) const; |
| 130 | 130 |
|
| 131 | 131 |
virtual VarStatus _getColStatus(int i) const; |
| 132 | 132 |
virtual VarStatus _getRowStatus(int i) const; |
| 133 | 133 |
|
| 134 | 134 |
virtual ProblemType _getPrimalType() const; |
| 135 | 135 |
virtual ProblemType _getDualType() const; |
| 136 | 136 |
|
| 137 | 137 |
virtual void _clear(); |
| 138 | 138 |
|
| 139 |
virtual void _messageLevel(MessageLevel); |
|
| 140 |
|
|
| 139 | 141 |
public: |
| 140 | 142 |
|
| 141 | 143 |
///Solves LP with primal simplex method. |
| 142 | 144 |
SolveExitStatus solvePrimal(); |
| 143 | 145 |
|
| 144 | 146 |
///Solves LP with dual simplex method. |
| 145 | 147 |
SolveExitStatus solveDual(); |
| 146 | 148 |
|
| 147 | 149 |
///Solves LP with barrier method. |
| 148 | 150 |
SolveExitStatus solveBarrier(); |
| 149 | 151 |
|
| 150 | 152 |
///Returns the constraint identifier understood by CLP. |
| 151 | 153 |
int clpRow(Row r) const { return rows(id(r)); }
|
| 152 | 154 |
|
| 153 | 155 |
///Returns the variable identifier understood by CLP. |
| 154 | 156 |
int clpCol(Col c) const { return cols(id(c)); }
|
| 155 | 157 |
|
| 156 |
///Enum for \c messageLevel() parameter |
|
| 157 |
enum MessageLevel {
|
|
| 158 |
/// no output (default value) |
|
| 159 |
MESSAGE_NO_OUTPUT = 0, |
|
| 160 |
/// print final solution |
|
| 161 |
MESSAGE_FINAL_SOLUTION = 1, |
|
| 162 |
/// print factorization |
|
| 163 |
MESSAGE_FACTORIZATION = 2, |
|
| 164 |
/// normal output |
|
| 165 |
MESSAGE_NORMAL_OUTPUT = 3, |
|
| 166 |
/// verbose output |
|
| 167 |
MESSAGE_VERBOSE_OUTPUT = 4 |
|
| 168 |
}; |
|
| 169 |
///Set the verbosity of the messages |
|
| 170 |
|
|
| 171 |
///Set the verbosity of the messages |
|
| 172 |
/// |
|
| 173 |
///\param m is the level of the messages output by the solver routines. |
|
| 174 |
void messageLevel(MessageLevel m); |
|
| 175 |
|
|
| 176 | 158 |
}; |
| 177 | 159 |
|
| 178 | 160 |
} //END OF NAMESPACE LEMON |
| 179 | 161 |
|
| 180 | 162 |
#endif //LEMON_CLP_H |
| 181 | 163 |
| ... | ... |
@@ -40,448 +40,449 @@ |
| 40 | 40 |
/// |
| 41 | 41 |
/// Note that actual digraph implementation like @ref ListDigraph or |
| 42 | 42 |
/// @ref SmartDigraph may have several additional functionality. |
| 43 | 43 |
/// |
| 44 | 44 |
/// \sa concept |
| 45 | 45 |
class Digraph {
|
| 46 | 46 |
private: |
| 47 | 47 |
///Digraphs are \e not copy constructible. Use DigraphCopy() instead. |
| 48 | 48 |
|
| 49 | 49 |
///Digraphs are \e not copy constructible. Use DigraphCopy() instead. |
| 50 | 50 |
/// |
| 51 | 51 |
Digraph(const Digraph &) {};
|
| 52 | 52 |
///\brief Assignment of \ref Digraph "Digraph"s to another ones are |
| 53 | 53 |
///\e not allowed. Use DigraphCopy() instead. |
| 54 | 54 |
|
| 55 | 55 |
///Assignment of \ref Digraph "Digraph"s to another ones are |
| 56 | 56 |
///\e not allowed. Use DigraphCopy() instead. |
| 57 | 57 |
|
| 58 | 58 |
void operator=(const Digraph &) {}
|
| 59 | 59 |
public: |
| 60 | 60 |
///\e |
| 61 | 61 |
|
| 62 | 62 |
/// Defalult constructor. |
| 63 | 63 |
|
| 64 | 64 |
/// Defalult constructor. |
| 65 | 65 |
/// |
| 66 | 66 |
Digraph() { }
|
| 67 | 67 |
/// Class for identifying a node of the digraph |
| 68 | 68 |
|
| 69 | 69 |
/// This class identifies a node of the digraph. It also serves |
| 70 | 70 |
/// as a base class of the node iterators, |
| 71 | 71 |
/// thus they will convert to this type. |
| 72 | 72 |
class Node {
|
| 73 | 73 |
public: |
| 74 | 74 |
/// Default constructor |
| 75 | 75 |
|
| 76 | 76 |
/// @warning The default constructor sets the iterator |
| 77 | 77 |
/// to an undefined value. |
| 78 | 78 |
Node() { }
|
| 79 | 79 |
/// Copy constructor. |
| 80 | 80 |
|
| 81 | 81 |
/// Copy constructor. |
| 82 | 82 |
/// |
| 83 | 83 |
Node(const Node&) { }
|
| 84 | 84 |
|
| 85 | 85 |
/// Invalid constructor \& conversion. |
| 86 | 86 |
|
| 87 | 87 |
/// This constructor initializes the iterator to be invalid. |
| 88 | 88 |
/// \sa Invalid for more details. |
| 89 | 89 |
Node(Invalid) { }
|
| 90 | 90 |
/// Equality operator |
| 91 | 91 |
|
| 92 | 92 |
/// Two iterators are equal if and only if they point to the |
| 93 | 93 |
/// same object or both are invalid. |
| 94 | 94 |
bool operator==(Node) const { return true; }
|
| 95 | 95 |
|
| 96 | 96 |
/// Inequality operator |
| 97 | 97 |
|
| 98 | 98 |
/// \sa operator==(Node n) |
| 99 | 99 |
/// |
| 100 | 100 |
bool operator!=(Node) const { return true; }
|
| 101 | 101 |
|
| 102 | 102 |
/// Artificial ordering operator. |
| 103 | 103 |
|
| 104 | 104 |
/// To allow the use of digraph descriptors as key type in std::map or |
| 105 | 105 |
/// similar associative container we require this. |
| 106 | 106 |
/// |
| 107 | 107 |
/// \note This operator only have to define some strict ordering of |
| 108 | 108 |
/// the items; this order has nothing to do with the iteration |
| 109 | 109 |
/// ordering of the items. |
| 110 | 110 |
bool operator<(Node) const { return false; }
|
| 111 | 111 |
|
| 112 | 112 |
}; |
| 113 | 113 |
|
| 114 | 114 |
/// This iterator goes through each node. |
| 115 | 115 |
|
| 116 | 116 |
/// This iterator goes through each node. |
| 117 | 117 |
/// Its usage is quite simple, for example you can count the number |
| 118 | 118 |
/// of nodes in digraph \c g of type \c Digraph like this: |
| 119 | 119 |
///\code |
| 120 | 120 |
/// int count=0; |
| 121 | 121 |
/// for (Digraph::NodeIt n(g); n!=INVALID; ++n) ++count; |
| 122 | 122 |
///\endcode |
| 123 | 123 |
class NodeIt : public Node {
|
| 124 | 124 |
public: |
| 125 | 125 |
/// Default constructor |
| 126 | 126 |
|
| 127 | 127 |
/// @warning The default constructor sets the iterator |
| 128 | 128 |
/// to an undefined value. |
| 129 | 129 |
NodeIt() { }
|
| 130 | 130 |
/// Copy constructor. |
| 131 | 131 |
|
| 132 | 132 |
/// Copy constructor. |
| 133 | 133 |
/// |
| 134 | 134 |
NodeIt(const NodeIt& n) : Node(n) { }
|
| 135 | 135 |
/// Invalid constructor \& conversion. |
| 136 | 136 |
|
| 137 | 137 |
/// Initialize the iterator to be invalid. |
| 138 | 138 |
/// \sa Invalid for more details. |
| 139 | 139 |
NodeIt(Invalid) { }
|
| 140 | 140 |
/// Sets the iterator to the first node. |
| 141 | 141 |
|
| 142 | 142 |
/// Sets the iterator to the first node of \c g. |
| 143 | 143 |
/// |
| 144 | 144 |
NodeIt(const Digraph&) { }
|
| 145 | 145 |
/// Node -> NodeIt conversion. |
| 146 | 146 |
|
| 147 | 147 |
/// Sets the iterator to the node of \c the digraph pointed by |
| 148 | 148 |
/// the trivial iterator. |
| 149 | 149 |
/// This feature necessitates that each time we |
| 150 | 150 |
/// iterate the arc-set, the iteration order is the same. |
| 151 | 151 |
NodeIt(const Digraph&, const Node&) { }
|
| 152 | 152 |
/// Next node. |
| 153 | 153 |
|
| 154 | 154 |
/// Assign the iterator to the next node. |
| 155 | 155 |
/// |
| 156 | 156 |
NodeIt& operator++() { return *this; }
|
| 157 | 157 |
}; |
| 158 | 158 |
|
| 159 | 159 |
|
| 160 | 160 |
/// Class for identifying an arc of the digraph |
| 161 | 161 |
|
| 162 | 162 |
/// This class identifies an arc of the digraph. It also serves |
| 163 | 163 |
/// as a base class of the arc iterators, |
| 164 | 164 |
/// thus they will convert to this type. |
| 165 | 165 |
class Arc {
|
| 166 | 166 |
public: |
| 167 | 167 |
/// Default constructor |
| 168 | 168 |
|
| 169 | 169 |
/// @warning The default constructor sets the iterator |
| 170 | 170 |
/// to an undefined value. |
| 171 | 171 |
Arc() { }
|
| 172 | 172 |
/// Copy constructor. |
| 173 | 173 |
|
| 174 | 174 |
/// Copy constructor. |
| 175 | 175 |
/// |
| 176 | 176 |
Arc(const Arc&) { }
|
| 177 | 177 |
/// Initialize the iterator to be invalid. |
| 178 | 178 |
|
| 179 | 179 |
/// Initialize the iterator to be invalid. |
| 180 | 180 |
/// |
| 181 | 181 |
Arc(Invalid) { }
|
| 182 | 182 |
/// Equality operator |
| 183 | 183 |
|
| 184 | 184 |
/// Two iterators are equal if and only if they point to the |
| 185 | 185 |
/// same object or both are invalid. |
| 186 | 186 |
bool operator==(Arc) const { return true; }
|
| 187 | 187 |
/// Inequality operator |
| 188 | 188 |
|
| 189 | 189 |
/// \sa operator==(Arc n) |
| 190 | 190 |
/// |
| 191 | 191 |
bool operator!=(Arc) const { return true; }
|
| 192 | 192 |
|
| 193 | 193 |
/// Artificial ordering operator. |
| 194 | 194 |
|
| 195 | 195 |
/// To allow the use of digraph descriptors as key type in std::map or |
| 196 | 196 |
/// similar associative container we require this. |
| 197 | 197 |
/// |
| 198 | 198 |
/// \note This operator only have to define some strict ordering of |
| 199 | 199 |
/// the items; this order has nothing to do with the iteration |
| 200 | 200 |
/// ordering of the items. |
| 201 | 201 |
bool operator<(Arc) const { return false; }
|
| 202 | 202 |
}; |
| 203 | 203 |
|
| 204 | 204 |
/// This iterator goes trough the outgoing arcs of a node. |
| 205 | 205 |
|
| 206 | 206 |
/// This iterator goes trough the \e outgoing arcs of a certain node |
| 207 | 207 |
/// of a digraph. |
| 208 | 208 |
/// Its usage is quite simple, for example you can count the number |
| 209 | 209 |
/// of outgoing arcs of a node \c n |
| 210 | 210 |
/// in digraph \c g of type \c Digraph as follows. |
| 211 | 211 |
///\code |
| 212 | 212 |
/// int count=0; |
| 213 | 213 |
/// for (Digraph::OutArcIt e(g, n); e!=INVALID; ++e) ++count; |
| 214 | 214 |
///\endcode |
| 215 | 215 |
|
| 216 | 216 |
class OutArcIt : public Arc {
|
| 217 | 217 |
public: |
| 218 | 218 |
/// Default constructor |
| 219 | 219 |
|
| 220 | 220 |
/// @warning The default constructor sets the iterator |
| 221 | 221 |
/// to an undefined value. |
| 222 | 222 |
OutArcIt() { }
|
| 223 | 223 |
/// Copy constructor. |
| 224 | 224 |
|
| 225 | 225 |
/// Copy constructor. |
| 226 | 226 |
/// |
| 227 | 227 |
OutArcIt(const OutArcIt& e) : Arc(e) { }
|
| 228 | 228 |
/// Initialize the iterator to be invalid. |
| 229 | 229 |
|
| 230 | 230 |
/// Initialize the iterator to be invalid. |
| 231 | 231 |
/// |
| 232 | 232 |
OutArcIt(Invalid) { }
|
| 233 | 233 |
/// This constructor sets the iterator to the first outgoing arc. |
| 234 | 234 |
|
| 235 | 235 |
/// This constructor sets the iterator to the first outgoing arc of |
| 236 | 236 |
/// the node. |
| 237 | 237 |
OutArcIt(const Digraph&, const Node&) { }
|
| 238 | 238 |
/// Arc -> OutArcIt conversion |
| 239 | 239 |
|
| 240 | 240 |
/// Sets the iterator to the value of the trivial iterator. |
| 241 | 241 |
/// This feature necessitates that each time we |
| 242 | 242 |
/// iterate the arc-set, the iteration order is the same. |
| 243 | 243 |
OutArcIt(const Digraph&, const Arc&) { }
|
| 244 | 244 |
///Next outgoing arc |
| 245 | 245 |
|
| 246 | 246 |
/// Assign the iterator to the next |
| 247 | 247 |
/// outgoing arc of the corresponding node. |
| 248 | 248 |
OutArcIt& operator++() { return *this; }
|
| 249 | 249 |
}; |
| 250 | 250 |
|
| 251 | 251 |
/// This iterator goes trough the incoming arcs of a node. |
| 252 | 252 |
|
| 253 | 253 |
/// This iterator goes trough the \e incoming arcs of a certain node |
| 254 | 254 |
/// of a digraph. |
| 255 | 255 |
/// Its usage is quite simple, for example you can count the number |
| 256 | 256 |
/// of outgoing arcs of a node \c n |
| 257 | 257 |
/// in digraph \c g of type \c Digraph as follows. |
| 258 | 258 |
///\code |
| 259 | 259 |
/// int count=0; |
| 260 | 260 |
/// for(Digraph::InArcIt e(g, n); e!=INVALID; ++e) ++count; |
| 261 | 261 |
///\endcode |
| 262 | 262 |
|
| 263 | 263 |
class InArcIt : public Arc {
|
| 264 | 264 |
public: |
| 265 | 265 |
/// Default constructor |
| 266 | 266 |
|
| 267 | 267 |
/// @warning The default constructor sets the iterator |
| 268 | 268 |
/// to an undefined value. |
| 269 | 269 |
InArcIt() { }
|
| 270 | 270 |
/// Copy constructor. |
| 271 | 271 |
|
| 272 | 272 |
/// Copy constructor. |
| 273 | 273 |
/// |
| 274 | 274 |
InArcIt(const InArcIt& e) : Arc(e) { }
|
| 275 | 275 |
/// Initialize the iterator to be invalid. |
| 276 | 276 |
|
| 277 | 277 |
/// Initialize the iterator to be invalid. |
| 278 | 278 |
/// |
| 279 | 279 |
InArcIt(Invalid) { }
|
| 280 | 280 |
/// This constructor sets the iterator to first incoming arc. |
| 281 | 281 |
|
| 282 | 282 |
/// This constructor set the iterator to the first incoming arc of |
| 283 | 283 |
/// the node. |
| 284 | 284 |
InArcIt(const Digraph&, const Node&) { }
|
| 285 | 285 |
/// Arc -> InArcIt conversion |
| 286 | 286 |
|
| 287 | 287 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 288 | 288 |
/// This feature necessitates that each time we |
| 289 | 289 |
/// iterate the arc-set, the iteration order is the same. |
| 290 | 290 |
InArcIt(const Digraph&, const Arc&) { }
|
| 291 | 291 |
/// Next incoming arc |
| 292 | 292 |
|
| 293 | 293 |
/// Assign the iterator to the next inarc of the corresponding node. |
| 294 | 294 |
/// |
| 295 | 295 |
InArcIt& operator++() { return *this; }
|
| 296 | 296 |
}; |
| 297 | 297 |
/// This iterator goes through each arc. |
| 298 | 298 |
|
| 299 | 299 |
/// This iterator goes through each arc of a digraph. |
| 300 | 300 |
/// Its usage is quite simple, for example you can count the number |
| 301 | 301 |
/// of arcs in a digraph \c g of type \c Digraph as follows: |
| 302 | 302 |
///\code |
| 303 | 303 |
/// int count=0; |
| 304 | 304 |
/// for(Digraph::ArcIt e(g); e!=INVALID; ++e) ++count; |
| 305 | 305 |
///\endcode |
| 306 | 306 |
class ArcIt : public Arc {
|
| 307 | 307 |
public: |
| 308 | 308 |
/// Default constructor |
| 309 | 309 |
|
| 310 | 310 |
/// @warning The default constructor sets the iterator |
| 311 | 311 |
/// to an undefined value. |
| 312 | 312 |
ArcIt() { }
|
| 313 | 313 |
/// Copy constructor. |
| 314 | 314 |
|
| 315 | 315 |
/// Copy constructor. |
| 316 | 316 |
/// |
| 317 | 317 |
ArcIt(const ArcIt& e) : Arc(e) { }
|
| 318 | 318 |
/// Initialize the iterator to be invalid. |
| 319 | 319 |
|
| 320 | 320 |
/// Initialize the iterator to be invalid. |
| 321 | 321 |
/// |
| 322 | 322 |
ArcIt(Invalid) { }
|
| 323 | 323 |
/// This constructor sets the iterator to the first arc. |
| 324 | 324 |
|
| 325 | 325 |
/// This constructor sets the iterator to the first arc of \c g. |
| 326 | 326 |
///@param g the digraph |
| 327 | 327 |
ArcIt(const Digraph& g) { ignore_unused_variable_warning(g); }
|
| 328 | 328 |
/// Arc -> ArcIt conversion |
| 329 | 329 |
|
| 330 | 330 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 331 | 331 |
/// This feature necessitates that each time we |
| 332 | 332 |
/// iterate the arc-set, the iteration order is the same. |
| 333 | 333 |
ArcIt(const Digraph&, const Arc&) { }
|
| 334 | 334 |
///Next arc |
| 335 | 335 |
|
| 336 | 336 |
/// Assign the iterator to the next arc. |
| 337 | 337 |
ArcIt& operator++() { return *this; }
|
| 338 | 338 |
}; |
| 339 | 339 |
///Gives back the target node of an arc. |
| 340 | 340 |
|
| 341 | 341 |
///Gives back the target node of an arc. |
| 342 | 342 |
/// |
| 343 | 343 |
Node target(Arc) const { return INVALID; }
|
| 344 | 344 |
///Gives back the source node of an arc. |
| 345 | 345 |
|
| 346 | 346 |
///Gives back the source node of an arc. |
| 347 | 347 |
/// |
| 348 | 348 |
Node source(Arc) const { return INVALID; }
|
| 349 | 349 |
|
| 350 | 350 |
/// \brief Returns the ID of the node. |
| 351 | 351 |
int id(Node) const { return -1; }
|
| 352 | 352 |
|
| 353 | 353 |
/// \brief Returns the ID of the arc. |
| 354 | 354 |
int id(Arc) const { return -1; }
|
| 355 | 355 |
|
| 356 | 356 |
/// \brief Returns the node with the given ID. |
| 357 | 357 |
/// |
| 358 | 358 |
/// \pre The argument should be a valid node ID in the graph. |
| 359 | 359 |
Node nodeFromId(int) const { return INVALID; }
|
| 360 | 360 |
|
| 361 | 361 |
/// \brief Returns the arc with the given ID. |
| 362 | 362 |
/// |
| 363 | 363 |
/// \pre The argument should be a valid arc ID in the graph. |
| 364 | 364 |
Arc arcFromId(int) const { return INVALID; }
|
| 365 | 365 |
|
| 366 | 366 |
/// \brief Returns an upper bound on the node IDs. |
| 367 | 367 |
int maxNodeId() const { return -1; }
|
| 368 | 368 |
|
| 369 | 369 |
/// \brief Returns an upper bound on the arc IDs. |
| 370 | 370 |
int maxArcId() const { return -1; }
|
| 371 | 371 |
|
| 372 | 372 |
void first(Node&) const {}
|
| 373 | 373 |
void next(Node&) const {}
|
| 374 | 374 |
|
| 375 | 375 |
void first(Arc&) const {}
|
| 376 | 376 |
void next(Arc&) const {}
|
| 377 | 377 |
|
| 378 | 378 |
|
| 379 | 379 |
void firstIn(Arc&, const Node&) const {}
|
| 380 | 380 |
void nextIn(Arc&) const {}
|
| 381 | 381 |
|
| 382 | 382 |
void firstOut(Arc&, const Node&) const {}
|
| 383 | 383 |
void nextOut(Arc&) const {}
|
| 384 | 384 |
|
| 385 | 385 |
// The second parameter is dummy. |
| 386 | 386 |
Node fromId(int, Node) const { return INVALID; }
|
| 387 | 387 |
// The second parameter is dummy. |
| 388 | 388 |
Arc fromId(int, Arc) const { return INVALID; }
|
| 389 | 389 |
|
| 390 | 390 |
// Dummy parameter. |
| 391 | 391 |
int maxId(Node) const { return -1; }
|
| 392 | 392 |
// Dummy parameter. |
| 393 | 393 |
int maxId(Arc) const { return -1; }
|
| 394 | 394 |
|
| 395 | 395 |
/// \brief The base node of the iterator. |
| 396 | 396 |
/// |
| 397 | 397 |
/// Gives back the base node of the iterator. |
| 398 | 398 |
/// It is always the target of the pointed arc. |
| 399 | 399 |
Node baseNode(const InArcIt&) const { return INVALID; }
|
| 400 | 400 |
|
| 401 | 401 |
/// \brief The running node of the iterator. |
| 402 | 402 |
/// |
| 403 | 403 |
/// Gives back the running node of the iterator. |
| 404 | 404 |
/// It is always the source of the pointed arc. |
| 405 | 405 |
Node runningNode(const InArcIt&) const { return INVALID; }
|
| 406 | 406 |
|
| 407 | 407 |
/// \brief The base node of the iterator. |
| 408 | 408 |
/// |
| 409 | 409 |
/// Gives back the base node of the iterator. |
| 410 | 410 |
/// It is always the source of the pointed arc. |
| 411 | 411 |
Node baseNode(const OutArcIt&) const { return INVALID; }
|
| 412 | 412 |
|
| 413 | 413 |
/// \brief The running node of the iterator. |
| 414 | 414 |
/// |
| 415 | 415 |
/// Gives back the running node of the iterator. |
| 416 | 416 |
/// It is always the target of the pointed arc. |
| 417 | 417 |
Node runningNode(const OutArcIt&) const { return INVALID; }
|
| 418 | 418 |
|
| 419 | 419 |
/// \brief The opposite node on the given arc. |
| 420 | 420 |
/// |
| 421 | 421 |
/// Gives back the opposite node on the given arc. |
| 422 | 422 |
Node oppositeNode(const Node&, const Arc&) const { return INVALID; }
|
| 423 | 423 |
|
| 424 |
/// \brief |
|
| 424 |
/// \brief Reference map of the nodes to type \c T. |
|
| 425 | 425 |
/// |
| 426 |
/// ReadWrite map of the nodes to type \c T. |
|
| 427 |
/// \sa Reference |
|
| 426 |
/// Reference map of the nodes to type \c T. |
|
| 428 | 427 |
template<class T> |
| 429 |
class NodeMap : public |
|
| 428 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&> {
|
|
| 430 | 429 |
public: |
| 431 | 430 |
|
| 432 | 431 |
///\e |
| 433 | 432 |
NodeMap(const Digraph&) { }
|
| 434 | 433 |
///\e |
| 435 | 434 |
NodeMap(const Digraph&, T) { }
|
| 436 | 435 |
|
| 437 | 436 |
private: |
| 438 | 437 |
///Copy constructor |
| 439 |
NodeMap(const NodeMap& nm) : |
|
| 438 |
NodeMap(const NodeMap& nm) : |
|
| 439 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
|
| 440 | 440 |
///Assignment operator |
| 441 | 441 |
template <typename CMap> |
| 442 | 442 |
NodeMap& operator=(const CMap&) {
|
| 443 | 443 |
checkConcept<ReadMap<Node, T>, CMap>(); |
| 444 | 444 |
return *this; |
| 445 | 445 |
} |
| 446 | 446 |
}; |
| 447 | 447 |
|
| 448 |
/// \brief |
|
| 448 |
/// \brief Reference map of the arcs to type \c T. |
|
| 449 | 449 |
/// |
| 450 | 450 |
/// Reference map of the arcs to type \c T. |
| 451 |
/// \sa Reference |
|
| 452 | 451 |
template<class T> |
| 453 |
class ArcMap : public |
|
| 452 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&> {
|
|
| 454 | 453 |
public: |
| 455 | 454 |
|
| 456 | 455 |
///\e |
| 457 | 456 |
ArcMap(const Digraph&) { }
|
| 458 | 457 |
///\e |
| 459 | 458 |
ArcMap(const Digraph&, T) { }
|
| 460 | 459 |
private: |
| 461 | 460 |
///Copy constructor |
| 462 |
ArcMap(const ArcMap& em) : |
|
| 461 |
ArcMap(const ArcMap& em) : |
|
| 462 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
|
| 463 | 463 |
///Assignment operator |
| 464 | 464 |
template <typename CMap> |
| 465 | 465 |
ArcMap& operator=(const CMap&) {
|
| 466 | 466 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
| 467 | 467 |
return *this; |
| 468 | 468 |
} |
| 469 | 469 |
}; |
| 470 | 470 |
|
| 471 | 471 |
template <typename _Digraph> |
| 472 | 472 |
struct Constraints {
|
| 473 | 473 |
void constraints() {
|
| 474 |
checkConcept<BaseDigraphComponent, _Digraph>(); |
|
| 474 | 475 |
checkConcept<IterableDigraphComponent<>, _Digraph>(); |
| 475 | 476 |
checkConcept<IDableDigraphComponent<>, _Digraph>(); |
| 476 | 477 |
checkConcept<MappableDigraphComponent<>, _Digraph>(); |
| 477 | 478 |
} |
| 478 | 479 |
}; |
| 479 | 480 |
|
| 480 | 481 |
}; |
| 481 | 482 |
|
| 482 | 483 |
} //namespace concepts |
| 483 | 484 |
} //namespace lemon |
| 484 | 485 |
|
| 485 | 486 |
|
| 486 | 487 |
|
| 487 | 488 |
#endif |
| ... | ... |
@@ -116,648 +116,649 @@ |
| 116 | 116 |
|
| 117 | 117 |
/// To allow the use of graph descriptors as key type in std::map or |
| 118 | 118 |
/// similar associative container we require this. |
| 119 | 119 |
/// |
| 120 | 120 |
/// \note This operator only have to define some strict ordering of |
| 121 | 121 |
/// the items; this order has nothing to do with the iteration |
| 122 | 122 |
/// ordering of the items. |
| 123 | 123 |
bool operator<(Node) const { return false; }
|
| 124 | 124 |
|
| 125 | 125 |
}; |
| 126 | 126 |
|
| 127 | 127 |
/// This iterator goes through each node. |
| 128 | 128 |
|
| 129 | 129 |
/// This iterator goes through each node. |
| 130 | 130 |
/// Its usage is quite simple, for example you can count the number |
| 131 | 131 |
/// of nodes in graph \c g of type \c Graph like this: |
| 132 | 132 |
///\code |
| 133 | 133 |
/// int count=0; |
| 134 | 134 |
/// for (Graph::NodeIt n(g); n!=INVALID; ++n) ++count; |
| 135 | 135 |
///\endcode |
| 136 | 136 |
class NodeIt : public Node {
|
| 137 | 137 |
public: |
| 138 | 138 |
/// Default constructor |
| 139 | 139 |
|
| 140 | 140 |
/// @warning The default constructor sets the iterator |
| 141 | 141 |
/// to an undefined value. |
| 142 | 142 |
NodeIt() { }
|
| 143 | 143 |
/// Copy constructor. |
| 144 | 144 |
|
| 145 | 145 |
/// Copy constructor. |
| 146 | 146 |
/// |
| 147 | 147 |
NodeIt(const NodeIt& n) : Node(n) { }
|
| 148 | 148 |
/// Invalid constructor \& conversion. |
| 149 | 149 |
|
| 150 | 150 |
/// Initialize the iterator to be invalid. |
| 151 | 151 |
/// \sa Invalid for more details. |
| 152 | 152 |
NodeIt(Invalid) { }
|
| 153 | 153 |
/// Sets the iterator to the first node. |
| 154 | 154 |
|
| 155 | 155 |
/// Sets the iterator to the first node of \c g. |
| 156 | 156 |
/// |
| 157 | 157 |
NodeIt(const Graph&) { }
|
| 158 | 158 |
/// Node -> NodeIt conversion. |
| 159 | 159 |
|
| 160 | 160 |
/// Sets the iterator to the node of \c the graph pointed by |
| 161 | 161 |
/// the trivial iterator. |
| 162 | 162 |
/// This feature necessitates that each time we |
| 163 | 163 |
/// iterate the arc-set, the iteration order is the same. |
| 164 | 164 |
NodeIt(const Graph&, const Node&) { }
|
| 165 | 165 |
/// Next node. |
| 166 | 166 |
|
| 167 | 167 |
/// Assign the iterator to the next node. |
| 168 | 168 |
/// |
| 169 | 169 |
NodeIt& operator++() { return *this; }
|
| 170 | 170 |
}; |
| 171 | 171 |
|
| 172 | 172 |
|
| 173 | 173 |
/// The base type of the edge iterators. |
| 174 | 174 |
|
| 175 | 175 |
/// The base type of the edge iterators. |
| 176 | 176 |
/// |
| 177 | 177 |
class Edge {
|
| 178 | 178 |
public: |
| 179 | 179 |
/// Default constructor |
| 180 | 180 |
|
| 181 | 181 |
/// @warning The default constructor sets the iterator |
| 182 | 182 |
/// to an undefined value. |
| 183 | 183 |
Edge() { }
|
| 184 | 184 |
/// Copy constructor. |
| 185 | 185 |
|
| 186 | 186 |
/// Copy constructor. |
| 187 | 187 |
/// |
| 188 | 188 |
Edge(const Edge&) { }
|
| 189 | 189 |
/// Initialize the iterator to be invalid. |
| 190 | 190 |
|
| 191 | 191 |
/// Initialize the iterator to be invalid. |
| 192 | 192 |
/// |
| 193 | 193 |
Edge(Invalid) { }
|
| 194 | 194 |
/// Equality operator |
| 195 | 195 |
|
| 196 | 196 |
/// Two iterators are equal if and only if they point to the |
| 197 | 197 |
/// same object or both are invalid. |
| 198 | 198 |
bool operator==(Edge) const { return true; }
|
| 199 | 199 |
/// Inequality operator |
| 200 | 200 |
|
| 201 | 201 |
/// \sa operator==(Edge n) |
| 202 | 202 |
/// |
| 203 | 203 |
bool operator!=(Edge) const { return true; }
|
| 204 | 204 |
|
| 205 | 205 |
/// Artificial ordering operator. |
| 206 | 206 |
|
| 207 | 207 |
/// To allow the use of graph descriptors as key type in std::map or |
| 208 | 208 |
/// similar associative container we require this. |
| 209 | 209 |
/// |
| 210 | 210 |
/// \note This operator only have to define some strict ordering of |
| 211 | 211 |
/// the items; this order has nothing to do with the iteration |
| 212 | 212 |
/// ordering of the items. |
| 213 | 213 |
bool operator<(Edge) const { return false; }
|
| 214 | 214 |
}; |
| 215 | 215 |
|
| 216 | 216 |
/// This iterator goes through each edge. |
| 217 | 217 |
|
| 218 | 218 |
/// This iterator goes through each edge of a graph. |
| 219 | 219 |
/// Its usage is quite simple, for example you can count the number |
| 220 | 220 |
/// of edges in a graph \c g of type \c Graph as follows: |
| 221 | 221 |
///\code |
| 222 | 222 |
/// int count=0; |
| 223 | 223 |
/// for(Graph::EdgeIt e(g); e!=INVALID; ++e) ++count; |
| 224 | 224 |
///\endcode |
| 225 | 225 |
class EdgeIt : public Edge {
|
| 226 | 226 |
public: |
| 227 | 227 |
/// Default constructor |
| 228 | 228 |
|
| 229 | 229 |
/// @warning The default constructor sets the iterator |
| 230 | 230 |
/// to an undefined value. |
| 231 | 231 |
EdgeIt() { }
|
| 232 | 232 |
/// Copy constructor. |
| 233 | 233 |
|
| 234 | 234 |
/// Copy constructor. |
| 235 | 235 |
/// |
| 236 | 236 |
EdgeIt(const EdgeIt& e) : Edge(e) { }
|
| 237 | 237 |
/// Initialize the iterator to be invalid. |
| 238 | 238 |
|
| 239 | 239 |
/// Initialize the iterator to be invalid. |
| 240 | 240 |
/// |
| 241 | 241 |
EdgeIt(Invalid) { }
|
| 242 | 242 |
/// This constructor sets the iterator to the first edge. |
| 243 | 243 |
|
| 244 | 244 |
/// This constructor sets the iterator to the first edge. |
| 245 | 245 |
EdgeIt(const Graph&) { }
|
| 246 | 246 |
/// Edge -> EdgeIt conversion |
| 247 | 247 |
|
| 248 | 248 |
/// Sets the iterator to the value of the trivial iterator. |
| 249 | 249 |
/// This feature necessitates that each time we |
| 250 | 250 |
/// iterate the edge-set, the iteration order is the |
| 251 | 251 |
/// same. |
| 252 | 252 |
EdgeIt(const Graph&, const Edge&) { }
|
| 253 | 253 |
/// Next edge |
| 254 | 254 |
|
| 255 | 255 |
/// Assign the iterator to the next edge. |
| 256 | 256 |
EdgeIt& operator++() { return *this; }
|
| 257 | 257 |
}; |
| 258 | 258 |
|
| 259 | 259 |
/// \brief This iterator goes trough the incident undirected |
| 260 | 260 |
/// arcs of a node. |
| 261 | 261 |
/// |
| 262 | 262 |
/// This iterator goes trough the incident edges |
| 263 | 263 |
/// of a certain node of a graph. You should assume that the |
| 264 | 264 |
/// loop arcs will be iterated twice. |
| 265 | 265 |
/// |
| 266 | 266 |
/// Its usage is quite simple, for example you can compute the |
| 267 | 267 |
/// degree (i.e. count the number of incident arcs of a node \c n |
| 268 | 268 |
/// in graph \c g of type \c Graph as follows. |
| 269 | 269 |
/// |
| 270 | 270 |
///\code |
| 271 | 271 |
/// int count=0; |
| 272 | 272 |
/// for(Graph::IncEdgeIt e(g, n); e!=INVALID; ++e) ++count; |
| 273 | 273 |
///\endcode |
| 274 | 274 |
class IncEdgeIt : public Edge {
|
| 275 | 275 |
public: |
| 276 | 276 |
/// Default constructor |
| 277 | 277 |
|
| 278 | 278 |
/// @warning The default constructor sets the iterator |
| 279 | 279 |
/// to an undefined value. |
| 280 | 280 |
IncEdgeIt() { }
|
| 281 | 281 |
/// Copy constructor. |
| 282 | 282 |
|
| 283 | 283 |
/// Copy constructor. |
| 284 | 284 |
/// |
| 285 | 285 |
IncEdgeIt(const IncEdgeIt& e) : Edge(e) { }
|
| 286 | 286 |
/// Initialize the iterator to be invalid. |
| 287 | 287 |
|
| 288 | 288 |
/// Initialize the iterator to be invalid. |
| 289 | 289 |
/// |
| 290 | 290 |
IncEdgeIt(Invalid) { }
|
| 291 | 291 |
/// This constructor sets the iterator to first incident arc. |
| 292 | 292 |
|
| 293 | 293 |
/// This constructor set the iterator to the first incident arc of |
| 294 | 294 |
/// the node. |
| 295 | 295 |
IncEdgeIt(const Graph&, const Node&) { }
|
| 296 | 296 |
/// Edge -> IncEdgeIt conversion |
| 297 | 297 |
|
| 298 | 298 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 299 | 299 |
/// This feature necessitates that each time we |
| 300 | 300 |
/// iterate the arc-set, the iteration order is the same. |
| 301 | 301 |
IncEdgeIt(const Graph&, const Edge&) { }
|
| 302 | 302 |
/// Next incident arc |
| 303 | 303 |
|
| 304 | 304 |
/// Assign the iterator to the next incident arc |
| 305 | 305 |
/// of the corresponding node. |
| 306 | 306 |
IncEdgeIt& operator++() { return *this; }
|
| 307 | 307 |
}; |
| 308 | 308 |
|
| 309 | 309 |
/// The directed arc type. |
| 310 | 310 |
|
| 311 | 311 |
/// The directed arc type. It can be converted to the |
| 312 | 312 |
/// edge or it should be inherited from the undirected |
| 313 | 313 |
/// arc. |
| 314 | 314 |
class Arc : public Edge {
|
| 315 | 315 |
public: |
| 316 | 316 |
/// Default constructor |
| 317 | 317 |
|
| 318 | 318 |
/// @warning The default constructor sets the iterator |
| 319 | 319 |
/// to an undefined value. |
| 320 | 320 |
Arc() { }
|
| 321 | 321 |
/// Copy constructor. |
| 322 | 322 |
|
| 323 | 323 |
/// Copy constructor. |
| 324 | 324 |
/// |
| 325 | 325 |
Arc(const Arc& e) : Edge(e) { }
|
| 326 | 326 |
/// Initialize the iterator to be invalid. |
| 327 | 327 |
|
| 328 | 328 |
/// Initialize the iterator to be invalid. |
| 329 | 329 |
/// |
| 330 | 330 |
Arc(Invalid) { }
|
| 331 | 331 |
/// Equality operator |
| 332 | 332 |
|
| 333 | 333 |
/// Two iterators are equal if and only if they point to the |
| 334 | 334 |
/// same object or both are invalid. |
| 335 | 335 |
bool operator==(Arc) const { return true; }
|
| 336 | 336 |
/// Inequality operator |
| 337 | 337 |
|
| 338 | 338 |
/// \sa operator==(Arc n) |
| 339 | 339 |
/// |
| 340 | 340 |
bool operator!=(Arc) const { return true; }
|
| 341 | 341 |
|
| 342 | 342 |
/// Artificial ordering operator. |
| 343 | 343 |
|
| 344 | 344 |
/// To allow the use of graph descriptors as key type in std::map or |
| 345 | 345 |
/// similar associative container we require this. |
| 346 | 346 |
/// |
| 347 | 347 |
/// \note This operator only have to define some strict ordering of |
| 348 | 348 |
/// the items; this order has nothing to do with the iteration |
| 349 | 349 |
/// ordering of the items. |
| 350 | 350 |
bool operator<(Arc) const { return false; }
|
| 351 | 351 |
|
| 352 | 352 |
}; |
| 353 | 353 |
/// This iterator goes through each directed arc. |
| 354 | 354 |
|
| 355 | 355 |
/// This iterator goes through each arc of a graph. |
| 356 | 356 |
/// Its usage is quite simple, for example you can count the number |
| 357 | 357 |
/// of arcs in a graph \c g of type \c Graph as follows: |
| 358 | 358 |
///\code |
| 359 | 359 |
/// int count=0; |
| 360 | 360 |
/// for(Graph::ArcIt e(g); e!=INVALID; ++e) ++count; |
| 361 | 361 |
///\endcode |
| 362 | 362 |
class ArcIt : public Arc {
|
| 363 | 363 |
public: |
| 364 | 364 |
/// Default constructor |
| 365 | 365 |
|
| 366 | 366 |
/// @warning The default constructor sets the iterator |
| 367 | 367 |
/// to an undefined value. |
| 368 | 368 |
ArcIt() { }
|
| 369 | 369 |
/// Copy constructor. |
| 370 | 370 |
|
| 371 | 371 |
/// Copy constructor. |
| 372 | 372 |
/// |
| 373 | 373 |
ArcIt(const ArcIt& e) : Arc(e) { }
|
| 374 | 374 |
/// Initialize the iterator to be invalid. |
| 375 | 375 |
|
| 376 | 376 |
/// Initialize the iterator to be invalid. |
| 377 | 377 |
/// |
| 378 | 378 |
ArcIt(Invalid) { }
|
| 379 | 379 |
/// This constructor sets the iterator to the first arc. |
| 380 | 380 |
|
| 381 | 381 |
/// This constructor sets the iterator to the first arc of \c g. |
| 382 | 382 |
///@param g the graph |
| 383 | 383 |
ArcIt(const Graph &g) { ignore_unused_variable_warning(g); }
|
| 384 | 384 |
/// Arc -> ArcIt conversion |
| 385 | 385 |
|
| 386 | 386 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 387 | 387 |
/// This feature necessitates that each time we |
| 388 | 388 |
/// iterate the arc-set, the iteration order is the same. |
| 389 | 389 |
ArcIt(const Graph&, const Arc&) { }
|
| 390 | 390 |
///Next arc |
| 391 | 391 |
|
| 392 | 392 |
/// Assign the iterator to the next arc. |
| 393 | 393 |
ArcIt& operator++() { return *this; }
|
| 394 | 394 |
}; |
| 395 | 395 |
|
| 396 | 396 |
/// This iterator goes trough the outgoing directed arcs of a node. |
| 397 | 397 |
|
| 398 | 398 |
/// This iterator goes trough the \e outgoing arcs of a certain node |
| 399 | 399 |
/// of a graph. |
| 400 | 400 |
/// Its usage is quite simple, for example you can count the number |
| 401 | 401 |
/// of outgoing arcs of a node \c n |
| 402 | 402 |
/// in graph \c g of type \c Graph as follows. |
| 403 | 403 |
///\code |
| 404 | 404 |
/// int count=0; |
| 405 | 405 |
/// for (Graph::OutArcIt e(g, n); e!=INVALID; ++e) ++count; |
| 406 | 406 |
///\endcode |
| 407 | 407 |
|
| 408 | 408 |
class OutArcIt : public Arc {
|
| 409 | 409 |
public: |
| 410 | 410 |
/// Default constructor |
| 411 | 411 |
|
| 412 | 412 |
/// @warning The default constructor sets the iterator |
| 413 | 413 |
/// to an undefined value. |
| 414 | 414 |
OutArcIt() { }
|
| 415 | 415 |
/// Copy constructor. |
| 416 | 416 |
|
| 417 | 417 |
/// Copy constructor. |
| 418 | 418 |
/// |
| 419 | 419 |
OutArcIt(const OutArcIt& e) : Arc(e) { }
|
| 420 | 420 |
/// Initialize the iterator to be invalid. |
| 421 | 421 |
|
| 422 | 422 |
/// Initialize the iterator to be invalid. |
| 423 | 423 |
/// |
| 424 | 424 |
OutArcIt(Invalid) { }
|
| 425 | 425 |
/// This constructor sets the iterator to the first outgoing arc. |
| 426 | 426 |
|
| 427 | 427 |
/// This constructor sets the iterator to the first outgoing arc of |
| 428 | 428 |
/// the node. |
| 429 | 429 |
///@param n the node |
| 430 | 430 |
///@param g the graph |
| 431 | 431 |
OutArcIt(const Graph& n, const Node& g) {
|
| 432 | 432 |
ignore_unused_variable_warning(n); |
| 433 | 433 |
ignore_unused_variable_warning(g); |
| 434 | 434 |
} |
| 435 | 435 |
/// Arc -> OutArcIt conversion |
| 436 | 436 |
|
| 437 | 437 |
/// Sets the iterator to the value of the trivial iterator. |
| 438 | 438 |
/// This feature necessitates that each time we |
| 439 | 439 |
/// iterate the arc-set, the iteration order is the same. |
| 440 | 440 |
OutArcIt(const Graph&, const Arc&) { }
|
| 441 | 441 |
///Next outgoing arc |
| 442 | 442 |
|
| 443 | 443 |
/// Assign the iterator to the next |
| 444 | 444 |
/// outgoing arc of the corresponding node. |
| 445 | 445 |
OutArcIt& operator++() { return *this; }
|
| 446 | 446 |
}; |
| 447 | 447 |
|
| 448 | 448 |
/// This iterator goes trough the incoming directed arcs of a node. |
| 449 | 449 |
|
| 450 | 450 |
/// This iterator goes trough the \e incoming arcs of a certain node |
| 451 | 451 |
/// of a graph. |
| 452 | 452 |
/// Its usage is quite simple, for example you can count the number |
| 453 | 453 |
/// of outgoing arcs of a node \c n |
| 454 | 454 |
/// in graph \c g of type \c Graph as follows. |
| 455 | 455 |
///\code |
| 456 | 456 |
/// int count=0; |
| 457 | 457 |
/// for(Graph::InArcIt e(g, n); e!=INVALID; ++e) ++count; |
| 458 | 458 |
///\endcode |
| 459 | 459 |
|
| 460 | 460 |
class InArcIt : public Arc {
|
| 461 | 461 |
public: |
| 462 | 462 |
/// Default constructor |
| 463 | 463 |
|
| 464 | 464 |
/// @warning The default constructor sets the iterator |
| 465 | 465 |
/// to an undefined value. |
| 466 | 466 |
InArcIt() { }
|
| 467 | 467 |
/// Copy constructor. |
| 468 | 468 |
|
| 469 | 469 |
/// Copy constructor. |
| 470 | 470 |
/// |
| 471 | 471 |
InArcIt(const InArcIt& e) : Arc(e) { }
|
| 472 | 472 |
/// Initialize the iterator to be invalid. |
| 473 | 473 |
|
| 474 | 474 |
/// Initialize the iterator to be invalid. |
| 475 | 475 |
/// |
| 476 | 476 |
InArcIt(Invalid) { }
|
| 477 | 477 |
/// This constructor sets the iterator to first incoming arc. |
| 478 | 478 |
|
| 479 | 479 |
/// This constructor set the iterator to the first incoming arc of |
| 480 | 480 |
/// the node. |
| 481 | 481 |
///@param n the node |
| 482 | 482 |
///@param g the graph |
| 483 | 483 |
InArcIt(const Graph& g, const Node& n) {
|
| 484 | 484 |
ignore_unused_variable_warning(n); |
| 485 | 485 |
ignore_unused_variable_warning(g); |
| 486 | 486 |
} |
| 487 | 487 |
/// Arc -> InArcIt conversion |
| 488 | 488 |
|
| 489 | 489 |
/// Sets the iterator to the value of the trivial iterator \c e. |
| 490 | 490 |
/// This feature necessitates that each time we |
| 491 | 491 |
/// iterate the arc-set, the iteration order is the same. |
| 492 | 492 |
InArcIt(const Graph&, const Arc&) { }
|
| 493 | 493 |
/// Next incoming arc |
| 494 | 494 |
|
| 495 | 495 |
/// Assign the iterator to the next inarc of the corresponding node. |
| 496 | 496 |
/// |
| 497 | 497 |
InArcIt& operator++() { return *this; }
|
| 498 | 498 |
}; |
| 499 | 499 |
|
| 500 |
/// \brief |
|
| 500 |
/// \brief Reference map of the nodes to type \c T. |
|
| 501 | 501 |
/// |
| 502 |
/// ReadWrite map of the nodes to type \c T. |
|
| 503 |
/// \sa Reference |
|
| 502 |
/// Reference map of the nodes to type \c T. |
|
| 504 | 503 |
template<class T> |
| 505 |
class NodeMap : public |
|
| 504 |
class NodeMap : public ReferenceMap<Node, T, T&, const T&> |
|
| 506 | 505 |
{
|
| 507 | 506 |
public: |
| 508 | 507 |
|
| 509 | 508 |
///\e |
| 510 | 509 |
NodeMap(const Graph&) { }
|
| 511 | 510 |
///\e |
| 512 | 511 |
NodeMap(const Graph&, T) { }
|
| 513 | 512 |
|
| 514 | 513 |
private: |
| 515 | 514 |
///Copy constructor |
| 516 |
NodeMap(const NodeMap& nm) : |
|
| 515 |
NodeMap(const NodeMap& nm) : |
|
| 516 |
ReferenceMap<Node, T, T&, const T&>(nm) { }
|
|
| 517 | 517 |
///Assignment operator |
| 518 | 518 |
template <typename CMap> |
| 519 | 519 |
NodeMap& operator=(const CMap&) {
|
| 520 | 520 |
checkConcept<ReadMap<Node, T>, CMap>(); |
| 521 | 521 |
return *this; |
| 522 | 522 |
} |
| 523 | 523 |
}; |
| 524 | 524 |
|
| 525 |
/// \brief |
|
| 525 |
/// \brief Reference map of the arcs to type \c T. |
|
| 526 | 526 |
/// |
| 527 |
/// Reference map of the directed arcs to type \c T. |
|
| 528 |
/// \sa Reference |
|
| 527 |
/// Reference map of the arcs to type \c T. |
|
| 529 | 528 |
template<class T> |
| 530 |
class ArcMap : public |
|
| 529 |
class ArcMap : public ReferenceMap<Arc, T, T&, const T&> |
|
| 531 | 530 |
{
|
| 532 | 531 |
public: |
| 533 | 532 |
|
| 534 | 533 |
///\e |
| 535 | 534 |
ArcMap(const Graph&) { }
|
| 536 | 535 |
///\e |
| 537 | 536 |
ArcMap(const Graph&, T) { }
|
| 538 | 537 |
private: |
| 539 | 538 |
///Copy constructor |
| 540 |
ArcMap(const ArcMap& em) : |
|
| 539 |
ArcMap(const ArcMap& em) : |
|
| 540 |
ReferenceMap<Arc, T, T&, const T&>(em) { }
|
|
| 541 | 541 |
///Assignment operator |
| 542 | 542 |
template <typename CMap> |
| 543 | 543 |
ArcMap& operator=(const CMap&) {
|
| 544 | 544 |
checkConcept<ReadMap<Arc, T>, CMap>(); |
| 545 | 545 |
return *this; |
| 546 | 546 |
} |
| 547 | 547 |
}; |
| 548 | 548 |
|
| 549 |
/// |
|
| 549 |
/// Reference map of the edges to type \c T. |
|
| 550 | 550 |
|
| 551 |
/// Reference map of the arcs to type \c T. |
|
| 552 |
/// \sa Reference |
|
| 551 |
/// Reference map of the edges to type \c T. |
|
| 553 | 552 |
template<class T> |
| 554 |
class EdgeMap : public |
|
| 553 |
class EdgeMap : public ReferenceMap<Edge, T, T&, const T&> |
|
| 555 | 554 |
{
|
| 556 | 555 |
public: |
| 557 | 556 |
|
| 558 | 557 |
///\e |
| 559 | 558 |
EdgeMap(const Graph&) { }
|
| 560 | 559 |
///\e |
| 561 | 560 |
EdgeMap(const Graph&, T) { }
|
| 562 | 561 |
private: |
| 563 | 562 |
///Copy constructor |
| 564 |
EdgeMap(const EdgeMap& em) : |
|
| 563 |
EdgeMap(const EdgeMap& em) : |
|
| 564 |
ReferenceMap<Edge, T, T&, const T&>(em) {}
|
|
| 565 | 565 |
///Assignment operator |
| 566 | 566 |
template <typename CMap> |
| 567 | 567 |
EdgeMap& operator=(const CMap&) {
|
| 568 | 568 |
checkConcept<ReadMap<Edge, T>, CMap>(); |
| 569 | 569 |
return *this; |
| 570 | 570 |
} |
| 571 | 571 |
}; |
| 572 | 572 |
|
| 573 | 573 |
/// \brief Direct the given edge. |
| 574 | 574 |
/// |
| 575 | 575 |
/// Direct the given edge. The returned arc source |
| 576 | 576 |
/// will be the given node. |
| 577 | 577 |
Arc direct(const Edge&, const Node&) const {
|
| 578 | 578 |
return INVALID; |
| 579 | 579 |
} |
| 580 | 580 |
|
| 581 | 581 |
/// \brief Direct the given edge. |
| 582 | 582 |
/// |
| 583 | 583 |
/// Direct the given edge. The returned arc |
| 584 | 584 |
/// represents the given edge and the direction comes |
| 585 | 585 |
/// from the bool parameter. The source of the edge and |
| 586 | 586 |
/// the directed arc is the same when the given bool is true. |
| 587 | 587 |
Arc direct(const Edge&, bool) const {
|
| 588 | 588 |
return INVALID; |
| 589 | 589 |
} |
| 590 | 590 |
|
| 591 | 591 |
/// \brief Returns true if the arc has default orientation. |
| 592 | 592 |
/// |
| 593 | 593 |
/// Returns whether the given directed arc is same orientation as |
| 594 | 594 |
/// the corresponding edge's default orientation. |
| 595 | 595 |
bool direction(Arc) const { return true; }
|
| 596 | 596 |
|
| 597 | 597 |
/// \brief Returns the opposite directed arc. |
| 598 | 598 |
/// |
| 599 | 599 |
/// Returns the opposite directed arc. |
| 600 | 600 |
Arc oppositeArc(Arc) const { return INVALID; }
|
| 601 | 601 |
|
| 602 | 602 |
/// \brief Opposite node on an arc |
| 603 | 603 |
/// |
| 604 | 604 |
/// \return The opposite of the given node on the given edge. |
| 605 | 605 |
Node oppositeNode(Node, Edge) const { return INVALID; }
|
| 606 | 606 |
|
| 607 | 607 |
/// \brief First node of the edge. |
| 608 | 608 |
/// |
| 609 | 609 |
/// \return The first node of the given edge. |
| 610 | 610 |
/// |
| 611 | 611 |
/// Naturally edges don't have direction and thus |
| 612 | 612 |
/// don't have source and target node. However we use \c u() and \c v() |
| 613 | 613 |
/// methods to query the two nodes of the arc. The direction of the |
| 614 | 614 |
/// arc which arises this way is called the inherent direction of the |
| 615 | 615 |
/// edge, and is used to define the "default" direction |
| 616 | 616 |
/// of the directed versions of the arcs. |
| 617 | 617 |
/// \sa v() |
| 618 | 618 |
/// \sa direction() |
| 619 | 619 |
Node u(Edge) const { return INVALID; }
|
| 620 | 620 |
|
| 621 | 621 |
/// \brief Second node of the edge. |
| 622 | 622 |
/// |
| 623 | 623 |
/// \return The second node of the given edge. |
| 624 | 624 |
/// |
| 625 | 625 |
/// Naturally edges don't have direction and thus |
| 626 | 626 |
/// don't have source and target node. However we use \c u() and \c v() |
| 627 | 627 |
/// methods to query the two nodes of the arc. The direction of the |
| 628 | 628 |
/// arc which arises this way is called the inherent direction of the |
| 629 | 629 |
/// edge, and is used to define the "default" direction |
| 630 | 630 |
/// of the directed versions of the arcs. |
| 631 | 631 |
/// \sa u() |
| 632 | 632 |
/// \sa direction() |
| 633 | 633 |
Node v(Edge) const { return INVALID; }
|
| 634 | 634 |
|
| 635 | 635 |
/// \brief Source node of the directed arc. |
| 636 | 636 |
Node source(Arc) const { return INVALID; }
|
| 637 | 637 |
|
| 638 | 638 |
/// \brief Target node of the directed arc. |
| 639 | 639 |
Node target(Arc) const { return INVALID; }
|
| 640 | 640 |
|
| 641 | 641 |
/// \brief Returns the id of the node. |
| 642 | 642 |
int id(Node) const { return -1; }
|
| 643 | 643 |
|
| 644 | 644 |
/// \brief Returns the id of the edge. |
| 645 | 645 |
int id(Edge) const { return -1; }
|
| 646 | 646 |
|
| 647 | 647 |
/// \brief Returns the id of the arc. |
| 648 | 648 |
int id(Arc) const { return -1; }
|
| 649 | 649 |
|
| 650 | 650 |
/// \brief Returns the node with the given id. |
| 651 | 651 |
/// |
| 652 | 652 |
/// \pre The argument should be a valid node id in the graph. |
| 653 | 653 |
Node nodeFromId(int) const { return INVALID; }
|
| 654 | 654 |
|
| 655 | 655 |
/// \brief Returns the edge with the given id. |
| 656 | 656 |
/// |
| 657 | 657 |
/// \pre The argument should be a valid edge id in the graph. |
| 658 | 658 |
Edge edgeFromId(int) const { return INVALID; }
|
| 659 | 659 |
|
| 660 | 660 |
/// \brief Returns the arc with the given id. |
| 661 | 661 |
/// |
| 662 | 662 |
/// \pre The argument should be a valid arc id in the graph. |
| 663 | 663 |
Arc arcFromId(int) const { return INVALID; }
|
| 664 | 664 |
|
| 665 | 665 |
/// \brief Returns an upper bound on the node IDs. |
| 666 | 666 |
int maxNodeId() const { return -1; }
|
| 667 | 667 |
|
| 668 | 668 |
/// \brief Returns an upper bound on the edge IDs. |
| 669 | 669 |
int maxEdgeId() const { return -1; }
|
| 670 | 670 |
|
| 671 | 671 |
/// \brief Returns an upper bound on the arc IDs. |
| 672 | 672 |
int maxArcId() const { return -1; }
|
| 673 | 673 |
|
| 674 | 674 |
void first(Node&) const {}
|
| 675 | 675 |
void next(Node&) const {}
|
| 676 | 676 |
|
| 677 | 677 |
void first(Edge&) const {}
|
| 678 | 678 |
void next(Edge&) const {}
|
| 679 | 679 |
|
| 680 | 680 |
void first(Arc&) const {}
|
| 681 | 681 |
void next(Arc&) const {}
|
| 682 | 682 |
|
| 683 | 683 |
void firstOut(Arc&, Node) const {}
|
| 684 | 684 |
void nextOut(Arc&) const {}
|
| 685 | 685 |
|
| 686 | 686 |
void firstIn(Arc&, Node) const {}
|
| 687 | 687 |
void nextIn(Arc&) const {}
|
| 688 | 688 |
|
| 689 | 689 |
void firstInc(Edge &, bool &, const Node &) const {}
|
| 690 | 690 |
void nextInc(Edge &, bool &) const {}
|
| 691 | 691 |
|
| 692 | 692 |
// The second parameter is dummy. |
| 693 | 693 |
Node fromId(int, Node) const { return INVALID; }
|
| 694 | 694 |
// The second parameter is dummy. |
| 695 | 695 |
Edge fromId(int, Edge) const { return INVALID; }
|
| 696 | 696 |
// The second parameter is dummy. |
| 697 | 697 |
Arc fromId(int, Arc) const { return INVALID; }
|
| 698 | 698 |
|
| 699 | 699 |
// Dummy parameter. |
| 700 | 700 |
int maxId(Node) const { return -1; }
|
| 701 | 701 |
// Dummy parameter. |
| 702 | 702 |
int maxId(Edge) const { return -1; }
|
| 703 | 703 |
// Dummy parameter. |
| 704 | 704 |
int maxId(Arc) const { return -1; }
|
| 705 | 705 |
|
| 706 | 706 |
/// \brief Base node of the iterator |
| 707 | 707 |
/// |
| 708 | 708 |
/// Returns the base node (the source in this case) of the iterator |
| 709 | 709 |
Node baseNode(OutArcIt e) const {
|
| 710 | 710 |
return source(e); |
| 711 | 711 |
} |
| 712 | 712 |
/// \brief Running node of the iterator |
| 713 | 713 |
/// |
| 714 | 714 |
/// Returns the running node (the target in this case) of the |
| 715 | 715 |
/// iterator |
| 716 | 716 |
Node runningNode(OutArcIt e) const {
|
| 717 | 717 |
return target(e); |
| 718 | 718 |
} |
| 719 | 719 |
|
| 720 | 720 |
/// \brief Base node of the iterator |
| 721 | 721 |
/// |
| 722 | 722 |
/// Returns the base node (the target in this case) of the iterator |
| 723 | 723 |
Node baseNode(InArcIt e) const {
|
| 724 | 724 |
return target(e); |
| 725 | 725 |
} |
| 726 | 726 |
/// \brief Running node of the iterator |
| 727 | 727 |
/// |
| 728 | 728 |
/// Returns the running node (the source in this case) of the |
| 729 | 729 |
/// iterator |
| 730 | 730 |
Node runningNode(InArcIt e) const {
|
| 731 | 731 |
return source(e); |
| 732 | 732 |
} |
| 733 | 733 |
|
| 734 | 734 |
/// \brief Base node of the iterator |
| 735 | 735 |
/// |
| 736 | 736 |
/// Returns the base node of the iterator |
| 737 | 737 |
Node baseNode(IncEdgeIt) const {
|
| 738 | 738 |
return INVALID; |
| 739 | 739 |
} |
| 740 | 740 |
|
| 741 | 741 |
/// \brief Running node of the iterator |
| 742 | 742 |
/// |
| 743 | 743 |
/// Returns the running node of the iterator |
| 744 | 744 |
Node runningNode(IncEdgeIt) const {
|
| 745 | 745 |
return INVALID; |
| 746 | 746 |
} |
| 747 | 747 |
|
| 748 | 748 |
template <typename _Graph> |
| 749 | 749 |
struct Constraints {
|
| 750 | 750 |
void constraints() {
|
| 751 |
checkConcept<BaseGraphComponent, _Graph>(); |
|
| 751 | 752 |
checkConcept<IterableGraphComponent<>, _Graph>(); |
| 752 | 753 |
checkConcept<IDableGraphComponent<>, _Graph>(); |
| 753 | 754 |
checkConcept<MappableGraphComponent<>, _Graph>(); |
| 754 | 755 |
} |
| 755 | 756 |
}; |
| 756 | 757 |
|
| 757 | 758 |
}; |
| 758 | 759 |
|
| 759 | 760 |
} |
| 760 | 761 |
|
| 761 | 762 |
} |
| 762 | 763 |
|
| 763 | 764 |
#endif |
Changeset was too big and was cut off... Show full diff
0 comments (0 inline)