├── .autotools
├── .cproject
├── .gitattributes
├── .github
├── dependabot.yml
└── workflows
│ ├── linux.yml
│ ├── osx.yml
│ └── windows.yml
├── .gitignore
├── .project
├── .travis.yml
├── ALIRE
├── AUTHORS
├── COPYING
├── ChangeLog
├── INSTALL
├── Makefile.am
├── NEWS
├── README
├── README.md
├── README_MTVariants
├── appveyor.yml
├── configure.ac
├── ddd
├── .gitignore
├── AdditiveMap.hpp
├── Cache.hh
├── DDD.cpp
├── DDD.h
├── DED.cpp
├── DED.h
├── DataSet.h
├── FixObserver.cpp
├── FixObserver.hh
├── History.txt
├── Hom.cpp
├── Hom.h
├── Hom_Basic.cpp
├── Hom_Basic.hh
├── IntDataSet.cpp
├── IntDataSet.h
├── MLCache.hh
├── MLHom.cpp
├── MLHom.h
├── MLSHom.cpp
├── MLSHom.h
├── Makefile.am
├── MemoryManager.h
├── SDD.cpp
├── SDD.h
├── SDED.cpp
├── SDED.h
├── SHom.cpp
├── SHom.h
├── UniqueTable.h
├── UniqueTableId.hh
├── google
│ ├── AUTHORS
│ ├── COPYING
│ ├── README
│ ├── sparse_hash_map
│ ├── sparse_hash_set
│ ├── sparsehash
│ │ ├── densehashtable.h
│ │ ├── hashtable-common.h
│ │ ├── libc_allocator_with_realloc.h
│ │ ├── sparseconfig.h
│ │ └── sparsehashtable.h
│ ├── sparsetable
│ ├── template_util.h
│ └── type_traits.h
├── hashfunc.hh
├── init.hh
├── process.cpp
├── process.hpp
├── statistic.cpp
├── statistic.hpp
└── util
│ ├── configuration.hh
│ ├── dotExporter.cpp
│ ├── dotExporter.h
│ ├── ext_hash_map.hh
│ ├── hash_set.hh
│ ├── hash_support.hh
│ ├── map.hh
│ ├── set.hh
│ ├── tbb_hash_map.hh
│ └── vector.hh
├── demo
├── .gitignore
├── Makefile.am
├── PermuteVar.cpp
├── PermuteVar.hh
├── PlusPlus.cpp
├── PlusPlus.hh
├── README
├── SetVar.cpp
├── SetVar.hh
├── SwapMLHom.cpp
├── SwapMLHom.hh
├── hanoi
│ ├── .gitignore
│ ├── Makefile.am
│ ├── doc
│ │ ├── Makefile
│ │ ├── PNota.sty
│ │ ├── abstract.tex
│ │ ├── bibliography.bib
│ │ ├── conclu.tex
│ │ ├── encoding.tex
│ │ ├── hanoi_doc.tex
│ │ ├── hom.tex
│ │ ├── intro.tex
│ │ ├── llncs.cls
│ │ ├── perfs.tex
│ │ └── tool.tex
│ ├── hanoiHom.cpp
│ ├── hanoiHom.hh
│ ├── hanoi_v1.cpp
│ ├── hanoi_v1_bis.cpp
│ ├── hanoi_v1_ter.cpp
│ ├── hanoi_v2.cpp
│ ├── hanoi_v3.cpp
│ ├── hanoi_v4.cpp
│ ├── hanoi_v5.cpp
│ ├── hanoi_v6.cpp
│ ├── hanoi_v7.cpp
│ ├── hanoi_v8.cpp
│ └── hanoi_v9.cpp
├── morpion
│ ├── .gitignore
│ ├── Makefile.am
│ ├── hom
│ │ ├── const.cpp
│ │ ├── const.hpp
│ │ ├── general_v2.cpp
│ │ ├── general_v2.hpp
│ │ ├── notew.cpp
│ │ ├── notew.hpp
│ │ ├── play.cpp
│ │ ├── play.hpp
│ │ ├── winner.cpp
│ │ └── winner.hpp
│ ├── morpionv2.cpp
│ └── readme
├── tst1.cpp
├── tst10.cpp
├── tst11.cpp
├── tst12.cpp
├── tst13.cpp
├── tst14.cpp
├── tst15.cpp
├── tst2.cpp
├── tst3.cpp
├── tst4.cpp
├── tst5.cpp
├── tst6.cpp
├── tst7.cpp
├── tst8.cpp
└── tst9.cpp
├── doc
├── .gitignore
├── Doxyfile.in
├── Makefile.am
├── footer.html
├── mainpage.dox
└── manuel.ps
├── m4
└── ax_boost_base.m4
├── tag.sh
└── website
└── index.html
/.autotools:
--------------------------------------------------------------------------------
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 |
--------------------------------------------------------------------------------
/.gitattributes:
--------------------------------------------------------------------------------
1 | * text eol=lf
2 |
--------------------------------------------------------------------------------
/.github/dependabot.yml:
--------------------------------------------------------------------------------
1 | version: 2
2 | updates:
3 | - package-ecosystem: github-actions
4 | directory: "/"
5 | schedule:
6 | interval: daily
7 | time: "04:00"
8 | open-pull-requests-limit: 10
9 |
--------------------------------------------------------------------------------
/.github/workflows/linux.yml:
--------------------------------------------------------------------------------
1 | name: Linux Build
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: ubuntu-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v4
16 | - name: tag version date
17 | run: /bin/sh ./tag.sh
18 | - name: Install packages
19 | run: sudo apt-get install doxygen graphviz ;
20 | - name: autoreconf
21 | run: autoreconf -vfi
22 | - name: Prepare install folder
23 | run: mkdir usr && mkdir usr/local
24 | - name: configure
25 | run: ./configure --prefix=$PWD/usr/local/ || cat config.log
26 | - name: make lib
27 | run: cd ddd ; make -j ; cd ..
28 | - name: make demo
29 | run: make -j
30 | - name: make install
31 | run: make install
32 | - name: prepare artefact
33 | run: rm usr/local/lib/libDDD_d* ; tar cvzf linux.tgz usr/ ; mv linux.tgz website/
34 | - name: make dist
35 | run: make dist ; mv ddd*.tar.gz website/ ;
36 | - name: make doc
37 | run: cd doc ; make ; cd .. ; mv doc/libddd.html/ website/ ;
38 | - name: Deploy to GitHub Pages
39 | uses: JamesIves/github-pages-deploy-action@v4
40 | with:
41 | branch: gh-pages # The branch the action should deploy to.
42 | folder: website/ # The folder the action should deploy.
43 | clean: true # Automatically remove deleted files from the deploy branch
44 | single-commit: true
45 | - name: Trigger libITS
46 | uses: mvasigh/dispatch-action@main
47 | with:
48 | # You should create a personal access token and store it in your repository
49 | token: ${{ secrets.NOTIF_PAT }}
50 | repo: libITS
51 | owner: lip6
52 | event_type: ${{ runner.os }}
53 |
--------------------------------------------------------------------------------
/.github/workflows/osx.yml:
--------------------------------------------------------------------------------
1 | name: OSX build
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: macos-latest
13 |
14 |
15 | steps:
16 | - uses: actions/checkout@v4
17 | - name: tag version date
18 | run: /bin/sh ./tag.sh
19 | - name: Install packages
20 | run: brew install gcc@12 autoconf automake libtool binutils ;
21 | - name: autoreconf
22 | run: autoreconf -vfi
23 | - name: Prepare install folder
24 | run: mkdir usr && mkdir usr/local
25 | - name: configure
26 | run: ./configure --prefix=$PWD/usr/local/ AR='gcc-ar-12' NM='gcc-nm-12' RANLIB='gcc-ranlib-12' CXX='g++-12' CC='gcc-12' || cat config.log
27 | - name: make lib
28 | run: cd ddd ; make -j ; cd ..
29 | - name: make demo
30 | run: make -j
31 | - name: make install
32 | run: make install
33 | - name: prepare artefact
34 | run: rm usr/local/lib/libDDD_d* ; tar cvzf osx.tgz usr/ ; mv osx.tgz website/
35 | - name: Deploy to GitHub Pages
36 | uses: JamesIves/github-pages-deploy-action@v4
37 | with:
38 | branch: osx # The branch the action should deploy to.
39 | folder: website/ # The folder the action should deploy.
40 | clean: true # Automatically remove deleted files from the deploy branch
41 | single-commit: true
42 | - name: Trigger libITS
43 | uses: mvasigh/dispatch-action@main
44 | with:
45 | # You should create a personal access token and store it in your repository
46 | token: ${{ secrets.NOTIF_PAT }}
47 | repo: libITS
48 | owner: lip6
49 | event_type: ${{ runner.os }}
50 |
--------------------------------------------------------------------------------
/.github/workflows/windows.yml:
--------------------------------------------------------------------------------
1 | name: windows build
2 |
3 | on:
4 | push:
5 | branches: [ master ]
6 | pull_request:
7 | branches: [ master ]
8 |
9 | jobs:
10 | build:
11 |
12 | runs-on: windows-latest
13 |
14 | steps:
15 | - uses: actions/checkout@v4
16 | - name: install packages
17 | run: C:\msys64\usr\bin\bash -lc "PATH+=:/mingw64/bin ; pacman --noconfirm -S mingw-w64-x86_64-gcc mingw-w64-x86_64-autotools mingw-w64-x86_64-pkg-config p7zip base-devel libtool"
18 | - name: configure and make
19 | run: C:\msys64\usr\bin\bash -lc "PATH+=:/mingw64/bin ; cd /D/a/libDDD/libDDD ; autoreconf -vfi && ./configure --prefix=/D/a/libDDD/libDDD/usr/local/ --enable-nolto --enable-mingw-native && make -j 4 && make install || cat config.log"
20 | - name: package zip
21 | run: C:\msys64\usr\bin\bash -lc "cd /D/a/libDDD/libDDD ; rm usr/local/lib/libDDD_d* ; tar -a -c -f windows.zip usr/ ; mkdir site ; mv windows.zip site/"
22 | - name: Upload Artifacts # The project is then uploaded as an artifact named 'site'.
23 | uses: actions/upload-artifact@v4
24 | with:
25 | name: site
26 | path: site/
27 |
28 | deploy:
29 | needs: [build] # The second job must depend on the first one to complete before running, and uses ubuntu-latest instead of windows.
30 |
31 | runs-on: ubuntu-latest
32 | steps:
33 | - name: Checkout
34 | uses: actions/checkout@v4
35 | with:
36 | persist-credentials: false
37 | - name: Download Artifacts # The built project is downloaded into the 'site' folder.
38 | uses: actions/download-artifact@v4
39 | with:
40 | name: site
41 | - name: move to website
42 | run: ls -lah ; mkdir -p windows ; cp windows.zip windows/ ; ls -lah windows/
43 | - name: Deploy
44 | uses: JamesIves/github-pages-deploy-action@v4
45 | with:
46 | branch: Windows
47 | folder: windows/ # The deployment folder should match the name of the artifact. Even though our project builds into the 'build' folder the artifact name of 'site' must be placed here.
48 | clean: true # Automatically remove deleted files from the deploy branch
49 | single-commit: true
50 | - name: Trigger libITS
51 | uses: mvasigh/dispatch-action@main
52 | with:
53 | # You should create a personal access token and store it in your repository
54 | token: ${{ secrets.NOTIF_PAT }}
55 | repo: libITS
56 | owner: lip6
57 | event_type: Windows
58 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | **/*.o
2 | **/*.a
3 | **/*.Po
4 | **/*.lo
5 | **/*.la
6 | **/.libs/
7 | **/.dirstamp
8 | /install-sh
9 | /libtool
10 | /ltmain.sh
11 | /Makefile
12 | /missing
13 | /compile
14 | /config.guess
15 | /config.log
16 | /config.status
17 | /config.sub
18 | /configure
19 | /depcomp
20 | **/Makefile.in
21 | /ddd-*.tar.gz
22 | m4/*.m4
23 | **/autom4te.cache/
24 | /ar-lib
25 | /aclocal.m4
26 | **/.deps/
27 | /usr/
28 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | libddd
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.linuxtools.cdt.autotools.core.genmakebuilderV2
10 |
11 |
12 |
13 |
14 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
15 | clean,full,incremental,
16 |
17 |
18 | ?name?
19 |
20 |
21 |
22 | org.eclipse.cdt.make.core.append_environment
23 | true
24 |
25 |
26 | org.eclipse.cdt.make.core.buildArguments
27 |
28 |
29 |
30 | org.eclipse.cdt.make.core.buildCommand
31 | make
32 |
33 |
34 | org.eclipse.cdt.make.core.buildLocation
35 | ${workspace_loc:/libddd}/build-build_libits
36 |
37 |
38 | org.eclipse.cdt.make.core.contents
39 | org.eclipse.cdt.make.core.activeConfigSettings
40 |
41 |
42 | org.eclipse.cdt.make.core.enableAutoBuild
43 | false
44 |
45 |
46 | org.eclipse.cdt.make.core.enableCleanBuild
47 | true
48 |
49 |
50 | org.eclipse.cdt.make.core.enableFullBuild
51 | true
52 |
53 |
54 | org.eclipse.cdt.make.core.stopOnError
55 | true
56 |
57 |
58 | org.eclipse.cdt.make.core.useDefaultBuildCmd
59 | true
60 |
61 |
62 |
63 |
64 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
65 |
66 |
67 |
68 |
69 |
70 | org.eclipse.cdt.core.cnature
71 | org.eclipse.cdt.core.ccnature
72 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
73 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
74 | org.eclipse.linuxtools.cdt.autotools.core.autotoolsNatureV2
75 |
76 |
77 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 | sudo: false
3 | dist: focal
4 |
5 | matrix:
6 | include:
7 | # Linux GCC Builds
8 | - os: linux
9 | compiler: gcc
10 | addons: &gcc10
11 | apt:
12 | sources: ['ubuntu-toolchain-r-test']
13 | packages: ['g++-10', 'gcc-10', 'doxygen', 'graphviz']
14 | env: GCCVER='10' CXX_COMPILER='g++-10' C_COMPILER='gcc-10'
15 |
16 | # 4/ OSX GCC Builds
17 | - os: osx
18 | osx_image: xcode11.2
19 | compiler: gcc
20 | addons:
21 | homebrew:
22 | packages:
23 | - gcc
24 | env: GCCVER='9' CXX_COMPILER='g++-9' C_COMPILER='gcc-9'
25 |
26 | cache:
27 | directories:
28 | - /var/cache/apt/archives
29 |
30 | before_script:
31 | - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then export TARGETBRANCH=osx ; fi
32 | - cd ${TRAVIS_BUILD_DIR}
33 | - export CXX=${CXX_COMPILER}
34 | - export CC=${C_COMPILER}
35 | # linux only
36 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export AR=gcc-ar-${GCCVER} ; fi
37 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export RANLIB=gcc-ranlib-${GCCVER} ; fi
38 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export NM=gcc-nm-${GCCVER} ; fi
39 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then export TARGETBRANCH=gh-pages ; fi
40 |
41 | script :
42 | - /bin/sh ./tag.sh
43 | - autoreconf -vfi
44 | - mkdir usr && mkdir usr/local
45 | - ./configure --enable-nolto --prefix=$PWD/usr/local/ || cat config.log
46 | - cd ddd
47 | - make -j
48 | - cd ..
49 | - make -j
50 | - make install
51 | - tar cvzf $TRAVIS_OS_NAME.tgz usr/
52 | - mv $TRAVIS_OS_NAME.tgz website/
53 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then make dist ; mv ddd*.tar.gz website/ ; fi
54 | - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then cd doc ; make ; cd .. ; mv doc/libddd.html/ website/ ; fi
55 |
56 |
57 | deploy:
58 | provider: pages
59 | skip_cleanup: true
60 | github_token: $GITHUB_TOKEN # Set in travis-ci.org dashboard
61 | local_dir: website/
62 | target_branch: $TARGETBRANCH
63 | on:
64 | branch: master
65 |
66 |
67 | after_deploy:
68 | - curl -s -X POST -H "Content-Type:application/json" -H "Accept:application/json" -H "Travis-API-Version:3" -H "Authorization:token $APITOKEN" -d '{"request":{"message":"Triggered by LibDDD build.","branch":"master"}}' https://api.travis-ci.org/repo/lip6%2FlibITS/requests
69 |
--------------------------------------------------------------------------------
/ALIRE:
--------------------------------------------------------------------------------
1 | CONTENU
2 | alire : ce fichier
3 | src : contient la bibiotheque DDD
4 | demo: contient des exemples de programmes
5 | doc : contient un manuel de reference
6 |
7 | INSTALLATION
8 | 1. Aller dans le repertoire src
9 | 2. Compiler la bibiotheque DDD : make
10 | 3. Deplacer les fichiers *.h et libDDD.a a votre gout
11 |
12 | EXEMPLE
13 | Dans le repertoire demo 6 exemples de programme vous sont propose. Le Makefile vous permet directement de compiler un ou tous ces exemples :
14 | - la commande make produit 6 executables tsti.exe pour i=1..6
15 | - la commande make tsti.exe produit l'executable tsti.exe pour i=1..6
16 |
17 | PROBLEME
18 | Envoyez moi un mail : couvreur@labri.fr
19 |
20 |
21 | COMPILATION AVEC STL MODIFIE (INSTRUMENTE)
22 |
23 | 1- compile the sources of the application with options:
24 | -D INST_STL (or #define INST_STL before including any DDD library include file)
25 | -isystem
where dir is libddd/STLProf
26 |
27 | 2- link with libDDD_i.a
28 |
29 | Examples in demo:
30 |
31 | For instance in tst6.cpp,
32 | - #include "MemoryManager.h" has been added
33 |
34 | - A call to 'MemoryManager::pstats();' has been added at the end
35 | of the main()
36 |
37 | The obtained trace is (// are added comments):
38 |
39 | Each entry of the hash table is found using the hash function. Entries are
40 | the beginning of the chained list of elements. The performance of a hash function
41 | is good if the ratio / is
42 | kept low. The table of statistics by homomorphism can help determine the 'bad'
43 | hash functions.
44 |
45 | The statistics on the hash table describes the average number of jumps in the
46 | hash table when searching for an element.
47 |
48 | ///////////////////////////////// begin trace /////////////////////////////////
49 |
50 | *
51 | Cache Stats : size=35 // size of the cache
52 | nb jump in hash table : 43/nbsearch 41=1.04878 // /
53 |
54 | Cache hit ratio : 13.6364% // Hit/Misses stats on the cache
55 | *
56 | GHom Stats : size unicity table = 25 // number of stored homomorphisms
57 | NbInsertion(25)*100/NbAccess(32) = 78 // hit misses ie percent of insertion in hom table
58 |
59 | ---------------- MAPPING Jumps on GHOM --------------
60 | Hom LeftConcat --> 26/20= 1.3 // /
61 | Hom PermuteFin --> 3/2= 1.5
62 | Hom PermuteDown --> 2/2= 1
63 | Hom Compose --> 5/4= 1.25
64 | Hom Permute --> 1/1= 1
65 | Hom Identity --> 1/1= 1
66 | Hom PermuteUp --> 2/2= 1
67 |
68 | ----- END MAPPING Jumps on GHOM, reseting table -----
69 | *
70 | GDDS : size unicity table =43 // nb DDD nodes in the unicity table
71 | Average nb jump in hash table : 1.33898 // average jump in hash table
72 | NbInsertion(43)*100/NbAccess(59) = 72 // hit misses ie percent of insertion in DDD table
73 |
74 |
75 | ///////////////////////////////// end trace /////////////////////////////////
76 |
77 |
--------------------------------------------------------------------------------
/AUTHORS:
--------------------------------------------------------------------------------
1 | Authors :
2 | Yann Thierry-Mieg (2003-), Jean-Michel Couvreur (2001), and Denis Poitrenaud (2001)
3 | Contributors :
4 | Maximilien Colange (2009-2012) : split-equiv, arithmetic manipulation
5 | Alexandre Hamez < LIP6 and LRDE (EPITA), Alexandre.Hamez@lip6.fr > (2006-2009): maintenance, multi-threading, rewrite rules
6 | Vincent Beaudenon < LIP6 > (2004-2005) : serialisation, user (not strong) homomorphisms
7 | Fran�ois Br�ant < LIP6 > (2004) : INST_STL, multi-target build
8 | Samuel Charron < LRDE (EPITA) > (2005-2006) : tests
--------------------------------------------------------------------------------
/ChangeLog:
--------------------------------------------------------------------------------
1 | version 1.4 : January 2008. Release includes auto-saturation mechanisms and homomorphism rewrite rules.
2 | * homomorphisms Skip predicate added
3 | * rewriting rules implmented to produce dynamic saturation effect
4 | * local apply mechanisms and related rules
5 | * hanoi example added to repository
6 | * INST_STL removed from build (was broken with gcc > 3.3 anyway)
7 |
8 | version 1.3 : May 2007. Release includes support for additive Edge valued DDD and SDD
9 | * various cleanups and rewrites for compliance with gcc >= 4.1
10 | * minor updates to allow build on 64 bit architectures
11 | * added tests using uttk
12 | * include a dot export example
13 |
14 | Version 1.2 : January 2006. Release includes the fixpoint construction for homomorphisms.
15 | * include serialization and user homomorphisms
16 | * Cleaned up includes
17 | * Added doxygen documentation
18 | * Changed hash functions
19 | * Some efficiency speedup
20 |
21 | Version 1.1 : November 2004. First semi-public release of the libDDD. Release includes SDD.
22 | * Uses autotools for build procedure, tested on Mac, linux, cygwin.
23 | * Compiles in three variants :
24 | ** libddd.a, the optimized version,
25 | ** libddd_d.a version with debugging symbols activated,
26 | ** libddd_otfg.a a version with experimental on the fly garbage collection
27 | * Optionally, using gcc in versions 3.1, 3.2 or 3.3, it is possible to activate build of INST_STL version, modify src/Makefile.am for this.
28 |
29 | Pre 1.0 : 2001-2003. Beta versions of the pure DDD library. Version 0.99 was version number for some time.
30 |
--------------------------------------------------------------------------------
/Makefile.am:
--------------------------------------------------------------------------------
1 | SUBDIRS = ddd demo
2 |
3 | EXTRA_DIST = doc
4 |
5 | # We use some external m4 macros
6 | ACLOCAL_AMFLAGS = -I m4
7 |
--------------------------------------------------------------------------------
/NEWS:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/lip6/libDDD/bed76e621f6d0696f3d326a729ff18a16309e811/NEWS
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | see README.rmd
2 |
3 | (autoconf likes to have a README file)
4 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | What is libDDD ?
2 |
3 | libDDD is a C++ library for manipulation of decision diagrams.
4 |
5 | Main features include:
6 |
7 | * Flexible and powerful encoding of operations using inductive homomorphisms
8 | * Support for hierarchy of the description with SDD
9 | * Automatic support for saturation style algorithms
10 | * A priori unbounded integer domain variables
11 | * Rich expressivity with equiv-split mechanism
12 | * Weak ordering constraint allowing to store variable length decision paths
13 | * Supports both Data Decision Diagrams which are integer valued and Hierarchical Set Decision Diagrams.
14 |
15 | libDDD is distributed under the terms of LGPL.
16 |
17 | Please see [our main website](https://lip6.github.io/ITSTools-web/libddd.html) for more details.
18 |
19 | The [distribution for libDDD by itself is here](https://lip6.github.io/libDDD/index.html)
20 |
21 | [Documentation for libDDD](https://lip6.github.io/libDDD/libddd.html/index.html) is available here
22 |
23 |
24 |
--------------------------------------------------------------------------------
/README_MTVariants:
--------------------------------------------------------------------------------
1 | To build, simply run
2 |
3 | ./configure
4 | make
5 |
6 | By default, the library "src/libddd.a" is built using optimized flags.
7 |
8 | Some options you can activate to build other library variants :
9 |
10 | --enable-debug : activates build of debug versions of all libraries activated : src/libddd_d.a src/libddd_mt_d.a src/libddd_par_d.a etc..
11 |
12 | --enable-evddd : activates build of edge valued variant of library "src/libddd_ev.a". Currently built in non reentrant mode.
13 |
14 | Multi-threaded and reentrant variants below require the open-source library Threading Building Blocks TBB from intel. If this library is not installed in your system folders, you should specify include path using the CPPFLAGS variable.
15 |
16 | For instance, if tbb was built in /home/scott/tbb/ :
17 |
18 | ./configure --enable-reentrant CPPFLAGS="-I /home/scott/tbb/include"
19 |
20 | --enable-reentrant : activates build of reentrant library version "src/libddd_mt.a", adapted to multi-threaded applications.
21 |
22 | --enable-parallel : activates build of internally "src/libddd_par.a" multi-threaded variant. Saturation procedures then run faster on multi-core architectures. User programs can try this variant interchangeably with the default version. However, flag -D PARALLEL_DD must be defined when including libddd headers.
23 |
24 | For instance, to get parallel mode try :
25 | [ythierry@octopus trunk]$ ./configure --enable-parallel --with-libtbbinc=/home/ythierry/tbb20_017oss_src/include/ --with-libtbbbin=/home/ythierry/tbb20_017oss_src/build/linux_em64t_gcc_cc4.2.2_libc2.6.1_kernel2.6.22.9_release/
26 |
--------------------------------------------------------------------------------
/appveyor.yml:
--------------------------------------------------------------------------------
1 | build:
2 | verbosity: minimal
3 |
4 | build_script :
5 | - '%BASH_PATH% -lc "echo $PATH ; which g++"'
6 | - '%BASH_PATH% -lc "cd $APPVEYOR_BUILD_FOLDER; autoreconf -vfi && ./configure --prefix=$(pwd)/usr/local/ --enable-nolto --enable-mingw-native && make && make install "'
7 | - '%BASH_PATH% -lc "cd $APPVEYOR_BUILD_FOLDER; 7z a -tzip windows.zip usr/ "'
8 |
9 |
10 | environment :
11 | MSYSTEM: MINGW64
12 | BASH_PATH: C:\msys64\usr\bin\bash
13 |
14 |
15 | artifacts:
16 | - path: windows.zip
17 | name: windows.zip
18 |
19 |
--------------------------------------------------------------------------------
/ddd/.gitignore:
--------------------------------------------------------------------------------
1 | /Makefile
2 |
--------------------------------------------------------------------------------
/ddd/AdditiveMap.hpp:
--------------------------------------------------------------------------------
1 | #ifndef __ADDITIVEMAP_HH__
2 | #define __ADDITIVEMAP_HH__
3 |
4 | #include
5 | #include "ddd/util/hash_support.hh"
6 |
7 | template >
8 | class AdditiveMap {
9 |
10 | typedef std::vector > mapType;
11 |
12 | mapType map;
13 |
14 | public:
15 | typedef typename mapType::value_type value_type;
16 | typedef typename mapType::const_iterator const_iterator;
17 | typedef typename mapType::iterator iterator;
18 | AdditiveMap(){};
19 |
20 | // delegate iterator operations to map
21 | const_iterator end() const { return map.end(); }
22 | const_iterator begin() const { return map.begin();}
23 |
24 | iterator find (const K & key) {
25 | iterator res = map.begin();
26 | while (res != map.end()) {
27 | if (EqualKey () (res->first,key))
28 | return res;
29 | ++res;
30 | }
31 | return res;
32 | }
33 |
34 | int addAll (const AdditiveMap & other) {
35 | return addAll(other.begin(),other.end());
36 | }
37 |
38 | // adds a set of mappings
39 | // returns the number of sums computed
40 | int addAll (const_iterator begin,const_iterator end) {
41 | int count = 0;
42 | for ( ; begin != end ; ++ begin ) {
43 | const value_type & val = *begin;
44 | if (add (val.first,val.second) )
45 | ++count;
46 | }
47 | return count;
48 | }
49 |
50 | // adds value to the value mapped to key
51 | // returns true if sum was actually used, false if normal insertion performed
52 | bool add (const K & key, const V & value) {
53 | typename mapType::iterator it = find(key);
54 | if ( it != map.end() ) {
55 | // found it
56 | it->second = it->second + value ;
57 | return true;
58 | } else {
59 | map.push_back(std::make_pair(key,value));
60 | return false;
61 | }
62 | }
63 | // removes value to the value mapped to key
64 | // returns true if difference - was actually used, false if nothing performed
65 | bool remove (const K & key, const V & value) {
66 | typename mapType::iterator it = find(key);
67 | if ( it != map.end() ) {
68 | // found it
69 | it->second = it->second - value ;
70 | return true;
71 | } else {
72 | return false;
73 | }
74 | }
75 | };
76 |
77 | #endif
78 |
--------------------------------------------------------------------------------
/ddd/Cache.hh:
--------------------------------------------------------------------------------
1 | #ifndef _CACHE_HH_
2 | #define _CACHE_HH_
3 |
4 | #include "ddd/util/configuration.hh"
5 |
6 | template
7 | <
8 | typename FuncType
9 | , typename ParamType
10 | , typename ResType
11 | , typename EvalFunc=int
12 | >
13 | class Cache
14 | {
15 | private:
16 | mutable size_t peak_;
17 |
18 | typedef typename hash_map< std::pair, ResType >::type
19 | hash_map;
20 | hash_map cache_;
21 |
22 | public:
23 | Cache () : peak_ (0) {};
24 | Cache (size_t s) : peak_ (0), cache_ (s) {};
25 |
26 | /** clear the cache, discarding all values. */
27 | void clear (bool keepstats = false) {
28 | peak();
29 | cache_.clear();
30 | }
31 |
32 | size_t peak () const {
33 | size_t s = size();
34 | if ( peak_ < s )
35 | peak_ = s;
36 | return peak_;
37 | }
38 |
39 |
40 | size_t size () const {
41 | return cache_.size();
42 | }
43 |
44 | ResType eval (const FuncType & func, const ParamType & param) const {
45 | return func.eval(param);
46 | }
47 |
48 | bool
49 | should_insert (const FuncType & ) const
50 | {
51 | return true;
52 | }
53 |
54 | std::pair
55 | insert(const FuncType& hom, const ParamType& node)
56 | {
57 | bool found;
58 |
59 | { // lock on current bucket
60 | typename hash_map::const_accessor access;
61 | found = cache_.find ( access, std::make_pair(hom,node));
62 | if (found)
63 | return std::make_pair(false, access->second);
64 | } // end of lock on the current bucket
65 |
66 | // wasn't in cache
67 | ResType result = eval(hom, node);
68 | if (should_insert (hom))
69 | {
70 | // lock on current bucket
71 | typename hash_map::accessor access;
72 | bool insertion = cache_.insert ( access, std::make_pair(hom,node));
73 | if (insertion) {
74 | // should happen except in MT case
75 | access->second = result;
76 | }
77 | return std::make_pair(insertion,result);
78 | }
79 | else
80 | return std::make_pair (false, result);
81 | }
82 |
83 | #ifdef HASH_STAT
84 | std::map get_hits() const { return cache_.get_hits(); }
85 | std::map get_misses() const { return cache_.get_misses(); }
86 | std::map get_bounces() const { return cache_.get_bounces(); }
87 | #endif // HASH_STAT
88 | };
89 |
90 | #endif /* _CACHE_HH_ */
91 |
--------------------------------------------------------------------------------
/ddd/DED.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************/
2 | /* */
3 | /* This file is part of libDDD, a library for manipulation of DDD and SDD. */
4 | /* */
5 | /* Copyright (C) 2001-2008 Yann Thierry-Mieg, Jean-Michel Couvreur */
6 | /* and Denis Poitrenaud */
7 | /* */
8 | /* This program is free software; you can redistribute it and/or modify */
9 | /* it under the terms of the GNU Lesser General Public License as */
10 | /* published by the Free Software Foundation; either version 3 of the */
11 | /* License, or (at your option) any later version. */
12 | /* This program is distributed in the hope that it will be useful, */
13 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 | /* GNU LEsserGeneral Public License for more details. */
16 | /* */
17 | /* You should have received a copy of the GNU Lesser General Public License */
18 | /* along with this program; if not, write to the Free Software */
19 | /*Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20 | /* */
21 | /****************************************************************************/
22 |
23 | /* -*- C++ -*- */
24 | #ifndef DED_H
25 | #define DED_H
26 |
27 | #include
28 | #include "ddd/DDD.h"
29 | #include "ddd/Hom.h"
30 | #include "ddd/util/hash_support.hh"
31 |
32 | class _DED;
33 | class GDDD;
34 | class GHom;
35 |
36 | /******************************************************************************/
37 | namespace DED {
38 | GDDD add(const d3::set::type &);
39 |
40 | /* Memory Manager */
41 | unsigned int statistics();
42 | void pstats(bool reinit=true);
43 | size_t peak();
44 | void garbage();
45 | };
46 |
47 |
48 | #ifdef EVDDD
49 | GHom pushEVDDD(int v);
50 | #endif
51 |
52 | #endif
53 |
54 |
55 |
56 |
57 |
58 |
59 |
--------------------------------------------------------------------------------
/ddd/DataSet.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************/
2 | /* */
3 | /* This file is part of libDDD, a library for manipulation of DDD and SDD. */
4 | /* */
5 | /* Copyright (C) 2001-2008 Yann Thierry-Mieg, Jean-Michel Couvreur */
6 | /* and Denis Poitrenaud */
7 | /* */
8 | /* This program is free software; you can redistribute it and/or modify */
9 | /* it under the terms of the GNU Lesser General Public License as */
10 | /* published by the Free Software Foundation; either version 3 of the */
11 | /* License, or (at your option) any later version. */
12 | /* This program is distributed in the hope that it will be useful, */
13 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 | /* GNU LEsserGeneral Public License for more details. */
16 | /* */
17 | /* You should have received a copy of the GNU Lesser General Public License */
18 | /* along with this program; if not, write to the Free Software */
19 | /*Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20 | /* */
21 | /****************************************************************************/
22 |
23 | #ifndef __DATASET_H__
24 | #define __DATASET_H__
25 |
26 | #include
27 |
28 | /// This class is an abstraction of a set of data.
29 | /// Set Decision Diagrams SDD arcs are labeled by a DataSet *, canonization of SDD requires
30 | /// a set-based interface (union, intersection, set difference), ability to compute a hash key
31 | /// and test two sets for equality for unicity table purposes, and test for emptiness as SDD are
32 | /// both zero suppresed (no path lead to GSDD::null), and empty-set suppressed (no arc labeled by
33 | /// empty_set is represented)
34 | ///
35 | /// Additional interface is provided to query/examine the structure, in particular set_size to
36 | /// is required to compute the full set size of an SDD, and print (although this last is not essential)
37 | ///
38 | /// Concrete DataSet classes should derive from DataSet and fulfill the contract FOR THEIR OWN TYPE
39 | /// hard or dynamic casting the argument into one's own type is the recommended behavior
40 | ///
41 | /// \todo recent experiments with V. Beaudenon show maybe some behavior should be put here,
42 | /// for instance set_intersect is always empty if incompatible types are compared.
43 | class DataSet
44 | {
45 | public :
46 | /// destructor
47 | virtual ~DataSet() {};
48 | /// returns a new instance copy of this
49 | virtual DataSet *newcopy () const = 0;
50 | /// returns a new instance with elements = this inter b
51 | virtual DataSet *set_intersect (const DataSet & b) const = 0;
52 | /// returns a new instance with elements = this union b
53 | virtual DataSet *set_union (const DataSet & b) const = 0;
54 | /// returns a new instance with elements = this setminus b
55 | virtual DataSet *set_minus (const DataSet & b) const = 0;
56 | /// returns true if this is the empty set
57 | virtual bool empty() const = 0;
58 | /// returns a pointer to an instance of the empty set
59 | virtual DataSet *empty_set() const = 0;
60 | /// Compares two sets for equality.
61 | virtual bool set_equal(const DataSet & b) const =0;
62 | /// Compares two sets with a total order.
63 | virtual bool set_less_than (const DataSet & b) const =0;
64 | /// \return the size (number of elements) in a set
65 | virtual long double set_size() const = 0;
66 | /// returns a hash function, used in the SDD hash function computation
67 | virtual size_t set_hash() const =0;
68 | /// returns a formatted string description of the set
69 | virtual void set_print (std::ostream &os) const =0;
70 | /// for memory management : if your DataSet references no GDD,GHom,GSDD,GShom, mark() should do nothing
71 | virtual void mark() const = 0;
72 | #ifdef EVDDD
73 | virtual DataSet *normalizeDistance(int n) const =0;
74 | virtual int getMinDistance() const = 0;
75 | #endif
76 |
77 | };
78 |
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/ddd/FixObserver.cpp:
--------------------------------------------------------------------------------
1 | #include "FixObserver.hh"
2 |
3 | #include
4 |
5 | namespace fobs {
6 |
7 | class DefaultObserver : public FixObserver {
8 | public:
9 | DefaultObserver (): FixObserver () {}
10 |
11 | bool should_interrupt (const GSDD &, const GSDD &) { return false; }
12 | bool should_interrupt (const GDDD &, const GDDD &) { return false; }
13 | bool was_interrupted () const { return false; }
14 | void update (const GSDD & , const GSDD & ) {}
15 | void update (const GDDD & , const GDDD & ) {}
16 | };
17 |
18 | static FixObserver * obs = NULL;
19 |
20 | void
21 | set_fixobserver (FixObserver * o)
22 | {
23 | delete obs;
24 | obs = o;
25 | }
26 |
27 | FixObserver *
28 | get_fixobserver ()
29 | {
30 | if (obs == NULL)
31 | obs = new DefaultObserver ();
32 | return obs;
33 | }
34 |
35 | }
--------------------------------------------------------------------------------
/ddd/FixObserver.hh:
--------------------------------------------------------------------------------
1 | #ifndef FIXOBSERVER_HH_
2 | #define FIXOBSERVER_HH_
3 |
4 | /// forward declarations
5 | class GSDD;
6 | class GDDD;
7 |
8 | namespace fobs {
9 |
10 | class FixObserver {
11 | public:
12 | FixObserver (){}
13 | virtual ~FixObserver () {}
14 |
15 | /// \warning: if should_interrult() returns true, then it MUST return true
16 | /// at least until the next call to update().
17 | /// The attribute is_interrupted is here for this purpose: it can be set to
18 | /// true only by should_interrupt and to false only by update, and
19 | /// is_interrupted => should_interrupt returns true
20 | virtual bool should_interrupt (const GSDD & after, const GSDD & before) = 0;
21 | virtual bool should_interrupt (const GDDD & after, const GDDD & before) = 0;
22 | virtual bool was_interrupted () const = 0;
23 | virtual void update (const GSDD & after, const GSDD & before) = 0;
24 | virtual void update (const GDDD & after, const GDDD & before) = 0;
25 | };
26 |
27 | FixObserver *
28 | get_fixobserver ();
29 |
30 | void
31 | set_fixobserver (FixObserver *);
32 |
33 | }
34 |
35 | #endif /// ! FIXOBSERVER_HH_
36 |
--------------------------------------------------------------------------------
/ddd/History.txt:
--------------------------------------------------------------------------------
1 | 5/25/2004:
2 | - Added/Modified Makefiles to generate all version of the library:
3 | - libDDD.a : optimized
4 | - libDDD_d.a : debug info
5 | - libDDD_p.a : profiling info (compiled with -pg option, then use with gprof)
6 | - libDDD_i.a : instrumented STL for profiling hash tables
7 |
8 |
9 | - Added instrumented hash table in STL: directory is libddd/STLProf
10 | To use it, link with libDDD_i.a and
11 |
12 | - DDD.[h,cpp]
13 | - Added functions:
14 | size_t nbsons() const;
15 | return the number of sons of the current node.
16 | void pstats(bool reinit=true);
17 | print statistics on the use of the hash table
18 | if reinit is false, then the counter are not
19 | reinitialized.
20 |
21 | - DED.[h,cpp]
22 | static void pstats(bool reinit=true);
23 | prints hit/misses cache ratio
24 | prints average number of jumps in the hash table
25 | if reinit=false, reinitialize the counters
26 | virtual bool shouldCache();
27 | part of the optimization that avoid caching nodes
28 | with only one son.
29 | (check GDDD DED::eval())
30 |
31 | - Hom.[h,cpp]
32 | static void pstats(bool reinit=true);
33 |
34 | - MemoryManager.h
35 | static void pstats(bool reinit=true);
36 | This one calls all the pstats functions in the others
37 | storages. Should be used to get all the stats
38 |
39 | - UniqueTable.h
40 | hash_map-->hash_set (minor change)
41 | void pstat(bool reinit=true);
42 |
43 |
44 | To compile with instrumented STL:
45 | 1- compile the sources of the application with options:
46 | -D INST_STL (or #define INST_STL before including any DDD library include file)
47 | -isystem where dir is libddd/STLProf
48 |
49 | 2- link with libDDD_i.a
50 |
51 | Examples in demo:
52 |
53 | For instance in tst6.cpp,
54 | - #include "MemoryManager.h" has been added
55 |
56 | - A call to 'MemoryManager::pstats();' has been added at the end
57 | of the main()
58 |
59 | The obtained trace is (// are added comments):
60 |
61 | Each entry of the hash table is found using the hash function. Entries are
62 | the beginning of the chained list of elements. The performance of a hash function
63 | is good if the ratio / is
64 | kept low. The table of statistics by homomorphism can help determine the 'bad'
65 | hash functions.
66 |
67 | The statistics on the hash table describes the average number of jumps in the
68 | hash table when searching for an element.
69 |
70 | ///////////////////////////////// begin trace /////////////////////////////////
71 |
72 | *
73 | Cache Stats : size=35 // size of the cache
74 | nb jump in hash table : 43/nbsearch 41=1.04878 // /
75 |
76 | Cache hit ratio : 13.6364% // Hit/Misses stats on the cache
77 | *
78 | GHom Stats : size unicity table = 25 // number of stored homomorphisms
79 | NbInsertion(25)*100/NbAccess(32) = 78 // hit misses ie percent of insertion in hom table
80 |
81 | ---------------- MAPPING Jumps on GHOM --------------
82 | Hom LeftConcat --> 26/20= 1.3 // /
83 | Hom PermuteFin --> 3/2= 1.5
84 | Hom PermuteDown --> 2/2= 1
85 | Hom Compose --> 5/4= 1.25
86 | Hom Permute --> 1/1= 1
87 | Hom Identity --> 1/1= 1
88 | Hom PermuteUp --> 2/2= 1
89 |
90 | ----- END MAPPING Jumps on GHOM, reseting table -----
91 | *
92 | GDDS : size unicity table =43 // nb DDD nodes in the unicity table
93 | Average nb jump in hash table : 1.33898 // average jump in hash table
94 | NbInsertion(43)*100/NbAccess(59) = 72 // hit misses ie percent of insertion in DDD table
95 |
96 |
97 | ///////////////////////////////// end trace /////////////////////////////////
98 |
99 |
--------------------------------------------------------------------------------
/ddd/Hom_Basic.hh:
--------------------------------------------------------------------------------
1 | #ifndef __HOM_BASIC__H_
2 | #define __HOM_BASIC__H_
3 |
4 | #include "ddd/DDD.h"
5 | #include "ddd/Hom.h"
6 | #include "ddd/SDD.h"
7 | #include "ddd/SHom.h"
8 |
9 |
10 | // keep paths where variable var is equal to val
11 | GHom varEqState (int var, int val) ;
12 | // keep paths where variable var is NOT equal to val
13 | GHom varNeqState (int var, int val) ;
14 | // keep paths where variable var is strictly greater than val
15 | GHom varGtState (int var, int val) ;
16 | // keep paths where variable var is strictly < val
17 | GHom varLtState (int var, int val) ;
18 | // keep paths where variable var is <= to val
19 | GHom varLeqState (int var, int val) ;
20 | // keep paths where variable var is >= to val
21 | GHom varGeqState (int var, int val) ;
22 | // set a var to a constant
23 | GHom setVarConst (int var, int val) ;
24 | // increment or decrement the value of var by val
25 | GHom incVar (int var, int val) ;
26 |
27 | // keep paths where variable var is equal to val
28 | GHom varEqVar (int var, int var2) ;
29 | // keep paths where variable var is NOT equal to var2
30 | GHom varNeqVar (int var, int var2) ;
31 | // keep paths where variable var is strictly greater than var2
32 | GHom varGtVar (int var, int var2) ;
33 | // keep paths where variable var is strictly < var2
34 | GHom varLtVar (int var, int var2) ;
35 | // keep paths where variable var is <= to var2
36 | GHom varLeqVar (int var, int var2) ;
37 | // keep paths where variable var is >= to var2
38 | GHom varGeqVar (int var, int var2) ;
39 |
40 | #include
41 |
42 | /// an explicit representation of a state
43 | typedef std::vector state_t;
44 | /// A visitor callback function
45 | typedef std::function callback_t;
46 | /// Explicit conversion : visit every path in the DDD (variable ids are removed)
47 | void iterate (const GDDD & node, callback_t * cb);
48 | /// Explicit conversion : visit every path in the DDD (variable ids are removed)
49 | void iterate (const GSDD & node, callback_t * cb);
50 |
51 |
52 | #endif
53 |
--------------------------------------------------------------------------------
/ddd/IntDataSet.cpp:
--------------------------------------------------------------------------------
1 | /****************************************************************************/
2 | /* */
3 | /* This file is part of libDDD, a library for manipulation of DDD and SDD. */
4 | /* */
5 | /* Copyright (C) 2001-2008 Yann Thierry-Mieg, Jean-Michel Couvreur */
6 | /* and Denis Poitrenaud */
7 | /* */
8 | /* This program is free software; you can redistribute it and/or modify */
9 | /* it under the terms of the GNU Lesser General Public License as */
10 | /* published by the Free Software Foundation; either version 3 of the */
11 | /* License, or (at your option) any later version. */
12 | /* This program is distributed in the hope that it will be useful, */
13 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 | /* GNU LEsserGeneral Public License for more details. */
16 | /* */
17 | /* You should have received a copy of the GNU Lesser General Public License */
18 | /* along with this program; if not, write to the Free Software */
19 | /*Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20 | /* */
21 | /****************************************************************************/
22 |
23 |
24 | #include "ddd/IntDataSet.h"
25 |
26 |
27 | // static initialization
28 | UniqueTable > IntDataSet::canonical = UniqueTable > ();
29 |
30 | const std::vector * IntDataSet::empty_ = canonical(std::vector(0));
31 |
32 | IntDataSet::marktable_t IntDataSet::marktable = marktable_t();
33 |
34 |
35 | void IntDataSet::garbage () {
36 | // sweep phase
37 | for(canonical_it di=canonical.table.begin();di!=canonical.table.end();){
38 | if(marktable.find(*di) == marktable.end() ){
39 | canonical_it ci=di;
40 | di++;
41 | const std::vector *g=(*ci);
42 | canonical.table.erase(ci);
43 | delete g;
44 | }else {
45 | di++;
46 | }
47 | }
48 | marktable.clear();
49 | }
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/ddd/MLCache.hh:
--------------------------------------------------------------------------------
1 | #ifndef _MLCACHE_HH_
2 | #define _MLCACHE_HH_
3 |
4 | #include "ddd/util/configuration.hh"
5 |
6 |
7 | template
8 | <
9 | typename MLHomType
10 | , typename NodeType
11 | , typename HomNodeMapType
12 | >
13 | class MLCache
14 | {
15 | private:
16 | mutable size_t peak_;
17 |
18 | typedef typename hash_map< std::pair, HomNodeMapType >::type
19 | hash_map;
20 | hash_map cache_;
21 |
22 | public:
23 | MLCache () : peak_ (0) {};
24 |
25 | /** clear the cache, discarding all values. */
26 | void clear (bool keepstats = false) {
27 | peak();
28 | cache_.clear();
29 | }
30 |
31 | size_t peak () const {
32 | size_t s = size();
33 | if ( peak_ < s )
34 | peak_ = s;
35 | return peak_;
36 | }
37 |
38 |
39 | size_t size () const {
40 | return cache_.size();
41 | }
42 |
43 | std::pair
44 | insert(const MLHomType& hom, const NodeType& node)
45 | {
46 | bool found;
47 |
48 | { // lock on current bucket
49 | typename hash_map::const_accessor access;
50 | found = cache_.find ( access, std::make_pair(hom,node));
51 | if (found)
52 | return std::make_pair(false, access->second);
53 | } // end of lock on the current bucket
54 |
55 | // wasn't in cache
56 | HomNodeMapType result = hom.eval(node);
57 | // lock on current bucket
58 | typename hash_map::accessor access;
59 | bool insertion = cache_.insert ( access, std::make_pair(hom,node));
60 | if (insertion) {
61 | // should happen except in MT case
62 | access->second = result;
63 | }
64 | return std::make_pair(insertion,result);
65 | }
66 |
67 | #ifdef HASH_STAT
68 | std::map get_hits() const { return cache_.get_hits(); }
69 | std::map get_misses() const { return cache_.get_misses(); }
70 | std::map get_bounces() const { return cache_.get_bounces(); }
71 | #endif // HASH_STAT
72 | };
73 |
74 | #endif /* _MLCACHE_HH_ */
75 |
--------------------------------------------------------------------------------
/ddd/MLSHom.h:
--------------------------------------------------------------------------------
1 | #ifndef __MLSHOM__H__
2 | #define __MLSHOM__H__
3 |
4 | #include "ddd/AdditiveMap.hpp"
5 | #include "ddd/SHom.h"
6 |
7 | class MLShom;
8 |
9 | typedef AdditiveMap SHomNodeMap;
10 | typedef AdditiveMap SHomHomMap;
11 |
12 | class _MLShom;
13 |
14 | class MLShom {
15 |
16 | /// By definition, as homomorphism are linear, (h+g) (d) = h(d) + g(d) ;
17 | /// Where g,h are homomorphisms and d is a SDDD.
18 | friend MLShom operator+(const MLShom &,const MLShom &);
19 | /// The real implementation class. All true operations are delagated on this pointer.
20 | /// Construction/destruction take care of ensuring concret is only instantiated once in memory.
21 | const _MLShom* concret;
22 |
23 | public :
24 |
25 | /// Elementary homomorphism Identity, defined as a constant.
26 | /// id(d) =
27 | static const MLShom id;
28 |
29 | /// Default public constructor.
30 | /// Builds Identity homomorphism : forall d in DDD, id(d) = d
31 | MLShom():concret(id.concret){};
32 |
33 | MLShom(const GShom &h);
34 | MLShom (const GShom & up, const MLShom & down);
35 | MLShom (const _MLShom &);
36 | MLShom (_MLShom *);
37 | MLShom (const _MLShom *);
38 |
39 |
40 | /// Create variable/value pair and left concatenate to a homomorphism.
41 | /// h(var,val,g) (d) = DDD(var,val) ^ g(d).
42 | /// In other words : var -- val -> g
43 | /// \param var the variable index
44 | /// \param val the value associated to the variable
45 | /// \param h the homomorphism to apply on successor node. Default is identity, so is equivalent to a left concatenation of a DDD(var,val).
46 | MLShom(int var, const DataSet & val, const MLShom &h=MLShom::id);
47 |
48 | virtual ~MLShom();
49 |
50 |
51 | bool operator<(const MLShom &h) const {return concret(concret)); };
58 |
59 | /// The computation function responsible for evaluation over a node.
60 | /// Users should not directly use this. Normal behavior is to use operator()
61 | /// that encapsulates this call with operation caching.
62 | SHomNodeMap eval(const GSDD &) const ;
63 | /// cache calls to eval
64 | SHomNodeMap operator() (const GSDD &) const;
65 |
66 |
67 | /// Collects and destroys unused homomorphisms. Do not call this directly but through
68 | /// MemoryManager::garbage() as order of calls (among GSDD::garbage(), GShom::garbage(),
69 | /// SDED::garbage()) is important.
70 | static void garbage();
71 |
72 | };
73 |
74 | /// Composition by union of two homomorphisms.
75 | /// This commutative operation computes a homomorphism
76 | /// that evaluates as the sum of two homomorphism.
77 | ///
78 | /// Semantics : (h1 + h2) (d) = h1(d) + h2(d).
79 | MLShom operator+(const MLShom &,const MLShom &);
80 |
81 | class _MLShom {
82 | /// For garbage collection.
83 | /// Counts the number of times a _MLHom is referenced from the context of an MLHom.
84 | mutable int refCounter;
85 | /// For garbage collection. Used in the two phase garbage collection process.
86 | /// A Shom that is not marked after the first pass over the unicity table, will
87 | /// be sweeped in the second phase. Outside of garbage collection routine, marking
88 | /// should always bear the value false.
89 | mutable bool marking;
90 |
91 | /// open access to container class MLHom.
92 | friend class MLShom;
93 |
94 | /// For garbage collection. Used in first phase of garbage collection.
95 | virtual void mark() const{};
96 |
97 |
98 | public:
99 | _MLShom (int ref=0) : refCounter(ref),marking(false) {}
100 | /** test if caching should be done : default means should cache */
101 | virtual bool shouldCache () const { return true ; }
102 |
103 | /// Virtual Destructor.
104 | virtual ~_MLShom(){};
105 | virtual SHomNodeMap eval(const GSDD &) const = 0;
106 |
107 | /** unique table trivia */
108 | virtual size_t hash() const = 0;
109 | virtual bool operator==(const _MLShom &h) const=0;
110 | // for use by unique table : return new MyConcreteClassName(*this);
111 | virtual _MLShom * clone () const =0 ;
112 |
113 | };
114 |
115 | class StrongMLShom : public _MLShom {
116 | public :
117 |
118 | bool operator==(const _MLShom &h) const;
119 |
120 | virtual bool operator==(const StrongMLShom &) const=0;
121 |
122 | SHomNodeMap eval(const GSDD &) const ;
123 |
124 | /// User defined behavior is input through this function
125 | virtual SHomHomMap phi (int var,const DataSet & val) const=0;
126 | virtual SHomNodeMap phiOne () const=0;
127 |
128 | };
129 |
130 | #endif
131 |
--------------------------------------------------------------------------------
/ddd/Makefile.am:
--------------------------------------------------------------------------------
1 | lib_LTLIBRARIES = libDDD.la \
2 | libDDD_d.la
3 |
4 | MYSRCDIR= $(abs_top_srcdir)/ddd
5 |
6 | ddddir = $(pkgincludedir)
7 | ddd_hdrs = DataSet.h \
8 | Cache.hh \
9 | DDD.h \
10 | DED.h \
11 | FixObserver.hh \
12 | Hom.h \
13 | Hom_Basic.hh \
14 | MemoryManager.h \
15 | MLCache.hh \
16 | SDD.h \
17 | SDED.h \
18 | SHom.h \
19 | UniqueTable.h \
20 | UniqueTableId.hh \
21 | IntDataSet.h \
22 | hashfunc.hh \
23 | MLHom.h \
24 | MLSHom.h \
25 | statistic.hpp \
26 | process.hpp \
27 | AdditiveMap.hpp \
28 | init.hh
29 |
30 | utildir = $(pkgincludedir)/util
31 | util_hdrs = util/dotExporter.h \
32 | util/configuration.hh \
33 | util/ext_hash_map.hh \
34 | util/hash_support.hh \
35 | util/hash_set.hh \
36 | util/tbb_hash_map.hh \
37 | util/vector.hh \
38 | util/set.hh \
39 | util/map.hh \
40 | google/sparse_hash_map \
41 | google/sparse_hash_set \
42 | google/sparsetable \
43 | google/template_util.h \
44 | google/type_traits.h \
45 | google/sparsehash/densehashtable.h \
46 | google/sparsehash/hashtable-common.h \
47 | google/sparsehash/libc_allocator_with_realloc.h \
48 | google/sparsehash/sparseconfig.h \
49 | google/sparsehash/sparsehashtable.h
50 |
51 | EXTRA_DIST = google/AUTHORS google/COPYING google/README
52 |
53 | nobase_ddd_HEADERS = $(ddd_hdrs) $(util_hdrs)
54 |
55 | srcs = DED.cpp \
56 | Cache.hh \
57 | DDD.cpp \
58 | FixObserver.cpp \
59 | Hom.cpp \
60 | Hom_Basic.cpp \
61 | SDED.cpp \
62 | SDD.cpp \
63 | SHom.cpp \
64 | IntDataSet.cpp \
65 | MLHom.cpp \
66 | MLSHom.cpp \
67 | statistic.cpp \
68 | process.cpp \
69 | util/dotExporter.cpp
70 |
71 | # Flags for TBB
72 | if WITH_LIBTBBINC_PATH
73 | TBBINC_FLAGS=-I $(LIBTBB_INC)
74 | endif
75 |
76 |
77 | # standard version
78 | libDDD_la_SOURCES = $(ddd_hdrs) $(util_hdrs) $(srcs)
79 | libDDD_la_CPPFLAGS = -g -O3 -Wall -DNDEBUG $(TBBINC_FLAGS) -I $(abs_top_srcdir)
80 |
81 | # debug version
82 | libDDD_d_la_SOURCES = $(ddd_hdrs) $(util_hdrs) $(srcs)
83 | libDDD_d_la_CPPFLAGS = -g -O0 -Wall $(TBBINC_FLAGS) -I $(abs_top_srcdir)
84 |
--------------------------------------------------------------------------------
/ddd/SDED.h:
--------------------------------------------------------------------------------
1 | /****************************************************************************/
2 | /* */
3 | /* This file is part of libDDD, a library for manipulation of DDD and SDD. */
4 | /* */
5 | /* Copyright (C) 2001-2008 Yann Thierry-Mieg, Jean-Michel Couvreur */
6 | /* and Denis Poitrenaud */
7 | /* */
8 | /* This program is free software; you can redistribute it and/or modify */
9 | /* it under the terms of the GNU Lesser General Public License as */
10 | /* published by the Free Software Foundation; either version 3 of the */
11 | /* License, or (at your option) any later version. */
12 | /* This program is distributed in the hope that it will be useful, */
13 | /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
14 | /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
15 | /* GNU LEsserGeneral Public License for more details. */
16 | /* */
17 | /* You should have received a copy of the GNU Lesser General Public License */
18 | /* along with this program; if not, write to the Free Software */
19 | /*Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
20 | /* */
21 | /****************************************************************************/
22 |
23 | /* -*- C++ -*- */
24 | #ifndef SDED_H
25 | #define SDED_H
26 |
27 | #include