00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 #ifndef INCLUDE_DBM_FED_H
00017 #define INCLUDE_DBM_FED_H
00018
00019 #include <stdexcept>
00020 #include <vector>
00021 #include <string>
00022 #include "base/pointer.h"
00023 #include "base/Object.h"
00024 #include "dbm/dbm.h"
00025 #include "dbm/mingraph.h"
00026 #include "dbm/Valuation.h"
00027
00028
00029
00030
00031
00032
00033
00034 namespace dbm
00035 {
00036
00037 class ClockAccessor : public base::Object
00038 {
00039 public:
00040 virtual ~ClockAccessor() {}
00041
00042
00043
00044 virtual const std::string getClockName(cindex_t index) const = 0;
00045 };
00046
00047
00048 class idbm_t;
00049 class ifed_t;
00050 class fdbm_t;
00051 class dbmlist_t;
00052
00053
00054 class dbm_t;
00055 class fed_t;
00056
00057
00058 template<class TYPE>
00059 class ClockOperation
00060 {
00061 public:
00062
00063 ClockOperation& operator + (int32_t val);
00064 ClockOperation& operator - (int32_t val);
00065 ClockOperation& operator += (int32_t val);
00066 ClockOperation& operator -= (int32_t val);
00067
00068
00069
00070 ClockOperation& operator = (const ClockOperation& op);
00071
00072
00073 ClockOperation& operator = (int32_t val);
00074
00075
00076
00077
00078
00079
00080 bool operator < (const ClockOperation& x) const;
00081 bool operator <= (const ClockOperation& x) const;
00082 bool operator > (const ClockOperation& x) const;
00083 bool operator >= (const ClockOperation& x) const;
00084 bool operator == (const ClockOperation& x) const;
00085 bool operator < (int32_t v) const;
00086 bool operator <= (int32_t v) const;
00087 bool operator > (int32_t v) const;
00088 bool operator >= (int32_t v) const;
00089 bool operator == (int32_t v) const;
00090
00091
00092
00093
00094
00095
00096 ClockOperation(TYPE* d, cindex_t c);
00097
00098
00099 TYPE* getPtr() const { return ptr; }
00100 cindex_t getClock() const { return clock; }
00101 int32_t getVal() const { return incVal; }
00102
00103 private:
00104 TYPE* ptr;
00105 cindex_t clock;
00106 int32_t incVal;
00107 };
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168
00169
00170
00171
00172
00173
00174
00175
00176 class dbm_t
00177 {
00178 friend class fed_t;
00179 friend class dbmlist_t;
00180 public:
00181
00182
00183 enum
00184 {
00185 MAX_DIM_POWER = 15,
00186 MAX_DIM = ((1 << MAX_DIM_POWER) - 1),
00187 };
00188
00189
00190
00191
00192 explicit dbm_t(cindex_t dim = 1);
00193
00194
00195 dbm_t(const dbm_t& arg);
00196
00197
00198
00199 dbm_t(const raw_t* arg, cindex_t dim);
00200
00201 ~dbm_t();
00202
00203
00204 cindex_t getDimension() const;
00205
00206
00207
00208
00209
00210 std::string toString(const ClockAccessor&) const;
00211
00212
00213
00214
00215 static size_t getSizeOfMinDBM(cindex_t dim, mingraph_t);
00216
00217
00218
00219
00220
00221 static dbm_t readFromMinDBM(cindex_t dim, mingraph_t);
00222
00223
00224
00225 void setDimension(cindex_t dim);
00226
00227
00228 bool isEmpty() const;
00229
00230
00231 void setEmpty();
00232
00233
00234 void nil();
00235
00236
00237 bool hasZero() const;
00238
00239
00240 uint32_t hash(uint32_t seed = 0) const;
00241
00242
00243 bool sameAs(const dbm_t& arg) const;
00244
00245
00246 void intern();
00247
00248
00249 void copyFrom(const raw_t *src, cindex_t dim);
00250
00251
00252
00253 void copyTo(raw_t *dst, cindex_t dim) const;
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263 const raw_t* operator () () const;
00264
00265
00266
00267 raw_t operator () (cindex_t i, cindex_t j) const;
00268
00269
00270
00271 const raw_t* operator [] (cindex_t i) const;
00272
00273
00274
00275 raw_t* getDBM();
00276
00277
00278
00279
00280
00281
00282
00283 size_t analyzeForMinDBM(uint32_t *bitMatrix) const;
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293 int32_t* writeToMinDBMWithOffset(bool minimizeGraph,
00294 bool tryConstraints16,
00295 allocator_t c_alloc,
00296 size_t offset) const;
00297
00298
00299
00300
00301
00302
00303
00304
00305 int32_t* writeAnalyzedDBM(uint32_t *bitMatrix,
00306 size_t nbConstraints,
00307 BOOL tryConstraints16,
00308 allocator_t c_alloc,
00309 size_t offset) const;
00310
00311
00312
00313
00314 relation_t relation(mingraph_t ming, raw_t* unpackBuffer) const;
00315
00316
00317
00318
00319
00320 dbm_t& operator = (const dbm_t&);
00321 dbm_t& operator = (const raw_t*);
00322
00323
00324
00325
00326
00327
00328 bool operator == (const dbm_t&) const;
00329 bool operator == (const fed_t&) const;
00330 bool operator == (const raw_t*) const;
00331 bool operator != (const dbm_t&) const;
00332 bool operator != (const fed_t&) const;
00333 bool operator != (const raw_t*) const;
00334 bool operator < (const dbm_t&) const;
00335 bool operator < (const fed_t&) const;
00336 bool operator < (const raw_t*) const;
00337 bool operator > (const dbm_t&) const;
00338 bool operator > (const fed_t&) const;
00339 bool operator > (const raw_t*) const;
00340 bool operator <= (const dbm_t&) const;
00341 bool operator <= (const fed_t&) const;
00342 bool operator <= (const raw_t*) const;
00343 bool operator >= (const dbm_t&) const;
00344 bool operator >= (const fed_t&) const;
00345 bool operator >= (const raw_t*) const;
00346
00347
00348
00349
00350 relation_t relation(const dbm_t& arg) const;
00351 relation_t relation(const fed_t& arg) const;
00352 relation_t relation(const raw_t* arg, cindex_t dim) const;
00353
00354
00355
00356 bool lt(const fed_t& arg) const;
00357 bool gt(const fed_t& arg) const;
00358 bool le(const fed_t& arg) const;
00359 bool ge(const fed_t& arg) const;
00360 bool eq(const fed_t& arg) const;
00361 relation_t exactRelation(const fed_t& arg) const;
00362
00363
00364
00365
00366 dbm_t& setZero();
00367
00368
00369
00370 dbm_t& setInit();
00371
00372
00373 bool isInit() const;
00374
00375
00376 bool isZero() const;
00377
00378
00379
00380
00381
00382
00383 int32_t getUpperMinimumCost(int32_t cost) const;
00384
00385
00386 int32_t getInfimum() const { return 0; }
00387
00388
00389
00390
00391 dbm_t& operator += (const dbm_t&);
00392 dbm_t& operator += (const fed_t&);
00393 dbm_t& operator += (const raw_t*);
00394
00395
00396
00397
00398
00399 dbm_t& operator &= (const dbm_t&);
00400 dbm_t& operator &= (const raw_t*);
00401 dbm_t& operator &= (const constraint_t&);
00402 dbm_t& operator &= (const base::pointer_t<constraint_t>&);
00403 dbm_t& operator &= (const std::vector<constraint_t>&);
00404
00405
00406
00407
00408
00409
00410
00411
00412
00413
00414
00415 bool constrain(cindex_t i, int32_t value);
00416 bool constrain(cindex_t i, cindex_t j, raw_t c);
00417 bool constrain(cindex_t i, cindex_t j, int32_t b, strictness_t s);
00418 bool constrain(cindex_t i, cindex_t j, int32_t b, bool isStrict);
00419 bool constrain(const constraint_t& c);
00420 bool constrain(const constraint_t *c, size_t n);
00421 bool constrain(const cindex_t *table, const constraint_t *c, size_t n);
00422 bool constrain(const cindex_t *table, const base::pointer_t<constraint_t>&);
00423 bool constrain(const cindex_t *table, const std::vector<constraint_t>&);
00424
00425
00426
00427
00428
00429 bool intersects(const dbm_t&) const;
00430 bool intersects(const fed_t&) const;
00431 bool intersects(const raw_t*, cindex_t dim) const;
00432
00433
00434
00435 dbm_t& up();
00436
00437
00438
00439 dbm_t& down();
00440
00441
00442
00443
00444 dbm_t& freeClock(cindex_t clock);
00445
00446
00447
00448
00449
00450 dbm_t& freeUp(cindex_t clock);
00451 dbm_t& freeDown(cindex_t clock);
00452 dbm_t& freeAllUp();
00453 dbm_t& freeAllDown();
00454
00455
00456
00457
00458
00459
00460
00461
00462
00463 void updateValue(cindex_t x, int32_t v);
00464 void updateClock(cindex_t x, cindex_t y);
00465 void updateIncrement(cindex_t x, int32_t v);
00466 void update(cindex_t x, cindex_t y, int32_t v);
00467
00468
00469
00470
00471 bool satisfies(cindex_t i, cindex_t j, raw_t c) const;
00472 bool satisfies(const constraint_t& c) const;
00473 bool operator && (const constraint_t& c) const;
00474
00475
00476 bool isUnbounded() const;
00477
00478
00479
00480
00481 dbm_t& relaxUp();
00482 dbm_t& relaxDown();
00483
00484
00485
00486
00487 dbm_t& relaxUpClock(cindex_t clock);
00488 dbm_t& relaxDownClock(cindex_t clock);
00489
00490
00491 dbm_t& relaxAll();
00492
00493
00494
00495
00496 bool contains(const IntValuation& point) const;
00497 bool contains(const int32_t* point, cindex_t dim) const;
00498 bool contains(const DoubleValuation& point) const;
00499 bool contains(const double* point, cindex_t dim) const;
00500
00501
00502
00503
00504
00505
00506
00507
00508
00509
00510
00511
00512
00513
00514 bool delay(const DoubleValuation& point, double* t) const;
00515 bool delay(const double* point, cindex_t dim, double* t) const;
00516
00517
00518
00519
00520 void extrapolateMaxBounds(const int32_t *max);
00521 void diagonalExtrapolateMaxBounds(const int32_t *max);
00522 void extrapolateLUBounds(const int32_t *lower, const int32_t *upper);
00523 void diagonalExtrapolateLUBounds(const int32_t *lower, const int32_t *upper);
00524
00525
00526
00527
00528
00529
00530
00531
00532
00533
00534
00535
00536
00537
00538
00539 void resize(const uint32_t *bitSrc, const uint32_t *bitDst,
00540 size_t bitSize, cindex_t *table);
00541
00542
00543
00544
00545
00546
00547
00548
00549
00550
00551 void changeClocks(const cindex_t *target, cindex_t newDim);
00552
00553
00554 void swapClocks(cindex_t x, cindex_t y);
00555
00556
00557
00558
00559
00560
00561
00562
00563
00564
00565
00566 DoubleValuation& getValuation(DoubleValuation& cval, bool *freeC = NULL) const
00567 throw(std::out_of_range);
00568
00569
00570
00571 dbm_t(const ClockOperation<dbm_t>& op);
00572
00573
00574
00575
00576 ClockOperation<dbm_t> operator () (cindex_t clk);
00577
00578
00579
00580
00581
00582
00583 bool isSubtractionEmpty(const raw_t* arg, cindex_t dim) const;
00584 bool isSubtractionEmpty(const fed_t& arg) const;
00585 bool isSubtractionEmpty(const dbm_t& arg) const;
00586
00587
00588
00589
00590
00591
00592 void newCopy(const raw_t *arg, cindex_t dim);
00593
00594
00595 void newCopy(const dbm_t& arg);
00596
00597
00598 void updateCopy(const raw_t* arg, cindex_t dim);
00599
00600
00601 void updateCopy(const dbm_t& arg);
00602
00603
00604 const idbm_t* const_idbmt() const;
00605
00606
00607 idbm_t* idbmt();
00608
00609
00610
00611
00612 const raw_t* const_dbm() const;
00613
00614
00615
00616 raw_t* dbm();
00617
00618
00619 cindex_t edim() const;
00620
00621
00622 cindex_t pdim() const;
00623
00624
00625 bool isMutable() const;
00626
00627
00628 raw_t* getNew();
00629
00630
00631 raw_t* getCopy();
00632
00633 private:
00634
00635
00636 uintptr_t uval() const;
00637
00638
00639 void incRef() const;
00640
00641
00642 void decRef() const;
00643
00644
00645 void empty(cindex_t dim);
00646 void emptyImmutable(cindex_t dim);
00647 void emptyMutable(cindex_t dim);
00648
00649
00650 void setEmpty(cindex_t dim);
00651
00652
00653 void setPtr(idbm_t* ptr);
00654
00655
00656
00657
00658 bool tryMutable();
00659
00660
00661
00662 raw_t* setNew(cindex_t dim);
00663
00664
00665
00666 raw_t* inew(cindex_t dim);
00667
00668
00669
00670 raw_t* icopy(cindex_t dim);
00671
00672
00673
00674
00675
00676 void ptr_intern();
00677 dbm_t& ptr_convexUnion(const raw_t *arg, cindex_t dim);
00678 bool ptr_intersectionIsArg(const raw_t *arg, cindex_t dim);
00679 bool ptr_constrain(cindex_t i, cindex_t j, raw_t c);
00680 bool ptr_constrain(cindex_t k, int32_t value);
00681 bool ptr_constrain(const constraint_t *cnstr, size_t n);
00682 bool ptr_constrain(const cindex_t *table, const constraint_t *cnstr, size_t n);
00683 void ptr_up();
00684 void ptr_down();
00685 void ptr_freeClock(cindex_t k);
00686 void ptr_updateValue(cindex_t i, int32_t v);
00687 void ptr_updateClock(cindex_t i, cindex_t j);
00688 void ptr_update(cindex_t i, cindex_t j, int32_t v);
00689 void ptr_freeUp(cindex_t k);
00690 void ptr_freeDown(cindex_t k);
00691 void ptr_freeAllUp();
00692 void ptr_freeAllDown();
00693 void ptr_relaxDownClock(cindex_t k);
00694 void ptr_relaxUpClock(cindex_t k);
00695 void ptr_relaxAll();
00696 bool ptr_getValuation(DoubleValuation& cval, bool *freeC) const;
00697 void ptr_swapClocks(cindex_t x, cindex_t y);
00698 #ifdef CHECK_COW_EXTRAPOLATION
00699 void ptr_extrapolateMaxBounds(const int32_t *max);
00700 void ptr_diagonalExtrapolateMaxBounds(const int32_t *max);
00701 void ptr_extrapolateLUBounds(const int32_t *lower, const int32_t *upper);
00702 void ptr_diagonalExtrapolateLUBounds(const int32_t *lower, const int32_t *upper);
00703 #endif
00704
00705
00706
00707
00708
00709
00710 idbm_t* idbmPtr;
00711 };
00712
00713
00714
00715
00716
00717
00718
00719
00720
00721
00722
00723
00724
00725
00726
00727
00728
00729
00730
00731
00732
00733
00734
00735
00736
00737
00738
00739
00740 class fed_t
00741 {
00742 public:
00743
00744
00745
00746 explicit fed_t(cindex_t dim = 1);
00747
00748
00749 fed_t(const fed_t& arg);
00750
00751
00752 fed_t(const dbm_t& arg);
00753
00754
00755 fed_t(const raw_t* arg, cindex_t dim);
00756
00757 ~fed_t();
00758
00759
00760 size_t size() const;
00761
00762
00763 cindex_t getDimension() const;
00764
00765
00766
00767 void setDimension(cindex_t dim);
00768
00769
00770 bool isEmpty() const;
00771
00772
00773 void setEmpty();
00774
00775
00776 void nil();
00777
00778
00779 bool hasZero() const;
00780
00781
00782
00783
00784
00785 std::string toString(const ClockAccessor&) const;
00786
00787
00788
00789
00790
00791
00792 int32_t getUpperMinimumCost(int cost) const;
00793
00794
00795 int32_t getInfimum() const { return 0; }
00796
00797
00798
00799 uint32_t hash(uint32_t seed = 0) const;
00800
00801
00802 bool sameAs(const fed_t& arg) const;
00803
00804
00805 void intern();
00806
00807
00808
00809
00810
00811 fed_t& operator = (const fed_t&);
00812 fed_t& operator = (const dbm_t&);
00813 fed_t& operator = (const raw_t*);
00814
00815
00816
00817
00818
00819
00820
00821 bool operator == (const fed_t&) const;
00822 bool operator == (const dbm_t&) const;
00823 bool operator == (const raw_t*) const;
00824 bool operator != (const fed_t&) const;
00825 bool operator != (const dbm_t&) const;
00826 bool operator != (const raw_t*) const;
00827 bool operator < (const fed_t&) const;
00828 bool operator < (const dbm_t&) const;
00829 bool operator < (const raw_t*) const;
00830 bool operator > (const fed_t&) const;
00831 bool operator > (const dbm_t&) const;
00832 bool operator > (const raw_t*) const;
00833 bool operator <= (const fed_t&) const;
00834 bool operator <= (const dbm_t&) const;
00835 bool operator <= (const raw_t*) const;
00836 bool operator >= (const fed_t&) const;
00837 bool operator >= (const dbm_t&) const;
00838 bool operator >= (const raw_t*) const;
00839
00840
00841
00842
00843 relation_t relation(const fed_t& arg) const;
00844 relation_t relation(const dbm_t& arg) const;
00845 relation_t relation(const raw_t* arg, cindex_t dim) const;
00846
00847
00848 bool isSupersetEq(const raw_t* arg, cindex_t dim) const;
00849
00850
00851
00852
00853
00854 bool eq(const fed_t& arg) const;
00855 bool eq(const dbm_t& arg) const;
00856 bool eq(const raw_t* arg, cindex_t dim) const;
00857 bool lt(const fed_t& arg) const;
00858 bool lt(const dbm_t& arg) const;
00859 bool lt(const raw_t* arg, cindex_t dim) const;
00860 bool gt(const fed_t& arg) const;
00861 bool gt(const dbm_t& arg) const;
00862 bool gt(const raw_t* arg, cindex_t dim) const;
00863 bool le(const fed_t& arg) const;
00864 bool le(const dbm_t& arg) const;
00865 bool le(const raw_t* arg, cindex_t dim) const;
00866 bool ge(const fed_t& arg) const;
00867 bool ge(const dbm_t& arg) const;
00868 bool ge(const raw_t* arg, cindex_t dim) const;
00869
00870 relation_t exactRelation(const fed_t& arg) const;
00871 relation_t exactRelation(const dbm_t& arg) const;
00872 relation_t exactRelation(const raw_t* arg, cindex_t dim) const;
00873
00874
00875
00876 fed_t& setZero();
00877
00878
00879
00880 fed_t& setInit();
00881
00882
00883 fed_t& convexHull();
00884
00885
00886
00887
00888
00889 fed_t& operator |= (const fed_t&);
00890 fed_t& operator |= (const dbm_t&);
00891 fed_t& operator |= (const raw_t*);
00892
00893
00894 fed_t& unionWith(fed_t& arg);
00895 fed_t& unionWithC(fed_t arg);
00896
00897
00898
00899
00900 fed_t& add(const fed_t& arg);
00901 fed_t& add(const dbm_t& arg);
00902 fed_t& add(const raw_t* arg, cindex_t dim);
00903
00904
00905 fed_t& append(fed_t& arg);
00906 fed_t& appendC(fed_t arg);
00907 void append(fdbm_t* arg);
00908
00909
00910
00911
00912
00913
00914 fed_t& operator += (const fed_t&);
00915 fed_t& operator += (const dbm_t&);
00916 fed_t& operator += (const raw_t*);
00917
00918
00919
00920
00921
00922 fed_t& operator &= (const fed_t&);
00923 fed_t& operator &= (const dbm_t&);
00924 fed_t& operator &= (const raw_t*);
00925 fed_t& operator &= (const constraint_t&);
00926 fed_t& operator &= (const base::pointer_t<constraint_t>&);
00927 fed_t& operator &= (const std::vector<constraint_t>&);
00928
00929
00930
00931
00932 fed_t& operator -= (const fed_t&);
00933 fed_t& operator -= (const dbm_t&);
00934 fed_t& operator -= (const raw_t*);
00935
00936
00937
00938
00939
00940
00941 bool constrain(cindex_t i, int32_t value);
00942 bool constrain(cindex_t i, cindex_t j, raw_t c);
00943 bool constrain(cindex_t i, cindex_t j, int32_t b, strictness_t s);
00944 bool constrain(cindex_t i, cindex_t j, int32_t b, bool isStrict);
00945 bool constrain(const constraint_t& c);
00946 bool constrain(const constraint_t *c, size_t n);
00947 bool constrain(const cindex_t *table, const constraint_t *c, size_t n);
00948 bool constrain(const cindex_t *table, const base::pointer_t<constraint_t>&);
00949 bool constrain(const cindex_t *table, const std::vector<constraint_t>&);
00950
00951
00952
00953
00954
00955 bool intersects(const fed_t&) const;
00956 bool intersects(const dbm_t&) const;
00957 bool intersects(const raw_t*, cindex_t dim) const;
00958
00959
00960 fed_t& up();
00961
00962
00963 fed_t& down();
00964
00965
00966 fed_t& freeClock(cindex_t clock);
00967
00968
00969
00970
00971
00972 fed_t& freeUp(cindex_t clock);
00973 fed_t& freeDown(cindex_t clock);
00974 fed_t& freeAllUp();
00975 fed_t& freeAllDown();
00976
00977
00978
00979
00980
00981
00982
00983
00984
00985 void updateValue(cindex_t x, int32_t v);
00986 void updateClock(cindex_t x, cindex_t y);
00987 void updateIncrement(cindex_t x, int32_t v);
00988 void update(cindex_t x, cindex_t y, int32_t v);
00989
00990
00991
00992
00993 bool satisfies(cindex_t i, cindex_t j, raw_t c) const;
00994 bool satisfies(const constraint_t& c) const;
00995 bool operator && (const constraint_t& c) const;
00996
00997
00998 bool isUnbounded() const;
00999
01000
01001
01002
01003 fed_t& relaxUp();
01004 fed_t& relaxDown();
01005
01006
01007
01008
01009 fed_t& relaxUpClock(cindex_t clock);
01010 fed_t& relaxDownClock(cindex_t clock);
01011
01012
01013 fed_t& relaxAll();
01014
01015
01016
01017
01018
01019 fed_t& reduce();
01020
01021
01022 fed_t& noReduce() { return *this; }
01023
01024
01025
01026
01027 fed_t& expensiveReduce();
01028
01029
01030
01031
01032 fed_t& mergeReduce();
01033
01034
01035
01036
01037 fed_t& convexReduce();
01038
01039
01040
01041 fed_t& expensiveConvexReduce();
01042
01043
01044
01045 fed_t& partitionReduce();
01046
01047
01048
01049
01050
01051 bool contains(const IntValuation& point) const;
01052 bool contains(const int32_t* point, cindex_t dim) const;
01053 bool contains(const DoubleValuation& point) const;
01054 bool contains(const double* point, cindex_t dim) const;
01055
01056
01057
01058
01059
01060
01061
01062
01063
01064
01065 double possibleBackDelay(const DoubleValuation& point) const;
01066 double possibleBackDelay(const double* point, cindex_t dim) const;
01067
01068
01069
01070
01071
01072
01073
01074
01075
01076
01077
01078
01079
01080
01081 bool delay(const DoubleValuation& point, double* t) const;
01082 bool delay(const double* point, cindex_t dim, double* t) const;
01083
01084
01085
01086
01087 void extrapolateMaxBounds(const int32_t *max);
01088 void diagonalExtrapolateMaxBounds(const int32_t *max);
01089 void extrapolateLUBounds(const int32_t *lower, const int32_t *upper);
01090 void diagonalExtrapolateLUBounds(const int32_t *lower, const int32_t *upper);
01091
01092
01093
01094
01095
01096
01097
01098
01099
01100 void splitExtrapolate(const constraint_t *begin, const constraint_t *end,
01101 const int32_t *max);
01102
01103
01104
01105
01106
01107
01108
01109
01110
01111
01112 void resize(const uint32_t *bitSrc, const uint32_t *bitDst,
01113 size_t bitSize, cindex_t *table);
01114
01115
01116
01117
01118
01119
01120
01121
01122
01123
01124 void changeClocks(const cindex_t *target, cindex_t newDim);
01125
01126
01127 void swapClocks(cindex_t x, cindex_t y);
01128
01129
01130
01131
01132
01133
01134
01135
01136
01137
01138
01139
01140
01141 DoubleValuation& getValuation(DoubleValuation& cval, bool *freeC = NULL) const
01142 throw(std::out_of_range);
01143
01144
01145
01146
01147
01148
01149
01150
01151 fed_t& predt(const fed_t& bad);
01152 fed_t& predt(const dbm_t& bad);
01153 fed_t& predt(const raw_t* bad, cindex_t dim);
01154
01155
01156
01157
01158 bool isIncludedInPredt(const fed_t& good, const fed_t& bad) const;
01159
01160
01161
01162 bool has(const dbm_t& arg) const;
01163 bool has(const raw_t* arg, cindex_t dim) const;
01164
01165
01166
01167
01168
01169
01170 bool hasSame(const dbm_t& arg) const;
01171
01172
01173
01174
01175
01176
01177
01178 void removeIncludedIn(const fed_t& arg);
01179 bool removeIncludedIn(const dbm_t& arg);
01180 bool removeIncludedIn(const raw_t* arg, cindex_t dim);
01181
01182
01183
01184 fed_t(const ClockOperation<fed_t>& op);
01185
01186
01187
01188
01189
01190
01191
01192 ClockOperation<fed_t> operator () (cindex_t clk);
01193
01194
01195
01196
01197
01198
01199 bool isSubtractionEmpty(const raw_t* arg, cindex_t dim) const;
01200 bool isSubtractionEmpty(const dbm_t& arg) const;
01201 bool isSubtractionEmpty(const fed_t& arg) const;
01202 static bool isSubtractionEmpty(const raw_t* dbm, cindex_t dim, const fed_t& fed);
01203
01204
01205 static fed_t subtract(const raw_t* arg1, const raw_t* arg2, cindex_t dim);
01206 static fed_t subtract(const dbm_t& arg1, const raw_t* arg2, cindex_t dim);
01207
01208
01209
01210
01211
01212 void removeEmpty();
01213
01214
01215
01216
01217
01218 bool hasEmpty() const;
01219
01220
01221 class iterator
01222 {
01223 public:
01224
01225 static const fdbm_t *ENDF;
01226
01227
01228 iterator();
01229
01230
01231
01232 iterator(ifed_t* fed);
01233
01234
01235 dbm_t& operator *() const;
01236
01237
01238 dbm_t* operator ->() const;
01239
01240
01241 raw_t* operator () () const;
01242 raw_t operator () (cindex_t i, cindex_t j) const;
01243
01244
01245 iterator& operator ++();
01246
01247
01248 bool null() const;
01249
01250
01251 bool hasNext() const;
01252
01253
01254 bool operator == (const iterator& arg) const;
01255 bool operator != (const iterator& arg) const;
01256
01257
01258 void remove();
01259
01260
01261 void removeEmpty();
01262
01263
01264
01265 fdbm_t* extract();
01266
01267
01268 void insert(fdbm_t* dbm);
01269
01270 private:
01271 fdbm_t **fdbm;
01272 ifed_t *ifed;
01273 };
01274
01275
01276 class const_iterator
01277 {
01278 public:
01279
01280 static const const_iterator ENDI;
01281
01282
01283 const_iterator(const fdbm_t* fed);
01284 const_iterator(const fed_t& fed);
01285 const_iterator();
01286
01287
01288 const dbm_t& operator *() const;
01289
01290
01291 const dbm_t* operator ->() const;
01292
01293
01294 const raw_t* operator () () const;
01295 raw_t operator () (cindex_t i, cindex_t j) const;
01296
01297
01298 const_iterator& operator ++();
01299
01300
01301 bool null() const;
01302
01303
01304 bool hasNext() const;
01305
01306
01307 bool operator == (const const_iterator& arg) const;
01308 bool operator != (const const_iterator& arg) const;
01309
01310 private:
01311 const fdbm_t *fdbm;
01312 };
01313
01314
01315
01316
01317
01318
01319 const_iterator begin() const;
01320 const const_iterator end() const;
01321 iterator beginMutable();
01322 const iterator endMutable() const;
01323
01324
01325 iterator erase(iterator& iter);
01326
01327
01328
01329
01330
01331
01332
01333
01334 size_t write(fdbm_t** mem);
01335
01336
01337
01338
01339
01340 void read(fdbm_t** fed, size_t size);
01341
01342
01343 const dbm_t& const_dbmt() const;
01344
01345
01346
01347 bool removeThisDBM(const dbm_t &dbm);
01348
01349
01350 void setMutable();
01351
01352 private:
01353
01354
01355
01356 fed_t(ifed_t* ifed);
01357
01358
01359 ifed_t* ifed();
01360 const ifed_t* ifed() const;
01361
01362
01363 bool isMutable() const;
01364 bool isOK() const;
01365 void incRef() const;
01366 void decRef() const;
01367 void decRefImmutable() const;
01368
01369
01370 dbm_t& dbmt();
01371
01372
01373
01374 void toArray(const raw_t** ar) const;
01375
01376
01377
01378 void ptr_subtract(const raw_t* arg, cindex_t dim);
01379
01380
01381 relation_t ptr_relation(const raw_t* arg, cindex_t dim) const;
01382
01383 ifed_t *ifedPtr;
01384 };
01385
01386
01387
01388
01389
01390
01391
01392
01393
01394
01395
01396
01397 dbm_t operator + (const dbm_t& a, const raw_t* b);
01398 dbm_t operator + (const fed_t& a, const raw_t* b);
01399 dbm_t operator + (const dbm_t& a, const dbm_t& b);
01400 dbm_t operator + (const dbm_t& a, const fed_t& b);
01401 dbm_t operator + (const fed_t& a, const dbm_t& b);
01402 dbm_t operator + (const fed_t& a, const fed_t& b);
01403
01404 dbm_t operator & (const dbm_t& a, const raw_t* b);
01405 fed_t operator & (const fed_t& a, const raw_t* b);
01406 dbm_t operator & (const dbm_t& a, const dbm_t& b);
01407 fed_t operator & (const dbm_t& a, const fed_t& b);
01408 fed_t operator & (const fed_t& a, const dbm_t& b);
01409 fed_t operator & (const fed_t& a, const fed_t& b);
01410
01411 dbm_t operator & (const dbm_t& a, const constraint_t& c);
01412 dbm_t operator & (const constraint_t& c, const dbm_t& a);
01413 fed_t operator & (const fed_t& a, const constraint_t& c);
01414 fed_t operator & (const constraint_t& c, const fed_t& a);
01415
01416 dbm_t operator & (const dbm_t& a, const base::pointer_t<constraint_t>& c);
01417 dbm_t operator & (const base::pointer_t<constraint_t>& c, const dbm_t& a);
01418 fed_t operator & (const fed_t& a, const base::pointer_t<constraint_t>& c);
01419 fed_t operator & (const base::pointer_t<constraint_t>& c, const fed_t& a);
01420
01421 dbm_t operator & (const dbm_t& a, const std::vector<constraint_t>& vec);
01422 dbm_t operator & (const std::vector<constraint_t>& vec, const dbm_t& a);
01423 fed_t operator & (const fed_t& a, const std::vector<constraint_t>& vec);
01424 fed_t operator & (const std::vector<constraint_t>& vec, const fed_t& a);
01425
01426 fed_t operator | (const dbm_t& a, const raw_t* b);
01427 fed_t operator | (const fed_t& a, const raw_t* b);
01428 fed_t operator | (const dbm_t& a, const dbm_t& b);
01429 fed_t operator | (const fed_t& a, const dbm_t& b);
01430 fed_t operator | (const dbm_t& a, const fed_t& b);
01431 fed_t operator | (const fed_t& a, const fed_t& b);
01432
01433 fed_t operator - (const dbm_t& a, const raw_t* b);
01434 fed_t operator - (const fed_t& a, const raw_t* b);
01435 fed_t operator - (const dbm_t& a, const dbm_t& b);
01436 fed_t operator - (const fed_t& a, const dbm_t& b);
01437 fed_t operator - (const dbm_t& a, const fed_t& b);
01438 fed_t operator - (const fed_t& a, const fed_t& b);
01439
01440
01441
01442 dbm_t zero(cindex_t dim);
01443 dbm_t init(cindex_t dim);
01444
01445
01446
01447
01448 dbm_t up(const dbm_t& arg);
01449 dbm_t down(const dbm_t& arg);
01450 dbm_t freeClock(const dbm_t& arg, cindex_t clock);
01451 dbm_t freeUp(const dbm_t& arg, cindex_t k);
01452 dbm_t freeDown(const dbm_t& arg, cindex_t k);
01453 dbm_t freeAllUp(const dbm_t& arg);
01454 dbm_t freeAllDown(const dbm_t& arg);
01455 dbm_t relaxUp(const dbm_t& arg);
01456 dbm_t relaxDown(const dbm_t& arg);
01457 dbm_t relaxUpClock(const dbm_t& arg, cindex_t k);
01458 dbm_t relaxDownClock(const dbm_t& arg, cindex_t k);
01459
01460
01461
01462
01463 fed_t up(const fed_t& arg);
01464 fed_t down(const fed_t& arg);
01465 fed_t freeClock(const fed_t& arg, cindex_t x);
01466 fed_t freeUp(const fed_t& arg, cindex_t k);
01467 fed_t freeDown(const fed_t& arg, cindex_t x);
01468 fed_t freeAllUp(const fed_t& arg);
01469 fed_t freeAllDown(const fed_t& arg);
01470 fed_t relaxUp(const fed_t& arg);
01471 fed_t relaxDown(const fed_t& arg);
01472 fed_t relaxUpClock(const fed_t& arg, cindex_t k);
01473 fed_t relaxDownClock(const fed_t& arg, cindex_t k);
01474 fed_t reduce(const fed_t& arg);
01475 fed_t expensiveReduce(const fed_t& arg);
01476 fed_t predt(const fed_t& good, const fed_t& bad);
01477 fed_t predt(const fed_t& good, const dbm_t& bad);
01478 fed_t predt(const fed_t& good, const raw_t* bad, cindex_t dim);
01479 fed_t predt(const dbm_t& good, const fed_t& bad);
01480 fed_t predt(const dbm_t& good, const dbm_t& bad);
01481 fed_t predt(const dbm_t& good, const raw_t* bad, cindex_t dim);
01482 fed_t predt(const raw_t* good, cindex_t dim, const fed_t& bad);
01483 fed_t predt(const raw_t* good, cindex_t dim, const dbm_t& bad);
01484 fed_t predt(const raw_t* good, const raw_t* bad, cindex_t dim);
01485
01486
01487
01488 void cleanUp();
01489 }
01490
01491 #include "dbm/inline_fed.h"
01492
01493 #endif // INCLUDE_DBM_FED_H