1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
3036
3037
3038
3039
3040
3041
3042
3043
3044
3045
3046
3047
3048
3049
3050
3051
3052
3053
3054
3055
3056
3057
3058
3059
3060
3061
3062
3063
3064
3065
3066
3067
3068
3069
3070
3071
3072
3073
3074
3075
3076
3077
3078
3079
3080
3081
3082
3083
3084
3085
3086
3087
3088
3089
3090
3091
3092
3093
3094
3095
3096
3097
3098
3099
3100
3101
3102
3103
3104
3105
3106
3107
3108
3109
3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
3120
3121
3122
3123
3124
3125
3126
3127
3128
3129
3130
3131
3132
3133
3134
3135
3136
3137
3138
3139
3140
3141
3142
3143
3144
3145
3146
3147
3148
3149
3150
3151
3152
3153
3154
3155
3156
3157
3158
3159
3160
3161
3162
3163
3164
3165
3166
3167
3168
3169
3170
3171
3172
3173
3174
3175
3176
3177
3178
3179
3180
3181
3182
3183
3184
3185
3186
3187
3188
3189
3190
3191
3192
3193
3194
3195
3196
3197
3198
3199
3200
3201
3202
3203
3204
3205
3206
3207
3208
3209
3210
3211
3212
3213
3214
3215
3216
3217
3218
3219
3220
3221
3222
3223
3224
3225
3226
3227
3228
3229
3230
3231
3232
3233
3234
3235
3236
3237
3238
3239
3240
3241
3242
3243
3244
3245
3246
3247
3248
3249
3250
3251
3252
3253
3254
3255
3256
3257
3258
3259
3260
3261
3262
3263
|
/* This is the header file of the C interface of the Parma Polyhedra Library.
Copyright (C) 2001-2010 Roberto Bagnara <bagnara@cs.unipr.it>
Copyright (C) 2010-2011 BUGSENG srl (http://bugseng.com)
This file is part of the Parma Polyhedra Library (PPL).
The PPL is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by the
Free Software Foundation; either version 3 of the License, or (at your
option) any later version.
The PPL is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1307, USA.
For the most up-to-date information see the Parma Polyhedra Library
site: http://www.cs.unipr.it/ppl/ . */
#ifndef PPL_ppl_c_h
#define PPL_ppl_c_h 1
/*!
\defgroup PPL_C_interface C Language Interface
The Parma Polyhedra Library comes equipped with an interface
for the C language.
*/
/*! \mainpage
All the declarations needed for using the PPL's C interface
(preprocessor symbols, data types, variables and
functions) are collected in the header file <CODE>ppl_c.h</CODE>.
This file, which is designed to work with pre-ANSI and ANSI C compilers
as well as C99 and C++ compilers, should be included, either directly
or via some other header file, with the directive
\code
#include <ppl_c.h>
\endcode
If this directive does not work, then your compiler is unable to find
the file <CODE>ppl_c.h</CODE>. So check that the library is installed
(if it is not installed, you may want to <CODE>make install</CODE>,
perhaps with root privileges) in the right place
(if not you may want to reconfigure the library using the appropriate
pathname for the <CODE>--prefix</CODE> option); and that your compiler
knows where it is installed (if not you should add the path to the
directory where <CODE>ppl_c.h</CODE> is located to the compiler's
include file search path; this is usually done with the
<CODE>-I</CODE> option).
The name space of the PPL's C interface is <CODE>PPL_*</CODE> for
preprocessor symbols, enumeration values and variables; and
<CODE>ppl_*</CODE> for data types and function names. The interface
systematically uses <EM>opaque data types</EM> (generic pointers that
completely hide the internal representations from the client code) and
provides all required access functions. By using just the interface,
the client code can exploit all the functionalities of the library yet
avoid directly manipulating the library's data structures. The advantages
are that (1) applications do not depend on the internals of the library
(these may change from release to release), and (2) the interface
invariants can be thoroughly checked (by the access functions).
\note
All functions taking as input argument an opaque pointer datatype assume
that such an argument is actually <em>referring to a valid PPL object</em>.
For instance, a function with an argument having type
<code>ppl_MIP_Problem_t</code> will expect a valid MIP_Problem object,
previously initialized by calling, e.g., <code>ppl_new_MIP_Problem</code>.
If that is not the case (e.g., if a null pointer is passed in),
the behavior is undefined.
The PPL's C interface is initialized by means of the
<CODE>ppl_initialize</CODE> function. This function must
be called <EM>before using any other interface of the library</EM>.
The application can release the resources allocated by the library by
calling the <CODE>ppl_finalize</CODE> function. After this function
is called <EM>no other interface of the library may be used</EM>
until the interface is re-initialized using <CODE>ppl_initialize</CODE>.
Any application using the PPL should make sure that only the
intended version(s) of the library are ever used. The version used can be
checked at compile-time thanks to the macros PPL_VERSION_MAJOR,
PPL_VERSION_MINOR, PPL_VERSION_REVISION and PPL_VERSION_BETA, which
give, respectively major, minor, revision and beta numbers of the PPL
version. This is an example of their use:
\code
#if PPL_VERSION_MAJOR == 0 && PPL_VERSION_MINOR < 6
# error "PPL version 0.6 or following is required"
#endif
\endcode
Compile-time checking, however, is not normally enough, particularly in
an environment where there is dynamic linking. Run-time checking can
be performed by means of the functions <CODE>ppl_version_major</CODE>,
<CODE>ppl_version_minor</CODE>, <CODE>ppl_version_revision</CODE>, and
<CODE>ppl_version_beta</CODE>. The PPL's C interface also provides
functions <CODE>ppl_version</CODE>, returning character string
containing the full version number, and <CODE>ppl_banner</CODE>,
returning a string that, in addition, provides (pointers to) other
useful information for the library user.
All programs using the PPL's C interface must link with the
following libraries: <CODE>libppl_c</CODE> (PPL's C interface),
<CODE>libppl</CODE> (PPL's core), <CODE>libgmpxx</CODE> (GMP's C++
interface), and <CODE>libgmp</CODE> (GMP's library core). On most
Unix-like systems, this is done by adding <CODE>-lppl_c</CODE>,
<CODE>-lppl</CODE>, <CODE>-lgmpxx</CODE>, and <CODE>-lgmp</CODE> to
the compiler's or linker's command line. For example:
\verbatim
gcc myprogram.o -lppl_c -lppl -lgmpxx -lgmp
\endverbatim
If this does not work, it means that your compiler/linker is not
finding the libraries where it expects. Again, this could be because you
forgot to install the library or you installed it in a non-standard
location. In the latter case you will need to use the appropriate
options (usually <CODE>-L</CODE>) and, if you use shared libraries,
some sort of run-time path selection mechanisms. Consult your
compiler's documentation for details. Notice that the PPL is built
using <A HREF="http://www.gnu.org/software/libtool/">Libtool</A> and
an application can exploit this fact to significantly simplify the
linking phase. See Libtool's documentation for details. Those
working under Linux can find a lot of useful information on how to use
program libraries (including static, shared, and dynamically loaded
libraries) in the
<A HREF="http://www.dwheeler.com/program-library/">Program Library
HOWTO</A>.
For examples on how to use the functions provided by the C interface,
you are referred to the directory <CODE>demos/ppl_lpsol/</CODE> in
the source distribution. It contains a <EM>Mixed Integer (Linear)
Programming</EM> solver written in C. In order to use this solver
you will need to install
<A HREF="http://www.gnu.org/software/glpk/">GLPK</A> (the GNU Linear
Programming Kit): this is used to read linear programs in MPS format.
*/ /* \mainpage */
/*
For some reason, GMP up to and including version 4.1.3 requires
<stdio.h> to be included before <gmp.h>.
*/
#include <stdio.h>
#include <gmp.h>
#include <stddef.h>
/*
PPL_PROTO is a macro used to wrap function prototypes, so that
compilers that don't understand ANSI C prototypes still work, and
ANSI C compilers can issue warnings about type mismatches.
*/
#if defined(__STDC__) \
|| defined(__cplusplus) \
|| defined (_AIX) \
|| (defined (__mips) && defined (_SYSTYPE_SVR4)) \
|| defined(_WIN32)
# define PPL_PROTO(protos) protos
#else
# define PPL_PROTO(protos) ()
#endif
#ifdef __cplusplus
extern "C" {
#endif
/*! \defgroup Init Library Initialization and Finalization
Functions for initialization/finalization of the library,
as well as setting/resetting of floating-point rounding mode.
*/
/*@{*/
/*! \brief
Initializes the Parma Polyhedra Library.
This function must be called before any other function.
\return
<CODE>PPL_ERROR_INVALID_ARGUMENT</CODE> if the library
was already initialized.
*/
int
ppl_initialize PPL_PROTO((void));
/*! \brief
Finalizes the Parma Polyhedra Library.
This function must be called after any other function.
\return
<CODE>PPL_ERROR_INVALID_ARGUMENT</CODE> if the library
was already finalized.
*/
int
ppl_finalize PPL_PROTO((void));
/*! \brief
Sets the FPU rounding mode so that the PPL abstractions based on
floating point numbers work correctly.
This is performed automatically at initialization-time. Calling
this function is needed only if restore_pre_PPL_rounding() has been
previously called.
*/
int
ppl_set_rounding_for_PPL PPL_PROTO((void));
/*! \brief
Sets the FPU rounding mode as it was before initialization of the PPL.
After calling this function it is absolutely necessary to call
set_rounding_for_PPL() before using any PPL abstractions based on
floating point numbers.
This is performed automatically at finalization-time.
*/
int
ppl_restore_pre_PPL_rounding PPL_PROTO((void));
/*! \brief
Writes to \p p the precision parameter used for irrational calculations.
*/
int
ppl_irrational_precision PPL_PROTO((unsigned* p));
/*! \brief
Sets the precision parameter used for irrational calculations.
If \p p is less than or equal to <CODE>INT_MAX</CODE>, sets the
precision parameter used for irrational calculations to \p p.
Then, in the irrational calculations returning an unbounded rational,
(e.g., when computing a square root), the lesser between numerator
and denominator will be limited to 2**\p p.
*/
int
ppl_set_irrational_precision PPL_PROTO((unsigned p));
/*@}*/ /* Init */
/*! \defgroup Version Version Checking
Symbolic constants and functions related to library version checking.
*/
/*@{*/
#include "ppl_c_version.h"
/*! \brief
Returns the major number of the PPL version.
*/
int
ppl_version_major PPL_PROTO((void));
/*! \brief
Returns the minor number of the PPL version.
*/
int
ppl_version_minor PPL_PROTO((void));
/*! \brief
Returns the revision number of the PPL version.
*/
int
ppl_version_revision PPL_PROTO((void));
/*! \brief
Returns the beta number of the PPL version.
*/
int
ppl_version_beta PPL_PROTO((void));
/*! \brief
Writes to \c *p a pointer to a character string containing the
PPL version.
*/
int
ppl_version PPL_PROTO((const char** p));
/*! \brief
Writes to \c *p a pointer to a character string containing the PPL banner.
The banner provides information about the PPL version, the licensing,
the lack of any warranty whatsoever, the C++ compiler used to build
the library, where to report bugs and where to look for further
information.
*/
int
ppl_banner PPL_PROTO((const char** p));
/*@}*/ /* Version Checking */
/*! \defgroup Error Error Handling
Symbolic constants and functions related to error reporting/handling.
*/
/*@{*/
/*! \brief
Defines the error codes that any function may return.
*/
enum ppl_enum_error_code {
/*! \hideinitializer
The virtual memory available to the process has been exhausted. */
PPL_ERROR_OUT_OF_MEMORY = -2,
/*! \hideinitializer
A function has been invoked with an invalid argument. */
PPL_ERROR_INVALID_ARGUMENT = -3,
/*! \hideinitializer
A function has been invoked outside its domain of definition. */
PPL_ERROR_DOMAIN_ERROR = -4,
/*! \hideinitializer
The construction of an object that would exceed its maximum
permitted size was attempted. */
PPL_ERROR_LENGTH_ERROR = -5,
/*! \hideinitializer
An arithmetic overflow occurred and the computation was consequently
interrupted. This can <EM>only</EM> happen in library's incarnations
using bounded integers as coefficients. */
PPL_ARITHMETIC_OVERFLOW = -6,
/*! \hideinitializer
An error occurred during a C input/output operation. A more
precise indication of what went wrong is available via
<CODE>errno</CODE>. */
PPL_STDIO_ERROR = -7,
/*! \hideinitializer
An internal error that was diagnosed by the PPL itself.
This indicates a bug in the PPL. */
PPL_ERROR_INTERNAL_ERROR = -8,
/*! \hideinitializer
A standard exception has been raised by the C++ run-time environment.
This indicates a bug in the PPL. */
PPL_ERROR_UNKNOWN_STANDARD_EXCEPTION = -9,
/*! \hideinitializer
A totally unknown, totally unexpected error happened.
This indicates a bug in the PPL. */
PPL_ERROR_UNEXPECTED_ERROR = -10,
/*! \hideinitializer
An exception has been raised by the PPL as a timeout previously set
by the user has expired.
*/
PPL_TIMEOUT_EXCEPTION = -11,
/*! \hideinitializer
The client program attempted to use the PPL in a way that violates
its internal logic. This happens, for instance, when the client
attempts to use the timeout facilities on a system that does not
support them. */
PPL_ERROR_LOGIC_ERROR = -12
};
/*! \brief
Installs the user-defined error handler pointed at by \p h.
The error handler takes an error code and a textual description that
gives further information about the actual error. The C string
containing the textual description is read-only and its existence is
not guaranteed after the handler has returned.
*/
int
ppl_set_error_handler PPL_PROTO((void (*h)(enum ppl_enum_error_code code,
const char* description)));
/*@}*/ /* Error */
/*! \defgroup Timeout Handling
Functions for setting and resetting timeouts.
*/
/*@{*/
/*! \brief
Sets the timeout for computations whose completion could require
an exponential amount of time.
\param time
The number of hundreths of seconds.
It must be strictly greater than zero.
Computations taking exponential time will be interrupted some time
after \p time hundreths of seconds have elapsed since the call to
the timeout setting function. If the computation is interrupted that
way, the interrupted function will return error code
<code>PPL_TIMEOUT_EXCEPTION</code>.
Otherwise, if the computation completes without being interrupted,
then the timeout should be reset by calling
<code>ppl_reset_timeout()</code>.
*/
int
ppl_set_timeout PPL_PROTO((unsigned time));
/*! \brief
Resets the timeout time so that the computation is not interrupted.
*/
int
ppl_reset_timeout PPL_PROTO((void));
/*! \brief
Sets a threshold for computations whose completion could require
an exponential amount of time.
\param weight
The maximum computational weight allowed.
It must be strictly greater than zero.
Computations taking exponential time will be interrupted some time
after reaching the \p weight complexity threshold. If the computation
is interrupted that way, the interrupted function will return error code
<code>PPL_TIMEOUT_EXCEPTION</code>.
Otherwise, if the computation completes without being interrupted,
then the deterministic timeout should be reset by calling
<code>ppl_reset_deterministic_timeout()</code>.
\note
This "timeout" checking functionality is said to be \e deterministic
because it is not based on actual elapsed time. Its behavior will
only depend on (some of the) computations performed in the PPL library
and it will be otherwise independent from the computation environment
(CPU, operating system, compiler, etc.).
\warning
The weight mechanism is under alpha testing. In particular,
there is still no clear relation between the weight threshold and
the actual computational complexity. As a consequence, client
applications should be ready to reconsider the tuning of these
weight thresholds when upgrading to newer version of the PPL.
*/
int
ppl_set_deterministic_timeout PPL_PROTO((unsigned weight));
/*! \brief
Resets the deterministic timeout so that the computation is not interrupted.
*/
int
ppl_reset_deterministic_timeout PPL_PROTO((void));
/*@}*/ /* Timeout Handling */
/*! \defgroup Datatypes Library Datatypes
\brief
Typedefs for the library datatypes and related symbolic constants.
The datatypes provided by the library should be manipulated
by means of the corresponding opaque pointer types and
the functions working on them.
\note
To simplify the detection of common programming mistakes,
we provide both pointer-to-const and pointer-to-nonconst
opaque pointers, with implicit conversions mapping each
pointer-to-nonconst to the corresponding pointer-to-const when needed.
The user of the C interface is therefore recommended to adopt
the pointer-to-const type whenever read-only access is meant.
*/
/*@{*/
/*! \brief
An unsigned integral type for representing space dimensions.
*/
typedef size_t ppl_dimension_type;
/*! \brief
Writes to \p m the maximum space dimension this library can handle.
*/
int
ppl_max_space_dimension PPL_PROTO((ppl_dimension_type* m));
/*! \brief
Writes to \p m a value that does not designate a valid dimension.
*/
int
ppl_not_a_dimension PPL_PROTO((ppl_dimension_type* m));
/*! \brief
Pretty-prints \p var to <CODE>stdout</CODE>.
*/
int
ppl_io_print_variable PPL_PROTO((ppl_dimension_type var));
/*! \brief
Pretty-prints \p var to the given output \p stream.
*/
int
ppl_io_fprint_variable PPL_PROTO((FILE* stream, ppl_dimension_type var));
/*! \brief
Pretty-prints \p var to a malloc-allocated string, a pointer to which
is returned via \p strp.
*/
int
ppl_io_asprint_variable PPL_PROTO((char** strp, ppl_dimension_type var));
/*! \brief
The type of output functions used for printing variables.
An output function for variables must write a textual representation
for \p var to a character buffer, null-terminate it, and return a
pointer to the beginning of the buffer. In case the operation fails,
0 should be returned and perhaps <CODE>errno</CODE> should be set
in a meaningful way. The library does nothing with the buffer, besides
printing its contents.
*/
typedef const char*
ppl_io_variable_output_function_type(ppl_dimension_type var);
/*! \brief
Sets the output function to be used for printing variables to \p p.
*/
int
ppl_io_set_variable_output_function(ppl_io_variable_output_function_type* p);
/*! \brief
Writes a pointer to the current variable output function to \p pp.
*/
int
ppl_io_get_variable_output_function(ppl_io_variable_output_function_type** pp);
/*! \brief Utility function for the wrapping of lines of text.
\param src
The source string holding the text to wrap.
\param indent_depth
The indentation depth.
\param preferred_first_line_length
The preferred length for the first line of text.
\param preferred_line_length
The preferred length for all the lines but the first one.
\return
The wrapped string in a malloc-allocated buffer.
*/
char*
ppl_io_wrap_string(const char* src,
unsigned indent_depth,
unsigned preferred_first_line_length,
unsigned preferred_line_length);
/*@}*/ /* Datatypes */
#undef PPL_TYPE_DECLARATION
#define PPL_TYPE_DECLARATION(Type) \
/*! \brief Opaque pointer \ingroup Datatypes */ \
typedef struct ppl_##Type##_tag* ppl_##Type##_t; \
/*! \brief Opaque pointer to const object \ingroup Datatypes */ \
typedef struct ppl_##Type##_tag const* ppl_const_##Type##_t;
/*! \interface ppl_Coefficient_tag
\brief
Types and functions for coefficients.
The types and functions for coefficients provide an interface towards
\extref{Parma_Polyhedra_Library::Coefficient, Coefficient}.
Depending on configuration, the PPL coefficients may be implemented
by the unbounded precision integers provided by GMP (default),
or by bounded precision integers (with checks for overflows).
*/
PPL_TYPE_DECLARATION(Coefficient)
/*! \interface ppl_Linear_Expression_tag
\brief
Types and functions for linear expressions.
The types and functions for linear expression provide an interface towards
\extref{Parma_Polyhedra_Library::Linear_Expression, Linear_Expression}.
*/
PPL_TYPE_DECLARATION(Linear_Expression)
/*! \interface ppl_Constraint_tag
\brief
Types and functions for constraints.
The types and functions for constraints provide an interface towards
\extref{Parma_Polyhedra_Library::Constraint, Constraint}.
*/
PPL_TYPE_DECLARATION(Constraint)
/*! \interface ppl_Constraint_System_tag
\brief
Types and functions for constraint systems.
The types and functions for constraint systems provide an interface
towards
\extref{Parma_Polyhedra_Library::Constraint_System, Constraint_System}.
*/
PPL_TYPE_DECLARATION(Constraint_System)
/*! \interface ppl_Constraint_System_const_iterator_tag
\brief
Types and functions for iterating on constraint systems.
The types and functions for constraint systems iterators provide
read-only access to the elements of a constraint system by interfacing
\extref{Parma_Polyhedra_Library::Constraint_System::const_iterator,
Constraint_System::const_iterator}.
*/
PPL_TYPE_DECLARATION(Constraint_System_const_iterator)
/*! \interface ppl_Generator_tag
\brief
Types and functions for generators.
The types and functions for generators provide an interface
towards \extref{Parma_Polyhedra_Library::Generator, Generator}.
*/
PPL_TYPE_DECLARATION(Generator)
/*! \interface ppl_Generator_System_tag
\brief
Types and functions for generator systems.
The types and functions for generator systems provide an interface
towards
\extref{Parma_Polyhedra_Library::Generator_System, Generator_System}.
*/
PPL_TYPE_DECLARATION(Generator_System)
/*! \interface ppl_Generator_System_const_iterator_tag
\brief
Types and functions for iterating on generator systems.
The types and functions for generator systems iterators provide
read-only access to the elements of a generator system by interfacing
\extref{Parma_Polyhedra_Library::Generator_System::const_iterator,
Generator_System::const_iterator}.
*/
PPL_TYPE_DECLARATION(Generator_System_const_iterator)
/*! \interface ppl_Congruence_tag
\brief
Types and functions for congruences.
The types and functions for congruences provide an interface
towards \extref{Parma_Polyhedra_Library::Congruence, Congruence}.
*/
PPL_TYPE_DECLARATION(Congruence)
/*! \interface ppl_Congruence_System_tag
\brief
Types and functions for congruence systems.
The types and functions for congruence systems provide an interface
towards
\extref{Parma_Polyhedra_Library::Congruence_System, Congruence_System}.
*/
PPL_TYPE_DECLARATION(Congruence_System)
/*! \interface ppl_Congruence_System_const_iterator_tag
\brief
Types and functions for iterating on congruence systems.
The types and functions for congruence systems iterators provide
read-only access to the elements of a congruence system by interfacing
\extref{Parma_Polyhedra_Library::Congruence_System::const_iterator,
Congruence_System::const_iterator}.
*/
PPL_TYPE_DECLARATION(Congruence_System_const_iterator)
/*! \interface ppl_Grid_Generator_tag
\brief
Types and functions for grid generators.
The types and functions for grid generators provide an interface
towards \extref{Parma_Polyhedra_Library::Grid_Generator, Grid_Generator}.
*/
PPL_TYPE_DECLARATION(Grid_Generator)
/*! \interface ppl_Grid_Generator_System_tag
\brief
Types and functions for grid generator systems.
The types and functions for grid generator systems provide an interface
towards
\extref{Parma_Polyhedra_Library::Grid_Generator_System,
Grid_Generator_System}.
*/
PPL_TYPE_DECLARATION(Grid_Generator_System)
/*! \interface ppl_Grid_Generator_System_const_iterator_tag
\brief
Types and functions for iterating on grid generator systems.
The types and functions for grid generator systems iterators provide
read-only access to the elements of a grid generator system by interfacing
\extref{Parma_Polyhedra_Library::Grid_Generator_System::const_iterator,
Grid_Generator_System::const_iterator}.
*/
PPL_TYPE_DECLARATION(Grid_Generator_System_const_iterator)
/*! \interface ppl_MIP_Problem_tag
\brief
Types and functions for MIP problems.
The types and functions for MIP problems provide an interface
towards \extref{Parma_Polyhedra_Library::MIP_Problem, MIP_Problem}.
*/
PPL_TYPE_DECLARATION(MIP_Problem)
/*! \interface ppl_PIP_Problem_tag
\brief
Types and functions for PIP problems.
The types and functions for PIP problems provide an interface
towards \extref{Parma_Polyhedra_Library::PIP_Problem, PIP_Problem}.
*/
PPL_TYPE_DECLARATION(PIP_Problem)
/*! \interface ppl_PIP_Tree_Node_tag
\brief
Types and functions for generic PIP tree nodes.
The types and functions for tree nodes provide an interface
towards \extref{Parma_Polyhedra_Library::PIP_Tree_Node, PIP_Tree_Node}.
*/
PPL_TYPE_DECLARATION(PIP_Tree_Node)
/*! \interface ppl_PIP_Decision_Node_tag
\brief
Types and functions for PIP decision nodes.
The types and functions for decision nodes provide an interface towards
\extref{Parma_Polyhedra_Library::PIP_Decision_Node, PIP_Decision_Node}.
*/
PPL_TYPE_DECLARATION(PIP_Decision_Node)
/*! \interface ppl_PIP_Solution_Node_tag
\brief
Types and functions for PIP solution nodes.
The types and functions for solution nodes provide an interface towards
\extref{Parma_Polyhedra_Library::PIP_Solution_Node, PIP_Solution_Node}.
*/
PPL_TYPE_DECLARATION(PIP_Solution_Node)
/*! \interface ppl_Artificial_Parameter_tag
\brief
Types and functions for PIP artificial parameters.
The types and functions for PIP artificial parameters provide
an interface towards
\extref{Parma_Polyhedra_Library::PIP_Tree_Node::Artificial_Parameter, Artificial_Parameter}.
*/
PPL_TYPE_DECLARATION(Artificial_Parameter)
PPL_TYPE_DECLARATION(Artificial_Parameter_Sequence)
/*! \interface ppl_Artificial_Parameter_Sequence_const_iterator_tag
\brief
Types and functions for iterating on PIP artificial parameters.
*/
PPL_TYPE_DECLARATION(Artificial_Parameter_Sequence_const_iterator)
#undef PPL_DECLARE_PRINT_FUNCTIONS
#undef PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS
#undef PPL_DECLARE_IO_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS
#define PPL_DECLARE_PRINT_FUNCTIONS(Type) \
/*! \relates ppl_##Type##_tag */ \
int \
ppl_io_print_##Type PPL_PROTO((ppl_const_##Type##_t x)); \
/*! \relates ppl_##Type##_tag */ \
int \
ppl_io_fprint_##Type PPL_PROTO((FILE* stream, ppl_const_##Type##_t x)); \
/*! \relates ppl_##Type##_tag */ \
int \
ppl_io_asprint_##Type PPL_PROTO((char** strp, ppl_const_##Type##_t x));
#define PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
/*! \relates ppl_##Type##_tag */ \
int \
ppl_##Type##_ascii_dump \
PPL_PROTO((ppl_const_##Type##_t x, FILE* stream)); \
/*! \relates ppl_##Type##_tag */ \
int \
ppl_##Type##_ascii_load \
PPL_PROTO((ppl_##Type##_t x, FILE* stream));
#define PPL_DECLARE_IO_FUNCTIONS(Type) \
PPL_DECLARE_PRINT_FUNCTIONS(Type) \
PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS(Type)
#define PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Type) \
/*! \relates ppl_##Type##_tag \brief Prints \p x to \c stdout. */ \
int \
ppl_io_print_##Type PPL_PROTO((ppl_const_##Type##_t x)); \
/*! \relates ppl_##Type##_tag \brief Prints \p x to the given output \p stream. */ \
int \
ppl_io_fprint_##Type PPL_PROTO((FILE* stream, ppl_const_##Type##_t x)); \
/*! \relates ppl_##Type##_tag \brief Prints \p x to a malloc-allocated string, a pointer to which is returned via \p strp. */ \
int \
ppl_io_asprint_##Type PPL_PROTO((char** strp, ppl_const_##Type##_t x));
#define PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
/*! \relates ppl_##Type##_tag \brief Dumps an ascii representation of \p x on \p stream. */ \
int \
ppl_##Type##_ascii_dump \
PPL_PROTO((ppl_const_##Type##_t x, FILE* stream)); \
/*! \relates ppl_##Type##_tag \brief Loads an ascii representation of \p x from \p stream. */ \
int \
ppl_##Type##_ascii_load \
PPL_PROTO((ppl_##Type##_t x, FILE* stream));
#define PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Type) \
/*! \brief \name Input/Output Functions */ \
/*@{*/ \
PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Type) \
PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS(Type) \
/*@}*/ /* Input/Output Functions */
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Coefficient_tag \brief
Creates a new coefficient with value 0 and writes a handle for the
newly created coefficient at address \p pc.
*/
int
ppl_new_Coefficient PPL_PROTO((ppl_Coefficient_t* pc));
/*! \relates ppl_Coefficient_tag \brief
Creates a new coefficient with the value given by the GMP integer
\p z and writes a handle for the newly created coefficient
at address \p pc.
*/
int
ppl_new_Coefficient_from_mpz_t PPL_PROTO((ppl_Coefficient_t* pc, mpz_t z));
/*! \relates ppl_Coefficient_tag \brief
Builds a coefficient that is a copy of \p c; writes a handle
for the newly created coefficient at address \p pc.
*/
int
ppl_new_Coefficient_from_Coefficient PPL_PROTO((ppl_Coefficient_t* pc,
ppl_const_Coefficient_t c));
/*! \relates ppl_Coefficient_tag \brief
Assign to \p dst the value given by the GMP integer \p z.
*/
int
ppl_assign_Coefficient_from_mpz_t PPL_PROTO((ppl_Coefficient_t dst, mpz_t z));
/*! \relates ppl_Coefficient_tag \brief
Assigns a copy of the coefficient \p src to \p dst.
*/
int
ppl_assign_Coefficient_from_Coefficient
PPL_PROTO((ppl_Coefficient_t dst, ppl_const_Coefficient_t src));
/*! \relates ppl_Coefficient_tag \brief
Invalidates the handle \p c: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Coefficient PPL_PROTO((ppl_const_Coefficient_t c));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Read-Only Accessor Functions */
/*@{*/
/*! \relates ppl_Coefficient_tag \brief
Sets the value of the GMP integer \p z to the value of \p c.
*/
int
ppl_Coefficient_to_mpz_t PPL_PROTO((ppl_const_Coefficient_t c, mpz_t z));
/*! \relates ppl_Coefficient_tag \brief
Returns a positive integer if \p c is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p c is broken. Useful for debugging purposes.
*/
int
ppl_Coefficient_OK PPL_PROTO((ppl_const_Coefficient_t c));
/*! \relates ppl_Coefficient_tag \brief
Returns a positive integer if coefficients are bounded; returns 0
otherwise.
*/
int
ppl_Coefficient_is_bounded PPL_PROTO((void));
/*! \relates ppl_Coefficient_tag \brief
Returns a positive integer if coefficients are bounded, in which case
\p min is set to their minimum value; returns 0 otherwise.
*/
int
ppl_Coefficient_min PPL_PROTO((mpz_t min));
/*! \relates ppl_Coefficient_tag \brief
Returns a positive integer if coefficients are bounded, in which case
\p max is set to their maximum value; returns 0 otherwise.
*/
int
ppl_Coefficient_max PPL_PROTO((mpz_t max));
/*@}*/ /* Read-Only Accessor Functions */
/* No ascii dump for Coefficient */
/*! \brief \name I/O Functions */
/*@{*/
PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS(Coefficient)
/*@}*/ /* I/O Functions */
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Linear_Expression_tag \brief
Creates a new linear expression corresponding to the constant 0 in a
zero-dimensional space; writes a handle for the new linear
expression at address \p ple.
*/
int
ppl_new_Linear_Expression PPL_PROTO((ppl_Linear_Expression_t* ple));
/*! \relates ppl_Linear_Expression_tag \brief
Creates a new linear expression corresponding to the constant 0 in a
<TT>d</TT>-dimensional space; writes a handle for the new linear
expression at address \p ple.
*/
int
ppl_new_Linear_Expression_with_dimension
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_dimension_type d));
/*! \relates ppl_Linear_Expression_tag \brief
Builds a linear expression that is a copy of \p le; writes a handle
for the newly created linear expression at address \p ple.
*/
int
ppl_new_Linear_Expression_from_Linear_Expression
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Linear_Expression_t le));
/*! \relates ppl_Linear_Expression_tag \brief
Builds a linear expression corresponding to constraint \p c;
writes a handle for the newly created linear expression at address \p ple.
*/
int
ppl_new_Linear_Expression_from_Constraint
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Constraint_t c));
/*! \relates ppl_Linear_Expression_tag \brief
Builds a linear expression corresponding to generator \p g;
writes a handle for the newly created linear expression at address \p ple.
*/
int
ppl_new_Linear_Expression_from_Generator
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Generator_t g));
/*! \relates ppl_Linear_Expression_tag \brief
Builds a linear expression corresponding to congruence \p c;
writes a handle for the newly created linear expression at address \p ple.
*/
int
ppl_new_Linear_Expression_from_Congruence
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Congruence_t c));
/*! \relates ppl_Linear_Expression_tag \brief
Builds a linear expression corresponding to grid generator \p g;
writes a handle for the newly created linear expression at address \p ple.
*/
int
ppl_new_Linear_Expression_from_Grid_Generator
PPL_PROTO((ppl_Linear_Expression_t* ple, ppl_const_Grid_Generator_t g));
/*! \relates ppl_Linear_Expression_tag \brief
Assigns a copy of the linear expression \p src to \p dst.
*/
int
ppl_assign_Linear_Expression_from_Linear_Expression
PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
/*! \relates ppl_Linear_Expression_tag \brief
Invalidates the handle \p le: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Linear_Expression PPL_PROTO((ppl_const_Linear_Expression_t le));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Linear Expression */
/*@{*/
/*! \relates ppl_Linear_Expression_tag \brief
Writes to \p m the space dimension of \p le.
*/
int
ppl_Linear_Expression_space_dimension
PPL_PROTO((ppl_const_Linear_Expression_t le, ppl_dimension_type* m));
/*! \relates ppl_Linear_Expression_tag \brief
Copies into \p n the coefficient of variable \p var in
the linear expression \p le.
*/
int
ppl_Linear_Expression_coefficient PPL_PROTO((ppl_const_Linear_Expression_t le,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Linear_Expression_tag \brief
Copies into \p n the inhomogeneous term of linear expression \p le.
*/
int
ppl_Linear_Expression_inhomogeneous_term
PPL_PROTO((ppl_const_Linear_Expression_t le, ppl_Coefficient_t n));
/*! \relates ppl_Linear_Expression_tag \brief
Returns a positive integer if \p le is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p le is broken. Useful for debugging purposes.
*/
int
ppl_Linear_Expression_OK PPL_PROTO((ppl_const_Linear_Expression_t le));
/*! \relates ppl_Linear_Expression_tag \brief
Returns <CODE>true</CODE> if and only if \p *this is \f$0\f$.
*/
int
ppl_Linear_Expression_is_zero PPL_PROTO((ppl_const_Linear_Expression_t le));
/*! \relates ppl_Linear_Expression_tag \brief
Returns <CODE>true</CODE> if and only if all the homogeneous
terms of \p *this are \f$0\f$.
*/
int
ppl_Linear_Expression_all_homogeneous_terms_are_zero
PPL_PROTO((ppl_const_Linear_Expression_t le));
/*@}*/ /* Functions that Do Not Modify the Linear Expression */
/*! \brief \name Functions that May Modify the Linear Expression */
/*@{*/
/*! \relates ppl_Linear_Expression_tag \brief
Adds \p n to the coefficient of variable \p var in the linear
expression \p le. The space dimension is set to be the maximum
between \p var + 1 and the old space dimension.
*/
int
ppl_Linear_Expression_add_to_coefficient
PPL_PROTO((ppl_Linear_Expression_t le,
ppl_dimension_type var,
ppl_const_Coefficient_t n));
/*! \relates ppl_Linear_Expression_tag \brief
Adds \p n to the inhomogeneous term of the linear expression \p le.
*/
int
ppl_Linear_Expression_add_to_inhomogeneous
PPL_PROTO((ppl_Linear_Expression_t le, ppl_const_Coefficient_t n));
/*! \relates ppl_Linear_Expression_tag \brief
Adds the linear expression \p src to \p dst.
*/
int
ppl_add_Linear_Expression_to_Linear_Expression
PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
/*! \relates ppl_Linear_Expression_tag \brief
Subtracts the linear expression \p src from \p dst.
*/
int
ppl_subtract_Linear_Expression_from_Linear_Expression
PPL_PROTO((ppl_Linear_Expression_t dst, ppl_const_Linear_Expression_t src));
/*! \relates ppl_Linear_Expression_tag \brief
Multiply the linear expression \p dst by \p n.
*/
int
ppl_multiply_Linear_Expression_by_Coefficient
PPL_PROTO((ppl_Linear_Expression_t le, ppl_const_Coefficient_t n));
/*@}*/ /* Functions that May Modify the Linear Expression */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Linear_Expression)
/*! \brief \ingroup Datatypes
Describes the relations represented by a constraint.
*/
enum ppl_enum_Constraint_Type {
/*! The constraint is of the form \f$e < 0\f$. */
PPL_CONSTRAINT_TYPE_LESS_THAN,
/*! The constraint is of the form \f$e \leq 0\f$. */
PPL_CONSTRAINT_TYPE_LESS_OR_EQUAL,
/*! The constraint is of the form \f$e = 0\f$. */
PPL_CONSTRAINT_TYPE_EQUAL,
/*! The constraint is of the form \f$e \geq 0\f$. */
PPL_CONSTRAINT_TYPE_GREATER_OR_EQUAL,
/*! The constraint is of the form \f$e > 0\f$. */
PPL_CONSTRAINT_TYPE_GREATER_THAN
};
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Constraint_tag \brief
Creates the new constraint `\p le \p rel 0' and writes a handle for
it at address \p pc. The space dimension of the new constraint is
equal to the space dimension of \p le.
*/
int
ppl_new_Constraint PPL_PROTO((ppl_Constraint_t* pc,
ppl_const_Linear_Expression_t le,
enum ppl_enum_Constraint_Type rel));
/*! \relates ppl_Constraint_tag \brief
Creates the unsatisfiable (zero-dimension space) constraint \f$0 = 1\f$
and writes a handle for it at address \p pc.
*/
int
ppl_new_Constraint_zero_dim_false PPL_PROTO((ppl_Constraint_t* pc));
/*! \relates ppl_Constraint_tag \brief
Creates the true (zero-dimension space) constraint \f$0 \leq 1\f$,
also known as <EM>positivity constraint</EM>.
A handle for the newly created constraint is written at address \p pc.
*/
int
ppl_new_Constraint_zero_dim_positivity PPL_PROTO((ppl_Constraint_t* pc));
/*! \relates ppl_Constraint_tag \brief
Builds a constraint that is a copy of \p c; writes a handle
for the newly created constraint at address \p pc.
*/
int
ppl_new_Constraint_from_Constraint PPL_PROTO((ppl_Constraint_t* pc,
ppl_const_Constraint_t c));
/*! \relates ppl_Constraint_tag \brief
Assigns a copy of the constraint \p src to \p dst.
*/
int
ppl_assign_Constraint_from_Constraint PPL_PROTO((ppl_Constraint_t dst,
ppl_const_Constraint_t src));
/*! \relates ppl_Constraint_tag \brief
Invalidates the handle \p c: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Constraint PPL_PROTO((ppl_const_Constraint_t c));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Constraint */
/*@{*/
/*! \relates ppl_Constraint_tag \brief
Writes to \p m the space dimension of \p c.
*/
int
ppl_Constraint_space_dimension PPL_PROTO((ppl_const_Constraint_t c,
ppl_dimension_type* m));
/*! \relates ppl_Constraint_tag \brief
Returns the type of constraint \p c.
*/
int
ppl_Constraint_type PPL_PROTO((ppl_const_Constraint_t c));
/*! \relates ppl_Constraint_tag \brief
Copies into \p n the coefficient of variable \p var in
constraint \p c.
*/
int
ppl_Constraint_coefficient PPL_PROTO((ppl_const_Constraint_t c,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Constraint_tag \brief
Copies into \p n the inhomogeneous term of constraint \p c.
*/
int
ppl_Constraint_inhomogeneous_term PPL_PROTO((ppl_const_Constraint_t c,
ppl_Coefficient_t n));
/*! \relates ppl_Constraint_tag \brief
Returns a positive integer if \p c is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p c is broken. Useful for debugging purposes.
*/
int
ppl_Constraint_OK PPL_PROTO((ppl_const_Constraint_t c));
/*@}*/ /* Functions that Do Not Modify the Constraint */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Constraint)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Constraint_System_tag \brief
Builds an empty system of constraints and writes a handle to it at
address \p pcs.
*/
int
ppl_new_Constraint_System PPL_PROTO((ppl_Constraint_System_t* pcs));
/*! \relates ppl_Constraint_System_tag \brief
Builds a zero-dimensional, unsatisfiable constraint system and
writes a handle to it at address \p pcs.
*/
int
ppl_new_Constraint_System_zero_dim_empty
PPL_PROTO((ppl_Constraint_System_t* pcs));
/*! \relates ppl_Constraint_System_tag \brief
Builds the singleton constraint system containing only a copy of
constraint \p c; writes a handle for the newly created system at
address \p pcs.
*/
int
ppl_new_Constraint_System_from_Constraint
PPL_PROTO((ppl_Constraint_System_t* pcs, ppl_const_Constraint_t c));
/*! \relates ppl_Constraint_System_tag \brief
Builds a constraint system that is a copy of \p cs; writes a handle
for the newly created system at address \p pcs.
*/
int
ppl_new_Constraint_System_from_Constraint_System
PPL_PROTO((ppl_Constraint_System_t* pcs, ppl_const_Constraint_System_t cs));
/*! \relates ppl_Constraint_System_tag \brief
Assigns a copy of the constraint system \p src to \p dst.
*/
int
ppl_assign_Constraint_System_from_Constraint_System
PPL_PROTO((ppl_Constraint_System_t dst, ppl_const_Constraint_System_t src));
/*! \relates ppl_Constraint_System_tag \brief
Invalidates the handle \p cs: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Constraint_System PPL_PROTO((ppl_const_Constraint_System_t cs));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Constraint System */
/*@{*/
/*! \relates ppl_Constraint_System_tag \brief
Writes to \p m the dimension of the vector space enclosing \p cs.
*/
int
ppl_Constraint_System_space_dimension
PPL_PROTO((ppl_const_Constraint_System_t cs, ppl_dimension_type* m));
/*! \relates ppl_Constraint_System_tag \brief
Returns a positive integer if \p cs contains no (non-trivial) constraint;
returns 0 otherwise.
*/
int
ppl_Constraint_System_empty
PPL_PROTO((ppl_const_Constraint_System_t cs));
/*! \relates ppl_Constraint_System_tag \brief
Returns a positive integer if \p cs contains any (non-trivial) strict
inequality; returns 0 otherwise.
*/
int
ppl_Constraint_System_has_strict_inequalities
PPL_PROTO((ppl_const_Constraint_System_t cs));
/*! \relates ppl_Constraint_System_tag \brief
Assigns to \p cit a const iterator "pointing" to the beginning of
the constraint system \p cs.
*/
int
ppl_Constraint_System_begin
PPL_PROTO((ppl_const_Constraint_System_t cs,
ppl_Constraint_System_const_iterator_t cit));
/*! \relates ppl_Constraint_System_tag \brief
Assigns to \p cit a const iterator "pointing" past the end of the
constraint system \p cs.
*/
int
ppl_Constraint_System_end
PPL_PROTO((ppl_const_Constraint_System_t cs,
ppl_Constraint_System_const_iterator_t cit));
/*! \relates ppl_Constraint_System_tag \brief
Returns a positive integer if \p cs is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p cs is broken. Useful for debugging purposes.
*/
int
ppl_Constraint_System_OK PPL_PROTO((ppl_const_Constraint_System_t cs));
/*@}*/ /* Functions that Do Not Modify the Constraint System */
/*! \brief \name Functions that May Modify the Constraint System */
/*@{*/
/*! \relates ppl_Constraint_System_tag \brief
Removes all the constraints from the constraint system \p cs
and sets its space dimension to 0.
*/
int
ppl_Constraint_System_clear PPL_PROTO((ppl_Constraint_System_t cs));
/*! \relates ppl_Constraint_System_tag \brief
Inserts a copy of the constraint \p c into \p cs; the space
dimension is increased, if necessary.
*/
int
ppl_Constraint_System_insert_Constraint PPL_PROTO((ppl_Constraint_System_t cs,
ppl_const_Constraint_t c));
/*@}*/ /* Functions that May Modify the Constraint System */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Constraint_System)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Builds a new `const iterator' and writes a handle to it at address
\p pcit.
*/
int
ppl_new_Constraint_System_const_iterator
PPL_PROTO((ppl_Constraint_System_const_iterator_t* pcit));
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Builds a const iterator that is a copy of \p cit; writes a
handle for the newly created const iterator at address \p pcit.
*/
int
ppl_new_Constraint_System_const_iterator_from_Constraint_System_const_iterator
PPL_PROTO((ppl_Constraint_System_const_iterator_t* pcit,
ppl_const_Constraint_System_const_iterator_t cit));
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Assigns a copy of the const iterator \p src to \p dst.
*/
int
ppl_assign_Constraint_System_const_iterator_from_Constraint_System_const_iterator
PPL_PROTO((ppl_Constraint_System_const_iterator_t dst,
ppl_const_Constraint_System_const_iterator_t src));
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Invalidates the handle \p cit: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Constraint_System_const_iterator
PPL_PROTO((ppl_const_Constraint_System_const_iterator_t cit));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Dereferencing, Incrementing and Equality Testing */
/*@{*/
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Dereference \p cit writing a const handle to the resulting
constraint at address \p pc.
*/
int
ppl_Constraint_System_const_iterator_dereference
PPL_PROTO((ppl_const_Constraint_System_const_iterator_t cit,
ppl_const_Constraint_t* pc));
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Increment \p cit so that it "points" to the next constraint.
*/
int
ppl_Constraint_System_const_iterator_increment
PPL_PROTO((ppl_Constraint_System_const_iterator_t cit));
/*! \relates ppl_Constraint_System_const_iterator_tag \brief
Returns a positive integer if the iterators corresponding to \p x and
\p y are equal; returns 0 if they are different.
*/
int
ppl_Constraint_System_const_iterator_equal_test
PPL_PROTO((ppl_const_Constraint_System_const_iterator_t x,
ppl_const_Constraint_System_const_iterator_t y));
/*@}*/ /* Dereferencing, Incrementing and Equality Testing */
/*! \brief \ingroup Datatypes
Describes the different kinds of generators.
*/
enum ppl_enum_Generator_Type {
/*! The generator is a line. */
PPL_GENERATOR_TYPE_LINE,
/*! The generator is a ray. */
PPL_GENERATOR_TYPE_RAY,
/*! The generator is a point. */
PPL_GENERATOR_TYPE_POINT,
/*! The generator is a closure point. */
PPL_GENERATOR_TYPE_CLOSURE_POINT
};
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Generator_tag \brief
Creates a new generator of direction \p le and type \p t. If the
generator to be created is a point or a closure point, the divisor
\p d is applied to \p le. For other types of generators \p d is
simply disregarded. A handle for the new generator is written at
address \p pg. The space dimension of the new generator is equal to
the space dimension of \p le.
*/
int
ppl_new_Generator PPL_PROTO((ppl_Generator_t* pg,
ppl_const_Linear_Expression_t le,
enum ppl_enum_Generator_Type t,
ppl_const_Coefficient_t d));
/*! \relates ppl_Generator_tag \brief
Creates the point that is the origin of the zero-dimensional space
\f$\Rset^0\f$. Writes a handle for the new generator at address
\p pg.
*/
int
ppl_new_Generator_zero_dim_point PPL_PROTO((ppl_Generator_t* pg));
/*! \relates ppl_Generator_tag \brief
Creates, as a closure point, the point that is the origin of the
zero-dimensional space \f$\Rset^0\f$. Writes a handle for the new
generator at address \p pg.
*/
int
ppl_new_Generator_zero_dim_closure_point PPL_PROTO((ppl_Generator_t* pg));
/*! \relates ppl_Generator_tag \brief
Builds a generator that is a copy of \p g; writes a handle
for the newly created generator at address \p pg.
*/
int
ppl_new_Generator_from_Generator PPL_PROTO((ppl_Generator_t* pg,
ppl_const_Generator_t g));
/*! \relates ppl_Generator_tag \brief
Assigns a copy of the generator \p src to \p dst.
*/
int
ppl_assign_Generator_from_Generator PPL_PROTO((ppl_Generator_t dst,
ppl_const_Generator_t src));
/*! \relates ppl_Generator_tag \brief
Invalidates the handle \p g: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Generator PPL_PROTO((ppl_const_Generator_t g));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Generator */
/*@{*/
/*! \relates ppl_Generator_tag \brief
Writes to \p m the space dimension of \p g.
*/
int
ppl_Generator_space_dimension PPL_PROTO((ppl_const_Generator_t g,
ppl_dimension_type* m));
/*! \relates ppl_Generator_tag \brief
Returns the type of generator \p g.
*/
int
ppl_Generator_type PPL_PROTO((ppl_const_Generator_t g));
/*! \relates ppl_Generator_tag \brief
Copies into \p n the coefficient of variable \p var in generator \p g.
*/
int
ppl_Generator_coefficient PPL_PROTO((ppl_const_Generator_t g,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Generator_tag \brief
If \p g is a point or a closure point assigns its divisor to \p n.
*/
int
ppl_Generator_divisor PPL_PROTO((ppl_const_Generator_t g,
ppl_Coefficient_t n));
/*! \relates ppl_Generator_tag \brief
Returns a positive integer if \p g is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p g is broken. Useful for debugging purposes.
*/
int
ppl_Generator_OK PPL_PROTO((ppl_const_Generator_t g));
/*@}*/ /* Functions that Do Not Modify the Generator */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Generator)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Generator_System_tag \brief
Builds an empty system of generators and writes a handle to it at
address \p pgs.
*/
int
ppl_new_Generator_System PPL_PROTO((ppl_Generator_System_t* pgs));
/*
Creates the universe zero-dimensional system of generators (i.e.,
containing the origin only). Writes a handle to the new system at
address \p pgs.
*/
int
ppl_new_Generator_System_zero_dim_univ
PPL_PROTO((ppl_Generator_System_t* pgs));
/*! \relates ppl_Generator_System_tag \brief
Builds the singleton generator system containing only a copy of
generator \p g; writes a handle for the newly created system at
address \p pgs.
*/
int
ppl_new_Generator_System_from_Generator PPL_PROTO((ppl_Generator_System_t* pgs,
ppl_const_Generator_t g));
/*! \relates ppl_Generator_System_tag \brief
Builds a generator system that is a copy of \p gs; writes a handle
for the newly created system at address \p pgs.
*/
int
ppl_new_Generator_System_from_Generator_System
PPL_PROTO((ppl_Generator_System_t* pgs, ppl_const_Generator_System_t gs));
/*! \relates ppl_Generator_System_tag \brief
Assigns a copy of the generator system \p src to \p dst.
*/
int
ppl_assign_Generator_System_from_Generator_System
PPL_PROTO((ppl_Generator_System_t dst, ppl_const_Generator_System_t src));
/*! \relates ppl_Generator_System_tag \brief
Invalidates the handle \p gs: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Generator_System PPL_PROTO((ppl_const_Generator_System_t gs));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Generator System */
/*@{*/
/*! \relates ppl_Generator_System_tag \brief
Writes to \p m the dimension of the vector space enclosing \p gs.
*/
int
ppl_Generator_System_space_dimension
PPL_PROTO((ppl_const_Generator_System_t gs, ppl_dimension_type* m));
/*! \relates ppl_Generator_System_tag \brief
Returns a positive integer if \p gs contains no generators;
returns 0 otherwise.
*/
int
ppl_Generator_System_empty
PPL_PROTO((ppl_const_Generator_System_t gs));
/*! \relates ppl_Generator_System_tag \brief
Assigns to \p git a const iterator "pointing" to the beginning of
the generator system \p gs.
*/
int
ppl_Generator_System_begin
PPL_PROTO((ppl_const_Generator_System_t gs,
ppl_Generator_System_const_iterator_t git));
/*! \relates ppl_Generator_System_tag \brief
Assigns to \p git a const iterator "pointing" past the end of the
generator system \p gs.
*/
int
ppl_Generator_System_end
PPL_PROTO((ppl_const_Generator_System_t gs,
ppl_Generator_System_const_iterator_t git));
/*! \relates ppl_Generator_System_tag \brief
Returns a positive integer if \p gs is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p gs is broken. Useful for debugging purposes.
*/
int
ppl_Generator_System_OK PPL_PROTO((ppl_const_Generator_System_t gs));
/*@}*/ /* Functions that Do Not Modify the Generator System */
/*! \brief \name Functions that May Modify the Generator System */
/*@{*/
/*! \relates ppl_Generator_System_tag \brief
Removes all the generators from the generator system \p gs
and sets its space dimension to 0.
*/
int
ppl_Generator_System_clear PPL_PROTO((ppl_Generator_System_t gs));
/*! \relates ppl_Generator_System_tag \brief
Inserts a copy of the generator \p g into \p gs; the space
dimension is increased, if necessary.
*/
int
ppl_Generator_System_insert_Generator PPL_PROTO((ppl_Generator_System_t gs,
ppl_const_Generator_t g));
/*@}*/ /* Functions that May Modify the Generator System */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Generator_System)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Builds a new `const iterator' and writes a handle to it at address
\p pgit.
*/
int
ppl_new_Generator_System_const_iterator
PPL_PROTO((ppl_Generator_System_const_iterator_t* pgit));
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Builds a const iterator that is a copy of \p git; writes a
handle for the newly created const iterator at address \p pgit.
*/
int
ppl_new_Generator_System_const_iterator_from_Generator_System_const_iterator
PPL_PROTO((ppl_Generator_System_const_iterator_t* pgit,
ppl_const_Generator_System_const_iterator_t git));
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Assigns a copy of the const iterator \p src to \p dst.
*/
int
ppl_assign_Generator_System_const_iterator_from_Generator_System_const_iterator
PPL_PROTO((ppl_Generator_System_const_iterator_t dst,
ppl_const_Generator_System_const_iterator_t src));
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Invalidates the handle \p git: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Generator_System_const_iterator
PPL_PROTO((ppl_const_Generator_System_const_iterator_t git));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Dereferencing, Incrementing and Equality Testing */
/*@{*/
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Dereference \p git writing a const handle to the resulting
generator at address \p pg.
*/
int
ppl_Generator_System_const_iterator_dereference
PPL_PROTO((ppl_const_Generator_System_const_iterator_t git,
ppl_const_Generator_t* pg));
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Increment \p git so that it "points" to the next generator.
*/
int
ppl_Generator_System_const_iterator_increment
PPL_PROTO((ppl_Generator_System_const_iterator_t git));
/*! \relates ppl_Generator_System_const_iterator_tag \brief
Returns a positive integer if the iterators corresponding to \p x and
\p y are equal; returns 0 if they are different.
*/
int
ppl_Generator_System_const_iterator_equal_test
PPL_PROTO((ppl_const_Generator_System_const_iterator_t x,
ppl_const_Generator_System_const_iterator_t y));
/*@}*/ /* Dereferencing, Incrementing and Equality Testing */
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Congruence_tag \brief
Creates the new congruence \f$le = 0 \pmod{m}\f$ and writes a handle for
it at address \p pc. The space dimension of the new congruence is
equal to the space dimension of \p le.
*/
int
ppl_new_Congruence PPL_PROTO((ppl_Congruence_t* pc,
ppl_const_Linear_Expression_t le,
ppl_const_Coefficient_t m));
/*! \relates ppl_Congruence_tag \brief
Creates the unsatisfiable (zero-dimension space) congruence
\f$0 = 1 \pmod{0}\f$ and writes a handle for it at address \p pc.
*/
int
ppl_new_Congruence_zero_dim_false PPL_PROTO((ppl_Congruence_t* pc));
/*! \relates ppl_Congruence_tag \brief
Creates the true (zero-dimension space) congruence \f$0 = 1 \pmod{1}\f$,
also known as <EM>integrality congruence</EM>.
A handle for the newly created congruence is written at address \p pc.
*/
int
ppl_new_Congruence_zero_dim_integrality PPL_PROTO((ppl_Congruence_t* pc));
/*! \relates ppl_Congruence_tag \brief
Builds a congruence that is a copy of \p c; writes a handle
for the newly created congruence at address \p pc.
*/
int
ppl_new_Congruence_from_Congruence PPL_PROTO((ppl_Congruence_t* pc,
ppl_const_Congruence_t c));
/*! \relates ppl_Congruence_tag \brief
Assigns a copy of the congruence \p src to \p dst.
*/
int
ppl_assign_Congruence_from_Congruence PPL_PROTO((ppl_Congruence_t dst,
ppl_const_Congruence_t src));
/*! \relates ppl_Congruence_tag \brief
Invalidates the handle \p c: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Congruence PPL_PROTO((ppl_const_Congruence_t c));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Congruence */
/*@{*/
/*! \relates ppl_Congruence_tag \brief
Writes to \p m the space dimension of \p c.
*/
int
ppl_Congruence_space_dimension PPL_PROTO((ppl_const_Congruence_t c,
ppl_dimension_type* m));
/*! \relates ppl_Congruence_tag \brief
Copies into \p n the coefficient of variable \p var in
congruence \p c.
*/
int
ppl_Congruence_coefficient PPL_PROTO((ppl_const_Congruence_t c,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Congruence_tag \brief
Copies into \p n the inhomogeneous term of congruence \p c.
*/
int
ppl_Congruence_inhomogeneous_term PPL_PROTO((ppl_const_Congruence_t c,
ppl_Coefficient_t n));
/*! \relates ppl_Congruence_tag \brief
Copies into \p m the modulus of congruence \p c.
*/
int
ppl_Congruence_modulus PPL_PROTO((ppl_const_Congruence_t c,
ppl_Coefficient_t m));
/*! \relates ppl_Congruence_tag \brief
Returns a positive integer if \p c is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p c is broken. Useful for debugging purposes.
*/
int
ppl_Congruence_OK PPL_PROTO((ppl_const_Congruence_t c));
/*@}*/ /* Functions that Do Not Modify the Congruence */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Congruence)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Congruence_System_tag \brief
Builds an empty system of congruences and writes a handle to it at
address \p pcs.
*/
int
ppl_new_Congruence_System PPL_PROTO((ppl_Congruence_System_t* pcs));
/*! \relates ppl_Congruence_System_tag \brief
Builds a zero-dimensional, unsatisfiable congruence system and
writes a handle to it at address \p pcs.
*/
int
ppl_new_Congruence_System_zero_dim_empty
PPL_PROTO((ppl_Congruence_System_t* pcs));
/*! \relates ppl_Congruence_System_tag \brief
Builds the singleton congruence system containing only a copy of
congruence \p c; writes a handle for the newly created system at
address \p pcs.
*/
int
ppl_new_Congruence_System_from_Congruence
PPL_PROTO((ppl_Congruence_System_t* pcs, ppl_const_Congruence_t c));
/*! \relates ppl_Congruence_System_tag \brief
Builds a congruence system that is a copy of \p cs; writes a handle
for the newly created system at address \p pcs.
*/
int
ppl_new_Congruence_System_from_Congruence_System
PPL_PROTO((ppl_Congruence_System_t* pcs, ppl_const_Congruence_System_t cs));
/*! \relates ppl_Congruence_System_tag \brief
Assigns a copy of the congruence system \p src to \p dst.
*/
int
ppl_assign_Congruence_System_from_Congruence_System
PPL_PROTO((ppl_Congruence_System_t dst, ppl_const_Congruence_System_t src));
/*! \relates ppl_Congruence_System_tag \brief
Invalidates the handle \p cs: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Congruence_System PPL_PROTO((ppl_const_Congruence_System_t cs));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Congruence System */
/*@{*/
/*! \relates ppl_Congruence_System_tag \brief
Writes to \p m the dimension of the vector space enclosing \p cs.
*/
int
ppl_Congruence_System_space_dimension
PPL_PROTO((ppl_const_Congruence_System_t cs, ppl_dimension_type* m));
/*! \relates ppl_Congruence_System_tag \brief
Returns a positive integer if \p cs contains no (non-trivial) congruence;
returns 0 otherwise.
*/
int
ppl_Congruence_System_empty
PPL_PROTO((ppl_const_Congruence_System_t cs));
/*! \relates ppl_Congruence_System_tag \brief
Assigns to \p cit a const iterator "pointing" to the beginning of
the congruence system \p cs.
*/
int
ppl_Congruence_System_begin
PPL_PROTO((ppl_const_Congruence_System_t cs,
ppl_Congruence_System_const_iterator_t cit));
/*! \relates ppl_Congruence_System_tag \brief
Assigns to \p cit a const iterator "pointing" past the end of the
congruence system \p cs.
*/
int
ppl_Congruence_System_end
PPL_PROTO((ppl_const_Congruence_System_t cs,
ppl_Congruence_System_const_iterator_t cit));
/*! \relates ppl_Congruence_System_tag \brief
Returns a positive integer if \p cs is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p cs is broken. Useful for debugging purposes.
*/
int
ppl_Congruence_System_OK PPL_PROTO((ppl_const_Congruence_System_t cs));
/*@}*/ /* Functions that Do Not Modify the Congruence System */
/*! \brief \name Functions that May Modify the Congruence System */
/*@{*/
/*! \relates ppl_Congruence_System_tag \brief
Removes all the congruences from the congruence system \p cs
and sets its space dimension to 0.
*/
int
ppl_Congruence_System_clear PPL_PROTO((ppl_Congruence_System_t cs));
/*! \relates ppl_Congruence_System_tag \brief
Inserts a copy of the congruence \p c into \p cs; the space
dimension is increased, if necessary.
*/
int
ppl_Congruence_System_insert_Congruence PPL_PROTO((ppl_Congruence_System_t cs,
ppl_const_Congruence_t c));
/*@}*/ /* Functions that May Modify the Congruence System */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Congruence_System)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Builds a new `const iterator' and writes a handle to it at address
\p pcit.
*/
int
ppl_new_Congruence_System_const_iterator
PPL_PROTO((ppl_Congruence_System_const_iterator_t* pcit));
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Builds a const iterator that is a copy of \p cit; writes a
handle for the newly created const iterator at address \p pcit.
*/
int
ppl_new_Congruence_System_const_iterator_from_Congruence_System_const_iterator
PPL_PROTO((ppl_Congruence_System_const_iterator_t* pcit,
ppl_const_Congruence_System_const_iterator_t cit));
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Assigns a copy of the const iterator \p src to \p dst.
*/
int
ppl_assign_Congruence_System_const_iterator_from_Congruence_System_const_iterator
PPL_PROTO((ppl_Congruence_System_const_iterator_t dst,
ppl_const_Congruence_System_const_iterator_t src));
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Invalidates the handle \p cit: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Congruence_System_const_iterator
PPL_PROTO((ppl_const_Congruence_System_const_iterator_t cit));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Dereferencing, Incrementing and Equality Testing */
/*@{*/
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Dereference \p cit writing a const handle to the resulting
congruence at address \p pc.
*/
int
ppl_Congruence_System_const_iterator_dereference
PPL_PROTO((ppl_const_Congruence_System_const_iterator_t cit,
ppl_const_Congruence_t* pc));
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Increment \p cit so that it "points" to the next congruence.
*/
int
ppl_Congruence_System_const_iterator_increment
PPL_PROTO((ppl_Congruence_System_const_iterator_t cit));
/*! \relates ppl_Congruence_System_const_iterator_tag \brief
Returns a positive integer if the iterators corresponding to \p x and
\p y are equal; returns 0 if they are different.
*/
int
ppl_Congruence_System_const_iterator_equal_test
PPL_PROTO((ppl_const_Congruence_System_const_iterator_t x,
ppl_const_Congruence_System_const_iterator_t y));
/*@}*/ /* Dereferencing, Incrementing and Equality Testing */
/*! \brief \ingroup Datatypes
Describes the different kinds of grid generators.
*/
enum ppl_enum_Grid_Generator_Type {
/*! The grid generator is a line. */
PPL_GRID_GENERATOR_TYPE_LINE,
/*! The grid generator is a parameter. */
PPL_GRID_GENERATOR_TYPE_PARAMETER,
/*! The grid generator is a point. */
PPL_GRID_GENERATOR_TYPE_POINT
};
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Grid_Generator_tag \brief
Creates a new grid generator of direction \p le and type \p t. If the
grid generator to be created is a point or a parameter, the divisor
\p d is applied to \p le. If it is a line, \p d is simply disregarded.
A handle for the new grid generator is written at address \p pg.
The space dimension of the new grid generator is equal to the space
dimension of \p le.
*/
int
ppl_new_Grid_Generator PPL_PROTO((ppl_Grid_Generator_t* pg,
ppl_const_Linear_Expression_t le,
enum ppl_enum_Grid_Generator_Type t,
ppl_const_Coefficient_t d));
/*! \relates ppl_Grid_Generator_tag \brief
Creates the point that is the origin of the zero-dimensional space
\f$\Rset^0\f$. Writes a handle for the new grid generator at address
\p pg.
*/
int
ppl_new_Grid_Generator_zero_dim_point PPL_PROTO((ppl_Grid_Generator_t* pg));
/*! \relates ppl_Grid_Generator_tag \brief
Builds a grid generator that is a copy of \p g; writes a handle
for the newly created grid generator at address \p pg.
*/
int
ppl_new_Grid_Generator_from_Grid_Generator
PPL_PROTO((ppl_Grid_Generator_t* pg, ppl_const_Grid_Generator_t g));
/*! \relates ppl_Grid_Generator_tag \brief
Assigns a copy of the grid generator \p src to \p dst.
*/
int
ppl_assign_Grid_Generator_from_Grid_Generator
PPL_PROTO((ppl_Grid_Generator_t dst,
ppl_const_Grid_Generator_t src));
/*! \relates ppl_Grid_Generator_tag \brief
Invalidates the handle \p g: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Grid_Generator PPL_PROTO((ppl_const_Grid_Generator_t g));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Grid Generator */
/*@{*/
/*! \relates ppl_Grid_Generator_tag \brief
Writes to \p m the space dimension of \p g.
*/
int
ppl_Grid_Generator_space_dimension PPL_PROTO((ppl_const_Grid_Generator_t g,
ppl_dimension_type* m));
/*! \relates ppl_Grid_Generator_tag \brief
Returns the type of grid generator \p g.
*/
int
ppl_Grid_Generator_type PPL_PROTO((ppl_const_Grid_Generator_t g));
/*! \relates ppl_Grid_Generator_tag \brief
Copies into \p n the coefficient of variable \p var in
grid generator \p g.
*/
int
ppl_Grid_Generator_coefficient PPL_PROTO((ppl_const_Grid_Generator_t g,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Grid_Generator_tag \brief
If \p g is a point or a parameter assigns its divisor to \p n.
*/
int
ppl_Grid_Generator_divisor PPL_PROTO((ppl_const_Grid_Generator_t g,
ppl_Coefficient_t n));
/*! \relates ppl_Grid_Generator_tag \brief
Returns a positive integer if \p g is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p g is broken. Useful for debugging purposes.
*/
int
ppl_Grid_Generator_OK PPL_PROTO((ppl_const_Grid_Generator_t g));
/*@}*/ /* Functions that Do Not Modify the Generator */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Grid_Generator)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Grid_Generator_System_tag \brief
Builds an empty system of grid generators and writes a handle to it at
address \p pgs.
*/
int
ppl_new_Grid_Generator_System PPL_PROTO((ppl_Grid_Generator_System_t* pgs));
/*
Creates the universe zero-dimensional system of grid generators (i.e.,
containing the origin only). Writes a handle to the new system at
address \p pgs.
*/
int
ppl_new_Grid_Generator_System_zero_dim_univ
PPL_PROTO((ppl_Grid_Generator_System_t* pgs));
/*! \relates ppl_Grid_Generator_System_tag \brief
Builds the singleton grid generator system containing only a copy of
generator \p g; writes a handle for the newly created system at
address \p pgs.
*/
int
ppl_new_Grid_Generator_System_from_Grid_Generator
PPL_PROTO((ppl_Grid_Generator_System_t* pgs,
ppl_const_Grid_Generator_t g));
/*! \relates ppl_Grid_Generator_System_tag \brief
Builds a grid generator system that is a copy of \p gs; writes a handle
for the newly created system at address \p pgs.
*/
int
ppl_new_Grid_Generator_System_from_Grid_Generator_System
PPL_PROTO((ppl_Grid_Generator_System_t* pgs,
ppl_const_Grid_Generator_System_t gs));
/*! \relates ppl_Grid_Generator_System_tag \brief
Assigns a copy of the grid generator system \p src to \p dst.
*/
int
ppl_assign_Grid_Generator_System_from_Grid_Generator_System
PPL_PROTO((ppl_Grid_Generator_System_t dst,
ppl_const_Grid_Generator_System_t src));
/*! \relates ppl_Grid_Generator_System_tag \brief
Invalidates the handle \p gs: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Grid_Generator_System
PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Functions that Do Not Modify the Grid Generator System */
/*@{*/
/*! \relates ppl_Grid_Generator_System_tag \brief
Writes to \p m the dimension of the vector space enclosing \p gs.
*/
int
ppl_Grid_Generator_System_space_dimension
PPL_PROTO((ppl_const_Grid_Generator_System_t gs, ppl_dimension_type* m));
/*! \relates ppl_Grid_Generator_System_tag \brief
Returns a positive integer if \p gs contains no generator;
returns 0 otherwise.
*/
int
ppl_Grid_Generator_System_empty
PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
/*! \relates ppl_Grid_Generator_System_tag \brief
Assigns to \p git a const iterator "pointing" to the beginning of
the grid generator system \p gs.
*/
int
ppl_Grid_Generator_System_begin
PPL_PROTO((ppl_const_Grid_Generator_System_t gs,
ppl_Grid_Generator_System_const_iterator_t git));
/*! \relates ppl_Grid_Generator_System_tag \brief
Assigns to \p git a const iterator "pointing" past the end of the
grid generator system \p gs.
*/
int
ppl_Grid_Generator_System_end
PPL_PROTO((ppl_const_Grid_Generator_System_t gs,
ppl_Grid_Generator_System_const_iterator_t git));
/*! \relates ppl_Grid_Generator_System_tag \brief
Returns a positive integer if \p gs is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p gs is broken. Useful for debugging purposes.
*/
int
ppl_Grid_Generator_System_OK PPL_PROTO((ppl_const_Grid_Generator_System_t gs));
/*@}*/ /* Functions that Do Not Modify the Grid Generator System */
/*! \brief \name Functions that May Modify the Grid Generator System */
/*@{*/
/*! \relates ppl_Grid_Generator_System_tag \brief
Removes all the generators from the grid generator system \p gs
and sets its space dimension to 0.
*/
int
ppl_Grid_Generator_System_clear PPL_PROTO((ppl_Grid_Generator_System_t gs));
/*! \relates ppl_Grid_Generator_System_tag \brief
Inserts a copy of the grid generator \p g into \p gs; the space
dimension is increased, if necessary.
*/
int
ppl_Grid_Generator_System_insert_Grid_Generator
PPL_PROTO((ppl_Grid_Generator_System_t gs,
ppl_const_Grid_Generator_t g));
/*@}*/ /* Functions that May Modify the Grid Generator System */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Grid_Generator_System)
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Builds a new `const iterator' and writes a handle to it at address
\p pgit.
*/
int
ppl_new_Grid_Generator_System_const_iterator
PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t* pgit));
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Builds a const iterator that is a copy of \p git; writes a
handle for the newly created const iterator at address \p pgit.
*/
int
ppl_new_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t* pgit,
ppl_const_Grid_Generator_System_const_iterator_t git));
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Assigns a copy of the const iterator \p src to \p dst.
*/
int
ppl_assign_Grid_Generator_System_const_iterator_from_Grid_Generator_System_const_iterator
PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t dst,
ppl_const_Grid_Generator_System_const_iterator_t src));
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Invalidates the handle \p git: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Grid_Generator_System_const_iterator
PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t git));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Dereferencing, Incrementing and Equality Testing */
/*@{*/
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Dereference \p git writing a const handle to the resulting
grid generator at address \p pg.
*/
int
ppl_Grid_Generator_System_const_iterator_dereference
PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t git,
ppl_const_Grid_Generator_t* pg));
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Increment \p git so that it "points" to the next grid generator.
*/
int
ppl_Grid_Generator_System_const_iterator_increment
PPL_PROTO((ppl_Grid_Generator_System_const_iterator_t git));
/*! \relates ppl_Grid_Generator_System_const_iterator_tag \brief
Returns a positive integer if the iterators corresponding to \p x and
\p y are equal; returns 0 if they are different.
*/
int
ppl_Grid_Generator_System_const_iterator_equal_test
PPL_PROTO((ppl_const_Grid_Generator_System_const_iterator_t x,
ppl_const_Grid_Generator_System_const_iterator_t y));
/*@}*/ /* Dereferencing, Incrementing and Equality Testing */
/*! \brief \ingroup Datatypes
Code of the worst-case polynomial complexity class.
*/
extern unsigned int PPL_COMPLEXITY_CLASS_POLYNOMIAL;
/*! \brief \ingroup Datatypes
Code of the worst-case exponential but typically polynomial
complexity class.
*/
extern unsigned int PPL_COMPLEXITY_CLASS_SIMPLEX;
/*! \brief \ingroup Datatypes
Code of the universal complexity class.
*/
extern unsigned int PPL_COMPLEXITY_CLASS_ANY;
/*! \brief \ingroup Datatypes
Individual bit saying that the polyhedron and the set of points
satisfying the constraint are disjoint.
*/
extern unsigned int PPL_POLY_CON_RELATION_IS_DISJOINT;
/*! \brief \ingroup Datatypes
Individual bit saying that the polyhedron intersects the set of
points satisfying the constraint, but it is not included in it.
*/
extern unsigned int PPL_POLY_CON_RELATION_STRICTLY_INTERSECTS;
/*! \brief \ingroup Datatypes
Individual bit saying that the polyhedron is included in the set of
points satisfying the constraint.
*/
extern unsigned int PPL_POLY_CON_RELATION_IS_INCLUDED;
/*! \brief \ingroup Datatypes
Individual bit saying that the polyhedron is included in the set of
points saturating the constraint.
*/
extern unsigned int PPL_POLY_CON_RELATION_SATURATES;
/*! \brief \ingroup Datatypes
Individual bit saying that adding the generator would not change the
polyhedron.
*/
extern unsigned int PPL_POLY_GEN_RELATION_SUBSUMES;
/*! \brief \ingroup Datatypes
Widths of bounded integer types.
*/
enum ppl_enum_Bounded_Integer_Type_Width {
/*! \hideinitializer 8 bits. */
PPL_BITS_8 = 8,
/*! \hideinitializer 16 bits. */
PPL_BITS_16 = 16,
/*! \hideinitializer 32 bits. */
PPL_BITS_32 = 32,
/*! \hideinitializer 64 bits. */
PPL_BITS_64 = 64,
/*! \hideinitializer 128 bits. */
PPL_BITS_128 = 128
};
/*! \brief \ingroup Datatypes
Representation of bounded integer types.
*/
enum ppl_enum_Bounded_Integer_Type_Representation {
/*! Unsigned binary. */
PPL_UNSIGNED,
/*! \brief
Signed binary where negative values are represented by the two's
complement of the absolute value.
*/
PPL_SIGNED_2_COMPLEMENT
};
/*! \brief \ingroup Datatypes
Overflow behavior of bounded integer types.
*/
enum ppl_enum_Bounded_Integer_Type_Overflow {
/*! \brief
On overflow, wrapping takes place.
This means that, for a \f$w\f$-bit bounded integer, the computation
happens modulo \f$2^w\f$.
*/
PPL_OVERFLOW_WRAPS,
/*! \brief
On overflow, the result is undefined.
This simply means that the result of the operation resulting in an
overflow can take any value.
\note
Even though something more serious can happen in the system
being analyzed ---due to, e.g., C's undefined behavior---, here we
are only concerned with the results of arithmetic operations.
It is the responsibility of the analyzer to ensure that other
manifestations of undefined behavior are conservatively approximated.
*/
PPL_OVERFLOW_UNDEFINED,
/*! \brief
Overflow is impossible.
This is for the analysis of languages where overflow is trapped
before it affects the state, for which, thus, any indication that
an overflow may have affected the state is necessarily due to
the imprecision of the analysis.
*/
PPL_OVERFLOW_IMPOSSIBLE
};
/*! \brief \name Symbolic Constants */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Code of the "maximization" optimization mode.
*/
extern int PPL_OPTIMIZATION_MODE_MAXIMIZATION;
/*! \relates ppl_MIP_Problem_tag \brief
Code of the "minimization" optimization mode.
*/
extern int PPL_OPTIMIZATION_MODE_MINIMIZATION;
/*! \relates ppl_MIP_Problem_tag \brief
Code of the "unfeasible MIP problem" status.
*/
extern int PPL_MIP_PROBLEM_STATUS_UNFEASIBLE;
/*! \relates ppl_MIP_Problem_tag \brief
Code of the "unbounded MIP problem" status.
*/
extern int PPL_MIP_PROBLEM_STATUS_UNBOUNDED;
/*! \relates ppl_MIP_Problem_tag \brief
Code of the "optimized MIP problem" status.
*/
extern int PPL_MIP_PROBLEM_STATUS_OPTIMIZED;
/*! \relates ppl_MIP_Problem_tag \brief
Code for the MIP problem's "pricing" control parameter name.
*/
extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_NAME_PRICING;
/*! \relates ppl_MIP_Problem_tag \brief
Code of MIP problem's "textbook" pricing method.
*/
extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_TEXTBOOK;
/*! \relates ppl_MIP_Problem_tag \brief
Code of MIP problem's "exact steepest-edge" pricing method.
*/
extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_EXACT;
/*! \relates ppl_MIP_Problem_tag \brief
Code of MIP problem's "float steepest-edge" pricing method.
*/
extern int PPL_MIP_PROBLEM_CONTROL_PARAMETER_PRICING_STEEPEST_EDGE_FLOAT;
/*! \relates ppl_PIP_Problem_tag \brief
Code of the "unfeasible PIP problem" status.
*/
extern int PPL_PIP_PROBLEM_STATUS_UNFEASIBLE;
/*! \relates ppl_PIP_Problem_tag \brief
Code of the "optimized PIP problem" status.
*/
extern int PPL_PIP_PROBLEM_STATUS_OPTIMIZED;
/*! \relates ppl_PIP_Problem_tag \brief
Code for the PIP problem's "cutting strategy" control parameter name.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_CUTTING_STRATEGY;
/*! \relates ppl_PIP_Problem_tag \brief
Code for the PIP problem's "pivot row strategy" control parameter name.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_NAME_PIVOT_ROW_STRATEGY;
/*! \relates ppl_PIP_Problem_tag \brief
Code of PIP problem's "first" cutting strategy.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_FIRST;
/*! \relates ppl_PIP_Problem_tag \brief
Code of PIP problem's "deepest" cutting strategy.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_DEEPEST;
/*! \relates ppl_PIP_Problem_tag \brief
Code of PIP problem's "all" cutting strategy.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_CUTTING_STRATEGY_ALL;
/*! \relates ppl_PIP_Problem_tag \brief
Code of PIP problem's "first" pivot row strategy.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_FIRST;
/*! \relates ppl_PIP_Problem_tag \brief
Code of PIP problem's "max column" pivot row strategy.
*/
extern int PPL_PIP_PROBLEM_CONTROL_PARAMETER_PIVOT_ROW_STRATEGY_MAX_COLUMN;
/*@}*/ /* Symbolic Constants */
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Builds a trivial MIP problem of dimension \p d and writes a
handle to it at address \p pmip.
*/
int
ppl_new_MIP_Problem_from_space_dimension PPL_PROTO((ppl_MIP_Problem_t* pmip,
ppl_dimension_type d));
/*! \relates ppl_MIP_Problem_tag \brief
Builds a MIP problem of space dimension \p d having feasible region \p cs,
objective function \p le and optimization mode \p m; writes a handle to
it at address \p pmip.
*/
int
ppl_new_MIP_Problem PPL_PROTO((ppl_MIP_Problem_t* pmip,
ppl_dimension_type d,
ppl_const_Constraint_System_t cs,
ppl_const_Linear_Expression_t le,
int m));
/*! \relates ppl_MIP_Problem_tag \brief
Builds a MIP problem that is a copy of \p mip; writes a handle
for the newly created system at address \p pmip.
*/
int
ppl_new_MIP_Problem_from_MIP_Problem
PPL_PROTO((ppl_MIP_Problem_t* pmip, ppl_const_MIP_Problem_t mip));
/*! \relates ppl_MIP_Problem_tag \brief
Assigns a copy of the MIP problem \p src to \p dst.
*/
int
ppl_assign_MIP_Problem_from_MIP_Problem
PPL_PROTO((ppl_MIP_Problem_t dst, ppl_const_MIP_Problem_t src));
/*! \relates ppl_MIP_Problem_tag \brief
Invalidates the handle \p mip: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_MIP_Problem PPL_PROTO((ppl_const_MIP_Problem_t mip));
/*@}*/ /* Constructors, Assignment and Destructor for MIP_Problem */
/*! \brief \name Functions that Do Not Modify the MIP_Problem */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Writes to \p m the dimension of the vector space enclosing \p mip.
*/
int
ppl_MIP_Problem_space_dimension
PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type* m));
/*! \relates ppl_MIP_Problem_tag \brief
Writes to \p m the number of integer space dimensions of \p mip.
*/
int
ppl_MIP_Problem_number_of_integer_space_dimensions
PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type* m));
/*! \relates ppl_MIP_Problem_tag \brief
Writes in the first positions of the array \p ds all the integer space
dimensions of problem \p mip. If the array is not big enough to hold
all of the integer space dimensions, the behavior is undefined.
*/
int
ppl_MIP_Problem_integer_space_dimensions
PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_dimension_type ds[]));
/*! \relates ppl_MIP_Problem_tag \brief
Writes to \p m the number of constraints defining
the feasible region of \p mip.
*/
int
ppl_MIP_Problem_number_of_constraints PPL_PROTO((ppl_const_MIP_Problem_t mip,
ppl_dimension_type* m));
/*! \relates ppl_MIP_Problem_tag \brief
Writes at address \p pc a const handle to the \p i-th constraint
defining the feasible region of the MIP problem \p mip
*/
int
ppl_MIP_Problem_constraint_at_index PPL_PROTO((ppl_const_MIP_Problem_t mip,
ppl_dimension_type i,
ppl_const_Constraint_t* pc));
/*! \relates ppl_MIP_Problem_tag \brief
Writes a const handle to the linear expression defining the
objective function of the MIP problem \p mip at address \p ple.
*/
int
ppl_MIP_Problem_objective_function
PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_const_Linear_Expression_t* ple));
/*! \relates ppl_MIP_Problem_tag \brief
Returns the optimization mode of the MIP problem \p mip.
*/
int
ppl_MIP_Problem_optimization_mode PPL_PROTO((ppl_const_MIP_Problem_t mip));
/*! \relates ppl_MIP_Problem_tag \brief
Returns a positive integer if \p mip is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p mip is broken. Useful for debugging purposes.
*/
int
ppl_MIP_Problem_OK PPL_PROTO((ppl_const_MIP_Problem_t mip));
/*@}*/ /* Functions that Do Not Modify the MIP_Problem */
/*! \brief \name Functions that May Modify the MIP_Problem */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Resets the MIP problem to be a trivial problem of space dimension 0.
*/
int
ppl_MIP_Problem_clear PPL_PROTO((ppl_MIP_Problem_t mip));
/*! \relates ppl_MIP_Problem_tag \brief
Adds \p d new dimensions to the space enclosing the MIP problem \p mip
and to \p mip itself.
*/
int
ppl_MIP_Problem_add_space_dimensions_and_embed
PPL_PROTO((ppl_MIP_Problem_t mip, ppl_dimension_type d));
/*! \relates ppl_MIP_Problem_tag \brief
Sets the space dimensions that are specified in first \p n positions
of the array \p ds to be integer dimensions of problem \p mip.
The presence of duplicates in \p ds is a waste but an innocuous one.
*/
int
ppl_MIP_Problem_add_to_integer_space_dimensions
PPL_PROTO((ppl_MIP_Problem_t mip, ppl_dimension_type ds[], size_t n));
/*! \relates ppl_MIP_Problem_tag \brief
Modifies the feasible region of the MIP problem \p mip by adding a copy
of the constraint \p c.
*/
int
ppl_MIP_Problem_add_constraint PPL_PROTO((ppl_MIP_Problem_t mip,
ppl_const_Constraint_t c));
/*! \relates ppl_MIP_Problem_tag \brief
Modifies the feasible region of the MIP problem \p mip by adding a copy
of the constraints in \p cs.
*/
int
ppl_MIP_Problem_add_constraints PPL_PROTO((ppl_MIP_Problem_t mip,
ppl_const_Constraint_System_t cs));
/*! \relates ppl_MIP_Problem_tag \brief
Sets the objective function of the MIP problem \p mip to a copy of \p le.
*/
int
ppl_MIP_Problem_set_objective_function
PPL_PROTO((ppl_MIP_Problem_t mip, ppl_const_Linear_Expression_t le));
/*! \relates ppl_MIP_Problem_tag \brief
Sets the optimization mode of the MIP problem \p mip to \p mode.
*/
int
ppl_MIP_Problem_set_optimization_mode PPL_PROTO((ppl_MIP_Problem_t mip,
int mode));
/*@}*/ /* Functions that May Modify the MIP_Problem */
/*! \brief \name Computing the Solution of the MIP_Problem */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Returns a positive integer if \p mip is satisfiable; returns 0 otherwise.
*/
int
ppl_MIP_Problem_is_satisfiable PPL_PROTO((ppl_const_MIP_Problem_t mip));
/*! \relates ppl_MIP_Problem_tag \brief
Solves the MIP problem \p mip, returning an exit status.
\return
<CODE>PPL_MIP_PROBLEM_STATUS_UNFEASIBLE</CODE> if the MIP problem
is not satisfiable;
<CODE>PPL_MIP_PROBLEM_STATUS_UNBOUNDED</CODE> if the MIP problem
is satisfiable but there is no finite bound to the value of
the objective function;
<CODE>PPL_MIP_PROBLEM_STATUS_OPTIMIZED</CODE> if the MIP problem
admits an optimal solution.
*/
int
ppl_MIP_Problem_solve PPL_PROTO((ppl_const_MIP_Problem_t mip));
/*! \relates ppl_MIP_Problem_tag \brief
Evaluates the objective function of \p mip on point \p g.
\param mip
The MIP problem defining the objective function;
\param g
The generator on which the objective function will be evaluated;
\param num
Will be assigned the numerator of the objective function value;
\param den
Will be assigned the denominator of the objective function value;
*/
int
ppl_MIP_Problem_evaluate_objective_function
PPL_PROTO((ppl_const_MIP_Problem_t mip, ppl_const_Generator_t g,
ppl_Coefficient_t num, ppl_Coefficient_t den));
/*! \relates ppl_MIP_Problem_tag \brief
Writes a const handle to a feasible point for the MIP problem \p mip
at address \p pg.
*/
int
ppl_MIP_Problem_feasible_point PPL_PROTO((ppl_const_MIP_Problem_t mip,
ppl_const_Generator_t* pg));
/*! \relates ppl_MIP_Problem_tag \brief
Writes a const handle to an optimizing point for the MIP problem \p mip
at address \p pg.
*/
int
ppl_MIP_Problem_optimizing_point PPL_PROTO((ppl_const_MIP_Problem_t mip,
ppl_const_Generator_t* pg));
/*! \relates ppl_MIP_Problem_tag \brief
Returns the optimal value for \p mip.
\param mip
The MIP problem;
\param num
Will be assigned the numerator of the optimal value;
\param den
Will be assigned the denominator of the optimal value.
*/
int
ppl_MIP_Problem_optimal_value
PPL_PROTO((ppl_const_MIP_Problem_t mip,
ppl_Coefficient_t num, ppl_Coefficient_t den));
/*@}*/ /* Computing the Solution of the MIP_Problem */
/*! \brief \name Querying/Setting Control Parameters */
/*@{*/
/*! \relates ppl_MIP_Problem_tag \brief
Returns the value of control parameter \p name in problem \p mip.
*/
int
ppl_MIP_Problem_get_control_parameter
PPL_PROTO((ppl_const_MIP_Problem_t mip, int name));
/*! \relates ppl_MIP_Problem_tag \brief
Sets control parameter \p value in problem \p mip.
*/
int
ppl_MIP_Problem_set_control_parameter
PPL_PROTO((ppl_MIP_Problem_t mip, int value));
/*! \relates ppl_MIP_Problem_tag \brief
Writes into \p *sz the size in bytes of the memory occupied by \p mip.
*/
int
ppl_MIP_Problem_total_memory_in_bytes
PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz));
/*! \relates ppl_MIP_Problem_tag \brief
Writes into \p *sz the size in bytes of the memory managed by \p mip.
*/
int
ppl_MIP_Problem_external_memory_in_bytes
PPL_PROTO((ppl_const_MIP_Problem_t mip, size_t* sz));
/*@}*/ /* Querying/Setting Control Parameters */
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_PIP_Problem_tag \brief
Builds a trivial PIP problem of dimension \p d and writes a
handle to it at address \p ppip.
*/
int
ppl_new_PIP_Problem_from_space_dimension PPL_PROTO((ppl_PIP_Problem_t* ppip,
ppl_dimension_type d));
/*! \relates ppl_PIP_Problem_tag \brief
Builds a PIP problem that is a copy of \p pip; writes a handle
for the newly created problem at address \p ppip.
*/
int
ppl_new_PIP_Problem_from_PIP_Problem
PPL_PROTO((ppl_PIP_Problem_t* ppip, ppl_const_PIP_Problem_t pip));
/*! \relates ppl_PIP_Problem_tag \brief
Assigns a copy of the PIP problem \p src to \p dst.
*/
int
ppl_assign_PIP_Problem_from_PIP_Problem
PPL_PROTO((ppl_PIP_Problem_t dst, ppl_const_PIP_Problem_t src));
/*! \relates ppl_PIP_Problem_tag \brief
Builds a PIP problem having space dimension \p d from the sequence
of constraints in the range \f$[\mathrm{first}, \mathrm{last})\f$;
the \p n dimensions whose indices occur in \p ds are interpreted as
parameters.
*/
int
ppl_new_PIP_Problem_from_constraints
PPL_PROTO((ppl_PIP_Problem_t* ppip,
ppl_dimension_type d,
ppl_Constraint_System_const_iterator_t first,
ppl_Constraint_System_const_iterator_t last,
size_t n,
ppl_dimension_type ds[]));
/*! \relates ppl_PIP_Problem_tag \brief
Invalidates the handle \p pip: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_PIP_Problem PPL_PROTO((ppl_const_PIP_Problem_t pip));
/*@}*/ /* Constructors, Assignment and Destructor for PIP_Problem */
/*! \brief \name Functions that Do Not Modify the PIP_Problem */
/*@{*/
/*! \relates ppl_PIP_Problem_tag \brief
Writes to \p m the dimension of the vector space enclosing \p pip.
The vector space dimensions includes both the problem variables
and the problem parameters, but they do not include the artificial
parameters.
*/
int
ppl_PIP_Problem_space_dimension
PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* m));
/*! \relates ppl_PIP_Problem_tag \brief
Writes to \p m the number of parameter space dimensions of \p pip.
*/
int
ppl_PIP_Problem_number_of_parameter_space_dimensions
PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* m));
/*! \relates ppl_PIP_Problem_tag \brief
Writes in the first positions of the array \p ds all the parameter space
dimensions of problem \p pip. If the array is not big enough to hold
all of the parameter space dimensions, the behavior is undefined.
*/
int
ppl_PIP_Problem_parameter_space_dimensions
PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type ds[]));
/*! \relates ppl_PIP_Problem_tag \brief
Writes into \p *pd the big parameter dimension of PIP problem \p pip.
*/
int
ppl_PIP_Problem_get_big_parameter_dimension
PPL_PROTO((ppl_const_PIP_Problem_t pip, ppl_dimension_type* pd));
/*! \relates ppl_PIP_Problem_tag \brief
Writes to \p m the number of constraints defining
the feasible region of \p pip.
*/
int
ppl_PIP_Problem_number_of_constraints PPL_PROTO((ppl_const_PIP_Problem_t pip,
ppl_dimension_type* m));
/*! \relates ppl_PIP_Problem_tag \brief
Writes at address \p pc a const handle to the \p i-th constraint
defining the feasible region of the PIP problem \p pip
*/
int
ppl_PIP_Problem_constraint_at_index PPL_PROTO((ppl_const_PIP_Problem_t pip,
ppl_dimension_type i,
ppl_const_Constraint_t* pc));
/*! \relates ppl_PIP_Problem_tag \brief
Writes into \p *sz the size in bytes of the memory occupied by \p pip.
*/
int
ppl_PIP_Problem_total_memory_in_bytes
PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz));
/*! \relates ppl_PIP_Problem_tag \brief
Writes into \p *sz the size in bytes of the memory managed by \p pip.
*/
int
ppl_PIP_Problem_external_memory_in_bytes
PPL_PROTO((ppl_const_PIP_Problem_t pip, size_t* sz));
/*! \relates ppl_PIP_Problem_tag \brief
Returns a positive integer if \p pip is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p pip is broken. Useful for debugging purposes.
*/
int
ppl_PIP_Problem_OK PPL_PROTO((ppl_const_PIP_Problem_t pip));
/*@}*/ /* Functions that Do Not Modify the PIP_Problem */
/*! \brief \name Functions that May Modify the PIP_Problem */
/*@{*/
/*! \relates ppl_PIP_Problem_tag \brief
Resets the PIP problem to be a trivial problem of space dimension 0.
*/
int
ppl_PIP_Problem_clear PPL_PROTO((ppl_PIP_Problem_t pip));
/*! \relates ppl_PIP_Problem_tag \brief
Adds <CODE>pip_vars + pip_params</CODE> new space dimensions
and embeds the PIP problem \p pip in the new vector space.
\param pip
The PIP problem to be embedded in the new vector space.
\param pip_vars
The number of space dimensions to add that are interpreted as
PIP problem variables (i.e., non parameters). These are added
\e before adding the \p pip_params parameters.
\param pip_params
The number of space dimensions to add that are interpreted as
PIP problem parameters. These are added \e after having added the
\p pip_vars problem variables.
The new space dimensions will be those having the highest indexes
in the new PIP problem; they are initially unconstrained.
*/
int
ppl_PIP_Problem_add_space_dimensions_and_embed
PPL_PROTO((ppl_PIP_Problem_t pip,
ppl_dimension_type pip_vars,
ppl_dimension_type pip_params));
/*! \relates ppl_PIP_Problem_tag \brief
Sets the space dimensions that are specified in first \p n positions
of the array \p ds to be parameter dimensions of problem \p pip.
The presence of duplicates in \p ds is a waste but an innocuous one.
*/
int
ppl_PIP_Problem_add_to_parameter_space_dimensions
PPL_PROTO((ppl_PIP_Problem_t pip, ppl_dimension_type ds[], size_t n));
/*! \relates ppl_PIP_Problem_tag \brief
Sets the big parameter dimension of PIP problem \p pip to \p d.
*/
int
ppl_PIP_Problem_set_big_parameter_dimension
PPL_PROTO((ppl_PIP_Problem_t pip, ppl_dimension_type d));
/*! \relates ppl_PIP_Problem_tag \brief
Modifies the feasible region of the PIP problem \p pip by adding a copy
of the constraint \p c.
*/
int
ppl_PIP_Problem_add_constraint PPL_PROTO((ppl_PIP_Problem_t pip,
ppl_const_Constraint_t c));
/*! \relates ppl_PIP_Problem_tag \brief
Modifies the feasible region of the PIP problem \p pip by adding a copy
of the constraints in \p cs.
*/
int
ppl_PIP_Problem_add_constraints PPL_PROTO((ppl_PIP_Problem_t pip,
ppl_const_Constraint_System_t cs));
/*@}*/ /* Functions that May Modify the PIP_Problem */
/*! \brief \name Computing and Printing the Solution of the PIP_Problem */
/*@{*/
/*! \relates ppl_PIP_Problem_tag \brief
Returns a positive integer if \p pip is satisfiable and an optimal
solution can be found; returns 0 otherwise.
*/
int
ppl_PIP_Problem_is_satisfiable PPL_PROTO((ppl_const_PIP_Problem_t pip));
/*! \relates ppl_PIP_Problem_tag \brief
Solves the PIP problem \p pip, returning an exit status.
\return
<CODE>PPL_PIP_PROBLEM_STATUS_UNFEASIBLE</CODE> if the PIP problem
is not satisfiable;
<CODE>PPL_PIP_PROBLEM_STATUS_OPTIMIZED</CODE> if the PIP problem
admits an optimal solution.
*/
int
ppl_PIP_Problem_solve PPL_PROTO((ppl_const_PIP_Problem_t pip));
/*! \relates ppl_PIP_Problem_tag \brief
Writes to \p pip_tree a solution for \p pip, if it exists.
*/
int
ppl_PIP_Problem_solution PPL_PROTO((ppl_const_PIP_Problem_t pip,
ppl_const_PIP_Tree_Node_t* pip_tree));
/*! \relates ppl_PIP_Problem_tag \brief
Writes to \p pip_tree an optimizing solution for \p pip, if it exists.
*/
int
ppl_PIP_Problem_optimizing_solution
PPL_PROTO((ppl_const_PIP_Problem_t pip,
ppl_const_PIP_Tree_Node_t* pip_tree));
/*@}*/ /* Computing the Solution of the PIP_Problem */
/*! \brief \name Querying/Setting Control Parameters */
/*@{*/
/*! \relates ppl_PIP_Problem_tag \brief
Returns the value of control parameter \p name in problem \p pip.
*/
int
ppl_PIP_Problem_get_control_parameter
PPL_PROTO((ppl_const_PIP_Problem_t pip, int name));
/*! \relates ppl_PIP_Problem_tag \brief
Sets control parameter \p value in problem \p pip.
*/
int
ppl_PIP_Problem_set_control_parameter
PPL_PROTO((ppl_PIP_Problem_t pip, int value));
/*@}*/ /* Querying/Setting Control Parameters */
/*! \relates ppl_PIP_Tree_Node_tag \brief
Writes to \p dpip_tree the solution node if \p spip_tree is
a solution node, and 0 otherwise.
*/
int
ppl_PIP_Tree_Node_as_solution
PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
ppl_const_PIP_Solution_Node_t* dpip_tree));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Writes to \p dpip_tree the decision node if \p spip_tree
is a decision node, and 0 otherwise.
*/
int
ppl_PIP_Tree_Node_as_decision
PPL_PROTO((ppl_const_PIP_Tree_Node_t spip_tree,
ppl_const_PIP_Decision_Node_t* dpip_tree));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Writes to \p pcs the local system of parameter constraints
at the pip tree node \p pip_tree.
*/
int
ppl_PIP_Tree_Node_get_constraints
PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
ppl_const_Constraint_System_t* pcs));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Returns a positive integer if \p pip_tree is well formed, i.e., if it
satisfies all its implementation invariants; returns 0 and perhaps
makes some noise if \p pip_tree is broken. Useful for debugging purposes.
*/
int
ppl_PIP_Tree_Node_OK PPL_PROTO((ppl_const_PIP_Tree_Node_t pip));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Writes to \p m the number of elements in the artificial parameter sequence
in the pip tree node \p pip_tree.
*/
int
ppl_PIP_Tree_Node_number_of_artificials
PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
ppl_dimension_type* m));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Assigns to \p pit a const iterator "pointing" to the beginning of
the artificial parameter sequence in the pip tree node \p pip_tree.
*/
int
ppl_PIP_Tree_Node_begin
PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
ppl_Artificial_Parameter_Sequence_const_iterator_t pit));
/*! \relates ppl_PIP_Tree_Node_tag \brief
Assigns to \p pit a const iterator "pointing" to the end of
the artificial parameter sequence in the pip tree node \p pip_tree.
*/
int
ppl_PIP_Tree_Node_end
PPL_PROTO((ppl_const_PIP_Tree_Node_t pip_tree,
ppl_Artificial_Parameter_Sequence_const_iterator_t pit));
/*! \relates ppl_PIP_Solution_Node_tag \brief
Writes to \p le a const pointer to the parametric expression of the values
of variable \p var in solution node \p pip_sol.
The linear expression assigned to \p le will only refer to
(problem or artificial) parameters.
\param pip_sol
The solution tree node.
\param var
The variable which is queried about.
\param le
The returned expression for variable \p var.
\return PPL_ERROR_INVALID_ARGUMENT
Returned if \p var is dimension-incompatible with \p *this
or if \p var is a problem parameter.
*/
int
ppl_PIP_Solution_Node_get_parametric_values
PPL_PROTO((ppl_const_PIP_Solution_Node_t pip_sol,
ppl_dimension_type var,
ppl_const_Linear_Expression_t* le));
/*! \relates ppl_PIP_Decision_Node_tag \brief
Writes to \p pip_tree a const pointer to either the true branch
(if \p b is not zero) or the false branch (if \p b is zero) of \p pip_dec.
*/
int
ppl_PIP_Decision_Node_get_child_node
PPL_PROTO((ppl_const_PIP_Decision_Node_t pip_dec,
int b,
ppl_const_PIP_Tree_Node_t* pip_tree));
/*! \relates ppl_Artificial_Parameter_tag \brief
Copies into \p le the linear expression in artificial parameter \p ap.
*/
int
ppl_Artificial_Parameter_get_Linear_Expression
PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
ppl_Linear_Expression_t le));
/*! \relates ppl_Artificial_Parameter_tag \brief
Copies into \p n the coefficient of variable \p var in
the artificial parameter \p ap.
*/
int
ppl_Artificial_Parameter_coefficient
PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
ppl_dimension_type var,
ppl_Coefficient_t n));
/*! \relates ppl_Artificial_Parameter_tag \brief
Copies into \p n the inhomogeneous term of the artificial
parameter \p ap.
*/
int
ppl_Artificial_Parameter_get_inhomogeneous_term
PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
ppl_Coefficient_t n));
/*! \relates ppl_Artificial_Parameter_tag \brief
Copies into \p n the denominator in artificial parameter \p ap.
*/
int
ppl_Artificial_Parameter_denominator
PPL_PROTO((ppl_const_Artificial_Parameter_t ap,
ppl_Coefficient_t n));
/*! \brief \name Constructors, Assignment and Destructor */
/*@{*/
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Builds a new `const iterator' and writes a handle to it at address
\p papit.
*/
int
ppl_new_Artificial_Parameter_Sequence_const_iterator
PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t* papit));
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Builds a const iterator that is a copy of \p apit; writes a
handle for the newly created const iterator at address \p papit.
*/
int
ppl_new_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t* papit,
ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit));
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Assigns a copy of the const iterator \p src to \p dst.
*/
int
ppl_assign_Artificial_Parameter_Sequence_const_iterator_from_Artificial_Parameter_Sequence_const_iterator
PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t dst,
ppl_const_Artificial_Parameter_Sequence_const_iterator_t src));
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Invalidates the handle \p apit: this makes sure the corresponding
resources will eventually be released.
*/
int
ppl_delete_Artificial_Parameter_Sequence_const_iterator
PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit));
/*@}*/ /* Constructors, Assignment and Destructor */
/*! \brief \name Dereferencing, Incrementing and Equality Testing */
/*@{*/
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Dereference \p apit writing a const handle to the resulting
artificial parameter at address \p pap.
*/
int
ppl_Artificial_Parameter_Sequence_const_iterator_dereference
PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t apit,
ppl_const_Artificial_Parameter_t* pap));
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Increment \p apit so that it "points" to the next artificial parameter.
*/
int
ppl_Artificial_Parameter_Sequence_const_iterator_increment
PPL_PROTO((ppl_Artificial_Parameter_Sequence_const_iterator_t apit));
/*! \relates ppl_Artificial_Parameter_Sequence_const_iterator_tag \brief
Returns a positive integer if the iterators corresponding to \p x and
\p y are equal; returns 0 if they are different.
*/
int
ppl_Artificial_Parameter_Sequence_const_iterator_equal_test
PPL_PROTO((ppl_const_Artificial_Parameter_Sequence_const_iterator_t x,
ppl_const_Artificial_Parameter_Sequence_const_iterator_t y));
/*@}*/ /* Dereferencing, Incrementing and Equality Testing */
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(MIP_Problem)
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Problem)
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Tree_Node)
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Solution_Node)
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(PIP_Decision_Node)
PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS(Artificial_Parameter)
#include "ppl_c_domains.h"
#ifdef __cplusplus
} /* extern "C" */
#endif
#undef PPL_TYPE_DECLARATION
#undef PPL_PROTO
#undef PPL_DECLARE_PRINT_FUNCTIONS
#undef PPL_DECLARE_ASCII_DUMP_LOAD_FUNCTIONS
#undef PPL_DECLARE_IO_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_PRINT_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_ASCII_DUMP_LOAD_FUNCTIONS
#undef PPL_DECLARE_AND_DOCUMENT_IO_FUNCTIONS
#endif /* !defined(PPL_ppl_c_h) */
|