Merge lp:~verifypn-maintainers/verifypn/interval_tar into lp:verifypn

Proposed by Peter Gjøl Jensen
Status: Merged
Approved by: Jiri Srba
Approved revision: 364
Merged at revision: 225
Proposed branch: lp:~verifypn-maintainers/verifypn/interval_tar
Merge into: lp:verifypn
Diff against target: 165007 lines (+159658/-95)
930 files modified
.bzrignore (+6/-4)
CMakeLists.txt (+99/-40)
README.md (+64/-51)
glpk-warning.patch (+10/-0)
include/CTL/Algorithm/AlgorithmTypes.h (+10/-0)
include/CTL/Algorithm/CertainZeroFPA.h (+36/-0)
include/CTL/Algorithm/FixedPointAlgorithm.h (+32/-0)
include/CTL/Algorithm/LocalFPA.h (+29/-0)
include/CTL/CTLEngine.h (+25/-0)
include/CTL/CTLResult.h (+33/-0)
include/CTL/DependencyGraph/BasicDependencyGraph.h (+23/-0)
include/CTL/DependencyGraph/Configuration.h (+40/-0)
include/CTL/DependencyGraph/Edge.h (+36/-0)
include/CTL/DependencyGraph/assignment.h (+11/-0)
include/CTL/PetriNets/OnTheFlyDG.h (+115/-0)
include/CTL/PetriNets/PetriConfig.h (+31/-0)
include/CTL/SearchStrategy/BFSSearch.h (+36/-0)
include/CTL/SearchStrategy/DFSSearch.h (+29/-0)
include/CTL/SearchStrategy/HeuristicSearch.h (+32/-0)
include/CTL/SearchStrategy/RDFSSearch.h (+34/-0)
include/CTL/SearchStrategy/SearchStrategy.h (+56/-0)
include/CTL/Stopwatch.h (+40/-0)
include/PetriEngine/AbstractPetriNetBuilder.h (+114/-0)
include/PetriEngine/Colored/ColoredNetStructures.h (+48/-0)
include/PetriEngine/Colored/ColoredPetriNetBuilder.h (+179/-0)
include/PetriEngine/Colored/Colors.h (+279/-0)
include/PetriEngine/Colored/Expressions.h (+658/-0)
include/PetriEngine/Colored/Multiset.h (+83/-0)
include/PetriEngine/NetStructures.h (+91/-0)
include/PetriEngine/PQL/Contexts.h (+250/-0)
include/PetriEngine/PQL/Expressions.h (+1221/-0)
include/PetriEngine/PQL/PQL.h (+285/-0)
include/PetriEngine/PQL/PQLParser.h (+34/-0)
include/PetriEngine/PQL/Visitor.h (+101/-0)
include/PetriEngine/PetriNet.h (+136/-0)
include/PetriEngine/PetriNetBuilder.h (+145/-0)
include/PetriEngine/Reachability/ReachabilityResult.h (+97/-0)
include/PetriEngine/Reachability/ReachabilitySearch.h (+182/-0)
include/PetriEngine/Reducer.h (+175/-0)
include/PetriEngine/ReducingSuccessorGenerator.h (+68/-0)
include/PetriEngine/STSolver.h (+55/-0)
include/PetriEngine/Simplification/LPCache.h (+54/-0)
include/PetriEngine/Simplification/LinearProgram.h (+94/-0)
include/PetriEngine/Simplification/LinearPrograms.h (+309/-0)
include/PetriEngine/Simplification/Member.h (+229/-0)
include/PetriEngine/Simplification/MurmurHash2.h (+39/-0)
include/PetriEngine/Simplification/Retval.h (+77/-0)
include/PetriEngine/Simplification/Vector.h (+130/-0)
include/PetriEngine/Structures/AlignedEncoder.h (+84/-0)
include/PetriEngine/Structures/Queue.h (+106/-0)
include/PetriEngine/Structures/State.h (+79/-0)
include/PetriEngine/Structures/StateSet.h (+258/-0)
include/PetriEngine/Structures/binarywrapper.h (+406/-0)
include/PetriEngine/Structures/light_deque.h (+78/-0)
include/PetriEngine/Structures/linked_bucket.h (+227/-0)
include/PetriEngine/SuccessorGenerator.h (+74/-0)
include/PetriEngine/TAR/AntiChain.h (+95/-0)
include/PetriEngine/TAR/ContainsVisitor.h (+230/-0)
include/PetriEngine/TAR/PlaceUseVisitor.h (+66/-0)
include/PetriEngine/TAR/RangeContext.h (+70/-0)
include/PetriEngine/TAR/RangeEvalContext.h (+66/-0)
include/PetriEngine/TAR/Solver.h (+56/-0)
include/PetriEngine/TAR/TARAutomata.h (+337/-0)
include/PetriEngine/TAR/TARReachability.h (+90/-0)
include/PetriEngine/TAR/TraceSet.h (+52/-0)
include/PetriEngine/TAR/range.h (+422/-0)
include/PetriEngine/errorcodes.h (+22/-0)
include/PetriEngine/options.h (+126/-0)
include/PetriParse/PNMLParser.h (+109/-0)
include/PetriParse/QueryBinaryParser.h (+45/-0)
include/PetriParse/QueryParser.h (+21/-0)
include/PetriParse/QueryXMLParser.h (+58/-0)
run_tests.sh (+40/-0)
src/CMakeLists.txt (+15/-0)
src/CTL/Algorithm/CMakeLists.txt (+9/-0)
src/CTL/Algorithm/CertainZeroFPA.cpp (+233/-0)
src/CTL/Algorithm/FixedPointAlgorithm.cpp (+33/-0)
src/CTL/Algorithm/LocalFPA.cpp (+123/-0)
src/CTL/CMakeLists.txt (+12/-0)
src/CTL/CTLEngine.cpp (+319/-0)
src/CTL/DependencyGraph/CMakeLists.txt (+3/-0)
src/CTL/DependencyGraph/Configuration.cpp (+5/-0)
src/CTL/PetriNets/CMakeLists.txt (+5/-0)
src/CTL/PetriNets/OnTheFlyDG.cpp (+634/-0)
src/CTL/SearchStrategy/CMakeLists.txt (+5/-0)
src/CTL/SearchStrategy/HeuristicSearch.cpp (+30/-0)
src/CTL/SearchStrategy/RDFSSearch.cpp (+38/-0)
src/CTL/SearchStrategy/SearchStrategy.cpp (+138/-0)
src/PetriEngine/CMakeLists.txt (+19/-0)
src/PetriEngine/Colored/CMakeLists.txt (+6/-0)
src/PetriEngine/Colored/ColoredPetriNetBuilder.cpp (+302/-0)
src/PetriEngine/Colored/Colors.cpp (+218/-0)
src/PetriEngine/Colored/Multiset.cpp (+193/-0)
src/PetriEngine/PQL/CMakeLists.txt (+17/-0)
src/PetriEngine/PQL/Contexts.cpp (+141/-0)
src/PetriEngine/PQL/Expressions.cpp (+4207/-0)
src/PetriEngine/PQL/PQL.cpp (+70/-0)
src/PetriEngine/PQL/PQLQueryParser.y (+83/-0)
src/PetriEngine/PQL/PQLQueryTokens.l (+75/-0)
src/PetriEngine/PetriNet.cpp (+248/-0)
src/PetriEngine/PetriNetBuilder.cpp (+467/-0)
src/PetriEngine/Reachability/CMakeLists.txt (+7/-0)
src/PetriEngine/Reachability/ReachabilitySearch.cpp (+158/-0)
src/PetriEngine/Reachability/ResultPrinter.cpp (+239/-0)
src/PetriEngine/Reducer.cpp (+1741/-0)
src/PetriEngine/ReducingSuccessorGenerator.cpp (+318/-0)
src/PetriEngine/STSolver.cpp (+276/-0)
src/PetriEngine/Simplification/CMakeLists.txt (+5/-0)
src/PetriEngine/Simplification/LPCache.cpp (+26/-0)
src/PetriEngine/Simplification/LinearProgram.cpp (+369/-0)
src/PetriEngine/Simplification/MurmurHash2.cpp (+523/-0)
src/PetriEngine/Simplification/Vector.cpp (+40/-0)
src/PetriEngine/Structures/AlignedEncoder.cpp (+595/-0)
src/PetriEngine/Structures/CMakeLists.txt (+4/-0)
src/PetriEngine/Structures/Queue.cpp (+129/-0)
src/PetriEngine/Structures/binarywrapper.cpp (+167/-0)
src/PetriEngine/SuccessorGenerator.cpp (+114/-0)
src/PetriEngine/TAR/CMakeLists.txt (+9/-0)
src/PetriEngine/TAR/PlaceUseVisitor.cpp (+147/-0)
src/PetriEngine/TAR/RangeContext.cpp (+336/-0)
src/PetriEngine/TAR/RangeEvalContext.cpp (+268/-0)
src/PetriEngine/TAR/Solver.cpp (+616/-0)
src/PetriEngine/TAR/TARReachability.cpp (+546/-0)
src/PetriEngine/TAR/TraceSet.cpp (+397/-0)
src/PetriParse/CMakeLists.txt (+5/-0)
src/PetriParse/PNMLParser.cpp (+620/-0)
src/PetriParse/QueryBinaryParser.cpp (+289/-0)
src/PetriParse/QueryXMLParser.cpp (+600/-0)
src/VerifyPN.cpp (+1093/-0)
test_models/FMS2-untimed/model.pnml (+588/-0)
test_models/FMS2-untimed/query.xml (+2904/-0)
test_models/Kanban2-test001/model.pnml (+450/-0)
test_models/Kanban2-test001/query.xml (+436/-0)
test_models/MAPK-test001/model.pnml (+738/-0)
test_models/MAPK-test001/query.xml (+136/-0)
test_models/abp-test001/model.pnml (+424/-0)
test_models/abp-test001/query.xml (+60/-0)
test_models/abp-test002/model.pnml (+424/-0)
test_models/abp-test002/query.xml (+60/-0)
test_models/abp-test003/model.pnml (+424/-0)
test_models/abp-test003/query.xml (+60/-0)
test_models/abp-test004/model.pnml (+424/-0)
test_models/abp-test004/query.xml (+60/-0)
test_models/abp-test005/model.pnml (+174/-0)
test_models/abp-test005/query.xml (+58/-0)
test_models/abp-test006/model.pnml (+200/-0)
test_models/abp-test006/query.xml (+58/-0)
test_models/abp-test007/model.pnml (+200/-0)
test_models/abp-test007/query.xml (+58/-0)
test_models/abp-test008/model.pnml (+174/-0)
test_models/abp-test008/query.xml (+58/-0)
test_models/arithmetic-test001/model.pnml (+870/-0)
test_models/arithmetic-test001/query.xml (+136/-0)
test_models/arithmetic-test002/model.pnml (+203/-0)
test_models/arithmetic-test002/query.xml (+426/-0)
test_models/arithmetic-test003/model.pnml (+423/-0)
test_models/arithmetic-test003/query.xml (+426/-0)
test_models/arithmetic-test004/model.pnml (+24/-0)
test_models/arithmetic-test004/query.xml (+38/-0)
test_models/arithmetic-test005/model.pnml (+52/-0)
test_models/arithmetic-test005/query.xml (+52/-0)
test_models/arithmetic-test006/model.pnml (+52/-0)
test_models/arithmetic-test006/query.xml (+90/-0)
test_models/arithmetic-test007/model.pnml (+94/-0)
test_models/arithmetic-test007/query.xml (+228/-0)
test_models/combined-test001/model.pnml (+170/-0)
test_models/combined-test001/query.xml (+134/-0)
test_models/combined-test002/model.pnml (+148/-0)
test_models/combined-test002/query.xml (+76/-0)
test_models/combined-test003/model.pnml (+210/-0)
test_models/combined-test003/query.xml (+52/-0)
test_models/combined-test004/model.pnml (+209/-0)
test_models/combined-test004/query.xml (+52/-0)
test_models/combined-test005/model.pnml (+181/-0)
test_models/combined-test005/query.xml (+20/-0)
test_models/combined-test006/model.pnml (+181/-0)
test_models/combined-test006/query.xml (+20/-0)
test_models/combined-test007/model.pnml (+858/-0)
test_models/combined-test007/query.xml (+84/-0)
test_models/composition-prime-test001/model.pnml (+1424/-0)
test_models/composition-prime-test001/query.xml (+20/-0)
test_models/composition-prime-test002/model.pnml (+1424/-0)
test_models/composition-prime-test002/query.xml (+20/-0)
test_models/composition-prime-test003/model.pnml (+1424/-0)
test_models/composition-prime-test003/query.xml (+20/-0)
test_models/composition-prime-test004/model.pnml (+1424/-0)
test_models/composition-prime-test004/query.xml (+20/-0)
test_models/composition-prime-test005/model.pnml (+1424/-0)
test_models/composition-prime-test005/query.xml (+20/-0)
test_models/composition-test001/model.pnml (+137/-0)
test_models/composition-test001/query.xml (+20/-0)
test_models/composition-test002/model.pnml (+137/-0)
test_models/composition-test002/query.xml (+20/-0)
test_models/composition-test003/model.pnml (+137/-0)
test_models/composition-test003/query.xml (+20/-0)
test_models/composition-test004/model.pnml (+124/-0)
test_models/composition-test004/query.xml (+20/-0)
test_models/composition-test005/model.pnml (+229/-0)
test_models/composition-test005/query.xml (+20/-0)
test_models/composition-test006/model.pnml (+229/-0)
test_models/composition-test006/query.xml (+20/-0)
test_models/composition-test007/model.pnml (+229/-0)
test_models/composition-test007/query.xml (+20/-0)
test_models/composition-test008/model.pnml (+244/-0)
test_models/composition-test008/query.xml (+20/-0)
test_models/composition-test009/model.pnml (+397/-0)
test_models/composition-test009/query.xml (+52/-0)
test_models/composition-test010/model.pnml (+397/-0)
test_models/composition-test010/query.xml (+28/-0)
test_models/composition-test011/model.pnml (+397/-0)
test_models/composition-test011/query.xml (+28/-0)
test_models/composition-test012/model.pnml (+149/-0)
test_models/composition-test012/query.xml (+52/-0)
test_models/composition-test013/model.pnml (+149/-0)
test_models/composition-test013/query.xml (+52/-0)
test_models/composition-test014/model.pnml (+295/-0)
test_models/composition-test014/query.xml (+34/-0)
test_models/composition-test015/model.pnml (+295/-0)
test_models/composition-test015/query.xml (+34/-0)
test_models/constant-test001/model.pnml (+159/-0)
test_models/constant-test001/query.xml (+20/-0)
test_models/constant-test002/model.pnml (+159/-0)
test_models/constant-test002/query.xml (+20/-0)
test_models/continuous-test001/model.pnml (+135/-0)
test_models/continuous-test001/query.xml (+39/-0)
test_models/continuous-test002/model.pnml (+135/-0)
test_models/continuous-test002/query.xml (+36/-0)
test_models/continuous-test003/model.pnml (+144/-0)
test_models/continuous-test003/query.xml (+15/-0)
test_models/continuous-test004/model.pnml (+144/-0)
test_models/continuous-test004/query.xml (+15/-0)
test_models/continuous-test005/model.pnml (+150/-0)
test_models/continuous-test005/query.xml (+15/-0)
test_models/continuous-test006/model.pnml (+147/-0)
test_models/continuous-test006/query.xml (+20/-0)
test_models/continuous-test007/model.pnml (+147/-0)
test_models/continuous-test007/query.xml (+20/-0)
test_models/continuous-test008/model.pnml (+143/-0)
test_models/continuous-test008/query.xml (+36/-0)
test_models/continuous-test009/model.pnml (+113/-0)
test_models/continuous-test009/query.xml (+66/-0)
test_models/deadlock-test001/model.pnml (+216/-0)
test_models/deadlock-test001/query.xml (+20/-0)
test_models/deadlock-test002/model.pnml (+394/-0)
test_models/deadlock-test002/query.xml (+52/-0)
test_models/deadlock-test003/model.pnml (+306/-0)
test_models/deadlock-test003/query.xml (+66/-0)
test_models/deadlock-test004/model.pnml (+164/-0)
test_models/deadlock-test004/query.xml (+20/-0)
test_models/deadlock-test005/model.pnml (+326/-0)
test_models/deadlock-test005/query.xml (+68/-0)
test_models/deadlock-test006/model.pnml (+326/-0)
test_models/deadlock-test006/query.xml (+60/-0)
test_models/deadlock-test007/model.pnml (+322/-0)
test_models/deadlock-test007/query.xml (+28/-0)
test_models/deadlock-test008/model.pnml (+348/-0)
test_models/deadlock-test008/query.xml (+28/-0)
test_models/deadlock-test009/model.pnml (+348/-0)
test_models/deadlock-test009/query.xml (+28/-0)
test_models/deadlock-test010/model.pnml (+322/-0)
test_models/deadlock-test010/query.xml (+28/-0)
test_models/deadlock-test011/model.pnml (+424/-0)
test_models/deadlock-test011/query.xml (+15/-0)
test_models/deadlock-test012/model.pnml (+424/-0)
test_models/deadlock-test012/query.xml (+15/-0)
test_models/deadlock-test013/model.pnml (+87/-0)
test_models/deadlock-test013/query.xml (+55/-0)
test_models/deadlock-test014/model.pnml (+82/-0)
test_models/deadlock-test014/query.xml (+55/-0)
test_models/deadlock-test015/model.pnml (+211/-0)
test_models/deadlock-test015/query.xml (+17/-0)
test_models/deadlock-test016/model.pnml (+232/-0)
test_models/deadlock-test016/query.xml (+38/-0)
test_models/deadlock-test017/model.pnml (+983/-0)
test_models/deadlock-test017/query.xml (+112/-0)
test_models/deadlock-test018/model.pnml (+45/-0)
test_models/deadlock-test018/query.xml (+34/-0)
test_models/deadlock-test019/model.pnml (+93/-0)
test_models/deadlock-test019/query.xml (+25/-0)
test_models/deadlock-test020/model.pnml (+93/-0)
test_models/deadlock-test020/query.xml (+158/-0)
test_models/deadlock-test021/model.pnml (+112/-0)
test_models/deadlock-test021/query.xml (+158/-0)
test_models/discrete-test-009/model.pnml (+261/-0)
test_models/discrete-test-009/query.xml (+114/-0)
test_models/discrete-test001/model.pnml (+43/-0)
test_models/discrete-test001/query.xml (+47/-0)
test_models/discrete-test002/model.pnml (+128/-0)
test_models/discrete-test002/query.xml (+44/-0)
test_models/discrete-test003/model.pnml (+159/-0)
test_models/discrete-test003/query.xml (+36/-0)
test_models/discrete-test004/model.pnml (+186/-0)
test_models/discrete-test004/query.xml (+80/-0)
test_models/discrete-test005/model.pnml (+566/-0)
test_models/discrete-test005/query.xml (+44/-0)
test_models/discrete-test006/model.pnml (+228/-0)
test_models/discrete-test006/query.xml (+200/-0)
test_models/discrete-test007/model.pnml (+248/-0)
test_models/discrete-test007/query.xml (+108/-0)
test_models/discrete-test008/model.pnml (+147/-0)
test_models/discrete-test008/query.xml (+94/-0)
test_models/discrete-test009/model.pnml (+261/-0)
test_models/discrete-test009/query.xml (+114/-0)
test_models/discrete-test010/model.pnml (+561/-0)
test_models/discrete-test010/query.xml (+262/-0)
test_models/discrete-test011/model.pnml (+512/-0)
test_models/discrete-test011/query.xml (+144/-0)
test_models/discrete-test012/model.pnml (+334/-0)
test_models/discrete-test012/query.xml (+20/-0)
test_models/division-test001/model.pnml (+593/-0)
test_models/division-test001/query.xml (+34/-0)
test_models/division-test002/model.pnml (+593/-0)
test_models/division-test002/query.xml (+34/-0)
test_models/error-conjunction-bug-test001/model.pnml (+612/-0)
test_models/error-conjunction-bug-test001/query.xml (+36/-0)
test_models/error-conjunction-reducer-test002/model.pnml (+631/-0)
test_models/error-conjunction-reducer-test002/query.xml (+62/-0)
test_models/error-encoder-test-001/model.pnml (+87/-0)
test_models/error-encoder-test-001/query.xml (+20/-0)
test_models/exercise-test001/model.pnml (+208/-0)
test_models/exercise-test001/query.xml (+72/-0)
test_models/exercise-test002/model.pnml (+174/-0)
test_models/exercise-test002/query.xml (+36/-0)
test_models/exercise-test003/model.pnml (+148/-0)
test_models/exercise-test003/query.xml (+28/-0)
test_models/exercise-test004/model.pnml (+148/-0)
test_models/exercise-test004/query.xml (+28/-0)
test_models/exercise-test005/model.pnml (+222/-0)
test_models/exercise-test005/query.xml (+20/-0)
test_models/exercise-test006/model.pnml (+222/-0)
test_models/exercise-test006/query.xml (+20/-0)
test_models/exercise-test007/model.pnml (+191/-0)
test_models/exercise-test007/query.xml (+20/-0)
test_models/exercise-test008/model.pnml (+220/-0)
test_models/exercise-test008/query.xml (+36/-0)
test_models/exercise-test009/model.pnml (+377/-0)
test_models/exercise-test009/query.xml (+20/-0)
test_models/exercise-test010/model.pnml (+377/-0)
test_models/exercise-test010/query.xml (+20/-0)
test_models/extra-test-001-liveness/model.pnml (+121/-0)
test_models/extra-test-001-liveness/query.xml (+38/-0)
test_models/extra-test-002-search-order/model.pnml (+158/-0)
test_models/extra-test-002-search-order/query.xml (+20/-0)
test_models/extra-test-003-maintanance/model.pnml (+406/-0)
test_models/extra-test-003-maintanance/query.xml (+20/-0)
test_models/extra-test-004-burger/model.pnml (+416/-0)
test_models/extra-test-004-burger/query.xml (+20/-0)
test_models/extra-test-004-transfusion/model.pnml (+2314/-0)
test_models/extra-test-004-transfusion/query.xml (+20/-0)
test_models/extra-test-005-liveness/model.pnml (+122/-0)
test_models/extra-test-005-liveness/query.xml (+76/-0)
test_models/extra-test-006-liveness/model.pnml (+141/-0)
test_models/extra-test-006-liveness/query.xml (+63/-0)
test_models/extra-test-007-liveness/model.pnml (+228/-0)
test_models/extra-test-007-liveness/query.xml (+70/-0)
test_models/fms-test001/model.pnml (+602/-0)
test_models/fms-test001/query.xml (+104/-0)
test_models/inclusion-test001/model.pnml (+182/-0)
test_models/inclusion-test001/query.xml (+112/-0)
test_models/inclusion-test002/model.pnml (+191/-0)
test_models/inclusion-test002/query.xml (+204/-0)
test_models/inclusion-test003/model.pnml (+191/-0)
test_models/inclusion-test003/query.xml (+204/-0)
test_models/inclusion-test004/model.pnml (+192/-0)
test_models/inclusion-test004/query.xml (+120/-0)
test_models/inclusion-test005/model.pnml (+194/-0)
test_models/inclusion-test005/query.xml (+120/-0)
test_models/inclusion-test006/model.pnml (+79/-0)
test_models/inclusion-test006/query.xml (+52/-0)
test_models/inclusion-test007/model.pnml (+132/-0)
test_models/inclusion-test007/query.xml (+104/-0)
test_models/inhibitors-test001/model.pnml (+134/-0)
test_models/inhibitors-test001/query.xml (+20/-0)
test_models/inhibitors-test002/model.pnml (+134/-0)
test_models/inhibitors-test002/query.xml (+20/-0)
test_models/inhibitors-test003/model.pnml (+134/-0)
test_models/inhibitors-test003/query.xml (+20/-0)
test_models/inhibitors-test004/model.pnml (+134/-0)
test_models/inhibitors-test004/query.xml (+20/-0)
test_models/invariants-test001/model.pnml (+184/-0)
test_models/invariants-test001/query.xml (+20/-0)
test_models/invariants-test002/model.pnml (+134/-0)
test_models/invariants-test002/query.xml (+20/-0)
test_models/invariants-test003/model.pnml (+134/-0)
test_models/invariants-test003/query.xml (+20/-0)
test_models/invariants-test004/model.pnml (+127/-0)
test_models/invariants-test004/query.xml (+20/-0)
test_models/invariants-test005/model.pnml (+127/-0)
test_models/invariants-test005/query.xml (+20/-0)
test_models/invariants-test006/model.pnml (+127/-0)
test_models/invariants-test006/query.xml (+20/-0)
test_models/invariants-test007/model.pnml (+129/-0)
test_models/invariants-test007/query.xml (+20/-0)
test_models/invariants-test008/model.pnml (+129/-0)
test_models/invariants-test008/query.xml (+20/-0)
test_models/invariants-test009/model.pnml (+172/-0)
test_models/invariants-test009/query.xml (+28/-0)
test_models/invariants-test010/model.pnml (+199/-0)
test_models/invariants-test010/query.xml (+28/-0)
test_models/invariants-test011/model.pnml (+156/-0)
test_models/invariants-test011/query.xml (+47/-0)
test_models/lightcross-text001/model.pnml (+172/-0)
test_models/lightcross-text001/query.xml (+84/-0)
test_models/liveness-test001/model.pnml (+171/-0)
test_models/liveness-test001/query.xml (+60/-0)
test_models/liveness-test002/model.pnml (+191/-0)
test_models/liveness-test002/query.xml (+20/-0)
test_models/liveness-test003/model.pnml (+191/-0)
test_models/liveness-test003/query.xml (+20/-0)
test_models/orphans-test001/model.pnml (+142/-0)
test_models/orphans-test001/query.xml (+28/-0)
test_models/orphans-test002/model.pnml (+142/-0)
test_models/orphans-test002/query.xml (+28/-0)
test_models/orphans-test003/model.pnml (+232/-0)
test_models/orphans-test003/query.xml (+30/-0)
test_models/orphans-test004/model.pnml (+232/-0)
test_models/orphans-test004/query.xml (+30/-0)
test_models/other-test001/model.pnml (+335/-0)
test_models/other-test001/query.xml (+28/-0)
test_models/other-test002/model.pnml (+335/-0)
test_models/other-test002/query.xml (+28/-0)
test_models/other-test003/model.pnml (+150/-0)
test_models/other-test003/query.xml (+20/-0)
test_models/other-test004/model.pnml (+150/-0)
test_models/other-test004/query.xml (+20/-0)
test_models/other-test005/model.pnml (+207/-0)
test_models/other-test005/query.xml (+20/-0)
test_models/other-test006/model.pnml (+207/-0)
test_models/other-test006/query.xml (+20/-0)
test_models/other-test007/model.pnml (+179/-0)
test_models/other-test007/query.xml (+28/-0)
test_models/other-test008/model.pnml (+174/-0)
test_models/other-test008/query.xml (+28/-0)
test_models/other-test009/model.pnml (+272/-0)
test_models/other-test009/query.xml (+20/-0)
test_models/other-test010/model.pnml (+272/-0)
test_models/other-test010/query.xml (+20/-0)
test_models/other-test011/model.pnml (+272/-0)
test_models/other-test011/query.xml (+20/-0)
test_models/other-test012/model.pnml (+195/-0)
test_models/other-test012/query.xml (+36/-0)
test_models/other-test013/model.pnml (+235/-0)
test_models/other-test013/query.xml (+84/-0)
test_models/other-test014/model.pnml (+252/-0)
test_models/other-test014/query.xml (+84/-0)
test_models/other-test015/model.pnml (+309/-0)
test_models/other-test015/query.xml (+68/-0)
test_models/prime-test001/model.pnml (+621/-0)
test_models/prime-test001/query.xml (+34/-0)
test_models/prime-test0019/model.pnml (+359/-0)
test_models/prime-test0019/query.xml (+20/-0)
test_models/prime-test002/model.pnml (+621/-0)
test_models/prime-test002/query.xml (+34/-0)
test_models/prime-test0020/model.pnml (+359/-0)
test_models/prime-test0020/query.xml (+20/-0)
test_models/prime-test0021/model.pnml (+359/-0)
test_models/prime-test0021/query.xml (+20/-0)
test_models/prime-test0022/model.pnml (+359/-0)
test_models/prime-test0022/query.xml (+20/-0)
test_models/prime-test003/model.pnml (+621/-0)
test_models/prime-test003/query.xml (+34/-0)
test_models/prime-test004/model.pnml (+621/-0)
test_models/prime-test004/query.xml (+34/-0)
test_models/prime-test005/model.pnml (+621/-0)
test_models/prime-test005/query.xml (+34/-0)
test_models/prime-test006/model.pnml (+621/-0)
test_models/prime-test006/query.xml (+34/-0)
test_models/prime-test007/model.pnml (+621/-0)
test_models/prime-test007/query.xml (+34/-0)
test_models/prime-test008/model.pnml (+621/-0)
test_models/prime-test008/query.xml (+34/-0)
test_models/prime-test009/model.pnml (+621/-0)
test_models/prime-test009/query.xml (+34/-0)
test_models/prime-test010/model.pnml (+621/-0)
test_models/prime-test010/query.xml (+34/-0)
test_models/prime-test011/model.pnml (+621/-0)
test_models/prime-test011/query.xml (+34/-0)
test_models/prime-test012/model.pnml (+621/-0)
test_models/prime-test012/query.xml (+34/-0)
test_models/prime-test013/model.pnml (+621/-0)
test_models/prime-test013/query.xml (+34/-0)
test_models/prime-test014/model.pnml (+621/-0)
test_models/prime-test014/query.xml (+34/-0)
test_models/prime-test015/model.pnml (+621/-0)
test_models/prime-test015/query.xml (+34/-0)
test_models/prime-test016/model.pnml (+802/-0)
test_models/prime-test016/query.xml (+36/-0)
test_models/prime-test017/model.pnml (+802/-0)
test_models/prime-test017/query.xml (+36/-0)
test_models/prime-test018/model.pnml (+802/-0)
test_models/prime-test018/query.xml (+36/-0)
test_models/prime-test019/model.pnml (+359/-0)
test_models/prime-test019/query.xml (+20/-0)
test_models/prime-test020/model.pnml (+359/-0)
test_models/prime-test020/query.xml (+20/-0)
test_models/prime-test023/model.pnml (+251/-0)
test_models/prime-test023/query.xml (+32/-0)
test_models/prime-test024/model.pnml (+251/-0)
test_models/prime-test024/query.xml (+32/-0)
test_models/productline-test001/model.pnml (+245/-0)
test_models/productline-test001/query.xml (+20/-0)
test_models/productline-test002/model.pnml (+245/-0)
test_models/productline-test002/query.xml (+20/-0)
test_models/productline-test003/model.pnml (+245/-0)
test_models/productline-test003/query.xml (+20/-0)
test_models/productline-test004/model.pnml (+255/-0)
test_models/productline-test004/query.xml (+20/-0)
test_models/productline-test005/model.pnml (+255/-0)
test_models/productline-test005/query.xml (+20/-0)
test_models/query-test001/model.pnml (+167/-0)
test_models/query-test001/query.xml (+224/-0)
test_models/query-test002/model.pnml (+135/-0)
test_models/query-test002/query.xml (+306/-0)
test_models/query-test003/model.pnml (+276/-0)
test_models/query-test003/query.xml (+102/-0)
test_models/query-test004/model.pnml (+165/-0)
test_models/query-test004/query.xml (+124/-0)
test_models/query-test005/model.pnml (+105/-0)
test_models/query-test005/query.xml (+76/-0)
test_models/reduction-001/model.pnml (+203/-0)
test_models/reduction-001/query.xml (+20/-0)
test_models/reduction-002/model.pnml (+203/-0)
test_models/reduction-002/query.xml (+20/-0)
test_models/reduction-003/model.pnml (+205/-0)
test_models/reduction-003/query.xml (+20/-0)
test_models/reduction-004/model.pnml (+207/-0)
test_models/reduction-004/query.xml (+20/-0)
test_models/reduction-005/model.pnml (+207/-0)
test_models/reduction-005/query.xml (+20/-0)
test_models/reduction-006/model.pnml (+203/-0)
test_models/reduction-006/query.xml (+20/-0)
test_models/reduction-007/model.pnml (+208/-0)
test_models/reduction-007/query.xml (+20/-0)
test_models/reduction-008-house/model.pnml (+623/-0)
test_models/reduction-008-house/query.xml (+44/-0)
test_models/reduction-009/model.pnml (+260/-0)
test_models/reduction-009/query.xml (+28/-0)
test_models/reduction-010/model.pnml (+122/-0)
test_models/reduction-010/query.xml (+20/-0)
test_models/reduction-011/model.pnml (+112/-0)
test_models/reduction-011/query.xml (+20/-0)
test_models/reduction-012/model.pnml (+121/-0)
test_models/reduction-012/query.xml (+20/-0)
test_models/reduction-013/model.pnml (+113/-0)
test_models/reduction-013/query.xml (+20/-0)
test_models/reduction-014/model.pnml (+151/-0)
test_models/reduction-014/query.xml (+20/-0)
test_models/reduction-015/model.pnml (+165/-0)
test_models/reduction-015/query.xml (+20/-0)
test_models/reduction-016/model.pnml (+134/-0)
test_models/reduction-016/query.xml (+20/-0)
test_models/reduction-017/model.pnml (+95/-0)
test_models/reduction-017/query.xml (+20/-0)
test_models/reduction-018/model.pnml (+98/-0)
test_models/reduction-018/query.xml (+22/-0)
test_models/reduction-019-deadlock/model.pnml (+154/-0)
test_models/reduction-019-deadlock/query.xml (+15/-0)
test_models/reduction-020-deadlock/model.pnml (+109/-0)
test_models/reduction-020-deadlock/query.xml (+15/-0)
test_models/reduction-021-deadlock/model.pnml (+109/-0)
test_models/reduction-021-deadlock/query.xml (+15/-0)
test_models/reduction-022-deadlock/model.pnml (+78/-0)
test_models/reduction-022-deadlock/query.xml (+15/-0)
test_models/reduction-023-deadlock/model.pnml (+51/-0)
test_models/reduction-023-deadlock/query.xml (+15/-0)
test_models/reduction-024/model.pnml (+802/-0)
test_models/reduction-024/query.xml (+44/-0)
test_models/reduction-025/model.pnml (+157/-0)
test_models/reduction-025/query.xml (+44/-0)
test_models/reduction-026/model.pnml (+165/-0)
test_models/reduction-026/query.xml (+44/-0)
test_models/reduction-027/model.pnml (+165/-0)
test_models/reduction-027/query.xml (+44/-0)
test_models/reduction-028/model.pnml (+161/-0)
test_models/reduction-028/query.xml (+44/-0)
test_models/reduction-029/model.pnml (+308/-0)
test_models/reduction-029/query.xml (+31/-0)
test_models/reduction-030/model.pnml (+308/-0)
test_models/reduction-030/query.xml (+31/-0)
test_models/reduction-031/model.pnml (+310/-0)
test_models/reduction-031/query.xml (+31/-0)
test_models/reduction-032/model.pnml (+217/-0)
test_models/reduction-032/query.xml (+31/-0)
test_models/reduction-033/model.pnml (+248/-0)
test_models/reduction-033/query.xml (+31/-0)
test_models/reduction-034/model.pnml (+248/-0)
test_models/reduction-034/query.xml (+31/-0)
test_models/reduction-035/model.pnml (+164/-0)
test_models/reduction-035/query.xml (+20/-0)
test_models/reduction-036/model.pnml (+164/-0)
test_models/reduction-036/query.xml (+20/-0)
test_models/reduction-037/model.pnml (+277/-0)
test_models/reduction-037/query.xml (+31/-0)
test_models/reduction-038/model.pnml (+277/-0)
test_models/reduction-038/query.xml (+57/-0)
test_models/reduction-039/model.pnml (+265/-0)
test_models/reduction-039/query.xml (+105/-0)
test_models/reduction-040/model.pnml (+150/-0)
test_models/reduction-040/query.xml (+20/-0)
test_models/reduction-041/model.pnml (+174/-0)
test_models/reduction-041/query.xml (+20/-0)
test_models/reduction-042/model.pnml (+178/-0)
test_models/reduction-042/query.xml (+31/-0)
test_models/reduction-043/model.pnml (+191/-0)
test_models/reduction-043/query.xml (+28/-0)
test_models/reduction-044/model.pnml (+170/-0)
test_models/reduction-044/query.xml (+31/-0)
test_models/reduction-045/model.pnml (+174/-0)
test_models/reduction-045/query.xml (+31/-0)
test_models/reduction-046/model.pnml (+111/-0)
test_models/reduction-046/query.xml (+47/-0)
test_models/reduction-047/model.pnml (+130/-0)
test_models/reduction-047/query.xml (+47/-0)
test_models/reduction-048/model.pnml (+130/-0)
test_models/reduction-048/query.xml (+47/-0)
test_models/reduction-049/model.pnml (+130/-0)
test_models/reduction-049/query.xml (+31/-0)
test_models/reduction-050/model.pnml (+66/-0)
test_models/reduction-050/query.xml (+20/-0)
test_models/shortest-path-test001/model.pnml (+337/-0)
test_models/shortest-path-test001/query.xml (+20/-0)
test_models/shortest-path-test002/model.pnml (+337/-0)
test_models/shortest-path-test002/query.xml (+20/-0)
test_models/sim-test001/model.pnml (+173/-0)
test_models/sim-test001/query.xml (+44/-0)
test_models/sim-test002/model.pnml (+226/-0)
test_models/sim-test002/query.xml (+44/-0)
test_models/simple-test001/model.pnml (+96/-0)
test_models/simple-test001/query.xml (+20/-0)
test_models/simple-test002/model.pnml (+111/-0)
test_models/simple-test002/query.xml (+20/-0)
test_models/simple-test003/model.pnml (+111/-0)
test_models/simple-test003/query.xml (+20/-0)
test_models/simple-test004/model.pnml (+232/-0)
test_models/simple-test004/query.xml (+20/-0)
test_models/simple-test005/model.pnml (+232/-0)
test_models/simple-test005/query.xml (+20/-0)
test_models/simple-test006/model.pnml (+250/-0)
test_models/simple-test006/query.xml (+20/-0)
test_models/simple-test007/model.pnml (+250/-0)
test_models/simple-test007/query.xml (+20/-0)
test_models/simple-test008/model.pnml (+151/-0)
test_models/simple-test008/query.xml (+20/-0)
test_models/simple-test009/model.pnml (+151/-0)
test_models/simple-test009/query.xml (+28/-0)
test_models/simple-test010/model.pnml (+151/-0)
test_models/simple-test010/query.xml (+28/-0)
test_models/simple-test011/model.pnml (+148/-0)
test_models/simple-test011/query.xml (+20/-0)
test_models/simple-test012/model.pnml (+148/-0)
test_models/simple-test012/query.xml (+20/-0)
test_models/simple-test013/model.pnml (+189/-0)
test_models/simple-test013/query.xml (+28/-0)
test_models/simple-test014/model.pnml (+189/-0)
test_models/simple-test014/query.xml (+28/-0)
test_models/simple-test015/model.pnml (+189/-0)
test_models/simple-test015/query.xml (+28/-0)
test_models/simple-test016/model.pnml (+151/-0)
test_models/simple-test016/query.xml (+20/-0)
test_models/simple-test017/model.pnml (+221/-0)
test_models/simple-test017/query.xml (+28/-0)
test_models/simple-test018/model.pnml (+94/-0)
test_models/simple-test018/query.xml (+36/-0)
test_models/simple-test019/model.pnml (+94/-0)
test_models/simple-test019/query.xml (+52/-0)
test_models/simple-test020/model.pnml (+134/-0)
test_models/simple-test020/query.xml (+44/-0)
test_models/subsetsum-test001/model.pnml (+202/-0)
test_models/subsetsum-test001/query.xml (+20/-0)
test_models/subsetsum-test002/model.pnml (+202/-0)
test_models/subsetsum-test002/query.xml (+20/-0)
test_models/subsetsum-test003/model.pnml (+260/-0)
test_models/subsetsum-test003/query.xml (+20/-0)
test_models/subsetsum-test004/model.pnml (+260/-0)
test_models/subsetsum-test004/query.xml (+20/-0)
test_models/subsetsum-test005/model.pnml (+247/-0)
test_models/subsetsum-test005/query.xml (+20/-0)
test_models/task-graph-test001/model.pnml (+470/-0)
test_models/task-graph-test001/query.xml (+124/-0)
test_models/trace-test001/model.pnml (+147/-0)
test_models/trace-test001/query.xml (+44/-0)
test_models/trace-test002/model.pnml (+136/-0)
test_models/trace-test002/query.xml (+44/-0)
test_models/trace-test003/model.pnml (+91/-0)
test_models/trace-test003/query.xml (+31/-0)
test_models/trace-test004/model.pnml (+118/-0)
test_models/trace-test004/query.xml (+20/-0)
test_models/trace-test005/model.pnml (+2634/-0)
test_models/trace-test005/query.xml (+20/-0)
test_models/trace-test006/model.pnml (+110/-0)
test_models/trace-test006/query.xml (+17/-0)
test_models/trace-test007/model.pnml (+110/-0)
test_models/trace-test007/query.xml (+17/-0)
test_models/trace-test008/model.pnml (+110/-0)
test_models/trace-test008/query.xml (+17/-0)
test_models/trace-test009/model.pnml (+110/-0)
test_models/trace-test009/query.xml (+17/-0)
test_models/train-simple-test001/model.pnml (+224/-0)
test_models/train-simple-test001/query.xml (+36/-0)
test_models/train-simple-test002/model.pnml (+224/-0)
test_models/train-simple-test002/query.xml (+36/-0)
test_models/train-simple-test003/model.pnml (+224/-0)
test_models/train-simple-test003/query.xml (+36/-0)
test_models/train-simple-test004/model.pnml (+224/-0)
test_models/train-simple-test004/query.xml (+36/-0)
test_models/train-simple-test005/model.pnml (+224/-0)
test_models/train-simple-test005/query.xml (+36/-0)
test_models/transInv-test001/model.pnml (+135/-0)
test_models/transInv-test001/query.xml (+20/-0)
test_models/transInv-test002/model.pnml (+135/-0)
test_models/transInv-test002/query.xml (+20/-0)
test_models/transInv-test003/model.pnml (+125/-0)
test_models/transInv-test003/query.xml (+20/-0)
test_models/transInv-test004/model.pnml (+135/-0)
test_models/transInv-test004/query.xml (+20/-0)
test_models/transInv-test005/model.pnml (+135/-0)
test_models/transInv-test005/query.xml (+20/-0)
test_models/transport-test001/model.pnml (+211/-0)
test_models/transport-test001/query.xml (+20/-0)
test_models/transport-test002/model.pnml (+211/-0)
test_models/transport-test002/query.xml (+20/-0)
test_models/transport-test003/model.pnml (+222/-0)
test_models/transport-test003/query.xml (+20/-0)
test_models/transport-test004/model.pnml (+222/-0)
test_models/transport-test004/query.xml (+20/-0)
test_models/transport-test005/model.pnml (+222/-0)
test_models/transport-test005/query.xml (+20/-0)
test_models/transport-test006/model.pnml (+220/-0)
test_models/transport-test006/query.xml (+20/-0)
test_models/transport-test007/model.pnml (+220/-0)
test_models/transport-test007/query.xml (+20/-0)
test_models/transport-test008/model.pnml (+220/-0)
test_models/transport-test008/query.xml (+20/-0)
test_models/transport-test009/model.pnml (+134/-0)
test_models/transport-test009/query.xml (+20/-0)
test_models/transport-test010/model.pnml (+134/-0)
test_models/transport-test010/query.xml (+20/-0)
test_models/transport-test011/model.pnml (+188/-0)
test_models/transport-test011/query.xml (+34/-0)
test_models/transport-test012/model.pnml (+188/-0)
test_models/transport-test012/query.xml (+34/-0)
test_models/transport-test013/model.pnml (+168/-0)
test_models/transport-test013/query.xml (+34/-0)
test_models/transport-test014/model.pnml (+168/-0)
test_models/transport-test014/query.xml (+34/-0)
test_models/transport-test015/model.pnml (+180/-0)
test_models/transport-test015/query.xml (+20/-0)
test_models/transport-test016/model.pnml (+180/-0)
test_models/transport-test016/query.xml (+20/-0)
test_models/transport-test017/model.pnml (+316/-0)
test_models/transport-test017/query.xml (+36/-0)
test_models/transport-test018/model.pnml (+234/-0)
test_models/transport-test018/query.xml (+36/-0)
test_models/transport-test019/model.pnml (+159/-0)
test_models/transport-test019/query.xml (+80/-0)
test_models/transport-test020/model.pnml (+66/-0)
test_models/transport-test020/query.xml (+36/-0)
test_models/transport-test021/model.pnml (+135/-0)
test_models/transport-test021/query.xml (+73/-0)
test_models/transport-test022/model.pnml (+136/-0)
test_models/transport-test022/query.xml (+55/-0)
test_models/transport-test023/model.pnml (+162/-0)
test_models/transport-test023/query.xml (+39/-0)
test_models/tricky-test001/model.pnml (+215/-0)
test_models/tricky-test001/query.xml (+28/-0)
test_models/tricky-test002/model.pnml (+215/-0)
test_models/tricky-test002/query.xml (+28/-0)
test_models/tricky-test003/model.pnml (+188/-0)
test_models/tricky-test003/query.xml (+34/-0)
test_models/tricky-test004/model.pnml (+125/-0)
test_models/tricky-test004/query.xml (+52/-0)
test_models/untimed-reductions-A-test001/model.pnml (+132/-0)
test_models/untimed-reductions-A-test001/query.xml (+36/-0)
test_models/untimed-reductions-A-test002/model.pnml (+144/-0)
test_models/untimed-reductions-A-test002/query.xml (+44/-0)
test_models/untimed-reductions-A-test003/model.pnml (+149/-0)
test_models/untimed-reductions-A-test003/query.xml (+44/-0)
test_models/untimed-reductions-A-test004/model.pnml (+146/-0)
test_models/untimed-reductions-A-test004/query.xml (+36/-0)
test_models/untimed-reductions-B-test001/model.pnml (+182/-0)
test_models/untimed-reductions-B-test001/query.xml (+44/-0)
test_models/untimed-reductions-B-test002/model.pnml (+177/-0)
test_models/untimed-reductions-B-test002/query.xml (+36/-0)
test_models/untimed-reductions-B-test003/model.pnml (+187/-0)
test_models/untimed-reductions-B-test003/query.xml (+36/-0)
test_models/untimed-reductions-B-test004/model.pnml (+182/-0)
test_models/untimed-reductions-B-test004/query.xml (+36/-0)
test_models/untimed-reductions-B-test005/model.pnml (+163/-0)
test_models/untimed-reductions-B-test005/query.xml (+36/-0)
test_models/untimed-reductions-C-test001/model.pnml (+150/-0)
test_models/untimed-reductions-C-test001/query.xml (+36/-0)
test_models/untimed-reductions-C-test002/model.pnml (+150/-0)
test_models/untimed-reductions-C-test002/query.xml (+36/-0)
test_models/untimed-reductions-C-test003/model.pnml (+150/-0)
test_models/untimed-reductions-C-test003/query.xml (+36/-0)
test_models/untimed-reductions-C-test004/model.pnml (+150/-0)
test_models/untimed-reductions-C-test004/query.xml (+56/-0)
test_models/untimed-reductions-D-test001/model.pnml (+209/-0)
test_models/untimed-reductions-D-test001/query.xml (+36/-0)
test_models/untimed-reductions-D-test002/model.pnml (+224/-0)
test_models/untimed-reductions-D-test002/query.xml (+36/-0)
test_models/untimed-reductions-E-test001/model.pnml (+109/-0)
test_models/untimed-reductions-E-test001/query.xml (+20/-0)
test_models/untimed-reductions-jacob-A-test001/model.pnml (+181/-0)
test_models/untimed-reductions-jacob-A-test001/query.xml (+119/-0)
test_models/untimed-reductions-jacob-B-test001/model.pnml (+259/-0)
test_models/untimed-reductions-jacob-B-test001/query.xml (+76/-0)
test_models/untimed-reductions-jacob-C-test001/model.pnml (+181/-0)
test_models/untimed-reductions-jacob-C-test001/query.xml (+124/-0)
test_models/untimed-reductions-jacob-D1-test001/model.pnml (+228/-0)
test_models/untimed-reductions-jacob-D1-test001/query.xml (+129/-0)
test_models/untimed-reductions-jacob-D2-test001/model.pnml (+150/-0)
test_models/untimed-reductions-jacob-D2-test001/query.xml (+15/-0)
test_models/untimed-reductions-jacob-E-test001/model.pnml (+173/-0)
test_models/untimed-reductions-jacob-E-test001/query.xml (+76/-0)
test_models/untimed-reductions-mads-test001/model.pnml (+140/-0)
test_models/untimed-reductions-mads-test001/query.xml (+47/-0)
test_models/untimed-reductions-mads-test002/model.pnml (+160/-0)
test_models/untimed-reductions-mads-test002/query.xml (+39/-0)
test_models/untimed-reductions-mads-test003/model.pnml (+140/-0)
test_models/untimed-reductions-mads-test003/query.xml (+39/-0)
test_models/untimed-reductions-mads-test004/model.pnml (+156/-0)
test_models/untimed-reductions-mads-test004/query.xml (+44/-0)
test_models/untimed-reductions-mads-test005/model.pnml (+124/-0)
test_models/untimed-reductions-mads-test005/query.xml (+50/-0)
test_models/untimed-reductions-mads-test006/model.pnml (+104/-0)
test_models/untimed-reductions-mads-test006/query.xml (+55/-0)
test_models/untimed-reductions-mads-test007/model.pnml (+152/-0)
test_models/untimed-reductions-mads-test007/query.xml (+15/-0)
test_models/untimed-reductions-mads-test008/model.pnml (+72/-0)
test_models/untimed-reductions-mads-test008/query.xml (+66/-0)
test_models/untimed-reductions-mads-test009/model.pnml (+637/-0)
test_models/untimed-reductions-mads-test009/query.xml (+50/-0)
test_models/untimed-test001/model.pnml (+140/-0)
test_models/untimed-test001/query.xml (+84/-0)
test_models/untimed-test002/model.pnml (+128/-0)
test_models/untimed-test002/query.xml (+20/-0)
test_models/untimed-test003/model.pnml (+128/-0)
test_models/untimed-test003/query.xml (+20/-0)
test_models/untimed-test004/model.pnml (+1021/-0)
test_models/untimed-test004/query.xml (+327/-0)
test_models/untimed-test005/model.pnml (+1035/-0)
test_models/untimed-test005/query.xml (+121/-0)
test_models/untimed-test006-philosophers/model.pnml (+856/-0)
test_models/untimed-test006-philosophers/query.xml (+63/-0)
test_models/untimed-test007-swimming-pool/model.pnml (+233/-0)
test_models/untimed-test007-swimming-pool/query.xml (+55/-0)
test_models/untimed-test008/model.pnml (+87/-0)
test_models/untimed-test008/query.xml (+20/-0)
test_models/untimed-test009/model.pnml (+129/-0)
test_models/untimed-test009/query.xml (+28/-0)
test_models/untimed-test010/model.pnml (+94/-0)
test_models/untimed-test010/query.xml (+36/-0)
test_models/untimed-test011/model.pnml (+134/-0)
test_models/untimed-test011/query.xml (+84/-0)
test_models/urgency-test001/model.pnml (+78/-0)
test_models/urgency-test001/query.xml (+76/-0)
test_models/urgency-test002/model.pnml (+82/-0)
test_models/urgency-test002/query.xml (+76/-0)
test_models/urgency-test003/model.pnml (+105/-0)
test_models/urgency-test003/query.xml (+44/-0)
test_models/urgency-test004/model.pnml (+266/-0)
test_models/urgency-test004/query.xml (+68/-0)
test_models/urgency-test005/model.pnml (+274/-0)
test_models/urgency-test005/query.xml (+52/-0)
test_models/urgency-test006/model.pnml (+301/-0)
test_models/urgency-test006/query.xml (+124/-0)
test_models/urgency-test007/model.pnml (+192/-0)
test_models/urgency-test007/query.xml (+108/-0)
test_models/urgency-test008/model.pnml (+193/-0)
test_models/urgency-test008/query.xml (+108/-0)
test_models/urgency-test009/model.pnml (+209/-0)
test_models/urgency-test009/query.xml (+108/-0)
test_models/urgency-test010/model.pnml (+514/-0)
test_models/urgency-test010/query.xml (+36/-0)
test_models/urgency-test011/model.pnml (+514/-0)
test_models/urgency-test011/query.xml (+36/-0)
test_models/urgency-test012/model.pnml (+269/-0)
test_models/urgency-test012/query.xml (+120/-0)
test_models/urgency-test013/model.pnml (+269/-0)
test_models/urgency-test013/query.xml (+120/-0)
test_models/urgency-test014/model.pnml (+243/-0)
test_models/urgency-test014/query.xml (+60/-0)
test_models/urgency-test015/model.pnml (+543/-0)
test_models/urgency-test015/query.xml (+52/-0)
test_models/urgency-test016/model.pnml (+258/-0)
test_models/urgency-test016/query.xml (+60/-0)
test_models/urgency-test017/model.pnml (+265/-0)
test_models/urgency-test017/query.xml (+36/-0)
test_models/weighted-test001/model.pnml (+268/-0)
test_models/weighted-test001/query.xml (+68/-0)
test_models/weighted-test002/model.pnml (+295/-0)
test_models/weighted-test002/query.xml (+20/-0)
test_models/weighted-test003/model.pnml (+312/-0)
test_models/weighted-test003/query.xml (+50/-0)
test_models/weighted-test004/model.pnml (+294/-0)
test_models/weighted-test004/query.xml (+178/-0)
test_models/workflow-test001/model.pnml (+162/-0)
test_models/workflow-test001/query.xml (+20/-0)
test_models/workflow-test002/model.pnml (+162/-0)
test_models/workflow-test002/query.xml (+20/-0)
test_models/workflow-test003/model.pnml (+162/-0)
test_models/workflow-test003/query.xml (+20/-0)
test_models/workflow-test004/model.pnml (+167/-0)
test_models/workflow-test004/query.xml (+20/-0)
test_models/workflow-test005/model.pnml (+172/-0)
test_models/workflow-test005/query.xml (+20/-0)
test_models/workflow-test006/model.pnml (+172/-0)
test_models/workflow-test006/query.xml (+20/-0)
test_models/workflow-test007/model.pnml (+237/-0)
test_models/workflow-test007/query.xml (+20/-0)
test_models/workflow-test008/model.pnml (+237/-0)
test_models/workflow-test008/query.xml (+20/-0)
test_models/workflow-test009/model.pnml (+237/-0)
test_models/workflow-test009/query.xml (+20/-0)
test_models/workflow-test010/model.pnml (+1304/-0)
test_models/workflow-test010/query.xml (+156/-0)
test_models/workflow-test011/model.pnml (+428/-0)
test_models/workflow-test011/query.xml (+68/-0)
test_models/workflow-test012/model.pnml (+599/-0)
test_models/workflow-test012/query.xml (+76/-0)
test_models/workflow-test013/model.pnml (+351/-0)
test_models/workflow-test013/query.xml (+116/-0)
test_models/workflow-test014/model.pnml (+351/-0)
test_models/workflow-test014/query.xml (+116/-0)
test_models/workflow-test015/model.pnml (+378/-0)
test_models/workflow-test015/query.xml (+116/-0)
test_models/workflow-test016/model.pnml (+583/-0)
test_models/workflow-test016/query.xml (+87/-0)
toolchain-x86_64-w64-mingw32.cmake (+17/-0)
To merge this branch: bzr merge lp:~verifypn-maintainers/verifypn/interval_tar
Reviewer Review Type Date Requested Status
Jiri Srba Approve
Review via email: mp+386674@code.launchpad.net

Commit message

 - Implements TAR w/o z3, but using a simple integer inference engine for Hoare logic.
 - Replaces LP-Solve with GLPK, reduces computation-time and memory overhead
 - Implements new global properties, translated into CTL formulae.

Passes MCC'19 models, needs manual validation.

To post a comment you must log in.
353. By Peter G. Jensen <email address hidden>

Merged in trunk

354. By Peter G. Jensen <email address hidden>

added simple test-script and test models

355. By Peter G. Jensen <email address hidden>

inhibitor arcs are not yet handled by TAR solver, so return error if used with TAR

356. By Peter G. Jensen <email address hidden>

fixed handling of inhibitor

357. By Peter G. Jensen <email address hidden>

removing unused glpk import from STSolver

358. By Peter G. Jensen <email address hidden>

another missing inhib check

359. By <email address hidden>

allowed compilation for Mac

360. By <email address hidden>

updated readme as TAR is now possible for all platforms

361. By Kenneth Yrke Jørgensen

Updated argeument for cross compile glpk for windows

362. By Kenneth Yrke Jørgensen

Updated readme with info for cross-compile

363. By Kenneth Yrke Jørgensen

Updated readme

364. By <email address hidden>

updated README with compilation instructions for mac

Revision history for this message
Jiri Srba (srba) wrote :

It now compiles for all three platforms!

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file '.bzrignore'
--- .bzrignore 2018-03-06 02:18:12 +0000
+++ .bzrignore 2020-09-11 14:21:20 +0000
@@ -2,10 +2,12 @@
2*.creator2*.creator
3*.files3*.files
4*.includes4*.includes
5verifypn-experimental-linux64
6*.user5*.user
7verifypn-linux64
8verifypn-osx64
9nbproject/6nbproject/
10cmake-build-*7cmake-build-*
11.idea/
12\ No newline at end of file8\ No newline at end of file
9.idea/
10src/PetriEngine/PQL/PQLQueryParser.parser.cpp
11src/PetriEngine/PQL/PQLQueryParser.parser.hpp
12src/PetriEngine/PQL/PQLQueryTokens.lexer.cpp
13build/
14
1315
=== modified file 'CMakeLists.txt'
--- CMakeLists.txt 2018-06-12 16:18:51 +0000
+++ CMakeLists.txt 2020-09-11 14:21:20 +0000
@@ -1,46 +1,105 @@
1cmake_minimum_required(VERSION 2.8.4)1cmake_minimum_required(VERSION 3.9)
2project(verifypn)2cmake_policy(SET CMP0048 NEW)
3cmake_policy(SET CMP0069 NEW)
4
5set(CMAKE_CXX_STANDARD 17)
6if (NOT CMAKE_BUILD_TYPE)
7 set(CMAKE_BUILD_TYPE Release)
8endif (NOT CMAKE_BUILD_TYPE)
9
10if (CMAKE_BUILD_TYPE MATCHES Release)
11 if (NOT APPLE)
12 set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
13 endif ()
14endif ()
15set(CMAKE_POSITION_INDEPENDENT_CODE ON)
16
17
18set(VERIFYPN_VERSION 3.0.1)
19add_compile_definitions(VERIFYPN_VERSION=\"${VERIFYPN_VERSION}\")
20
21project(verifypn VERSION ${VERIFYPN_VERSION} LANGUAGES CXX C)
22
23option(VERIFYPN_Static "Link libraries statically" ON)
24option(VERIFYPN_MC_Simplification "Enables multicore simplification, incompatible with static linking" OFF)
25option(VERIFYPN_GetDependencies "Fetch external dependencies from web." ON)
26
27
28if (VERIFYPN_Static)
29 set(BUILD_SHARED_LIBS OFF)
30 if (VERIFYPN_MC_Simplification)
31 message( FATAL_ERROR "Multicore Simplification is not compatible with static linking" )
32 endif(VERIFYPN_MC_Simplification)
33 if (NOT APPLE)
34 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static")
35 endif(NOT APPLE)
36else(VERIFYPN_Static)
37 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -static-libgcc -static-libstdc++")
38endif (VERIFYPN_Static)
39
40if (VERIFYPN_MC_Simplification)
41 add_compile_definitions(VERIFYPN_MC_Simplification)
42endif(VERIFYPN_MC_Simplification)
343
4if (UNIX AND NOT APPLE)44if (UNIX AND NOT APPLE)
5 if (CMAKE_SIZEOF_VOID_P EQUAL 8) # is system 64-bit?45 set(ARCH_TYPE "linux64")
6 set(ARCH_TYPE "linux64")
7 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -flto -march=x86-64 -std=c++14 -m64 -I.")
8 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto=4 -march=x86-64 -std=c++14 -m64 -static -static-libgcc -static-libstdc++")
9 else()
10 set(ARCH_TYPE "linux32")
11 endif ()
12elseif(APPLE)46elseif(APPLE)
13 if (CMAKE_SIZEOF_VOID_P EQUAL 8) # is system 64-bit?47 set(ARCH_TYPE "osx64")
14 set(ARCH_TYPE "osx64")48 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.8 -m64 ")
15 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmacosx-version-min=10.7 -std=c++14 -m64 -I. -stdlib=libc++")49 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mmacosx-version-min=10.8 -m64 ")
16 set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -dynamic -mmacosx-version-min=10.7 -std=c++14 -m64 -stdlib=libc++ -lc++")
17 else()
18 set(ARCH_TYPE "osx32")
19 endif ()
20else()50else()
21 if (CMAKE_CL_64)51 set(ARCH_TYPE "win64")
22 set(ARCH_TYPE "win64")
23 else()
24 set(ARCH_TYPE "win32")
25 endif()
26endif ()52endif ()
2753
28set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -pedantic-errors -O2 -DNDEBUG")54set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -Wall -pedantic-errors -O3 -DNDEBUG")
29set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g")55
3056set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -O3 -DNDEBUG")
31set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -O2 -DNDEBUG")57if (VERIFYPN_Static AND NOT APPLE)
32set(CMAKE_EXE_LINKER_FLAGS_DEBUG "${CMAKE_EXE_LINKER_FLAGS_DEBUG} -g")58 set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} -static")
3359endif()
34include_directories(PUBLIC .)60
3561set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
36file(GLOB verifypn_SRC62set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
37 "*.h"63set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
38 "*.cpp"64
39 "**/*.cpp"65if (VERIFYPN_GetDependencies)
40 "**/*.h"66 # setup for external imports
41 "**/**/*.cpp"67 include(ExternalProject)
42 "**/**/*.h"68 set(EXTERNAL_INSTALL_LOCATION ${CMAKE_BINARY_DIR}/external)
43)69
4470 ExternalProject_add(ptrie-ext
45add_executable(verifypn ${verifypn_SRC})71 GIT_REPOSITORY https://github.com/petergjoel/ptrie
46target_link_libraries(verifypn ${CMAKE_SOURCE_DIR}/lpsolve/liblpsolve55-${ARCH_TYPE}.a)72 GIT_TAG 230b3640bfbe2ed5befdafbaf17bd3804231b50f
73 CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${EXTERNAL_INSTALL_LOCATION} -DPTRIE_BuildTest=OFF -DCMAKE_BUILD_TYPE=Release
74 )
75 ExternalProject_add(rapidxml-ext
76 URL https://downloads.sourceforge.net/project/rapidxml/rapidxml/rapidxml%201.13/rapidxml-1.13.zip
77 URL_HASH SHA512=6c10583e6631ccdb0217d0a5381172cb4c1046226de6ef1acf398d85e81d145228e14c3016aefcd7b70a1db8631505b048d8b4f5d4b0dbf1811d2482eefdd265
78 BUILD_COMMAND ""
79 CONFIGURE_COMMAND mkdir -p ${CMAKE_BINARY_DIR}/external/include
80 INSTALL_COMMAND cd ../rapidxml-ext && ${CMAKE_COMMAND} -E copy rapidxml.hpp rapidxml_iterators.hpp rapidxml_print.hpp rapidxml_utils.hpp ${EXTERNAL_INSTALL_LOCATION}/include
81 )
82
83 if (WIN32) #If windows 32 or 64
84 set(GLPK_CFLAGS "-D __WOE__ -O3" )
85 else(WIN32)
86 set(GLPK_CFLAGS "-O3" )
87 endif(WIN32)
88 ExternalProject_add(glpk-ext
89 URL https://ftp.gnu.org/gnu/glpk/glpk-4.65.tar.gz
90 URL_HASH SHA512=997e8e599ff1718a08c66b86eadd0e01f4644899f1e95920f8ae91d66b4d8361021766b346845f4dcbcfe667b41ab72ea3d377017a0ebf85d7ece091cfd81375
91 CONFIGURE_COMMAND CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} <SOURCE_DIR>/configure --enable-shared=no --prefix=${EXTERNAL_INSTALL_LOCATION} CFLAGS=${GLPK_CFLAGS}
92 BUILD_COMMAND make
93 INSTALL_COMMAND make install
94 PATCH_COMMAND patch -p1 < ${PROJECT_SOURCE_DIR}/glpk-warning.patch
95 )
96
97 link_directories(${EXTERNAL_INSTALL_LOCATION}/lib)
98 link_directories(${EXTERNAL_INSTALL_LOCATION}/lib64)
99
100 # we can now include external libraries
101 include_directories(${EXTERNAL_INSTALL_LOCATION}/include)
102endif (VERIFYPN_GetDependencies)
103include_directories(include)
104
105add_subdirectory(${CMAKE_SOURCE_DIR}/src/)
47106
=== removed directory 'CTL'
=== removed directory 'CTL/Algorithm'
=== removed file 'CTL/Algorithm/AlgorithmTypes.h'
=== removed file 'CTL/Algorithm/CertainZeroFPA.cpp'
=== removed file 'CTL/Algorithm/CertainZeroFPA.h'
=== removed file 'CTL/Algorithm/FixedPointAlgorithm.cpp'
=== removed file 'CTL/Algorithm/FixedPointAlgorithm.h'
=== removed file 'CTL/Algorithm/LocalFPA.cpp'
=== removed file 'CTL/Algorithm/LocalFPA.h'
=== removed file 'CTL/CTLEngine.cpp'
=== removed file 'CTL/CTLEngine.h'
=== removed file 'CTL/CTLResult.h'
=== removed directory 'CTL/DependencyGraph'
=== removed file 'CTL/DependencyGraph/BasicDependencyGraph.h'
=== removed file 'CTL/DependencyGraph/Configuration.cpp'
=== removed file 'CTL/DependencyGraph/Configuration.h'
=== removed file 'CTL/DependencyGraph/Edge.h'
=== removed file 'CTL/DependencyGraph/assignment.h'
=== removed directory 'CTL/PetriNets'
=== removed file 'CTL/PetriNets/OnTheFlyDG.cpp'
=== removed file 'CTL/PetriNets/OnTheFlyDG.h'
=== removed file 'CTL/PetriNets/PetriConfig.h'
=== removed directory 'CTL/SearchStrategy'
=== removed file 'CTL/SearchStrategy/BFSSearch.h'
=== removed file 'CTL/SearchStrategy/DFSSearch.h'
=== removed file 'CTL/SearchStrategy/HeuristicSearch.cpp'
=== removed file 'CTL/SearchStrategy/HeuristicSearch.h'
=== removed file 'CTL/SearchStrategy/RDFSSearch.cpp'
=== removed file 'CTL/SearchStrategy/RDFSSearch.h'
=== removed file 'CTL/SearchStrategy/SearchStrategy.cpp'
=== removed file 'CTL/SearchStrategy/SearchStrategy.h'
=== removed file 'CTL/Stopwatch.h'
=== removed directory 'PetriEngine'
=== removed file 'PetriEngine/AbstractPetriNetBuilder.h'
=== removed directory 'PetriEngine/Colored'
=== removed file 'PetriEngine/Colored/ColoredNetStructures.h'
=== removed file 'PetriEngine/Colored/ColoredPetriNetBuilder.cpp'
=== removed file 'PetriEngine/Colored/ColoredPetriNetBuilder.h'
=== removed file 'PetriEngine/Colored/Colors.cpp'
=== removed file 'PetriEngine/Colored/Colors.h'
=== removed file 'PetriEngine/Colored/Expressions.h'
=== removed file 'PetriEngine/Colored/Multiset.cpp'
=== removed file 'PetriEngine/Colored/Multiset.h'
=== removed file 'PetriEngine/NetStructures.h'
=== removed directory 'PetriEngine/PQL'
=== removed file 'PetriEngine/PQL/Contexts.h'
=== removed file 'PetriEngine/PQL/Expressions.cpp'
=== removed file 'PetriEngine/PQL/Expressions.h'
=== removed file 'PetriEngine/PQL/PQL.cpp'
=== removed file 'PetriEngine/PQL/PQL.h'
=== removed file 'PetriEngine/PQL/PQLParser.h'
=== removed file 'PetriEngine/PQL/PQLQueryParser.parser.cpp'
=== removed file 'PetriEngine/PQL/PQLQueryParser.parser.hpp'
=== removed file 'PetriEngine/PQL/PQLQueryParser.y'
=== removed file 'PetriEngine/PQL/PQLQueryTokens.l'
=== removed file 'PetriEngine/PQL/PQLQueryTokens.lexer.cpp'
=== removed file 'PetriEngine/PetriNet.cpp'
=== removed file 'PetriEngine/PetriNet.h'
=== removed file 'PetriEngine/PetriNetBuilder.cpp'
=== removed file 'PetriEngine/PetriNetBuilder.h'
=== removed directory 'PetriEngine/Reachability'
=== removed file 'PetriEngine/Reachability/ReachabilityResult.h'
=== removed file 'PetriEngine/Reachability/ReachabilitySearch.cpp'
=== removed file 'PetriEngine/Reachability/ReachabilitySearch.h'
=== removed file 'PetriEngine/Reachability/ResultPrinter.cpp'
=== removed file 'PetriEngine/Reachability/TARReachability.cpp'
=== removed file 'PetriEngine/Reachability/TARReachability.h'
=== removed file 'PetriEngine/Reducer.cpp'
=== removed file 'PetriEngine/Reducer.h'
=== removed file 'PetriEngine/ReducingSuccessorGenerator.cpp'
=== removed file 'PetriEngine/ReducingSuccessorGenerator.h'
=== removed file 'PetriEngine/STSolver.cpp'
=== removed file 'PetriEngine/STSolver.h'
=== removed directory 'PetriEngine/Simplification'
=== removed file 'PetriEngine/Simplification/LPCache.cpp'
=== removed file 'PetriEngine/Simplification/LPCache.h'
=== removed file 'PetriEngine/Simplification/LinearProgram.cpp'
=== removed file 'PetriEngine/Simplification/LinearProgram.h'
=== removed file 'PetriEngine/Simplification/LinearPrograms.h'
=== removed file 'PetriEngine/Simplification/Member.h'
=== removed file 'PetriEngine/Simplification/MurmurHash2.cpp'
=== removed file 'PetriEngine/Simplification/MurmurHash2.h'
=== removed file 'PetriEngine/Simplification/Retval.h'
=== removed file 'PetriEngine/Simplification/Vector.cpp'
=== removed file 'PetriEngine/Simplification/Vector.h'
=== removed directory 'PetriEngine/Structures'
=== removed file 'PetriEngine/Structures/AlignedEncoder.cpp'
=== removed file 'PetriEngine/Structures/AlignedEncoder.h'
=== removed file 'PetriEngine/Structures/BitField.h'
=== removed file 'PetriEngine/Structures/Queue.cpp'
=== removed file 'PetriEngine/Structures/Queue.h'
=== removed file 'PetriEngine/Structures/State.h'
=== removed file 'PetriEngine/Structures/StateSet.h'
=== removed file 'PetriEngine/Structures/binarywrapper.cpp'
=== removed file 'PetriEngine/Structures/binarywrapper.h'
=== removed file 'PetriEngine/Structures/light_deque.h'
=== removed file 'PetriEngine/Structures/linked_bucket.h'
=== removed file 'PetriEngine/Structures/ptrie.h'
=== removed file 'PetriEngine/Structures/ptrie_map.h'
=== removed file 'PetriEngine/Structures/ptrie_stable.h'
=== removed file 'PetriEngine/SuccessorGenerator.cpp'
=== removed file 'PetriEngine/SuccessorGenerator.h'
=== removed directory 'PetriEngine/TAR'
=== removed file 'PetriEngine/TAR/AntiChain.h'
=== removed file 'PetriEngine/TAR/Renamer.h'
=== removed file 'PetriEngine/TAR/TARAutomata.h'
=== removed file 'PetriEngine/errorcodes.h'
=== removed file 'PetriEngine/options.h'
=== removed directory 'PetriParse'
=== removed file 'PetriParse/PNMLParser.cpp'
=== removed file 'PetriParse/PNMLParser.h'
=== removed file 'PetriParse/QueryBinaryParser.cpp'
=== removed file 'PetriParse/QueryBinaryParser.h'
=== removed file 'PetriParse/QueryParser.h'
=== removed file 'PetriParse/QueryXMLParser.cpp'
=== removed file 'PetriParse/QueryXMLParser.h'
=== removed directory 'PetriParse/rapidxml'
=== removed file 'PetriParse/rapidxml/license.txt'
=== removed file 'PetriParse/rapidxml/manual.html'
=== removed file 'PetriParse/rapidxml/rapidxml.hpp'
=== removed file 'PetriParse/rapidxml/rapidxml_iterators.hpp'
=== removed file 'PetriParse/rapidxml/rapidxml_print.hpp'
=== removed file 'PetriParse/rapidxml/rapidxml_utils.hpp'
=== renamed file 'README.mkd' => 'README.md'
--- README.mkd 2014-04-21 18:12:28 +0000
+++ README.md 2020-09-11 14:21:20 +0000
@@ -1,58 +1,71 @@
1VerifyPN1# VerifyPN
2========
3VerifyPN is based on [PeTe](https://github.com/jopsen/PeTe) and aims to provide2VerifyPN is based on [PeTe](https://github.com/jopsen/PeTe) and aims to provide
4a fast untimed engine for TAPAAL.3a fast untimed engine for TAPAAL.
54
6Building VerifyPN5## License
7-----------------6VerifyPN is available under the terms of the GNU GPL version 3 or
8VerifyPN is build using a simple makefile, depending on you platform and
9configuration of it, you might need to modify the makefile in order link
10correctly against following dependencies:
11
12 * GNU Bison (>= 2.4)
13 * flex (>= 2.5)
14 * lp_solve (>= 5.5)
15
16For simplicity, compiled output form GNU Bison, flex and binaries of lpsolve
17are included in the source tree.
18
19To cross compile for Windows on linux install `g++-mingw-w64` and run
20`make -f makefile.win32` for 32 bit version, and `make -f makefile.win64` for
2164 bit version.
22
23**Warning** both `verifypn-win32` and `verifypn-win64` are accompanied by a dll
24called `lpsolve55.dll`, however, this is **not** the same dll for both 32 and 64
25bit versions. Unfortunately, we cannot rename the dll either, so either we need
26to build with MSVC or accept this pain, and distribute Windows 32 and 64 bit
27versions in different folders, and watch out of this during deployment.
28
29To cross compile for 32 bit linux you need to run install `gcc-multilib`,
30`g++-multilib` and probably a few others.
31
32To build on OS X run `make -f makefile.osx32` or `make -f makefile.osx64`,
33as cross compilers for OS X are not readily available (e.g. in package manager)
34cross compilation for OS X is not supported.
35
36Testing
37-------
38VerifyPN builds can be validated with `make check` (for the respective makefiles).
39This executes a simple script that iterates over the files in the Tests/ folder,
40the tested Petri net is <test-name>-<exit-code>-<strategy>.xml and queries for
41this network is in <test-name>-<exit-code>-<strategy>.xml.q, here <test-name> is
42an identifier for the test, <exit-code> is the exit code expected by VerifyPN when
43given the Petri net and query. <strategy> is the search strategy used for the
44verification, `All` if all strategies should be tested.
45
46License
47-------
48VerifyPN is available under the terms of the GNU GPL versoin 3 or
49(at your option) any later version.7(at your option) any later version.
50If this license doesn't suit you're welcome to contact us, and purpose an8If this license doesn't suit you're welcome to contact us, and purpose an
51alternative license.9alternative license.
5210
53Authors11## Compilation
54-------12Requirements for compilation
55 * Jonas Finnemann Jensen13```
56 * Thomas Søndersø Nielsen14cmake >= 3.9
57 * Lars Kærlund Østergaard15flex >= 2.6.4
58 * Jiri Srba16bison >= 3.0.5
17gmp-static (required only for model checking competition)
18
19sudo apt update
20sudo apt install build-essential cmake flex bison brz
21
22```
23
24The four distributions of VerifyPN can be compiled as follows
25### Linux64 and OSX64
26```
27bzr branch lp:verifypn
28mkdir build && cd build
29cmake .. -DVERIFYPN_Static=ON -DVERIFYPN_MC_Simplification=OFF
30
31#For mac, one need to enforce that we use the GCC compiler using:
32export CC=gcc-9
33export CXX=g++-9
34#and point to the correct version of flex and bison by adding
35#-DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex
36#to cmake call
37
38```
39
40### Windows 64 cross-compilation with minGW
41Install cross-compiler and libs
42
43```
44sudo apt install mingw-w64-x86-64-dev mingw-w64-tools g++-mingw-w64-x86-64
45sudo apt install wine wine-binfmt #Needed to run tests compile
46```
47
48To build
49
50```
51mkdir build-win && cd build-win
52cmake .. -DVERIFYPN_Static=ON -DVERIFYPN_MC_Simplification=OFF -DCMAKE_TOOLCHAIN_FILE=../toolchain-x86_64-w64-mingw32.cmake
53make
54```
55
56### Linux64 - Model Checking Competition
57```
58mkdir build
59cd build
60cmake .. -DVERIFYPN_Static=OFF -DVERIFYPN_MC_Simplification=ON
61make
62```
63
64### Mac 64 compilation
65```
66mkdir build
67cd build
68cmake -DVERIFYPN_MC_Simplification=OFF -DBISON_EXECUTABLE=/usr/local/opt/bison/bin/bison -DFLEX_EXECUTABLE=/usr/local/opt/flex/bin/flex -DCMAKE_C_COMPILER=/usr/local/bin/gcc-9 -DCMAKE_CXX_COMPILER=/usr/local/bin/g++-9 ..
69make
70```
71
5972
=== removed file 'VerifyPN.cpp'
=== added file 'glpk-warning.patch'
--- glpk-warning.patch 1970-01-01 00:00:00 +0000
+++ glpk-warning.patch 2020-09-11 14:21:20 +0000
@@ -0,0 +1,10 @@
1--- a/src/draft/glpios03.c
2+++ b/src/draft/glpios03.c
3@@ -925,7 +925,6 @@
4 #if 0 /* 20/I-2018 */
5 xprintf("WARNING: LONG-STEP DUAL SIMPLEX WILL BE USED\n");
6 #else
7- xprintf("Long-step dual simplex will be used\n");
8 #endif
9 #endif
10 /* on entry to the B&B driver it is assumed that the active list
011
=== added directory 'include'
=== added directory 'include/CTL'
=== added directory 'include/CTL/Algorithm'
=== added file 'include/CTL/Algorithm/AlgorithmTypes.h'
--- include/CTL/Algorithm/AlgorithmTypes.h 1970-01-01 00:00:00 +0000
+++ include/CTL/Algorithm/AlgorithmTypes.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,10 @@
1#ifndef ALGORITHMTYPES_H
2#define ALGORITHMTYPES_H
3
4namespace CTL {
5
6enum CTLAlgorithmType{
7 Local = 0, CZero = 1
8};
9}
10#endif // ALGORITHMTYPES_H
011
=== added file 'include/CTL/Algorithm/CertainZeroFPA.h'
--- include/CTL/Algorithm/CertainZeroFPA.h 1970-01-01 00:00:00 +0000
+++ include/CTL/Algorithm/CertainZeroFPA.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,36 @@
1#ifndef CERTAINZEROFPA_H
2#define CERTAINZEROFPA_H
3
4#include "FixedPointAlgorithm.h"
5#include "CTL/DependencyGraph/Edge.h"
6#include "CTL/DependencyGraph/Configuration.h"
7#include "PetriEngine/Reachability/ReachabilitySearch.h"
8#include "CTL/SearchStrategy/SearchStrategy.h"
9
10
11namespace Algorithm {
12
13class CertainZeroFPA : public FixedPointAlgorithm
14{
15public:
16 CertainZeroFPA(PetriEngine::Reachability::Strategy type) : FixedPointAlgorithm(type)
17 {
18 }
19 virtual ~CertainZeroFPA()
20 {
21 }
22 virtual bool search(DependencyGraph::BasicDependencyGraph &t_graph) override;
23protected:
24
25 DependencyGraph::BasicDependencyGraph *graph;
26 DependencyGraph::Configuration* vertex;
27
28 void checkEdge(DependencyGraph::Edge* e, bool only_assign = false);
29 void finalAssign(DependencyGraph::Configuration *c, DependencyGraph::Assignment a);
30 void explore(DependencyGraph::Configuration *c);
31 void addDependency(DependencyGraph::Edge *e,
32 DependencyGraph::Configuration *target);
33
34};
35}
36#endif // CERTAINZEROFPA_H
037
=== added file 'include/CTL/Algorithm/FixedPointAlgorithm.h'
--- include/CTL/Algorithm/FixedPointAlgorithm.h 1970-01-01 00:00:00 +0000
+++ include/CTL/Algorithm/FixedPointAlgorithm.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,32 @@
1#ifndef FIXEDPOINTALGORITHM_H
2#define FIXEDPOINTALGORITHM_H
3
4#include "CTL/DependencyGraph/BasicDependencyGraph.h"
5#include "CTL/SearchStrategy/SearchStrategy.h"
6#include "PetriEngine/Reachability/ReachabilitySearch.h"
7
8namespace Algorithm {
9
10class FixedPointAlgorithm {
11public:
12 virtual bool search(DependencyGraph::BasicDependencyGraph &graph) =0;
13 FixedPointAlgorithm(PetriEngine::Reachability::Strategy type);
14 virtual ~FixedPointAlgorithm(){}
15
16 size_t processedEdges() const { return _processedEdges; }
17 size_t processedNegationEdges() const { return _processedNegationEdges; }
18 size_t exploredConfigurations() const { return _exploredConfigurations; }
19 size_t numberOfEdges() const { return _numberOfEdges; }
20protected:
21 std::shared_ptr<SearchStrategy::SearchStrategy> strategy;
22 //total number of processed edges
23 size_t _processedEdges = 0;
24 //total number of processed negation edges
25 size_t _processedNegationEdges = 0;
26 //number of explored configurations
27 size_t _exploredConfigurations = 0;
28 //total number of edges found when computing successors
29 size_t _numberOfEdges = 0;
30};
31}
32#endif // FIXEDPOINTALGORITHM_H
033
=== added file 'include/CTL/Algorithm/LocalFPA.h'
--- include/CTL/Algorithm/LocalFPA.h 1970-01-01 00:00:00 +0000
+++ include/CTL/Algorithm/LocalFPA.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,29 @@
1#ifndef LOCALFPA_H
2#define LOCALFPA_H
3
4#include "FixedPointAlgorithm.h"
5#include "../DependencyGraph/Configuration.h"
6
7namespace Algorithm {
8
9class LocalFPA : public FixedPointAlgorithm
10{
11
12 // FixedPointAlgorithm interface
13public:
14 LocalFPA(PetriEngine::Reachability::Strategy type) : FixedPointAlgorithm(type)
15 {
16 }
17 virtual ~LocalFPA (){}
18 virtual bool search(DependencyGraph::BasicDependencyGraph &graph);
19
20protected:
21 DependencyGraph::BasicDependencyGraph *graph;
22
23 void finalAssign(DependencyGraph::Configuration *c, DependencyGraph::Assignment a);
24 void explore(DependencyGraph::Configuration *c);
25 void addDependency(DependencyGraph::Edge *e,
26 DependencyGraph::Configuration *target);
27};
28}
29#endif // LOCALFPA_H
030
=== added file 'include/CTL/CTLEngine.h'
--- include/CTL/CTLEngine.h 1970-01-01 00:00:00 +0000
+++ include/CTL/CTLEngine.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,25 @@
1#ifndef CTLENGINE_H
2#define CTLENGINE_H
3
4#include "../PetriEngine/errorcodes.h"
5#include "../PetriEngine/PetriNet.h"
6#include "../PetriEngine/Reachability/ReachabilitySearch.h"
7
8#include "Algorithm/AlgorithmTypes.h"
9#include "../PetriEngine/PQL/PQL.h"
10
11#include <set>
12
13ReturnValue CTLMain(PetriEngine::PetriNet* net,
14 CTL::CTLAlgorithmType algorithmtype,
15 PetriEngine::Reachability::Strategy strategytype,
16 bool gamemode,
17 bool printstatistics,
18 bool mccoutput,
19 bool partial_order,
20 const std::vector<std::string>& querynames,
21 const std::vector<std::shared_ptr<PetriEngine::PQL::Condition>>& reducedQueries,
22 const std::vector<size_t>& ids,
23 options_t& options);
24
25#endif // CTLENGINE_H
026
=== added file 'include/CTL/CTLResult.h'
--- include/CTL/CTLResult.h 1970-01-01 00:00:00 +0000
+++ include/CTL/CTLResult.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,33 @@
1#ifndef CTLRESULT_H
2#define CTLRESULT_H
3
4#include "../PetriEngine/errorcodes.h"
5#include "../PetriEngine/PQL/PQL.h"
6
7#include <string>
8
9struct CTLResult {
10 CTLResult(const PetriEngine::PQL::Condition_ptr& qry){
11 query = qry;
12 }
13
14 PetriEngine::PQL::Condition_ptr query;
15 bool result;
16
17 double duration = 0;
18 size_t numberOfMarkings = 0;
19 size_t numberOfConfigurations = 0;
20 size_t processedEdges = 0;
21 size_t processedNegationEdges = 0;
22 size_t exploredConfigurations = 0;
23 size_t numberOfEdges = 0;
24#ifdef VERIFYPNDIST
25 size_t numberOfRoundsComputingDistance = 0;
26 size_t numberOfTokensReceived = 0;
27 size_t numberOfRequestsReceived = 0;
28 size_t numberOfAnswersReceived = 0;
29 size_t numberOfMessagesSend = 0;
30#endif
31};
32
33#endif // CTLRESULT_H
034
=== added directory 'include/CTL/DependencyGraph'
=== added file 'include/CTL/DependencyGraph/BasicDependencyGraph.h'
--- include/CTL/DependencyGraph/BasicDependencyGraph.h 1970-01-01 00:00:00 +0000
+++ include/CTL/DependencyGraph/BasicDependencyGraph.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,23 @@
1#ifndef ABSTRACTDEPENDENCYGRAPH_H
2#define ABSTRACTDEPENDENCYGRAPH_H
3
4#include <cstddef>
5#include <vector>
6#include <cstdint>
7
8namespace DependencyGraph {
9
10class Configuration;
11class Edge;
12
13class BasicDependencyGraph {
14
15public:
16 virtual std::vector<Edge*> successors(Configuration *c) =0;
17 virtual Configuration *initialConfiguration() =0;
18 virtual void release(Edge* e) = 0;
19 virtual void cleanUp() =0;
20};
21
22}
23#endif // ABSTRACTDEPENDENCYGRAPH_H
024
=== added file 'include/CTL/DependencyGraph/Configuration.h'
--- include/CTL/DependencyGraph/Configuration.h 1970-01-01 00:00:00 +0000
+++ include/CTL/DependencyGraph/Configuration.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,40 @@
1#ifndef CONFIGURATION_H
2#define CONFIGURATION_H
3
4#include "Edge.h"
5
6#include <string>
7#include <cstdio>
8#include <iostream>
9#include <vector>
10
11namespace DependencyGraph {
12
13class Edge;
14
15enum Assignment {
16 ONE = 1, UNKNOWN = 0, ZERO = -1, CZERO = -2
17};
18
19class Configuration
20{
21 uint32_t distance = 0;
22public:
23
24 uint32_t getDistance() const { return distance; }
25 void setDistance(uint32_t value) { distance = value; }
26
27 Configuration() {}
28 virtual ~Configuration();
29
30 bool isDone() const { return assignment == ONE || assignment == CZERO; }
31
32 uint32_t owner = 0;
33 uint32_t nsuccs = 0;
34 std::vector<Edge*> dependency_set;
35 Assignment assignment = UNKNOWN;
36};
37
38
39}
40#endif // CONFIGURATION_H
041
=== added file 'include/CTL/DependencyGraph/Edge.h'
--- include/CTL/DependencyGraph/Edge.h 1970-01-01 00:00:00 +0000
+++ include/CTL/DependencyGraph/Edge.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,36 @@
1#ifndef EDGE_H
2#define EDGE_H
3
4#include <cstdio>
5#include <vector>
6#include <string>
7#include <algorithm>
8#include <cassert>
9
10namespace DependencyGraph {
11
12class Configuration;
13
14class Edge {
15 typedef std::vector<Configuration*> container;
16public:
17 Edge(){}
18 Edge(Configuration &t_source) : source(&t_source) {}
19
20 void addTarget(Configuration* conf)
21 {
22 assert(conf);
23 targets.push_back(conf);
24 }
25
26 Configuration* source;
27 container targets;
28 uint8_t status = 0;
29 bool processed = false;
30 bool is_negated = false;
31 int32_t refcnt = 0;
32 bool handled = false;
33 uint32_t weight = 0;
34};
35}
36#endif // EDGE_H
037
=== added file 'include/CTL/DependencyGraph/assignment.h'
--- include/CTL/DependencyGraph/assignment.h 1970-01-01 00:00:00 +0000
+++ include/CTL/DependencyGraph/assignment.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,11 @@
1#ifndef ASSIGNMENT_H
2#define ASSIGNMENT_H
3
4namespace DependencyGraph {
5
6enum Assignment {
7 ONE = 1, UNKNOWN = 0, ZERO = -1, CZERO = -2
8};
9}
10
11#endif // ASSIGNMENT_H
012
=== added directory 'include/CTL/PetriNets'
=== added file 'include/CTL/PetriNets/OnTheFlyDG.h'
--- include/CTL/PetriNets/OnTheFlyDG.h 1970-01-01 00:00:00 +0000
+++ include/CTL/PetriNets/OnTheFlyDG.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,115 @@
1#ifndef ONTHEFLYDG_H
2#define ONTHEFLYDG_H
3
4#include <functional>
5#include <stack>
6#include <ptrie/ptrie_map.h>
7
8#include "CTL/DependencyGraph/BasicDependencyGraph.h"
9#include "CTL/DependencyGraph/Configuration.h"
10#include "CTL/DependencyGraph/Edge.h"
11#include "PetriConfig.h"
12#include "PetriParse/PNMLParser.h"
13#include "PetriEngine/PQL/PQL.h"
14#include "PetriEngine/Structures/AlignedEncoder.h"
15#include "PetriEngine/Structures/linked_bucket.h"
16#include "PetriEngine/ReducingSuccessorGenerator.h"
17
18namespace PetriNets {
19class OnTheFlyDG : public DependencyGraph::BasicDependencyGraph
20{
21public:
22 using Condition = PetriEngine::PQL::Condition;
23 using Condition_ptr = PetriEngine::PQL::Condition_ptr;
24 using Marking = PetriEngine::Structures::State;
25 OnTheFlyDG(PetriEngine::PetriNet *t_net, bool partial_order);
26
27 virtual ~OnTheFlyDG();
28
29 //Dependency graph interface
30 virtual std::vector<DependencyGraph::Edge*> successors(DependencyGraph::Configuration *c) override;
31 virtual DependencyGraph::Configuration *initialConfiguration() override;
32 virtual void cleanUp() override;
33 void setQuery(const Condition_ptr& query);
34
35 virtual void release(DependencyGraph::Edge* e) override;
36
37 size_t owner(Marking& marking, Condition* cond);
38 size_t owner(Marking& marking, const Condition_ptr& cond)
39 {
40 return owner(marking, cond.get());
41 }
42
43
44 //stats
45 size_t configurationCount() const;
46 size_t markingCount() const;
47
48 Condition::Result initialEval();
49
50protected:
51
52 //initialized from constructor
53 AlignedEncoder encoder;
54 PetriEngine::PetriNet *net = nullptr;
55 PetriConfig* initial_config;
56 Marking working_marking;
57 Marking query_marking;
58 uint32_t n_transitions = 0;
59 uint32_t n_places = 0;
60 size_t _markingCount = 0;
61 size_t _configurationCount = 0;
62 //used after query is set
63 Condition_ptr query = nullptr;
64
65 Condition::Result fastEval(Condition* query, Marking* unfolded);
66 Condition::Result fastEval(const Condition_ptr& query, Marking* unfolded)
67 {
68 return fastEval(query.get(), unfolded);
69 }
70 void nextStates(Marking& t_marking, Condition*,
71 std::function<void ()> pre,
72 std::function<bool (Marking&)> foreach,
73 std::function<void ()> post);
74 template<typename T>
75 void dowork(T& gen, bool& first,
76 std::function<void ()>& pre,
77 std::function<bool (Marking&)>& foreach)
78 {
79 gen.prepare(&query_marking);
80
81 while(gen.next(working_marking)){
82 if(first) pre();
83 first = false;
84 if(!foreach(working_marking))
85 {
86 gen.reset();
87 break;
88 }
89 }
90 }
91 PetriConfig *createConfiguration(size_t marking, size_t own, Condition* query);
92 PetriConfig *createConfiguration(size_t marking, size_t own, const Condition_ptr& query)
93 {
94 return createConfiguration(marking, own, query.get());
95 }
96 size_t createMarking(Marking &marking);
97 void markingStats(const uint32_t* marking, size_t& sum, bool& allsame, uint32_t& val, uint32_t& active, uint32_t& last);
98
99 DependencyGraph::Edge* newEdge(DependencyGraph::Configuration &t_source, uint32_t weight);
100
101 std::stack<DependencyGraph::Edge*> recycle;
102 ptrie::map<ptrie::uchar, std::vector<PetriConfig*> > trie;
103 linked_bucket_t<DependencyGraph::Edge,1024*10>* edge_alloc = nullptr;
104
105 // Problem with linked bucket and complex constructor
106 linked_bucket_t<char[sizeof(PetriConfig)], 1024*1024>* conf_alloc = nullptr;
107
108 PetriEngine::ReducingSuccessorGenerator _redgen;
109 bool _partial_order = false;
110
111};
112
113
114}
115#endif // ONTHEFLYDG_H
0116
=== added file 'include/CTL/PetriNets/PetriConfig.h'
--- include/CTL/PetriNets/PetriConfig.h 1970-01-01 00:00:00 +0000
+++ include/CTL/PetriNets/PetriConfig.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,31 @@
1#ifndef PETRICONFIG_H
2#define PETRICONFIG_H
3
4#include "CTL/DependencyGraph/Configuration.h"
5#include "PetriEngine/PQL/PQL.h"
6
7#include <sstream>
8
9namespace PetriNets {
10
11class PetriConfig : public DependencyGraph::Configuration {
12
13public:
14 using Condition = PetriEngine::PQL::Condition;
15 PetriConfig() :
16 DependencyGraph::Configuration(), marking(0), query(NULL)
17 {}
18
19 PetriConfig(size_t t_marking, Condition *t_query) :
20 DependencyGraph::Configuration(), marking(t_marking), query(t_query) {
21 }
22
23 virtual ~PetriConfig(){};
24
25 size_t marking;
26 Condition *query;
27
28};
29
30}
31#endif // PETRICONFIG_H
032
=== added directory 'include/CTL/SearchStrategy'
=== added file 'include/CTL/SearchStrategy/BFSSearch.h'
--- include/CTL/SearchStrategy/BFSSearch.h 1970-01-01 00:00:00 +0000
+++ include/CTL/SearchStrategy/BFSSearch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,36 @@
1/*
2 * File: Encoder.h
3 * Author: Peter G. Jensen
4 *
5 * Created on March 7, 2018, 1:50 PM
6 */
7
8#ifndef BFSSEARCH_H
9#define BFSSEARCH_H
10#include <queue>
11#include "CTL/DependencyGraph/Edge.h"
12#include "SearchStrategy.h"
13
14namespace SearchStrategy {
15
16// A custom search strategy that should ensure as little overhead as possible
17// while running sequential computation.
18
19class BFSSearch : public SearchStrategy {
20
21protected:
22 size_t Wsize() const { return W.size(); };
23 void pushToW(DependencyGraph::Edge* edge) { W.push(edge); };
24 DependencyGraph::Edge* popFromW()
25 {
26 auto e = W.front();
27 W.pop();
28 return e;
29 };
30 std::queue<DependencyGraph::Edge*> W;
31};
32
33} // end SearchStrategy
34
35#endif /* BFSSEARCH_H */
36
037
=== added file 'include/CTL/SearchStrategy/DFSSearch.h'
--- include/CTL/SearchStrategy/DFSSearch.h 1970-01-01 00:00:00 +0000
+++ include/CTL/SearchStrategy/DFSSearch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,29 @@
1#ifndef DFSSEARCH_H
2#define DFSSEARCH_H
3
4#include <stack>
5#include "CTL/DependencyGraph/Edge.h"
6#include "SearchStrategy.h"
7
8namespace SearchStrategy {
9
10// A custom search strategy that should ensure as little overhead as possible
11// while running sequential computation.
12
13class DFSSearch : public SearchStrategy {
14
15protected:
16 size_t Wsize() const { return W.size(); };
17 void pushToW(DependencyGraph::Edge* edge) { W.push(edge); };
18 DependencyGraph::Edge* popFromW()
19 {
20 auto e = W.top();
21 W.pop();
22 return e;
23 };
24 std::stack<DependencyGraph::Edge*> W;
25};
26
27} // end SearchStrategy
28
29#endif // DFSSEARCH_H
030
=== added file 'include/CTL/SearchStrategy/HeuristicSearch.h'
--- include/CTL/SearchStrategy/HeuristicSearch.h 1970-01-01 00:00:00 +0000
+++ include/CTL/SearchStrategy/HeuristicSearch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,32 @@
1/*
2 * File: Encoder.h
3 * Author: Peter G. Jensen
4 *
5 * Created on March 7, 2018, 1:51 PM
6 */
7
8#ifndef HEURISTICSEARCH_H
9#define HEURISTICSEARCH_H
10
11#include <vector>
12#include "CTL/DependencyGraph/Edge.h"
13#include "SearchStrategy.h"
14
15namespace SearchStrategy {
16
17// A custom search strategy that should ensure as little overhead as possible
18// while running sequential computation.
19
20class HeuristicSearch : public SearchStrategy {
21
22protected:
23 size_t Wsize() const;
24 void pushToW(DependencyGraph::Edge* edge);
25 DependencyGraph::Edge* popFromW();
26 std::vector<DependencyGraph::Edge*> W;
27};
28
29} // end SearchStrategy
30
31#endif /* HEURISTICSEARCH_H */
32
033
=== added file 'include/CTL/SearchStrategy/RDFSSearch.h'
--- include/CTL/SearchStrategy/RDFSSearch.h 1970-01-01 00:00:00 +0000
+++ include/CTL/SearchStrategy/RDFSSearch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,34 @@
1/*
2 * File: Encoder.h
3 * Author: Peter G. Jensen
4 *
5 * Created on March 7, 2018, 1:52 PM
6 */
7
8#ifndef RDFSSEARCH_H
9#define RDFSSEARCH_H
10
11#include <deque>
12#include "CTL/DependencyGraph/Edge.h"
13#include "SearchStrategy.h"
14
15namespace SearchStrategy {
16
17// A custom search strategy that should ensure as little overhead as possible
18// while running sequential computation.
19
20class RDFSSearch : public SearchStrategy {
21public:
22 void flush();
23protected:
24 size_t Wsize() const;
25 void pushToW(DependencyGraph::Edge* edge);
26 DependencyGraph::Edge* popFromW();
27 std::vector<DependencyGraph::Edge*> W;
28 size_t last_parent = 0;
29};
30
31} // end SearchStrategy
32
33#endif /* RDFSSEARCH_H */
34
035
=== added file 'include/CTL/SearchStrategy/SearchStrategy.h'
--- include/CTL/SearchStrategy/SearchStrategy.h 1970-01-01 00:00:00 +0000
+++ include/CTL/SearchStrategy/SearchStrategy.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,56 @@
1#ifndef ISEARCHSTRATEGY_H
2#define ISEARCHSTRATEGY_H
3
4#include "CTL/DependencyGraph/Edge.h"
5#include <sstream>
6
7namespace SearchStrategy {
8
9struct Message {
10 uint32_t sender;
11 uint32_t distance;
12 enum Type {HALT = 0, REQUEST = 1, ANSWER_ONE = 2, ANSWER_ZERO = 3} type;
13 DependencyGraph::Configuration *configuration;
14
15 Message() {}
16 Message(size_t sender, uint32_t distance, Type type, DependencyGraph::Configuration *configuration) :
17 sender(sender), distance(distance), type(type), configuration(configuration) {}
18
19 std::string ToString() {
20 std::stringstream ss;
21 ss << "Message from " << sender << ": ";
22 ss << (type == HALT ? "Halt" : type == REQUEST ? "Request" : type == ANSWER_ONE ? "Answer 1" : "Answer 0");
23 ss << configuration << "\n";
24 return ss.str();
25 }
26};
27
28
29class SearchStrategy
30{
31public:
32 virtual ~SearchStrategy() {};
33 bool empty() const;
34 void pushEdge(DependencyGraph::Edge *edge);
35 void pushDependency(DependencyGraph::Edge* edge);
36 void pushNegation(DependencyGraph::Edge *edge);
37 DependencyGraph::Edge* popEdge(bool saturate = false);
38 size_t size() const;
39//#ifdef VERIFYPNDIST
40 uint32_t maxDistance() const;
41 bool available() const;
42 void releaseNegationEdges(uint32_t );
43 bool trivialNegation();
44 virtual void flush() {};
45//#endif
46protected:
47 virtual size_t Wsize() const = 0;
48 virtual void pushToW(DependencyGraph::Edge* edge) = 0;
49 virtual DependencyGraph::Edge* popFromW() = 0;
50
51 std::vector<DependencyGraph::Edge*> N;
52 std::vector<DependencyGraph::Edge*> D;
53};
54
55}
56#endif // SEARCHSTRATEGY_H
057
=== added file 'include/CTL/Stopwatch.h'
--- include/CTL/Stopwatch.h 1970-01-01 00:00:00 +0000
+++ include/CTL/Stopwatch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,40 @@
1#ifndef STOPWATCH_H
2#define STOPWATCH_H
3
4#include <ctime>
5#include <sstream>
6
7using namespace std;
8
9class stopwatch {
10 bool _running = false;
11 clock_t _start;
12 clock_t _stop;
13
14public:
15 double started() const { return _start; }
16 double stopped() const { return _stop; }
17 bool running() const { return _running; }
18 void start() {
19 _running = true;
20 _start = clock();
21 }
22 void stop() {
23 _stop = clock();
24 _running = false;
25 }
26 double duration() const { return ( (double(_stop - _start))*1000)/CLOCKS_PER_SEC; }
27
28 ostream &operator<<(ostream &os){
29 os << duration() << " ms";
30 return os;
31 }
32
33 std::string toString(){
34 stringstream ss;
35 ss << this;
36 return ss.str();
37 }
38};
39
40#endif // STOPWATCH_H
041
=== added directory 'include/PetriEngine'
=== added file 'include/PetriEngine/AbstractPetriNetBuilder.h'
--- include/PetriEngine/AbstractPetriNetBuilder.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/AbstractPetriNetBuilder.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,114 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef ABSTRACTPETRINETBUILDER_H
21#define ABSTRACTPETRINETBUILDER_H
22
23#include <string>
24
25#include "PQL/PQL.h"
26#include "Colored/Multiset.h"
27#include "Colored/Expressions.h"
28
29namespace PetriEngine {
30
31 /** Abstract builder for petri nets */
32 class AbstractPetriNetBuilder {
33 protected:
34 bool _isColored = false;
35
36 public:
37 /** Add a new place with a unique name */
38 virtual void addPlace(const std::string& name,
39 int tokens,
40 double x = 0,
41 double y = 0) = 0;
42 /** Add a new colored place with a unique name */
43 virtual void addPlace(const std::string& name,
44 Colored::ColorType* type,
45 Colored::Multiset&& tokens,
46 double x = 0,
47 double y = 0)
48 {
49 std::cerr << "Colored places are not supported in standard P/T nets" << std::endl;
50 exit(ErrorCode);
51 }
52 /** Add a new transition with a unique name */
53 virtual void addTransition(const std::string& name,
54 double x = 0,
55 double y = 0) = 0;
56 /** Add a new colored transition with a unique name */
57 virtual void addTransition(const std::string& name,
58 const Colored::GuardExpression_ptr& guard,
59 double x = 0,
60 double y = 0)
61 {
62 std::cerr << "Colored transitions are not supported in standard P/T nets" << std::endl;
63 exit(ErrorCode);
64 }
65 /** Add input arc with given weight */
66 virtual void addInputArc(const std::string& place,
67 const std::string& transition,
68 bool inhibitor,
69 int) = 0;
70 /** Add colored input arc with given arc expression */
71 virtual void addInputArc(const std::string& place,
72 const std::string& transition,
73 const Colored::ArcExpression_ptr& expr)
74 {
75 std::cerr << "Colored input arcs are not supported in standard P/T nets" << std::endl;
76 exit(ErrorCode);
77 }
78 /** Add output arc with given weight */
79 virtual void addOutputArc(const std::string& transition,
80 const std::string& place,
81 int weight = 1) = 0;
82 /** Add output arc with given arc expression */
83 virtual void addOutputArc(const std::string& transition,
84 const std::string& place,
85 const Colored::ArcExpression_ptr& expr)
86 {
87 std::cerr << "Colored output arcs are not supported in standard P/T nets" << std::endl;
88 exit(ErrorCode);
89 }
90 /** Add color types with id */
91 virtual void addColorType(const std::string& id,
92 Colored::ColorType* type)
93 {
94 std::cerr << "Color types are not supported in standard P/T nets" << std::endl;
95 exit(ErrorCode);
96 }
97
98 virtual void enableColors() {
99 _isColored = true;
100 }
101
102 virtual bool isColored() const {
103 return _isColored;
104 }
105
106 virtual void sort() = 0;
107
108 virtual ~AbstractPetriNetBuilder() {
109 }
110 };
111
112}
113
114#endif // ABSTRACTPETRINETBUILDER_H
0115
=== added directory 'include/PetriEngine/Colored'
=== added file 'include/PetriEngine/Colored/ColoredNetStructures.h'
--- include/PetriEngine/Colored/ColoredNetStructures.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Colored/ColoredNetStructures.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,48 @@
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: ColoredNetStructures.h
9 * Author: Klostergaard
10 *
11 * Created on 17. februar 2018, 17:07
12 */
13
14#ifndef COLOREDNETSTRUCTURES_H
15#define COLOREDNETSTRUCTURES_H
16
17#include <vector>
18#include <set>
19#include "Colors.h"
20#include "Expressions.h"
21#include "Multiset.h"
22
23namespace PetriEngine {
24 namespace Colored {
25
26 struct Arc {
27 uint32_t place;
28 uint32_t transition;
29 ArcExpression_ptr expr;
30 bool input;
31 };
32
33 struct Transition {
34 std::string name;
35 GuardExpression_ptr guard;
36 std::vector<Arc> arcs;
37 };
38
39 struct Place {
40 std::string name;
41 ColorType* type;
42 Multiset marking;
43 };
44 }
45}
46
47#endif /* COLOREDNETSTRUCTURES_H */
48
049
=== added file 'include/PetriEngine/Colored/ColoredPetriNetBuilder.h'
--- include/PetriEngine/Colored/ColoredPetriNetBuilder.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Colored/ColoredPetriNetBuilder.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,179 @@
1/*
2 * File: ColoredPetriNetBuilder.h
3 * Author: Klostergaard
4 *
5 * Created on 17. februar 2018, 16:25
6 */
7
8#ifndef COLOREDPETRINETBUILDER_H
9#define COLOREDPETRINETBUILDER_H
10
11#include <vector>
12#include <unordered_map>
13
14#include "ColoredNetStructures.h"
15#include "../AbstractPetriNetBuilder.h"
16#include "../PetriNetBuilder.h"
17
18namespace PetriEngine {
19 class ColoredPetriNetBuilder : public AbstractPetriNetBuilder {
20 public:
21 typedef std::unordered_map<std::string, Colored::ColorType*> ColorTypeMap;
22 typedef std::unordered_map<std::string, std::unordered_map<uint32_t , std::string>> PTPlaceMap;
23 typedef std::unordered_map<std::string, std::vector<std::string>> PTTransitionMap;
24
25 public:
26 ColoredPetriNetBuilder();
27 ColoredPetriNetBuilder(const ColoredPetriNetBuilder& orig);
28 virtual ~ColoredPetriNetBuilder();
29
30 void addPlace(const std::string& name,
31 int tokens,
32 double x = 0,
33 double y = 0) override ;
34 void addPlace(const std::string& name,
35 Colored::ColorType* type,
36 Colored::Multiset&& tokens,
37 double x = 0,
38 double y = 0) override;
39 void addTransition(const std::string& name,
40 double x = 0,
41 double y = 0) override;
42 void addTransition(const std::string& name,
43 const Colored::GuardExpression_ptr& guard,
44 double x = 0,
45 double y = 0) override;
46 void addInputArc(const std::string& place,
47 const std::string& transition,
48 bool inhibitor,
49 int) override;
50 void addInputArc(const std::string& place,
51 const std::string& transition,
52 const Colored::ArcExpression_ptr& expr) override;
53 void addOutputArc(const std::string& transition,
54 const std::string& place,
55 int weight = 1) override;
56 void addOutputArc(const std::string& transition,
57 const std::string& place,
58 const Colored::ArcExpression_ptr& expr) override;
59 void addColorType(const std::string& id,
60 Colored::ColorType* type) override;
61
62
63 void sort() override;
64
65 double getUnfoldTime() const {
66 return _time;
67 }
68
69 uint32_t getPlaceCount() const {
70 return _places.size();
71 }
72
73 uint32_t getTransitionCount() const {
74 return _transitions.size();
75 }
76
77 uint32_t getArcCount() const {
78 uint32_t sum = 0;
79 for (auto& t : _transitions) {
80 sum += t.arcs.size();
81 }
82 return sum;
83 }
84
85 uint32_t getUnfoldedPlaceCount() const {
86 //return _nptplaces;
87 return _ptBuilder.numberOfPlaces();
88 }
89
90 uint32_t getUnfoldedTransitionCount() const {
91 return _ptBuilder.numberOfTransitions();
92 }
93
94 uint32_t getUnfoldedArcCount() const {
95 return _nptarcs;
96 }
97
98 bool isUnfolded() const {
99 return _unfolded;
100 }
101
102 const PTPlaceMap& getUnfoldedPlaceNames() const {
103 return _ptplacenames;
104 }
105
106 const PTTransitionMap& getUnfoldedTransitionNames() const {
107 return _pttransitionnames;
108 }
109
110 PetriNetBuilder& unfold();
111 PetriNetBuilder& stripColors();
112 private:
113 std::unordered_map<std::string,uint32_t> _placenames;
114 std::unordered_map<std::string,uint32_t> _transitionnames;
115 PTPlaceMap _ptplacenames;
116 PTTransitionMap _pttransitionnames;
117 uint32_t _nptplaces = 0;
118 uint32_t _npttransitions = 0;
119 uint32_t _nptarcs = 0;
120
121 std::vector<Colored::Place> _places;
122 std::vector<Colored::Transition> _transitions;
123 std::vector<Colored::Arc> _arcs;
124 ColorTypeMap _colors;
125 PetriNetBuilder _ptBuilder;
126 bool _unfolded = false;
127 bool _stripped = false;
128
129 double _time;
130
131 std::string arcToString(Colored::Arc& arc) const ;
132
133 void addArc(const std::string& place,
134 const std::string& transition,
135 const Colored::ArcExpression_ptr& expr,
136 bool input);
137
138 void unfoldPlace(Colored::Place& place);
139 void unfoldTransition(Colored::Transition& transition);
140 void unfoldArc(Colored::Arc& arc, Colored::ExpressionContext::BindingMap& binding, std::string& name);
141 };
142
143 class BindingGenerator {
144 public:
145 class Iterator {
146 private:
147 BindingGenerator* _generator;
148
149 public:
150 Iterator(BindingGenerator* generator);
151
152 bool operator==(Iterator& other);
153 bool operator!=(Iterator& other);
154 Iterator& operator++();
155 const Colored::ExpressionContext::BindingMap operator++(int);
156 Colored::ExpressionContext::BindingMap& operator*();
157 };
158 private:
159 Colored::GuardExpression_ptr _expr;
160 Colored::ExpressionContext::BindingMap _bindings;
161 ColoredPetriNetBuilder::ColorTypeMap& _colorTypes;
162
163 bool eval();
164
165 public:
166 BindingGenerator(Colored::Transition& transition,
167 const std::vector<Colored::Arc>& arcs,
168 ColoredPetriNetBuilder::ColorTypeMap& colorTypes);
169
170 Colored::ExpressionContext::BindingMap& nextBinding();
171 Colored::ExpressionContext::BindingMap& currentBinding();
172 bool isInitial() const;
173 Iterator begin();
174 Iterator end();
175 };
176}
177
178#endif /* COLOREDPETRINETBUILDER_H */
179
0180
=== added file 'include/PetriEngine/Colored/Colors.h'
--- include/PetriEngine/Colored/Colors.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Colored/Colors.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,279 @@
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: Colors.h
9 * Author: andreas
10 *
11 * Created on February 19, 2018, 8:22 PM
12 */
13
14#ifndef COLORS_H
15#define COLORS_H
16
17#include <stdint.h>
18#include <stddef.h>
19#include <string>
20#include <string.h>
21#include <utility>
22#include <vector>
23#include <unordered_map>
24
25namespace PetriEngine {
26 namespace Colored {
27 class ColorType;
28
29 class Color {
30 public:
31 friend std::ostream& operator<< (std::ostream& stream, const Color& color);
32
33 protected:
34 const std::vector<const Color*> _tuple;
35 ColorType* _colorType;
36 std::string _colorName;
37 uint32_t _id;
38
39 public:
40 Color(ColorType* colorType, uint32_t id, std::vector<const Color*>& colors);
41 Color(ColorType* colorType, uint32_t id, const char* color);
42 ~Color() {}
43
44 bool isTuple() const {
45 return _tuple.size() > 1;
46 }
47
48 const std::string& getColorName() const {
49 if (this->isTuple()) {
50 throw "Cannot get color from a tuple color.";
51 }
52 return _colorName;
53 }
54
55 ColorType* getColorType() const {
56 return _colorType;
57 }
58
59 uint32_t getId() const {
60 return _id;
61 }
62
63 const Color* operator[] (size_t index) const;
64 bool operator< (const Color& other) const;
65 bool operator> (const Color& other) const;
66 bool operator<= (const Color& other) const;
67 bool operator>= (const Color& other) const;
68
69 bool operator== (const Color& other) const {
70 return _colorType == other._colorType && _id == other._id;
71 }
72 bool operator!= (const Color& other) const {
73 return !((*this) == other);
74 }
75
76 const Color& operator++ () const;
77 const Color& operator-- () const;
78
79 std::string toString() const;
80 static std::string toString(const Color* color);
81 static std::string toString(const std::vector<const Color*>& colors);
82 };
83
84 /*
85 * Singleton pattern from:
86 * https://stackoverflow.com/questions/1008019/c-singleton-design-pattern
87 */
88 class DotConstant : public Color {
89 private:
90 DotConstant();
91
92 public:
93 static const Color* dotConstant() {
94 static DotConstant _instance;
95
96 return &_instance;
97 }
98
99 DotConstant(DotConstant const&) = delete;
100 void operator=(DotConstant const&) = delete;
101
102 bool operator== (const DotConstant& other) {
103 return true;
104 }
105 };
106
107 class ColorType {
108 public:
109 class iterator {
110 private:
111 ColorType& type;
112 size_t index;
113
114 public:
115 iterator(ColorType& type, size_t index) : type(type), index(index) {}
116
117 const Color& operator++() {
118 return type[++index];
119 }
120
121 const Color& operator++(int) {
122 return type[index++];
123 }
124
125 const Color& operator--() {
126 return type[--index];
127 }
128 const Color& operator--(int) {
129 return type[index--];
130 }
131
132 const Color& operator*() {
133 return type[index];
134 }
135
136 const Color* operator->() {
137 return &type[index];
138 }
139
140 bool operator==(iterator& other) {
141 return type == other.type && index == other.index;
142 }
143
144 bool operator!=(iterator& other) {
145 return !(type == other.type) || index != other.index;
146 }
147 };
148
149 private:
150 std::vector<Color> _colors;
151 uintptr_t _id;
152 std::string _name;
153
154 public:
155 ColorType(std::vector<ColorType*> elements);
156 ColorType(std::string name = "Undefined") : _colors(), _name(std::move(name)) {
157 _id = (uintptr_t)this;
158 }
159
160 virtual void addColor(const char* colorName);
161 virtual void addColor(std::vector<const Color*>& colors);
162 virtual void addDot() {
163 _colors.push_back(*DotConstant::dotConstant());
164 }
165
166 virtual size_t size() const {
167 return _colors.size();
168 }
169
170 virtual const Color& operator[] (size_t index) {
171 return _colors[index];
172 }
173
174 virtual const Color& operator[] (int index) {
175 return _colors[index];
176 }
177
178 virtual const Color& operator[] (uint32_t index) {
179 return _colors[index];
180 }
181
182 virtual const Color* operator[] (const char* index);
183
184 virtual const Color* operator[] (const std::string& index) {
185 return (*this)[index.c_str()];
186 }
187
188 bool operator== (const ColorType& other) const {
189 return _id == other._id;
190 }
191
192 uintptr_t getId() {
193 return _id;
194 }
195
196 const std::string& getName() const {
197 return _name;
198 }
199
200 iterator begin() {
201 return {*this, 0};
202 }
203
204 iterator end() {
205 return {*this, size()};
206 }
207 };
208
209 class ProductType : public ColorType {
210 private:
211 std::vector<ColorType*> constituents;
212 std::unordered_map<size_t,Color> cache;
213
214 public:
215 ProductType(const std::string& name = "Undefined") : ColorType(name) {}
216 ~ProductType() {
217 cache.clear();
218 }
219
220 void addType(ColorType* type) {
221 constituents.push_back(type);
222 }
223
224 void addColor(const char* colorName) override {}
225 void addColor(std::vector<const Color*>& colors) override {}
226 void addDot() override {}
227
228 size_t size() const override {
229 size_t product = 1;
230 for (auto ct : constituents) {
231 product *= ct->size();
232 }
233 return product;
234 }
235
236 bool containsTypes(const std::vector<const ColorType*>& types) const {
237 if (constituents.size() != types.size()) return false;
238
239 for (size_t i = 0; i < constituents.size(); ++i) {
240 if (!(*constituents[i] == *types[i])) {
241 return false;
242 }
243 }
244
245 return true;
246 }
247
248 const Color* getColor(const std::vector<const Color*>& colors);
249
250 const Color& operator[](size_t index) override;
251 const Color& operator[](int index) override {
252 return operator[]((size_t)index);
253 }
254 const Color& operator[](uint32_t index) override {
255 return operator[]((size_t)index);
256 }
257
258 const Color* operator[](const char* index) override;
259 const Color* operator[](const std::string& index) override;
260 };
261
262 struct Variable {
263 std::string name;
264 ColorType* colorType;
265 };
266
267 struct Binding {
268 Variable* var;
269 const Color* color;
270
271 bool operator==(Binding& other) {
272 return var->name.compare(other.var->name);
273 }
274 };
275 }
276}
277
278#endif /* COLORS_H */
279
0280
=== added file 'include/PetriEngine/Colored/Expressions.h'
--- include/PetriEngine/Colored/Expressions.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Colored/Expressions.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,658 @@
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: Expressions.h
9 * Author: andreas
10 *
11 * Created on February 19, 2018, 7:00 PM
12 */
13
14#ifndef COLORED_EXPRESSIONS_H
15#define COLORED_EXPRESSIONS_H
16
17#include <string>
18#include <unordered_map>
19#include <set>
20#include <stdlib.h>
21#include <iostream>
22#include <cassert>
23#include <memory>
24
25
26#include "Colors.h"
27#include "Multiset.h"
28#include "../errorcodes.h"
29
30namespace PetriEngine {
31 class ColoredPetriNetBuilder;
32
33 namespace Colored {
34 struct ExpressionContext {
35 typedef std::unordered_map<std::string, const Color*> BindingMap;
36
37 BindingMap& binding;
38 std::unordered_map<std::string, ColorType*>& colorTypes;
39
40 const Color* findColor(const std::string& color) const {
41 if (color.compare("dot") == 0)
42 return DotConstant::dotConstant();
43 for (auto& elem : colorTypes) {
44 auto col = (*elem.second)[color];
45 if (col)
46 return col;
47 }
48 printf("Could not find color: %s\nCANNOT_COMPUTE\n", color.c_str());
49 exit(ErrorCode);
50 }
51
52 ProductType* findProductColorType(const std::vector<const ColorType*>& types) const {
53 for (auto& elem : colorTypes) {
54 auto* pt = dynamic_cast<ProductType*>(elem.second);
55 if (pt && pt->containsTypes(types)) {
56 return pt;
57 }
58 }
59 return nullptr;
60 }
61 };
62
63 class WeightException : public std::exception {
64 private:
65 std::string _message;
66 public:
67 explicit WeightException(std::string message) : _message(message) {}
68
69 const char* what() const noexcept override {
70 return ("Undefined weight: " + _message).c_str();
71 }
72 };
73
74 class Expression {
75 public:
76 Expression() {}
77
78 virtual void getVariables(std::set<Variable*>& variables) const {
79 }
80
81 virtual void expressionType() {
82 std::cout << "Expression" << std::endl;
83 }
84
85 virtual std::string toString() const {
86 return "Unsupported";
87 }
88 };
89
90 class ColorExpression : public Expression {
91 public:
92 ColorExpression() {}
93 virtual ~ColorExpression() {}
94
95 virtual const Color* eval(ExpressionContext& context) const = 0;
96 };
97
98 class DotConstantExpression : public ColorExpression {
99 public:
100 const Color* eval(ExpressionContext& context) const override {
101 return DotConstant::dotConstant();
102 }
103 };
104
105 typedef std::shared_ptr<ColorExpression> ColorExpression_ptr;
106
107 class VariableExpression : public ColorExpression {
108 private:
109 Variable* _variable;
110
111 public:
112 const Color* eval(ExpressionContext& context) const override {
113 return context.binding[_variable->name];
114 }
115
116 void getVariables(std::set<Variable*>& variables) const override {
117 variables.insert(_variable);
118 }
119
120 std::string toString() const override {
121 return _variable->name;
122 }
123
124 VariableExpression(Variable* variable)
125 : _variable(variable) {}
126 };
127
128 class UserOperatorExpression : public ColorExpression {
129 private:
130 const Color* _userOperator;
131
132 public:
133 const Color* eval(ExpressionContext& context) const override {
134 return _userOperator;
135 }
136
137 std::string toString() const override {
138 return _userOperator->toString();
139 }
140
141 UserOperatorExpression(const Color* userOperator)
142 : _userOperator(userOperator) {}
143 };
144
145 class UserSortExpression : public Expression {
146 private:
147 ColorType* _userSort;
148
149 public:
150 ColorType* eval(ExpressionContext& context) const {
151 return _userSort;
152 }
153
154 std::string toString() const override {
155 return _userSort->getName();
156 }
157
158 UserSortExpression(ColorType* userSort)
159 : _userSort(userSort) {}
160 };
161
162 typedef std::shared_ptr<UserSortExpression> UserSortExpression_ptr;
163
164 class NumberConstantExpression : public Expression {
165 private:
166 uint32_t _number;
167
168 public:
169 uint32_t eval(ExpressionContext& context) const {
170 return _number;
171 }
172
173 NumberConstantExpression(uint32_t number)
174 : _number(number) {}
175 };
176
177 typedef std::shared_ptr<NumberConstantExpression> NumberConstantExpression_ptr;
178
179 class SuccessorExpression : public ColorExpression {
180 private:
181 ColorExpression_ptr _color;
182
183 public:
184 const Color* eval(ExpressionContext& context) const override {
185 return &++(*_color->eval(context));
186 }
187
188 void getVariables(std::set<Variable*>& variables) const override {
189 _color->getVariables(variables);
190 }
191
192 std::string toString() const override {
193 return _color->toString() + "++";
194 }
195
196 SuccessorExpression(ColorExpression_ptr&& color)
197 : _color(std::move(color)) {}
198 };
199
200 class PredecessorExpression : public ColorExpression {
201 private:
202 ColorExpression_ptr _color;
203
204 public:
205 const Color* eval(ExpressionContext& context) const override {
206 return &--(*_color->eval(context));
207 }
208
209 void getVariables(std::set<Variable*>& variables) const override {
210 _color->getVariables(variables);
211 }
212
213 std::string toString() const override {
214 return _color->toString() + "--";
215 }
216
217 PredecessorExpression(ColorExpression_ptr&& color)
218 : _color(std::move(color)) {}
219 };
220
221 class TupleExpression : public ColorExpression {
222 private:
223 std::vector<ColorExpression_ptr> _colors;
224
225 public:
226 const Color* eval(ExpressionContext& context) const override {
227 std::vector<const Color*> colors;
228 std::vector<const ColorType*> types;
229 for (auto color : _colors) {
230 colors.push_back(color->eval(context));
231 types.push_back(colors.back()->getColorType());
232 }
233 ProductType* pt = context.findProductColorType(types);
234
235 const Color* col = pt->getColor(colors);
236 assert(col != nullptr);
237 return col;
238 }
239
240 void getVariables(std::set<Variable*>& variables) const override {
241 for (auto elem : _colors) {
242 elem->getVariables(variables);
243 }
244 }
245
246 std::string toString() const override {
247 std::string res = "(" + _colors[0]->toString();
248 for (uint32_t i = 1; i < _colors.size(); ++i) {
249 res += "," + _colors[i]->toString();
250 }
251 res += ")";
252 return res;
253 }
254
255 TupleExpression(std::vector<ColorExpression_ptr>&& colors)
256 : _colors(std::move(colors)) {}
257 };
258
259 class GuardExpression : public Expression {
260 public:
261 GuardExpression() {}
262 virtual ~GuardExpression() {}
263
264 virtual bool eval(ExpressionContext& context) const = 0;
265 };
266
267 typedef std::shared_ptr<GuardExpression> GuardExpression_ptr;
268
269 class LessThanExpression : public GuardExpression {
270 private:
271 ColorExpression_ptr _left;
272 ColorExpression_ptr _right;
273
274 public:
275 bool eval(ExpressionContext& context) const override {
276 return _left->eval(context) < _right->eval(context);
277 }
278
279 void getVariables(std::set<Variable*>& variables) const override {
280 _left->getVariables(variables);
281 _right->getVariables(variables);
282 }
283
284 LessThanExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
285 : _left(std::move(left)), _right(std::move(right)) {}
286 };
287
288 class GreaterThanExpression : public GuardExpression {
289 private:
290 ColorExpression_ptr _left;
291 ColorExpression_ptr _right;
292
293 public:
294 bool eval(ExpressionContext& context) const override {
295 return _left->eval(context) > _right->eval(context);
296 }
297
298 void getVariables(std::set<Variable*>& variables) const override {
299 _left->getVariables(variables);
300 _right->getVariables(variables);
301 }
302
303 GreaterThanExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
304 : _left(std::move(left)), _right(std::move(right)) {}
305 };
306
307 class LessThanEqExpression : public GuardExpression {
308 private:
309 ColorExpression_ptr _left;
310 ColorExpression_ptr _right;
311
312 public:
313 bool eval(ExpressionContext& context) const override {
314 return _left->eval(context) <= _right->eval(context);
315 }
316
317 void getVariables(std::set<Variable*>& variables) const override {
318 _left->getVariables(variables);
319 _right->getVariables(variables);
320 }
321
322 LessThanEqExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
323 : _left(std::move(left)), _right(std::move(right)) {}
324 };
325
326 class GreaterThanEqExpression : public GuardExpression {
327 private:
328 ColorExpression_ptr _left;
329 ColorExpression_ptr _right;
330
331 public:
332 bool eval(ExpressionContext& context) const override {
333 return _left->eval(context) >= _right->eval(context);
334 }
335
336 void getVariables(std::set<Variable*>& variables) const override {
337 _left->getVariables(variables);
338 _right->getVariables(variables);
339 }
340
341 GreaterThanEqExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
342 : _left(std::move(left)), _right(std::move(right)) {}
343 };
344
345 class EqualityExpression : public GuardExpression {
346 private:
347 ColorExpression_ptr _left;
348 ColorExpression_ptr _right;
349
350 public:
351 bool eval(ExpressionContext& context) const override {
352 return _left->eval(context) == _right->eval(context);
353 }
354
355 void getVariables(std::set<Variable*>& variables) const override {
356 _left->getVariables(variables);
357 _right->getVariables(variables);
358 }
359
360 EqualityExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
361 : _left(std::move(left)), _right(std::move(right)) {}
362 };
363
364 class InequalityExpression : public GuardExpression {
365 private:
366 ColorExpression_ptr _left;
367 ColorExpression_ptr _right;
368
369 public:
370 bool eval(ExpressionContext& context) const override {
371 return _left->eval(context) != _right->eval(context);
372 }
373
374 void getVariables(std::set<Variable*>& variables) const override {
375 _left->getVariables(variables);
376 _right->getVariables(variables);
377 }
378
379 InequalityExpression(ColorExpression_ptr&& left, ColorExpression_ptr&& right)
380 : _left(std::move(left)), _right(std::move(right)) {}
381 };
382
383 class NotExpression : public GuardExpression {
384 private:
385 GuardExpression_ptr _expr;
386
387 public:
388 bool eval(ExpressionContext& context) const override {
389 return !_expr->eval(context);
390 }
391
392 void getVariables(std::set<Variable*>& variables) const override {
393 _expr->getVariables(variables);
394 }
395
396 NotExpression(GuardExpression_ptr&& expr) : _expr(std::move(expr)) {}
397 };
398
399 class AndExpression : public GuardExpression {
400 private:
401 GuardExpression_ptr _left;
402 GuardExpression_ptr _right;
403
404 public:
405 bool eval(ExpressionContext& context) const override {
406 return _left->eval(context) && _right->eval(context);
407 }
408
409 void getVariables(std::set<Variable*>& variables) const override {
410 _left->getVariables(variables);
411 _right->getVariables(variables);
412 }
413
414 AndExpression(GuardExpression_ptr&& left, GuardExpression_ptr&& right)
415 : _left(left), _right(right) {}
416 };
417
418 class OrExpression : public GuardExpression {
419 private:
420 GuardExpression_ptr _left;
421 GuardExpression_ptr _right;
422
423 public:
424 bool eval(ExpressionContext& context) const override {
425 return _left->eval(context) || _right->eval(context);
426 }
427
428 void getVariables(std::set<Variable*>& variables) const override {
429 _left->getVariables(variables);
430 _right->getVariables(variables);
431 }
432
433 OrExpression(GuardExpression_ptr&& left, GuardExpression_ptr&& right)
434 : _left(std::move(left)), _right(std::move(right)) {}
435 };
436
437 class ArcExpression : public Expression {
438 public:
439 ArcExpression() {}
440 virtual ~ArcExpression() {}
441
442 virtual Multiset eval(ExpressionContext& context) const = 0;
443
444 virtual void expressionType() override {
445 std::cout << "ArcExpression" << std::endl;
446 }
447
448 virtual uint32_t weight() const = 0;
449 };
450
451 typedef std::shared_ptr<ArcExpression> ArcExpression_ptr;
452
453 class AllExpression : public Expression {
454 private:
455 ColorType* _sort;
456
457 public:
458 virtual ~AllExpression() {};
459 std::vector<const Color*> eval(ExpressionContext& context) const {
460 std::vector<const Color*> colors;
461 assert(_sort != nullptr);
462 for (size_t i = 0; i < _sort->size(); i++) {
463 colors.push_back(&(*_sort)[i]);
464 }
465 return colors;
466 }
467
468 size_t size() const {
469 return _sort->size();
470 }
471
472 std::string toString() const override {
473 return _sort->getName() + ".all";
474 }
475
476 AllExpression(ColorType* sort) : _sort(sort)
477 {
478 assert(sort != nullptr);
479 }
480 };
481
482 typedef std::shared_ptr<AllExpression> AllExpression_ptr;
483
484 class NumberOfExpression : public ArcExpression {
485 private:
486 uint32_t _number;
487 std::vector<ColorExpression_ptr> _color;
488 AllExpression_ptr _all;
489
490 public:
491 Multiset eval(ExpressionContext& context) const override {
492 std::vector<const Color*> colors;
493 if (!_color.empty()) {
494 for (auto elem : _color) {
495 colors.push_back(elem->eval(context));
496 }
497 } else if (_all != nullptr) {
498 colors = _all->eval(context);
499 }
500 std::vector<std::pair<const Color*,uint32_t>> col;
501 for (auto elem : colors) {
502 col.push_back(std::make_pair(elem, _number));
503 }
504 return Multiset(col);
505 }
506
507 void getVariables(std::set<Variable*>& variables) const override {
508 if (_all != nullptr)
509 return;
510 for (auto elem : _color) {
511 elem->getVariables(variables);
512 }
513 }
514
515 uint32_t weight() const override {
516 if (_all == nullptr)
517 return _number * _color.size();
518 else
519 return _number * _all->size();
520 }
521
522 bool isAll() const {
523 return (bool)_all;
524 }
525
526 bool isSingleColor() const {
527 return !isAll() && _color.size() == 1;
528 }
529
530 uint32_t number() const {
531 return _number;
532 }
533
534 std::string toString() const override {
535 if (isAll())
536 return std::to_string(_number) + "'(" + _all->toString() + ")";
537 std::string res = std::to_string(_number) + "'(" + _color[0]->toString() + ")";
538 for (uint32_t i = 1; i < _color.size(); ++i) {
539 res += " + ";
540 res += std::to_string(_number) + "'(" + _color[i]->toString() + ")";
541 }
542 return res;
543 }
544
545 NumberOfExpression(std::vector<ColorExpression_ptr>&& color, uint32_t number = 1)
546 : _number(number), _color(std::move(color)), _all(nullptr) {}
547 NumberOfExpression(AllExpression_ptr&& all, uint32_t number = 1)
548 : _number(number), _color(), _all(std::move(all)) {}
549 };
550
551 typedef std::shared_ptr<NumberOfExpression> NumberOfExpression_ptr;
552
553 class AddExpression : public ArcExpression {
554 private:
555 std::vector<ArcExpression_ptr> _constituents;
556
557 public:
558 Multiset eval(ExpressionContext& context) const override {
559 Multiset ms;
560 for (auto expr : _constituents) {
561 ms += expr->eval(context);
562 }
563 return ms;
564 }
565
566 void getVariables(std::set<Variable*>& variables) const override {
567 for (auto elem : _constituents) {
568 elem->getVariables(variables);
569 }
570 }
571
572 uint32_t weight() const override {
573 uint32_t res = 0;
574 for (auto expr : _constituents) {
575 res += expr->weight();
576 }
577 return res;
578 }
579
580 std::string toString() const override {
581 std::string res = _constituents[0]->toString();
582 for (uint32_t i = 1; i < _constituents.size(); ++i) {
583 res += " + " + _constituents[i]->toString();
584 }
585 return res;
586 }
587
588 AddExpression(std::vector<ArcExpression_ptr>&& constituents)
589 : _constituents(std::move(constituents)) {}
590 };
591
592 class SubtractExpression : public ArcExpression {
593 private:
594 ArcExpression_ptr _left;
595 ArcExpression_ptr _right;
596
597 public:
598 Multiset eval(ExpressionContext& context) const override {
599 return _left->eval(context) - _right->eval(context);
600 }
601
602 void getVariables(std::set<Variable*>& variables) const override {
603 _left->getVariables(variables);
604 _right->getVariables(variables);
605 }
606
607 uint32_t weight() const override {
608 auto* left = dynamic_cast<NumberOfExpression*>(_left.get());
609 if (!left || !left->isAll()) {
610 throw WeightException("Left constituent of subtract is not an all expression!");
611 }
612 auto* right = dynamic_cast<NumberOfExpression*>(_right.get());
613 if (!right || !right->isSingleColor()) {
614 throw WeightException("Right constituent of subtract is not a single color number of expression!");
615 }
616
617 uint32_t val = std::min(left->number(), right->number());
618 return _left->weight() - val;
619 }
620
621 std::string toString() const override {
622 return _left->toString() + " - " + _right->toString();
623 }
624
625 SubtractExpression(ArcExpression_ptr&& left, ArcExpression_ptr&& right)
626 : _left(std::move(left)), _right(std::move(right)) {}
627 };
628
629 class ScalarProductExpression : public ArcExpression {
630 private:
631 uint32_t _scalar;
632 ArcExpression_ptr _expr;
633
634 public:
635 Multiset eval(ExpressionContext& context) const override {
636 return _expr->eval(context) * _scalar;
637 }
638
639 void getVariables(std::set<Variable*>& variables) const override {
640 _expr->getVariables(variables);
641 }
642
643 uint32_t weight() const override {
644 return _scalar * _expr->weight();
645 }
646
647 std::string toString() const override {
648 return std::to_string(_scalar) + " * " + _expr->toString();
649 }
650
651 ScalarProductExpression(ArcExpression_ptr&& expr, uint32_t scalar)
652 : _scalar(std::move(scalar)), _expr(expr) {}
653 };
654 }
655}
656
657#endif /* COLORED_EXPRESSIONS_H */
658
0659
=== added file 'include/PetriEngine/Colored/Multiset.h'
--- include/PetriEngine/Colored/Multiset.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Colored/Multiset.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,83 @@
1/*
2 * To change this license header, choose License Headers in Project Properties.
3 * To change this template file, choose Tools | Templates
4 * and open the template in the editor.
5 */
6
7/*
8 * File: Multiset.h
9 * Author: andreas
10 *
11 * Created on February 20, 2018, 10:37 AM
12 */
13
14#ifndef MULTISET_H
15#define MULTISET_H
16
17#include <vector>
18#include <utility>
19
20#include "Colors.h"
21
22
23namespace PetriEngine {
24 namespace Colored {
25 class Multiset {
26 private:
27 class Iterator {
28 private:
29 Multiset* ms;
30 size_t index;
31
32 public:
33 Iterator(Multiset* ms, size_t index)
34 : ms(ms), index(index) {}
35
36 bool operator==(Iterator& other);
37 bool operator!=(Iterator& other);
38 Iterator& operator++();
39 std::pair<const Color*,uint32_t&> operator++(int);
40 std::pair<const Color*,uint32_t&> operator*();
41 };
42
43 typedef std::vector<std::pair<uint32_t,uint32_t>> Internal;
44
45 public:
46 Multiset();
47 Multiset(const Multiset& orig);
48 Multiset(std::pair<const Color*,uint32_t> color);
49 Multiset(std::vector<std::pair<const Color*,uint32_t>>& colors);
50 virtual ~Multiset();
51
52 Multiset operator+ (const Multiset& other) const;
53 Multiset operator- (const Multiset& other) const;
54 Multiset operator* (uint32_t scalar) const;
55 void operator+= (const Multiset& other);
56 void operator-= (const Multiset& other);
57 void operator*= (uint32_t scalar);
58 uint32_t operator[] (const Color* color) const;
59 uint32_t& operator[] (const Color* color);
60
61 bool empty() const;
62 void clean();
63
64 size_t distinctSize() const {
65 return _set.size();
66 }
67
68 size_t size() const;
69
70 Iterator begin();
71 Iterator end();
72
73 std::string toString() const;
74
75 private:
76 Internal _set;
77 ColorType* type;
78 };
79 }
80}
81
82#endif /* MULTISET_H */
83
084
=== added file 'include/PetriEngine/NetStructures.h'
--- include/PetriEngine/NetStructures.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/NetStructures.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,91 @@
1/*
2 * File: NetStructures.h
3 * Author: Peter G. Jensen
4 *
5 * Created on 09 March 2016, 21:08
6 */
7
8#ifndef NETSTRUCTURES_H
9#define NETSTRUCTURES_H
10
11#include <limits>
12#include <vector>
13
14namespace PetriEngine {
15
16 struct Arc {
17 uint32_t place;
18 uint32_t weight;
19 bool skip = false;
20 bool inhib = false;
21
22 Arc() :
23 place(std::numeric_limits<uint32_t>::max()),
24 weight(std::numeric_limits<uint32_t>::max()),
25 skip(false),
26 inhib(false) {
27 };
28
29 bool operator < (const Arc& other) const
30 {
31 return place < other.place;
32 }
33
34 bool operator == (const Arc& other) const
35 {
36 return place == other.place && weight == other.weight && inhib == other.inhib;
37 }
38 };
39
40 struct Transition {
41 std::vector<Arc> pre;
42 std::vector<Arc> post;
43 bool skip = false;
44 bool inhib = false;
45
46 void addPreArc(const Arc& arc)
47 {
48 auto lb = std::lower_bound(pre.begin(), pre.end(), arc);
49 if(lb != pre.end() && lb->place == arc.place)
50 lb->weight += arc.weight;
51 else
52 lb = pre.insert(lb, arc);
53 assert(lb->weight > 0);
54 }
55
56 void addPostArc(const Arc& arc)
57 {
58 auto lb = std::lower_bound(post.begin(), post.end(), arc);
59 if(lb != post.end() && lb->place == arc.place)
60 lb->weight += arc.weight;
61 else
62 lb = post.insert(lb, arc);
63 assert(lb->weight > 0);
64
65 }
66 };
67
68 struct Place {
69 std::vector<uint32_t> consumers; // things consuming
70 std::vector<uint32_t> producers; // things producing
71 bool skip = false;
72 bool inhib = false;
73
74 // should be replaced using concepts in c++20
75 void addConsumer(uint32_t id)
76 {
77 auto lb = std::lower_bound(consumers.begin(), consumers.end(), id);
78 if(lb == consumers.end() || *lb != id)
79 consumers.insert(lb, id);
80 }
81
82 void addProducer(uint32_t id)
83 {
84 auto lb = std::lower_bound(producers.begin(), producers.end(), id);
85 if(lb == producers.end() || *lb != id)
86 producers.insert(lb, id);
87 }
88 };
89}
90#endif /* NETSTRUCTURES_H */
91
092
=== added directory 'include/PetriEngine/PQL'
=== added file 'include/PetriEngine/PQL/Contexts.h'
--- include/PetriEngine/PQL/Contexts.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PQL/Contexts.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,250 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef CONTEXTS_H
21#define CONTEXTS_H
22
23#include "../PetriNet.h"
24#include "../Simplification/LPCache.h"
25#include "PQL.h"
26#include "../NetStructures.h"
27
28#include <string>
29#include <vector>
30#include <list>
31#include <map>
32#include <chrono>
33#include <glpk.h>
34
35namespace PetriEngine {
36 namespace PQL {
37
38 /** Context provided for context analysis */
39 class AnalysisContext {
40 protected:
41 const unordered_map<std::string, uint32_t>& _placeNames;
42 const unordered_map<std::string, uint32_t>& _transitionNames;
43 const PetriNet* _net;
44 std::vector<ExprError> _errors;
45 public:
46
47 /** A resolution result */
48 struct ResolutionResult {
49 /** Offset in relevant vector */
50 int offset;
51 /** True, if the resolution was successful */
52 bool success;
53 };
54
55 AnalysisContext(const std::unordered_map<std::string, uint32_t>& places, const std::unordered_map<std::string, uint32_t>& tnames, const PetriNet* net)
56 : _placeNames(places), _transitionNames(tnames), _net(net) {
57
58 }
59
60 virtual void setHasDeadlock(){};
61
62 const PetriNet* net() const
63 {
64 return _net;
65 }
66
67 /** Resolve an identifier */
68 virtual ResolutionResult resolve(const std::string& identifier, bool place = true);
69
70 /** Report error */
71 void reportError(const ExprError& error) {
72 _errors.push_back(error);
73 }
74
75 /** Get list of errors */
76 const std::vector<ExprError>& errors() const {
77 return _errors;
78 }
79 auto& allPlaceNames() const { return _placeNames; }
80 auto& allTransitionNames() const { return _transitionNames; }
81
82 };
83
84 class ColoredAnalysisContext : public AnalysisContext {
85 protected:
86 const std::unordered_map<std::string, std::unordered_map<uint32_t , std::string>>& _coloredPlaceNames;
87 const std::unordered_map<std::string, std::vector<std::string>>& _coloredTransitionNames;
88
89 bool _colored;
90
91 public:
92 ColoredAnalysisContext(const std::unordered_map<std::string, uint32_t>& places,
93 const std::unordered_map<std::string, uint32_t>& tnames,
94 const PetriNet* net,
95 const std::unordered_map<std::string, std::unordered_map<uint32_t , std::string>>& cplaces,
96 const std::unordered_map<std::string, std::vector<std::string>>& ctnames,
97 bool colored)
98 : AnalysisContext(places, tnames, net),
99 _coloredPlaceNames(cplaces),
100 _coloredTransitionNames(ctnames),
101 _colored(colored)
102 {}
103
104 bool resolvePlace(const std::string& place, std::unordered_map<uint32_t,std::string>& out);
105
106 bool resolveTransition(const std::string& transition, std::vector<std::string>& out);
107
108 bool isColored() const {
109 return _colored;
110 }
111 auto& allColoredPlaceNames() const { return _coloredPlaceNames; }
112 auto& allColoredTransitionNames() const { return _coloredTransitionNames; }
113 };
114
115 /** Context provided for evalation */
116 class EvaluationContext {
117 public:
118
119 /** Create evaluation context, this doesn't take ownership */
120 EvaluationContext(const MarkVal* marking,
121 const PetriNet* net) {
122 _marking = marking;
123 _net = net;
124 }
125
126 EvaluationContext() {};
127
128 const MarkVal* marking() const {
129 return _marking;
130 }
131
132 void setMarking(MarkVal* marking) {
133 _marking = marking;
134 }
135
136 const PetriNet* net() const {
137 return _net;
138 }
139 private:
140 const MarkVal* _marking = nullptr;
141 const PetriNet* _net = nullptr;
142 };
143
144 /** Context for distance computation */
145 class DistanceContext : public EvaluationContext {
146 public:
147
148 DistanceContext(const PetriNet* net,
149 const MarkVal* marking)
150 : EvaluationContext(marking, net) {
151 _negated = false;
152 }
153
154
155 void negate() {
156 _negated = !_negated;
157 }
158
159 bool negated() const {
160 return _negated;
161 }
162
163 private:
164 bool _negated;
165 };
166
167 /** Context for condition to TAPAAL export */
168 class TAPAALConditionExportContext {
169 public:
170 bool failed;
171 std::string netName;
172 };
173
174 class SimplificationContext {
175 public:
176
177 SimplificationContext(const MarkVal* marking,
178 const PetriNet* net, uint32_t queryTimeout, uint32_t lpTimeout,
179 LPCache* cache)
180 : _queryTimeout(queryTimeout), _lpTimeout(lpTimeout) {
181 _negated = false;
182 _marking = marking;
183 _net = net;
184 _base_lp = buildBase();
185 _start = std::chrono::high_resolution_clock::now();
186 _cache = cache;
187 }
188
189 virtual ~SimplificationContext() {
190 if(_base_lp != nullptr)
191 glp_delete_prob(_base_lp);
192 _base_lp = nullptr;
193 }
194
195
196 const MarkVal* marking() const {
197 return _marking;
198 }
199
200 const PetriNet* net() const {
201 return _net;
202 }
203
204 void negate() {
205 _negated = !_negated;
206 }
207
208 bool negated() const {
209 return _negated;
210 }
211
212 void setNegate(bool b){
213 _negated = b;
214 }
215
216 double getReductionTime();
217
218 bool timeout() const {
219 auto end = std::chrono::high_resolution_clock::now();
220 auto diff = std::chrono::duration_cast<std::chrono::seconds>(end - _start);
221 return (diff.count() >= _queryTimeout);
222 }
223
224 uint32_t getLpTimeout() const;
225
226 LPCache* cache() const
227 {
228 return _cache;
229 }
230
231
232 glp_prob* makeBaseLP() const;
233
234 private:
235 bool _negated;
236 const MarkVal* _marking;
237 const PetriNet* _net;
238 uint32_t _queryTimeout, _lpTimeout;
239 std::chrono::high_resolution_clock::time_point _start;
240 LPCache* _cache;
241 mutable glp_prob* _base_lp = nullptr;
242
243 glp_prob* buildBase() const;
244
245 };
246
247 } // PQL
248} // PetriEngine
249
250#endif // CONTEXTS_H
0251
=== added file 'include/PetriEngine/PQL/Expressions.h'
--- include/PetriEngine/PQL/Expressions.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PQL/Expressions.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,1221 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef EXPRESSIONS_H
21#define EXPRESSIONS_H
22
23
24#include <iostream>
25#include <fstream>
26#include <algorithm>
27#include "PQL.h"
28#include "Contexts.h"
29#include "..//Simplification/Member.h"
30#include "../Simplification/LinearPrograms.h"
31#include "../Simplification/Retval.h"
32
33using namespace PetriEngine::Simplification;
34
35namespace PetriEngine {
36 namespace PQL {
37
38 std::string generateTabs(uint32_t tabs);
39 class CompareCondition;
40 class NotCondition;
41 /******************** EXPRESSIONS ********************/
42
43 /** Base class for all binary expressions */
44 class NaryExpr : public Expr {
45 protected:
46 NaryExpr() {};
47 public:
48
49 NaryExpr(std::vector<Expr_ptr>&& exprs) : _exprs(std::move(exprs)) {
50 }
51 virtual void analyze(AnalysisContext& context) override;
52 int evaluate(const EvaluationContext& context) override;
53 int formulaSize() const override{
54 size_t sum = 0;
55 for(auto& e : _exprs) sum += e->formulaSize();
56 return sum + 1;
57 }
58 void toString(std::ostream&) const override;
59 bool placeFree() const override;
60 auto& expressions() const { return _exprs; }
61 protected:
62 virtual int apply(int v1, int v2) const = 0;
63 virtual std::string op() const = 0;
64 std::vector<Expr_ptr> _exprs;
65 virtual int32_t preOp(const EvaluationContext& context) const;
66 };
67
68 class PlusExpr;
69 class MultiplyExpr;
70
71 class CommutativeExpr : public NaryExpr
72 {
73 public:
74 friend CompareCondition;
75 virtual void analyze(AnalysisContext& context) override;
76 int evaluate(const EvaluationContext& context) override;
77 void toBinary(std::ostream&) const override;
78 int formulaSize() const override{
79 size_t sum = _ids.size();
80 for(auto& e : _exprs) sum += e->formulaSize();
81 return sum + 1;
82 }
83 void toString(std::ostream&) const override;
84 bool placeFree() const override;
85 auto constant() const { return _constant; }
86 auto& places() const { return _ids; }
87 protected:
88 CommutativeExpr(int constant): _constant(constant) {};
89 void init(std::vector<Expr_ptr>&& exprs);
90 virtual int32_t preOp(const EvaluationContext& context) const override;
91 int32_t _constant;
92 std::vector<std::pair<uint32_t,std::string>> _ids;
93 Member commutativeCons(int constant, SimplificationContext& context, std::function<void(Member& a, Member b)> op) const;
94 };
95
96 /** Binary plus expression */
97 class PlusExpr : public CommutativeExpr {
98 public:
99
100 PlusExpr(std::vector<Expr_ptr>&& exprs, bool tk = false);
101
102 Expr::Types type() const override;
103 Member constraint(SimplificationContext& context) const override;
104 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
105 bool tk = false;
106 void incr(ReducingSuccessorGenerator& generator) const override;
107 void decr(ReducingSuccessorGenerator& generator) const override;
108 void visit(Visitor& visitor) const override;
109 protected:
110 int apply(int v1, int v2) const override;
111 //int binaryOp() const;
112 std::string op() const override;
113 };
114
115 /** Binary minus expression */
116 class SubtractExpr : public NaryExpr {
117 public:
118
119 SubtractExpr(std::vector<Expr_ptr>&& exprs) : NaryExpr(std::move(exprs))
120 {
121 }
122 Expr::Types type() const override;
123 Member constraint(SimplificationContext& context) const override;
124 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
125 void incr(ReducingSuccessorGenerator& generator) const override;
126 void decr(ReducingSuccessorGenerator& generator) const override;
127 void toBinary(std::ostream&) const override;
128 void visit(Visitor& visitor) const override;
129 protected:
130 int apply(int v1, int v2) const override;
131 //int binaryOp() const;
132 std::string op() const override;
133 };
134
135 /** Binary multiplication expression **/
136 class MultiplyExpr : public CommutativeExpr {
137 public:
138
139 MultiplyExpr(std::vector<Expr_ptr>&& exprs);
140 Expr::Types type() const override;
141 Member constraint(SimplificationContext& context) const override;
142 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
143 void incr(ReducingSuccessorGenerator& generator) const override;
144 void decr(ReducingSuccessorGenerator& generator) const override;
145 void visit(Visitor& visitor) const override;
146 protected:
147 int apply(int v1, int v2) const override;
148 //int binaryOp() const;
149 std::string op() const override;
150 };
151
152 /** Unary minus expression*/
153 class MinusExpr : public Expr {
154 public:
155
156 MinusExpr(const Expr_ptr expr) {
157 _expr = expr;
158 }
159 void analyze(AnalysisContext& context) override;
160 int evaluate(const EvaluationContext& context) override;
161 void toString(std::ostream&) const override;
162 Expr::Types type() const override;
163 Member constraint(SimplificationContext& context) const override;
164 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
165 void toBinary(std::ostream&) const override;
166 void incr(ReducingSuccessorGenerator& generator) const override;
167 void decr(ReducingSuccessorGenerator& generator) const override;
168 void visit(Visitor& visitor) const override;
169 int formulaSize() const override{
170 return _expr->formulaSize() + 1;
171 }
172 bool placeFree() const override;
173 const Expr_ptr& operator[](size_t i) const { return _expr; };
174 private:
175 Expr_ptr _expr;
176 };
177
178 /** Literal integer value expression */
179 class LiteralExpr : public Expr {
180 public:
181
182 LiteralExpr(int value) : _value(value) {
183 }
184 void analyze(AnalysisContext& context) override;
185 int evaluate(const EvaluationContext& context) override;
186 void toString(std::ostream&) const override;
187 Expr::Types type() const override;
188 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
189 void toBinary(std::ostream&) const override;
190 void incr(ReducingSuccessorGenerator& generator) const override;
191 void decr(ReducingSuccessorGenerator& generator) const override;
192 void visit(Visitor& visitor) const override;
193 int formulaSize() const override{
194 return 1;
195 }
196 int value() const {
197 return _value;
198 };
199 Member constraint(SimplificationContext& context) const override;
200 bool placeFree() const override { return true; }
201 private:
202 int _value;
203 };
204
205
206 class IdentifierExpr : public Expr {
207 public:
208 IdentifierExpr(const std::string& name) : _name(name) {}
209 void analyze(AnalysisContext& context) override;
210 int evaluate(const EvaluationContext& context) override {
211 return _compiled->evaluate(context);
212 }
213 void toString(std::ostream& os) const override {
214 if(_compiled)
215 _compiled->toString(os);
216 else
217 os << _name;
218 }
219 Expr::Types type() const override {
220 if(_compiled) return _compiled->type();
221 return Expr::IdentifierExpr;
222 }
223 void toXML(std::ostream& os, uint32_t tabs, bool tokencount = false) const override {
224 _compiled->toXML(os, tabs, tokencount);
225 }
226 void incr(ReducingSuccessorGenerator& generator) const override {
227 _compiled->incr(generator);
228 }
229 void decr(ReducingSuccessorGenerator& generator) const override {
230 _compiled->decr(generator);
231 }
232 int formulaSize() const override {
233 if(_compiled) return _compiled->formulaSize();
234 return 1;
235 }
236 virtual bool placeFree() const override {
237 if(_compiled) return _compiled->placeFree();
238 return false;
239 }
240
241 Member constraint(SimplificationContext& context) const override {
242 return _compiled->constraint(context);
243 }
244
245 void toBinary(std::ostream& s) const override {
246 _compiled->toBinary(s);
247 }
248 void visit(Visitor& visitor) const override;
249 private:
250 std::string _name;
251 Expr_ptr _compiled;
252 };
253
254 /** Identifier expression */
255 class UnfoldedIdentifierExpr : public Expr {
256 public:
257 UnfoldedIdentifierExpr(const std::string& name, int offest)
258 : _offsetInMarking(offest), _name(name) {
259 }
260
261 UnfoldedIdentifierExpr(const std::string& name) : UnfoldedIdentifierExpr(name, -1) {
262 }
263
264 void analyze(AnalysisContext& context) override;
265 int evaluate(const EvaluationContext& context) override;
266 void toString(std::ostream&) const override;
267 Expr::Types type() const override;
268 void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const override;
269 void toBinary(std::ostream&) const override;
270 void incr(ReducingSuccessorGenerator& generator) const override;
271 void decr(ReducingSuccessorGenerator& generator) const override;
272 int formulaSize() const override{
273 return 1;
274 }
275 /** Offset in marking or valuation */
276 int offset() const {
277 return _offsetInMarking;
278 }
279 const std::string& name()
280 {
281 return _name;
282 }
283 Member constraint(SimplificationContext& context) const override;
284 bool placeFree() const override { return false; }
285 void visit(Visitor& visitor) const override;
286 private:
287 /** Offset in marking, -1 if undefined, should be resolved during analysis */
288 int _offsetInMarking;
289 /** Identifier text */
290 std::string _name;
291 };
292
293 class ShallowCondition : public Condition
294 {
295 Result evaluate(const EvaluationContext& context) override
296 { return _compiled->evaluate(context); }
297 Result evalAndSet(const EvaluationContext& context) override
298 { return _compiled->evalAndSet(context); }
299 uint32_t distance(DistanceContext& context) const override
300 { return _compiled->distance(context); }
301 void toTAPAALQuery(std::ostream& out,TAPAALConditionExportContext& context) const override
302 { _compiled->toTAPAALQuery(out, context); }
303 void toBinary(std::ostream& out) const override
304 { return _compiled->toBinary(out); }
305 Retval simplify(SimplificationContext& context) const override
306 { return _compiled->simplify(context); }
307 Condition_ptr prepareForReachability(bool negated) const override
308 { return _compiled->prepareForReachability(negated); }
309 bool isReachability(uint32_t depth) const override
310 { return _compiled->isReachability(depth); }
311
312 void toXML(std::ostream& out, uint32_t tabs) const override
313 { _compiled->toXML(out, tabs); }
314 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override
315 { _compiled->findInteresting(generator, negated);}
316 Quantifier getQuantifier() const override
317 { return _compiled->getQuantifier(); }
318 Path getPath() const override { return _compiled->getPath(); }
319 CTLType getQueryType() const override { return _compiled->getQueryType(); }
320 bool containsNext() const override { return _compiled->containsNext(); }
321 bool nestedDeadlock() const override { return _compiled->nestedDeadlock(); }
322#ifdef VERIFYPN_TAR
323 virtual z3::expr encodeSat(const PetriNet& net, z3::context& context, std::vector<int32_t>& uses, std::vector<bool>& incremented) const
324 { return _compiled->encodeSat(net, context, uses, incremented); }
325#endif
326 int formulaSize() const override{
327 return _compiled->formulaSize();
328 }
329
330 virtual Condition_ptr pushNegation(negstat_t& neg, const EvaluationContext& context, bool nested, bool negated, bool initrw) override
331 {
332 if(_compiled)
333 return _compiled->pushNegation(neg, context, nested, negated, initrw);
334 else {
335 if(negated)
336 return std::static_pointer_cast<Condition>(std::make_shared<NotCondition>(clone()));
337 else
338 return clone();
339 }
340 }
341
342 void analyze(AnalysisContext& context) override
343 {
344 if (_compiled) _compiled->analyze(context);
345 else _analyze(context);
346 }
347 void toString(std::ostream &out) const {
348 if (_compiled) _compiled->toString(out);
349 else _toString(out);
350 }
351
352 protected:
353 virtual void _analyze(AnalysisContext& context) = 0;
354 virtual void _toString(std::ostream& out) const = 0;
355 virtual Condition_ptr clone() = 0;
356 Condition_ptr _compiled = nullptr;
357 };
358
359 /* Not condition */
360 class NotCondition : public Condition {
361 public:
362
363 NotCondition(const Condition_ptr cond) {
364 _cond = cond;
365 _temporal = _cond->isTemporal();
366 _loop_sensitive = _cond->isLoopSensitive();
367 }
368 int formulaSize() const override{
369 return _cond->formulaSize() + 1;
370 }
371 void analyze(AnalysisContext& context) override;
372 Result evaluate(const EvaluationContext& context) override;
373 Result evalAndSet(const EvaluationContext& context) override;
374 void visit(Visitor&) const override;
375 uint32_t distance(DistanceContext& context) const override;
376 void toString(std::ostream&) const override;
377 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
378 Retval simplify(SimplificationContext& context) const override;
379 bool isReachability(uint32_t depth) const override;
380 Condition_ptr prepareForReachability(bool negated) const override;
381 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
382 void toXML(std::ostream&, uint32_t tabs) const override;
383 void toBinary(std::ostream&) const override;
384 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
385 Quantifier getQuantifier() const override { return Quantifier::NEG; }
386 Path getPath() const override { return Path::pError; }
387 CTLType getQueryType() const override { return CTLType::LOPERATOR; }
388 const Condition_ptr& operator[](size_t i) const { return _cond; };
389 virtual bool isTemporal() const override { return _temporal;}
390 bool containsNext() const override { return _cond->containsNext(); }
391 bool nestedDeadlock() const override { return _cond->nestedDeadlock(); }
392 private:
393 Condition_ptr _cond;
394 bool _temporal = false;
395 };
396
397
398 /******************** TEMPORAL OPERATORS ********************/
399
400 class QuantifierCondition : public Condition
401 {
402 public:
403 virtual bool isTemporal() const override { return true;}
404 CTLType getQueryType() const override { return CTLType::PATHQEURY; }
405 virtual const Condition_ptr& operator[] (size_t i) const = 0;
406 };
407
408 class SimpleQuantifierCondition : public QuantifierCondition {
409 public:
410 SimpleQuantifierCondition(const Condition_ptr cond) {
411 _cond = cond;
412 _loop_sensitive = cond->isLoopSensitive();
413 }
414 int formulaSize() const override{
415 return _cond->formulaSize() + 1;
416 }
417
418 void analyze(AnalysisContext& context) override;
419 Result evaluate(const EvaluationContext& context) override;
420 Result evalAndSet(const EvaluationContext& context) override;
421 void toString(std::ostream&) const override;
422 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
423 void toBinary(std::ostream& out) const override;
424 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
425 virtual const Condition_ptr& operator[] (size_t i) const override { return _cond;}
426 virtual bool containsNext() const override { return _cond->containsNext(); }
427 bool nestedDeadlock() const override { return _cond->nestedDeadlock(); }
428 private:
429 virtual std::string op() const = 0;
430
431 protected:
432 Condition_ptr _cond;
433 };
434
435 class EXCondition : public SimpleQuantifierCondition {
436 public:
437 using SimpleQuantifierCondition::SimpleQuantifierCondition;
438 Retval simplify(SimplificationContext& context) const override;
439 bool isReachability(uint32_t depth) const override;
440 Condition_ptr prepareForReachability(bool negated) const override;
441 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
442 void toXML(std::ostream&, uint32_t tabs) const override;
443 Quantifier getQuantifier() const override { return Quantifier::E; }
444 Path getPath() const override { return Path::X; }
445 uint32_t distance(DistanceContext& context) const override;
446 bool containsNext() const override { return true; }
447 virtual bool isLoopSensitive() const override { return true; }
448 void visit(Visitor&) const override;
449 private:
450 std::string op() const override;
451 };
452
453 class EGCondition : public SimpleQuantifierCondition {
454 public:
455 using SimpleQuantifierCondition::SimpleQuantifierCondition;
456
457 Retval simplify(SimplificationContext& context) const override;
458 bool isReachability(uint32_t depth) const override;
459 Condition_ptr prepareForReachability(bool negated) const override;
460 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
461 void toXML(std::ostream&, uint32_t tabs) const override;
462 Quantifier getQuantifier() const override { return Quantifier::E; }
463 Path getPath() const override { return Path::G; }
464 uint32_t distance(DistanceContext& context) const override;
465 Result evaluate(const EvaluationContext& context) override;
466 Result evalAndSet(const EvaluationContext& context) override;
467 virtual bool isLoopSensitive() const override { return true; }
468 void visit(Visitor&) const override;
469 private:
470 std::string op() const override;
471 };
472
473 class EFCondition : public SimpleQuantifierCondition {
474 public:
475 using SimpleQuantifierCondition::SimpleQuantifierCondition;
476
477 Retval simplify(SimplificationContext& context) const override;
478 bool isReachability(uint32_t depth) const override;
479 Condition_ptr prepareForReachability(bool negated) const override;
480 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
481 void toXML(std::ostream&, uint32_t tabs) const override;
482 Quantifier getQuantifier() const override { return Quantifier::E; }
483 Path getPath() const override { return Path::F; }
484 uint32_t distance(DistanceContext& context) const override;
485 Result evaluate(const EvaluationContext& context) override;
486 Result evalAndSet(const EvaluationContext& context) override;
487 void visit(Visitor&) const override;
488 private:
489 std::string op() const override;
490 };
491
492 class AXCondition : public SimpleQuantifierCondition {
493 public:
494 using SimpleQuantifierCondition::SimpleQuantifierCondition;
495 Retval simplify(SimplificationContext& context) const override;
496 bool isReachability(uint32_t depth) const override;
497 Condition_ptr prepareForReachability(bool negated) const override;
498 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
499 void toXML(std::ostream&, uint32_t tabs) const override;
500 Quantifier getQuantifier() const override { return Quantifier::A; }
501 Path getPath() const override { return Path::X; }
502 uint32_t distance(DistanceContext& context) const override;
503 bool containsNext() const override { return true; }
504 virtual bool isLoopSensitive() const override { return true; }
505 void visit(Visitor&) const override;
506 private:
507 std::string op() const override;
508 };
509
510 class AGCondition : public SimpleQuantifierCondition {
511 public:
512 using SimpleQuantifierCondition::SimpleQuantifierCondition;
513 Retval simplify(SimplificationContext& context) const override;
514 bool isReachability(uint32_t depth) const override;
515 Condition_ptr prepareForReachability(bool negated) const override;
516 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
517 void toXML(std::ostream&, uint32_t tabs) const override;
518 Quantifier getQuantifier() const override { return Quantifier::A; }
519 Path getPath() const override { return Path::G; }
520 uint32_t distance(DistanceContext& context) const override;
521 Result evaluate(const EvaluationContext& context) override;
522 Result evalAndSet(const EvaluationContext& context) override;
523 void visit(Visitor&) const override;
524 private:
525 std::string op() const override;
526 };
527
528 class AFCondition : public SimpleQuantifierCondition {
529 public:
530 using SimpleQuantifierCondition::SimpleQuantifierCondition;
531 Retval simplify(SimplificationContext& context) const override;
532 bool isReachability(uint32_t depth) const override;
533 Condition_ptr prepareForReachability(bool negated) const override;
534 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
535 void toXML(std::ostream&, uint32_t tabs) const override;
536 Quantifier getQuantifier() const override { return Quantifier::A; }
537 Path getPath() const override { return Path::F; }
538 uint32_t distance(DistanceContext& context) const override;
539 Result evaluate(const EvaluationContext& context) override;
540 Result evalAndSet(const EvaluationContext& context) override;
541 void visit(Visitor&) const override;
542 virtual bool isLoopSensitive() const override { return true; }
543 private:
544 std::string op() const override;
545 };
546
547 class UntilCondition : public QuantifierCondition {
548 public:
549 UntilCondition(const Condition_ptr cond1, const Condition_ptr cond2) {
550 _cond1 = cond1;
551 _cond2 = cond2;
552 _loop_sensitive = _cond1->isLoopSensitive() || _cond2->isLoopSensitive();
553 }
554 int formulaSize() const override{
555 return _cond1->formulaSize() + _cond2->formulaSize() + 1;
556 }
557
558 void analyze(AnalysisContext& context) override;
559 Result evaluate(const EvaluationContext& context) override;
560 void toString(std::ostream&) const override;
561 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
562 void toBinary(std::ostream& out) const override;
563 bool isReachability(uint32_t depth) const override;
564 Condition_ptr prepareForReachability(bool negated) const override;
565 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
566 Result evalAndSet(const EvaluationContext& context) override;
567
568 virtual const Condition_ptr& operator[] (size_t i) const override
569 { if(i == 0) return _cond1; return _cond2;}
570 Path getPath() const override
571 { return Path::U; }
572 bool containsNext() const override { return _cond1->containsNext() || _cond2->containsNext(); }
573 bool nestedDeadlock() const override { return _cond1->nestedDeadlock() || _cond2->nestedDeadlock(); }
574 private:
575 virtual std::string op() const = 0;
576
577 protected:
578 Condition_ptr _cond1;
579 Condition_ptr _cond2;
580 };
581
582 class EUCondition : public UntilCondition {
583 public:
584 using UntilCondition::UntilCondition;
585 Retval simplify(SimplificationContext& context) const override;
586 Quantifier getQuantifier() const override { return Quantifier::E; }
587 void visit(Visitor&) const override;
588 uint32_t distance(DistanceContext& context) const override;
589 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
590 void toXML(std::ostream&, uint32_t tabs) const override;
591
592 private:
593 std::string op() const override;
594 };
595
596 class AUCondition : public UntilCondition {
597 public:
598 using UntilCondition::UntilCondition;
599 Retval simplify(SimplificationContext& context) const override;
600 Quantifier getQuantifier() const override { return Quantifier::A; }
601 void visit(Visitor&) const override;
602 uint32_t distance(DistanceContext& context) const override;
603 void toXML(std::ostream&, uint32_t tabs) const override;
604 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
605 virtual bool isLoopSensitive() const override { return true; }
606 private:
607 std::string op() const override;
608 };
609
610 /******************** CONDITIONS ********************/
611
612 class UnfoldedFireableCondition : public ShallowCondition {
613 public:
614 UnfoldedFireableCondition(const std::string& tname) : ShallowCondition(), _name(tname) {};
615 Condition_ptr pushNegation(negstat_t& stat, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
616 void visit(Visitor&) const override;
617 protected:
618 void _analyze(AnalysisContext& context) override;
619 virtual void _toString(std::ostream& out) const;
620 Condition_ptr clone() { return std::make_shared<UnfoldedFireableCondition>(_name); }
621 private:
622 const std::string _name;
623 };
624
625 class FireableCondition : public ShallowCondition {
626 public:
627 FireableCondition(const std::string& tname) : _name(tname) {};
628 Condition_ptr pushNegation(negstat_t& stat, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
629 void visit(Visitor&) const override;
630 protected:
631 void _analyze(AnalysisContext& context) override;
632 virtual void _toString(std::ostream& out) const;
633 Condition_ptr clone() { return std::make_shared<FireableCondition>(_name); }
634 private:
635 const std::string _name;
636 };
637
638 /* Logical conditon */
639 class LogicalCondition : public Condition {
640 public:
641 int formulaSize() const override {
642 size_t i = 1;
643 for(auto& c : _conds) i += c->formulaSize();
644 return i;
645 }
646 void analyze(AnalysisContext& context) override;
647
648 uint32_t distance(DistanceContext& context) const override;
649 void toString(std::ostream&) const override;
650 void toBinary(std::ostream& out) const override;
651 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
652 bool isReachability(uint32_t depth) const override;
653 Condition_ptr prepareForReachability(bool negated) const override;
654 const Condition_ptr& operator[](size_t i) const
655 {
656 return _conds[i];
657 };
658 CTLType getQueryType() const override { return CTLType::LOPERATOR; }
659 Path getPath() const override { return Path::pError; }
660
661 bool isTemporal() const override
662 {
663 return _temporal;
664 }
665 auto begin() { return _conds.begin(); }
666 auto end() { return _conds.end(); }
667 auto begin() const { return _conds.begin(); }
668 auto end() const { return _conds.end(); }
669 bool empty() const { return _conds.size() == 0; }
670 bool singular() const { return _conds.size() == 1; }
671 size_t size() const { return _conds.size(); }
672 bool containsNext() const override
673 { return std::any_of(begin(), end(), [](auto& a){return a->containsNext();}); }
674 bool nestedDeadlock() const override;
675
676 protected:
677 LogicalCondition() {};
678 Retval simplifyOr(SimplificationContext& context) const;
679 Retval simplifyAnd(SimplificationContext& context) const;
680
681 private:
682 virtual uint32_t delta(uint32_t d1, uint32_t d2, const DistanceContext& context) const = 0;
683 virtual std::string op() const = 0;
684
685 protected:
686 bool _temporal = false;
687 std::vector<Condition_ptr> _conds;
688 };
689
690 /* Conjunctive and condition */
691 class AndCondition : public LogicalCondition {
692 public:
693
694 AndCondition(std::vector<Condition_ptr>&& conds);
695
696 AndCondition(const std::vector<Condition_ptr>& conds);
697
698 AndCondition(Condition_ptr left, Condition_ptr right);
699
700 Retval simplify(SimplificationContext& context) const override;
701 Result evaluate(const EvaluationContext& context) override;
702 Result evalAndSet(const EvaluationContext& context) override;
703 void visit(Visitor&) const override;
704 void toXML(std::ostream&, uint32_t tabs) const override;
705 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
706 Quantifier getQuantifier() const override { return Quantifier::AND; }
707 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
708 private:
709 //int logicalOp() const;
710 uint32_t delta(uint32_t d1, uint32_t d2, const DistanceContext& context) const override;
711 std::string op() const override;
712 };
713
714 /* Disjunctive or conditon */
715 class OrCondition : public LogicalCondition {
716 public:
717
718 OrCondition(std::vector<Condition_ptr>&& conds);
719
720 OrCondition(const std::vector<Condition_ptr>& conds);
721
722 OrCondition(Condition_ptr left, Condition_ptr right);
723
724 Retval simplify(SimplificationContext& context) const override;
725 Result evaluate(const EvaluationContext& context) override;
726 Result evalAndSet(const EvaluationContext& context) override;
727 void visit(Visitor&) const override;
728 void toXML(std::ostream&, uint32_t tabs) const override;
729 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
730 Quantifier getQuantifier() const override { return Quantifier::OR; }
731 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
732 private:
733 //int logicalOp() const;
734 uint32_t delta(uint32_t d1, uint32_t d2, const DistanceContext& context) const override;
735 std::string op() const override;
736 };
737
738 class CompareConjunction : public Condition
739 {
740 public:
741 struct cons_t {
742 int32_t _place = -1;
743 uint32_t _upper = std::numeric_limits<uint32_t>::max();
744 uint32_t _lower = 0;
745 std::string _name;
746 bool operator<(const cons_t& other) const
747 {
748 return _place < other._place;
749 }
750
751 void invert()
752 {
753 if(_lower == 0 && _upper == std::numeric_limits<uint32_t>::max())
754 return;
755 assert(_lower == 0 || _upper == std::numeric_limits<uint32_t>::max());
756 if(_lower == 0)
757 {
758 _lower = _upper + 1;
759 _upper = std::numeric_limits<uint32_t>::max();
760 }
761 else if(_upper == std::numeric_limits<uint32_t>::max())
762 {
763 _upper = _lower - 1;
764 _lower = 0;
765 }
766 else
767 {
768 assert(false);
769 }
770 }
771
772 void intersect(const cons_t& other)
773 {
774 _lower = std::max(_lower, other._lower);
775 _upper = std::min(_upper, other._upper);
776 }
777 };
778
779 CompareConjunction(bool negated = false)
780 : _negated(false) {};
781 friend FireableCondition;
782 CompareConjunction(const std::vector<cons_t>&& cons, bool negated)
783 : _constraints(cons), _negated(negated) {};
784 CompareConjunction(const std::vector<Condition_ptr>&, bool negated);
785 CompareConjunction(const CompareConjunction& other, bool negated = false)
786 : _constraints(other._constraints), _negated(other._negated != negated)
787 {
788 };
789
790 void merge(const CompareConjunction& other);
791 void merge(const std::vector<Condition_ptr>&, bool negated);
792
793 int formulaSize() const override{
794 int sum = 0;
795 for(auto& c : _constraints)
796 {
797 assert(c._place >= 0);
798 if(c._lower == c._upper) ++sum;
799 else {
800 if(c._lower != 0) ++sum;
801 if(c._upper != std::numeric_limits<uint32_t>::max()) ++sum;
802 }
803 }
804 if(sum == 1) return 2;
805 else return (sum*2) + 1;
806 }
807 void analyze(AnalysisContext& context) override;
808 uint32_t distance(DistanceContext& context) const override;
809 void toString(std::ostream& stream) const override;
810 void toTAPAALQuery(std::ostream& stream,TAPAALConditionExportContext& context) const override;
811 void toBinary(std::ostream& out) const override;
812 bool isReachability(uint32_t depth) const override { return depth > 0; };
813 Condition_ptr prepareForReachability(bool negated) const override;
814 CTLType getQueryType() const override { return CTLType::LOPERATOR; }
815 Path getPath() const override { return Path::pError; }
816 virtual void toXML(std::ostream& stream, uint32_t tabs) const override;
817 Retval simplify(SimplificationContext& context) const override;
818 Result evaluate(const EvaluationContext& context) override;
819 Result evalAndSet(const EvaluationContext& context) override;
820 void visit(Visitor&) const override;
821 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
822 Quantifier getQuantifier() const override { return _negated ? Quantifier::OR : Quantifier::AND; }
823 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
824 bool isNegated() const { return _negated; }
825 bool singular() const
826 {
827 return _constraints.size() == 1 &&
828 (_constraints[0]._lower == 0 ||
829 _constraints[0]._upper == std::numeric_limits<uint32_t>::max());
830 };
831 bool containsNext() const override { return false;}
832 bool nestedDeadlock() const override { return false; }
833 const std::vector<cons_t>& constraints() const { return _constraints; }
834 std::vector<cons_t>::const_iterator begin() const { return _constraints.begin(); }
835 std::vector<cons_t>::const_iterator end() const { return _constraints.end(); }
836 private:
837 std::vector<cons_t> _constraints;
838 bool _negated = false;
839 };
840
841
842 /* Comparison conditon */
843 class CompareCondition : public Condition {
844 public:
845
846 CompareCondition(const Expr_ptr expr1, const Expr_ptr expr2)
847 : _expr1(expr1), _expr2(expr2) {}
848
849 int formulaSize() const override{
850 return _expr1->formulaSize() + _expr2->formulaSize() + 1;
851 }
852 void analyze(AnalysisContext& context) override;
853 Result evaluate(const EvaluationContext& context) override;
854 Result evalAndSet(const EvaluationContext& context) override;
855 void toString(std::ostream&) const override;
856 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
857 void toBinary(std::ostream& out) const override;
858 bool isReachability(uint32_t depth) const override;
859 Condition_ptr prepareForReachability(bool negated) const override;
860 Quantifier getQuantifier() const override { return Quantifier::EMPTY; }
861 Path getPath() const override { return Path::pError; }
862 CTLType getQueryType() const override { return CTLType::EVAL; }
863 const Expr_ptr& operator[](uint32_t id) const
864 {
865 if(id == 0) return _expr1;
866 else return _expr2;
867 }
868 bool containsNext() const override { return false; }
869 bool nestedDeadlock() const override { return false; }
870 bool isTrivial() const;
871 protected:
872 uint32_t _distance(DistanceContext& c,
873 std::function<uint32_t(uint32_t, uint32_t, bool)> d) const
874 {
875 return d(_expr1->evaluate(c), _expr2->evaluate(c), c.negated());
876 }
877 private:
878 virtual bool apply(int v1, int v2) const = 0;
879 virtual std::string op() const = 0;
880 /** Operator when exported to TAPAAL */
881 virtual std::string opTAPAAL() const = 0;
882 /** Swapped operator when exported to TAPAAL, e.g. operator when operands are swapped */
883 virtual std::string sopTAPAAL() const = 0;
884
885 protected:
886 Expr_ptr _expr1;
887 Expr_ptr _expr2;
888 };
889
890 /* delta */
891 template<typename T>
892 uint32_t delta(int v1, int v2, bool negated)
893 { return 0; }
894
895 class EqualCondition : public CompareCondition {
896 public:
897
898 using CompareCondition::CompareCondition;
899 Retval simplify(SimplificationContext& context) const override;
900 void toXML(std::ostream&, uint32_t tabs) const override;
901 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
902 uint32_t distance(DistanceContext& context) const override;
903 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
904 void visit(Visitor&) const override;
905 private:
906 bool apply(int v1, int v2) const override;
907 std::string op() const override;
908 std::string opTAPAAL() const override;
909 std::string sopTAPAAL() const override;
910 };
911
912 /* None equality conditon */
913 class NotEqualCondition : public CompareCondition {
914 public:
915
916 using CompareCondition::CompareCondition;
917 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
918 Retval simplify(SimplificationContext& context) const override;
919 void toXML(std::ostream&, uint32_t tabs) const override;
920 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
921 uint32_t distance(DistanceContext& context) const override;
922 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
923 void visit(Visitor&) const override;
924 private:
925 bool apply(int v1, int v2) const override;
926 std::string op() const override;
927 std::string opTAPAAL() const override;
928 std::string sopTAPAAL() const override;
929 };
930
931 /* Less-than conditon */
932 class LessThanCondition : public CompareCondition {
933 public:
934
935 using CompareCondition::CompareCondition;
936 Retval simplify(SimplificationContext& context) const override;
937 void toXML(std::ostream&, uint32_t tabs) const override;
938 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
939 uint32_t distance(DistanceContext& context) const override;
940 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
941 void visit(Visitor&) const override;
942 private:
943 bool apply(int v1, int v2) const override;
944 std::string op() const override;
945 std::string opTAPAAL() const override;
946 std::string sopTAPAAL() const override;
947 };
948
949 /* Less-than-or-equal conditon */
950 class LessThanOrEqualCondition : public CompareCondition {
951 public:
952
953 using CompareCondition::CompareCondition;
954 Retval simplify(SimplificationContext& context) const override;
955 void toXML(std::ostream&, uint32_t tabs) const override;
956 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
957 uint32_t distance(DistanceContext& context) const override;
958 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
959 void visit(Visitor&) const override;
960 private:
961 bool apply(int v1, int v2) const override;
962 std::string op() const override;
963 std::string opTAPAAL() const override;
964 std::string sopTAPAAL() const override;
965 };
966
967 /* Greater-than conditon */
968 class GreaterThanCondition : public CompareCondition {
969 public:
970
971 using CompareCondition::CompareCondition;
972 Retval simplify(SimplificationContext& context) const override;
973 void toXML(std::ostream&, uint32_t tabs) const override;
974 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
975 uint32_t distance(DistanceContext& context) const override;
976 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
977 void visit(Visitor&) const override;
978 private:
979 bool apply(int v1, int v2) const override;
980 std::string op() const override;
981 std::string opTAPAAL() const override;
982 std::string sopTAPAAL() const override;
983 };
984
985 /* Greater-than-or-equal conditon */
986 class GreaterThanOrEqualCondition : public CompareCondition {
987 public:
988 using CompareCondition::CompareCondition;
989 Retval simplify(SimplificationContext& context) const override;
990 void toXML(std::ostream&, uint32_t tabs) const override;
991 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
992 uint32_t distance(DistanceContext& context) const override;
993 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
994 void visit(Visitor&) const override;
995 private:
996 bool apply(int v1, int v2) const override;
997 std::string op() const override;
998 std::string opTAPAAL() const override;
999 std::string sopTAPAAL() const override;
1000 };
1001
1002 /* Bool condition */
1003 class BooleanCondition : public Condition {
1004 public:
1005
1006 BooleanCondition(bool value) : _value(value) {
1007 if (value) {
1008 trivial = 1;
1009 } else {
1010 trivial = 2;
1011 }
1012 }
1013 int formulaSize() const override{
1014 return 0;
1015 }
1016 void analyze(AnalysisContext& context) override;
1017 Result evaluate(const EvaluationContext& context) override;
1018 Result evalAndSet(const EvaluationContext& context) override;
1019 void visit(Visitor&) const override;
1020 uint32_t distance(DistanceContext& context) const override;
1021 static Condition_ptr TRUE_CONSTANT;
1022 static Condition_ptr FALSE_CONSTANT;
1023 void toString(std::ostream&) const override;
1024 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
1025 static Condition_ptr getShared(bool val);
1026 Retval simplify(SimplificationContext& context) const override;
1027 bool isReachability(uint32_t depth) const override;
1028 Condition_ptr prepareForReachability(bool negated) const override;
1029 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
1030 void toXML(std::ostream&, uint32_t tabs) const override;
1031 void toBinary(std::ostream&) const override;
1032 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
1033 Quantifier getQuantifier() const override { return Quantifier::EMPTY; }
1034 Path getPath() const override { return Path::pError; }
1035 CTLType getQueryType() const override { return CTLType::EVAL; }
1036 bool containsNext() const override { return false; }
1037 bool nestedDeadlock() const override { return false; }
1038 private:
1039 const bool _value;
1040 };
1041
1042 /* Deadlock condition */
1043 class DeadlockCondition : public Condition {
1044 public:
1045
1046 DeadlockCondition() {
1047 _loop_sensitive = true;
1048 }
1049 int formulaSize() const override{
1050 return 1;
1051 }
1052 void analyze(AnalysisContext& context) override;
1053 Result evaluate(const EvaluationContext& context) override;
1054 Result evalAndSet(const EvaluationContext& context) override;
1055 void visit(Visitor&) const override;
1056 uint32_t distance(DistanceContext& context) const override;
1057 void toString(std::ostream&) const override;
1058 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
1059 Retval simplify(SimplificationContext& context) const override;
1060 bool isReachability(uint32_t depth) const override;
1061 Condition_ptr prepareForReachability(bool negated) const override;
1062 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
1063 void toXML(std::ostream&, uint32_t tabs) const override;
1064 void toBinary(std::ostream&) const override;
1065 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
1066 static Condition_ptr DEADLOCK;
1067 Quantifier getQuantifier() const override { return Quantifier::DEADLOCK; }
1068 Path getPath() const override { return Path::pError; }
1069 CTLType getQueryType() const override { return CTLType::EVAL; }
1070 bool containsNext() const override { return false; }
1071 bool nestedDeadlock() const override { return false; }
1072 };
1073
1074 class KSafeCondition : public ShallowCondition
1075 {
1076 public:
1077 KSafeCondition(const Expr_ptr& expr1) : _bound(expr1)
1078 {}
1079
1080 protected:
1081 void _analyze(AnalysisContext& context) override;
1082 void _toString(std::ostream& out) const override;
1083 void visit(Visitor&) const override;
1084 Condition_ptr clone() override
1085 {
1086 return std::make_shared<KSafeCondition>(_bound);
1087 }
1088 private:
1089 Expr_ptr _bound = nullptr;
1090 };
1091
1092 class LivenessCondition : public ShallowCondition
1093 {
1094 public:
1095 LivenessCondition() {}
1096 protected:
1097 void _analyze(AnalysisContext& context) override;
1098 void _toString(std::ostream& out) const override;
1099 void visit(Visitor&) const override;
1100 Condition_ptr clone() override { return std::make_shared<LivenessCondition>(); }
1101 };
1102
1103 class QuasiLivenessCondition : public ShallowCondition
1104 {
1105 public:
1106 QuasiLivenessCondition() {}
1107 protected:
1108 void _analyze(AnalysisContext& context) override;
1109 void _toString(std::ostream& out) const override;
1110 void visit(Visitor&) const override;
1111 Condition_ptr clone() override { return std::make_shared<QuasiLivenessCondition>(); }
1112 };
1113
1114 class StableMarkingCondition : public ShallowCondition
1115 {
1116 public:
1117 StableMarkingCondition() {}
1118 protected:
1119 void _analyze(AnalysisContext& context) override;
1120 void _toString(std::ostream& out) const override;
1121 void visit(Visitor&) const override;
1122 Condition_ptr clone() override { return std::make_shared<StableMarkingCondition>(); }
1123 };
1124
1125 class UpperBoundsCondition : public ShallowCondition
1126 {
1127 public:
1128
1129 UpperBoundsCondition(const std::vector<std::string>& places) : _places(places)
1130 {}
1131 protected:
1132 void _toString(std::ostream& out) const override;
1133 void _analyze(AnalysisContext& context) override;
1134 void visit(Visitor&) const override;
1135 Condition_ptr clone() override
1136 {
1137 return std::make_shared<UpperBoundsCondition>(_places);
1138 }
1139
1140 private:
1141 std::vector<std::string> _places;
1142 };
1143
1144 class UnfoldedUpperBoundsCondition : public Condition
1145 {
1146 public:
1147 struct place_t {
1148 std::string _name;
1149 uint32_t _place = 0;
1150 double _max = std::numeric_limits<double>::infinity();
1151 bool _maxed_out = false;
1152 place_t(const std::string& name)
1153 {
1154 _name = name;
1155 }
1156 place_t(const place_t& other, double max)
1157 {
1158 _name = other._name;
1159 _place = other._place;
1160 _max = max;
1161 }
1162 bool operator<(const place_t& other) const{
1163 return _place < other._place;
1164 }
1165 };
1166
1167 UnfoldedUpperBoundsCondition(const std::vector<std::string>& places)
1168 {
1169 for(auto& s : places) _places.push_back(s);
1170 }
1171 UnfoldedUpperBoundsCondition(const std::vector<place_t>& places, double max, double offset)
1172 : _places(places), _max(max), _offset(offset) {
1173 };
1174 int formulaSize() const override{
1175 return _places.size();
1176 }
1177 void analyze(AnalysisContext& context) override;
1178 size_t value(const MarkVal*);
1179 Result evaluate(const EvaluationContext& context) override;
1180 Result evalAndSet(const EvaluationContext& context) override;
1181 void visit(Visitor&) const override;
1182 uint32_t distance(DistanceContext& context) const override;
1183 void toString(std::ostream&) const override;
1184 void toTAPAALQuery(std::ostream&,TAPAALConditionExportContext& context) const override;
1185 void toBinary(std::ostream&) const override;
1186 Retval simplify(SimplificationContext& context) const override;
1187 bool isReachability(uint32_t depth) const override;
1188 Condition_ptr prepareForReachability(bool negated) const override;
1189 Condition_ptr pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated, bool initrw) override;
1190 void toXML(std::ostream&, uint32_t tabs) const override;
1191 void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const override;
1192 Quantifier getQuantifier() const override { return Quantifier::UPPERBOUNDS; }
1193 Path getPath() const override { return Path::pError; }
1194 CTLType getQueryType() const override { return CTLType::EVAL; }
1195 bool containsNext() const override { return false; }
1196 bool nestedDeadlock() const override { return false; }
1197
1198 double bounds(bool add_offset = true) const {
1199 return (add_offset ? _offset : 0 ) + _bound;
1200 }
1201
1202 virtual void setUpperBound(size_t bound)
1203 {
1204 _bound = std::max(_bound, bound);
1205 }
1206
1207 const std::vector<place_t>& places() const { return _places; }
1208
1209 private:
1210 std::vector<place_t> _places;
1211 size_t _bound = 0;
1212 double _max = std::numeric_limits<double>::infinity();
1213 double _offset = 0;
1214 };
1215
1216 }
1217}
1218
1219
1220
1221#endif // EXPRESSIONS_H
01222
=== added file 'include/PetriEngine/PQL/PQL.h'
--- include/PetriEngine/PQL/PQL.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PQL/PQL.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,285 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef PQL_H
20#define PQL_H
21#include <string>
22#include <list>
23#include <vector>
24#include <algorithm>
25#include <unordered_map>
26#include <memory>
27
28#include "../PetriNet.h"
29#include "../Structures/State.h"
30#include "../ReducingSuccessorGenerator.h"
31#include "../Simplification/LPCache.h"
32
33namespace PetriEngine {
34 class ReducingSuccessorGenerator;
35 namespace Simplification
36 {
37 class Member;
38 struct Retval;
39 }
40 namespace PQL {
41 class Visitor;
42
43 enum CTLType {PATHQEURY = 1, LOPERATOR = 2, EVAL = 3, TYPE_ERROR = -1};
44 enum Quantifier { AND = 1, OR = 2, A = 3, E = 4, NEG = 5, COMPCONJ = 6, DEADLOCK = 7, UPPERBOUNDS = 8, PN_BOOLEAN = 9, EMPTY = -1 };
45 enum Path { G = 1, X = 2, F = 3, U = 4, pError = -1 };
46
47
48 class AnalysisContext;
49 class EvaluationContext;
50 class DistanceContext;
51 class TAPAALConditionExportContext;
52 class SimplificationContext;
53
54 /** Representation of a PQL error */
55 class ExprError {
56 std::string _text;
57 int _length;
58 public:
59
60 ExprError(std::string text = "", int length = 0) {
61 _text = text;
62 _length = length;
63 }
64
65 /** Human readable explaination of the error */
66 const std::string& text() const {
67 return _text;
68 }
69
70 /** length in the source, 0 if not applicable */
71 int length() const {
72 return _length;
73 }
74
75 /** Convert error to string */
76 std::string toString() const {
77 return "Parsing error \"" + text() + "\"";
78 }
79
80 /** True, if this is a default created ExprError without any information */
81 bool isEmpty() const {
82 return _text.empty() && _length == 0;
83 }
84 };
85
86 /** Representation of an expression */
87 class Expr {
88 int _eval = 0;
89 public:
90 /** Types of expressions */
91 enum Types {
92 /** Binary addition expression */
93 PlusExpr,
94 /** Binary subtraction expression */
95 SubtractExpr,
96 /** Binary multiplication expression */
97 MultiplyExpr,
98 /** Unary minus expression */
99 MinusExpr,
100 /** Literal integer expression */
101 LiteralExpr,
102 /** Identifier expression */
103 IdentifierExpr
104 };
105 public:
106 /** Virtual destructor, an expression should know it subexpressions */
107 virtual ~Expr();
108 /** Perform context analysis */
109 virtual void analyze(AnalysisContext& context) = 0;
110 /** Evaluate the expression given marking and assignment */
111 virtual int evaluate(const EvaluationContext& context) = 0;
112 int evalAndSet(const EvaluationContext& context);
113 virtual void visit(Visitor& visitor) const = 0;
114 /** Convert expression to string */
115 virtual void toString(std::ostream&) const = 0;
116 /** Expression type */
117 virtual Types type() const = 0;
118 /** Construct left/right side of equations used in query simplification */
119 virtual Simplification::Member constraint(SimplificationContext& context) const = 0;
120 /** Output the expression as it currently is to a file in XML */
121 virtual void toXML(std::ostream&, uint32_t tabs, bool tokencount = false) const = 0;
122 virtual void toBinary(std::ostream&) const = 0;
123 /** Stubborn reduction: increasing and decreasing sets */
124 virtual void incr(ReducingSuccessorGenerator& generator) const = 0;
125 virtual void decr(ReducingSuccessorGenerator& generator) const = 0;
126 /** Count size of the entire formula in number of nodes */
127 virtual int formulaSize() const = 0;
128
129 virtual bool placeFree() const = 0;
130
131 void setEval(int eval) {
132 _eval = eval;
133 }
134
135 int getEval() const {
136 return _eval;
137 }
138 };
139/******************* NEGATION PUSH STATS *******************/
140
141 struct negstat_t
142 {
143 negstat_t()
144 {
145 for(size_t i = 0; i < 31; ++i) _used[i] = 0;
146 }
147 void print(std::ostream& stream)
148 {
149 for(size_t i = 0; i < 31; ++i) stream << _used[i] << ",";
150 }
151 void printRules(std::ostream& stream)
152 {
153 for(size_t i = 0; i < 31; ++i) stream << _rulename[i] << ",";
154 }
155 int _used[31];
156 const std::vector<const char*> _rulename = {
157 "EG p-> !EF !p",
158 "AG p-> !AF !p",
159 "!EX p -> AX p",
160 "EX false -> false",
161 "EX true -> !deadlock",
162 "!AX p -> EX p",
163 "AX false -> deadlock",
164 "AX true -> true",
165 "EF !deadlock -> !deadlock",
166 "EF EF p -> EF p",
167 "EF AF p -> AF p",
168 "EF E p U q -> EF q",
169 "EF A p U q -> EF q",
170 "EF .. or .. -> EF .. or EF ..",
171 "AF !deadlock -> !deadlock",
172 "AF AF p -> AF p",
173 "AF EF p -> EF p",
174 "AF .. or EF p -> EF p or AF ..",
175 "AF A p U q -> AF q",
176 "A p U !deadlock -> !deadlock",
177 "A deadlock U q -> q",
178 "A !deadlock U q -> AF q",
179 "A p U AF q -> AF q",
180 "A p U EF q -> EF q",
181 "A p U .. or EF q -> EF q or A p U ..",
182 "E p U !deadlock -> !deadlock",
183 "E deadlock U q -> q",
184 "E !deadlock U q -> EF q",
185 "E p U EF q -> EF q",
186 "E p U .. or EF q -> EF q or E p U ..",
187 "!! p -> p"
188
189 };
190 int& operator[](size_t i) { return _used[i]; }
191 bool negated_fireability = false;
192 };
193
194 /** Base condition */
195 class Condition {
196 public:
197 enum Result {RUNKNOWN=-1,RFALSE=0,RTRUE=1};
198 private:
199 bool _inv = false;
200 Result _eval = RUNKNOWN;
201 protected:
202 bool _loop_sensitive = false;
203 public:
204 /** Virtual destructor */
205 virtual ~Condition();
206 /** Perform context analysis */
207 virtual void analyze(AnalysisContext& context) = 0;
208 /** Evaluate condition */
209 virtual Result evaluate(const EvaluationContext& context) = 0;
210 virtual Result evalAndSet(const EvaluationContext& context) = 0;
211 virtual void visit(Visitor& visitor) const = 0;
212
213 /** Convert condition to string */
214 virtual void toString(std::ostream&) const = 0;
215 /** Export condition to TAPAAL query (add EF manually!) */
216 virtual void toTAPAALQuery(std::ostream&, TAPAALConditionExportContext& context) const = 0;
217 /** Get distance to query */
218 virtual uint32_t distance(DistanceContext& context) const = 0;
219 /** Query Simplification */
220 virtual Simplification::Retval simplify(SimplificationContext& context) const = 0;
221 /** Check if query is a reachability query */
222 virtual bool isReachability(uint32_t depth = 0) const = 0;
223
224 virtual bool isLoopSensitive() const { return _loop_sensitive; };
225 /** Prepare reachability queries */
226 virtual std::shared_ptr<Condition> prepareForReachability(bool negated = false) const = 0;
227 virtual std::shared_ptr<Condition> pushNegation(negstat_t&, const EvaluationContext& context, bool nested, bool negated = false, bool initrw = true) = 0;
228
229 /** Output the condition as it currently is to a file in XML */
230 virtual void toXML(std::ostream&, uint32_t tabs) const = 0;
231 virtual void toBinary(std::ostream& out) const = 0;
232
233 /** Find interesting transitions in stubborn reduction*/
234 virtual void findInteresting(ReducingSuccessorGenerator& generator, bool negated) const = 0;
235 /** Checks if the condition is trivially true */
236 bool isTriviallyTrue();
237 /*** Checks if the condition is trivially false */
238 bool isTriviallyFalse();
239 /** Count size of the entire formula in number of nodes */
240 virtual int formulaSize() const = 0;
241
242 bool isSatisfied() const
243 {
244 return _eval == RTRUE;
245 }
246
247 void setSatisfied(bool isSatisfied)
248 {
249 _eval = isSatisfied ? RTRUE : RFALSE;
250 }
251
252 void setSatisfied(Result isSatisfied)
253 {
254 _eval = isSatisfied;
255 }
256
257 void setInvariant(bool isInvariant)
258 {
259 _inv = isInvariant;
260 }
261
262 bool isInvariant()
263 {
264 return _inv;
265 }
266
267 virtual bool isTemporal() const { return false;}
268 virtual CTLType getQueryType() const = 0;
269 virtual Quantifier getQuantifier() const = 0;
270 virtual Path getPath() const = 0;
271 static std::shared_ptr<Condition>
272 initialMarkingRW(const std::function<std::shared_ptr<Condition> ()>& func, negstat_t& stats, const EvaluationContext& context, bool nested, bool negated, bool initrw);
273 virtual bool containsNext() const = 0;
274 virtual bool nestedDeadlock() const = 0;
275 protected:
276 //Value for checking if condition is trivially true or false.
277 //0 is undecided (default), 1 is true, 2 is false.
278 uint32_t trivial = 0;
279 };
280 typedef std::shared_ptr<Condition> Condition_ptr;
281 typedef std::shared_ptr<Expr> Expr_ptr;
282 } // PQL
283} // PetriEngine
284
285#endif // PQL_H
0286
=== added file 'include/PetriEngine/PQL/PQLParser.h'
--- include/PetriEngine/PQL/PQLParser.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PQL/PQLParser.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,34 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef PQLPARSER_H
20#define PQLPARSER_H
21
22#include <string>
23#include <memory>
24#include <vector>
25
26namespace PetriEngine {
27 namespace PQL {
28
29 class Condition;
30
31 std::shared_ptr<Condition> ParseQuery(const std::string& queryString, std::vector<std::string>& placenameforbound);
32 }
33}
34#endif // PQLPARSER_H
035
=== added file 'include/PetriEngine/PQL/Visitor.h'
--- include/PetriEngine/PQL/Visitor.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PQL/Visitor.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,101 @@
1/*
2 * Copyright Peter G. Jensen, all rights reserved.
3 */
4
5/*
6 * File: Visitor.h
7 * Author: Peter G. Jensen <root@petergjoel.dk>
8 *
9 * Created on April 11, 2020, 1:07 PM
10 */
11
12#ifndef VISITOR_H
13#define VISITOR_H
14
15#include "PetriEngine/PQL/Expressions.h"
16#include <type_traits>
17
18namespace PetriEngine
19{
20 namespace PQL
21 {
22 class Visitor {
23 public:
24 Visitor() {}
25
26 template<typename T>
27 void accept(T element)
28 {
29 _accept(element);
30 }
31
32 protected:
33
34 virtual void _accept(const NotCondition* element) = 0;
35 virtual void _accept(const AndCondition* element) = 0;
36 virtual void _accept(const OrCondition* element) = 0;
37 virtual void _accept(const LessThanCondition* element) = 0;
38 virtual void _accept(const LessThanOrEqualCondition* element) = 0;
39 virtual void _accept(const GreaterThanCondition* element) = 0;
40 virtual void _accept(const GreaterThanOrEqualCondition* element) = 0;
41 virtual void _accept(const EqualCondition* element) = 0;
42 virtual void _accept(const NotEqualCondition* element) = 0;
43
44 virtual void _accept(const DeadlockCondition* element) = 0;
45 virtual void _accept(const CompareConjunction* element) = 0;
46 virtual void _accept(const UnfoldedUpperBoundsCondition* element) = 0;
47
48 // Quantifiers, most uses of the visitor will not use the quantifiers - so we give a default implementation.
49 // default behaviour is error
50 virtual void _accept(const EFCondition*)
51 { assert(false); std::cerr << "No accept for EFCondition" << std::endl; exit(0);};
52 virtual void _accept(const EGCondition*)
53 { assert(false); std::cerr << "No accept for EGCondition" << std::endl; exit(0);};
54 virtual void _accept(const AGCondition*)
55 { assert(false); std::cerr << "No accept for AGCondition" << std::endl; exit(0);};
56 virtual void _accept(const AFCondition*)
57 { assert(false); std::cerr << "No accept for AFCondition" << std::endl; exit(0);};
58 virtual void _accept(const EXCondition*)
59 { assert(false); std::cerr << "No accept for EXCondition" << std::endl; exit(0);};
60 virtual void _accept(const AXCondition*)
61 { assert(false); std::cerr << "No accept for AXCondition" << std::endl; exit(0);};
62 virtual void _accept(const EUCondition*)
63 { assert(false); std::cerr << "No accept for EUCondition" << std::endl; exit(0);};
64 virtual void _accept(const AUCondition*)
65 { assert(false); std::cerr << "No accept for AUCondition" << std::endl; exit(0);};
66
67 // shallow elements, neither of these should exist in a compiled expression
68 virtual void _accept(const UnfoldedFireableCondition* element)
69 { assert(false); std::cerr << "No accept for UnfoldedFireableCondition" << std::endl; exit(0);};
70 virtual void _accept(const FireableCondition* element)
71 { assert(false); std::cerr << "No accept for FireableCondition" << std::endl; exit(0);};
72 virtual void _accept(const UpperBoundsCondition* element)
73 { assert(false); std::cerr << "No accept for UpperBoundsCondition" << std::endl; exit(0);};
74 virtual void _accept(const LivenessCondition* element)
75 { assert(false); std::cerr << "No accept for LivenessCondition" << std::endl; exit(0);};
76 virtual void _accept(const KSafeCondition* element)
77 { assert(false); std::cerr << "No accept for KSafeCondition" << std::endl; exit(0);};
78 virtual void _accept(const QuasiLivenessCondition* element)
79 { assert(false); std::cerr << "No accept for QuasiLivenessCondition" << std::endl; exit(0);};
80 virtual void _accept(const StableMarkingCondition* element)
81 { assert(false); std::cerr << "No accept for StableMarkingCondition" << std::endl; exit(0);};
82 virtual void _accept(const BooleanCondition* element)
83 { assert(false); std::cerr << "No accept for BooleanCondition" << std::endl; exit(0);};
84
85 // Expression
86 virtual void _accept(const UnfoldedIdentifierExpr* element) = 0;
87 virtual void _accept(const LiteralExpr* element) = 0;
88 virtual void _accept(const PlusExpr* element) = 0;
89 virtual void _accept(const MultiplyExpr* element) = 0;
90 virtual void _accept(const MinusExpr* element) = 0;
91 virtual void _accept(const SubtractExpr* element) = 0;
92
93 // shallow expression, default to error
94 virtual void _accept(const IdentifierExpr* element)
95 { assert(false); std::cerr << "No accept for IdentifierExpr" << std::endl; exit(0);};
96 };
97 }
98}
99
100#endif /* VISITOR_H */
101
0102
=== added file 'include/PetriEngine/PetriNet.h'
--- include/PetriEngine/PetriNet.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PetriNet.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,136 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef PETRINET_H
21#define PETRINET_H
22
23#include <string>
24#include <vector>
25#include <climits>
26#include <limits>
27#include <iostream>
28
29namespace PetriEngine {
30
31 namespace PQL {
32 class Condition;
33 }
34
35 namespace Structures {
36 class State;
37 }
38
39 class PetriNetBuilder;
40 class SuccessorGenerator;
41
42 struct TransPtr {
43 uint32_t inputs;
44 uint32_t outputs;
45 };
46
47 struct Invariant {
48 uint32_t place;
49 uint32_t tokens;
50 bool inhibitor;
51 int8_t direction;
52 // we can pack things here, but might give slowdown
53 } /*__attribute__((packed))*/;
54
55 /** Type used for holding markings values */
56 typedef uint32_t MarkVal;
57
58 /** Efficient representation of PetriNet */
59 class PetriNet {
60 PetriNet(uint32_t transitions, uint32_t invariants, uint32_t places);
61 public:
62 ~PetriNet();
63
64 uint32_t initial(size_t id) const;
65 MarkVal* makeInitialMarking() const;
66 /** Fire transition if possible and store result in result */
67 bool deadlocked(const MarkVal* marking) const;
68 bool fireable(const MarkVal* marking, int transitionIndex);
69 std::pair<const Invariant*, const Invariant*> preset(uint32_t id) const;
70 std::pair<const Invariant*, const Invariant*> postset(uint32_t id) const;
71 uint32_t numberOfTransitions() const {
72 return _ntransitions;
73 }
74
75 uint32_t numberOfPlaces() const {
76 return _nplaces;
77 }
78 int inArc(uint32_t place, uint32_t transition) const;
79 int outArc(uint32_t transition, uint32_t place) const;
80
81
82 const std::vector<std::string>& transitionNames() const
83 {
84 return _transitionnames;
85 }
86
87 const std::vector<std::string>& placeNames() const
88 {
89 return _placenames;
90 }
91
92 void print(MarkVal const * const val) const
93 {
94 for(size_t i = 0; i < _nplaces; ++i)
95 {
96 if(val[i] != 0)
97 {
98 std::cout << _placenames[i] << "(" << i << ")" << " -> " << val[i] << std::endl;
99 }
100 }
101 }
102
103 void sort();
104
105 void toXML(std::ostream& out);
106
107 const MarkVal* initial() const {
108 return _initialMarking;
109 }
110
111 private:
112
113 /** Number of x variables
114 * @remarks We could also get this from the _places vector, but I don't see any
115 * any complexity garentees for this type.
116 */
117 uint32_t _ninvariants, _ntransitions, _nplaces;
118
119 std::vector<TransPtr> _transitions;
120 std::vector<Invariant> _invariants;
121 std::vector<uint32_t> _placeToPtrs;
122 MarkVal* _initialMarking;
123
124 std::vector<std::string> _transitionnames;
125 std::vector<std::string> _placenames;
126
127 friend class PetriNetBuilder;
128 friend class Reducer;
129 friend class SuccessorGenerator;
130 friend class ReducingSuccessorGenerator;
131 friend class STSolver;
132 };
133
134} // PetriEngine
135
136#endif // PETRINET_H
0137
=== added file 'include/PetriEngine/PetriNetBuilder.h'
--- include/PetriEngine/PetriNetBuilder.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/PetriNetBuilder.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,145 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 *
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19#ifndef PETRINETBUILDER_H
20#define PETRINETBUILDER_H
21
22#include <vector>
23#include <string>
24#include <memory>
25#include <chrono>
26#include "AbstractPetriNetBuilder.h"
27#include "PQL/PQL.h"
28#include "PetriNet.h"
29#include "Reducer.h"
30#include "NetStructures.h"
31#include "Reachability/ReachabilityResult.h"
32namespace PetriEngine {
33 /** Builder for building engine representations of PetriNets */
34 class PetriNetBuilder : public AbstractPetriNetBuilder {
35 public:
36 friend class Reducer;
37
38 public:
39 PetriNetBuilder();
40 PetriNetBuilder(const PetriNetBuilder& other);
41 void addPlace(const std::string& name, int tokens, double x, double y) override;
42 void addTransition(const std::string& name,
43 double x,
44 double y) override;
45 void addInputArc(const std::string& place,
46 const std::string& transition,
47 bool inhibitor,
48 int weight) override;
49 void addOutputArc(const std::string& transition, const std::string& place, int weight) override;
50
51 virtual void sort() override;
52 /** Make the resulting petri net, you take ownership */
53 PetriNet* makePetriNet(bool reorder = true);
54 /** Make the resulting initial marking, you take ownership */
55
56 MarkVal const * initMarking()
57 {
58 return initialMarking.data();
59 }
60
61 uint32_t numberOfPlaces() const
62 {
63 return _placenames.size();
64 }
65
66 uint32_t numberOfTransitions() const
67 {
68 return _transitionnames.size();
69 }
70
71 const std::unordered_map<std::string, uint32_t>& getPlaceNames() const
72 {
73 return _placenames;
74 }
75
76 const std::unordered_map<std::string, uint32_t>& getTransitionNames() const
77 {
78 return _transitionnames;
79 }
80
81 void reduce(std::vector<std::shared_ptr<PQL::Condition> >& query,
82 std::vector<Reachability::ResultPrinter::Result>& results,
83 int reductiontype, bool reconstructTrace, const PetriNet* net, int timeout, std::vector<uint32_t>& reductions);
84
85 size_t RemovedTransitions() const
86 {
87 return reducer.RemovedTransitions();
88 }
89
90 size_t RemovedPlaces() const
91 {
92 return reducer.RemovedPlaces();
93 }
94
95 void printStats(std::ostream& out)
96 {
97 reducer.printStats(out);
98 }
99
100 Reducer* getReducer() { return &reducer; }
101
102 std::vector<std::pair<std::string, uint32_t>> orphanPlaces() const {
103 std::vector<std::pair<std::string, uint32_t>> res;
104 for(uint32_t p = 0; p < _places.size(); p++) {
105 if(_places[p].consumers.size() == 0 && _places[p].producers.size() == 0) {
106 for(auto &n : _placenames) {
107 if(n.second == p) {
108 res.push_back(std::make_pair(n.first, initialMarking[p]));
109 break;
110 }
111 }
112 }
113 }
114 return res;
115 }
116
117 double getReductionTime() const {
118 // duration in seconds
119 auto end = std::chrono::high_resolution_clock::now();
120 return (std::chrono::duration_cast<std::chrono::microseconds>(end - _start).count())*0.000001;
121 }
122
123 void startTimer() {
124 _start = std::chrono::high_resolution_clock::now();
125 }
126
127 private:
128 uint32_t nextPlaceId(std::vector<uint32_t>& counts, std::vector<uint32_t>& pcounts, std::vector<uint32_t>& ids, bool reorder);
129 std::chrono::high_resolution_clock::time_point _start;
130
131 protected:
132 std::unordered_map<std::string, uint32_t> _placenames;
133 std::unordered_map<std::string, uint32_t> _transitionnames;
134
135 std::vector<Transition> _transitions;
136 std::vector<Place> _places;
137
138 std::vector<MarkVal> initialMarking;
139 Reducer reducer;
140 };
141
142}
143
144#endif // PETRINETBUILDER_H
145
0146
=== added directory 'include/PetriEngine/Reachability'
=== added file 'include/PetriEngine/Reachability/ReachabilityResult.h'
--- include/PetriEngine/Reachability/ReachabilityResult.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Reachability/ReachabilityResult.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,97 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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 General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20#ifndef REACHABILITYRESULT_H
21#define REACHABILITYRESULT_H
22
23#include <vector>
24#include "../PQL/PQL.h"
25#include "../Structures/StateSet.h"
26#include "../Reducer.h"
27
28struct options_t;
29
30namespace PetriEngine {
31 class PetriNetBuilder;
32 namespace Reachability {
33
34 /** Result of a reachability search */
35
36 class AbstractHandler {
37 public:
38 enum Result {
39 /** The query was satisfied */
40 Satisfied,
41 /** The query cannot be satisfied */
42 NotSatisfied,
43 /** We're unable to say if the query can be satisfied */
44 Unknown,
45 /** The query should be verified using the CTL engine */
46 CTL,
47 /** Just ignore */
48 Ignore
49 };
50 virtual std::pair<Result, bool> handle(
51 size_t index,
52 PQL::Condition* query,
53 Result result,
54 const std::vector<uint32_t>* maxPlaceBound = nullptr,
55 size_t expandedStates = 0,
56 size_t exploredStates = 0,
57 size_t discoveredStates = 0,
58 int maxTokens = 0,
59 Structures::StateSetInterface* stateset = nullptr, size_t lastmarking = 0, const MarkVal* initialMarking = nullptr) = 0;
60 };
61
62 class ResultPrinter : public AbstractHandler {
63 protected:
64 PetriNetBuilder* builder;
65 options_t* options;
66 std::vector<std::string>& querynames;
67 Reducer* reducer;
68 public:
69 const string techniques = "TECHNIQUES COLLATERAL_PROCESSING STRUCTURAL_REDUCTION QUERY_REDUCTION SAT_SMT ";
70 const string techniquesStateSpace = "TECHNIQUES EXPLICIT STATE_COMPRESSION";
71
72 ResultPrinter(PetriNetBuilder* b, options_t* o, std::vector<std::string>& querynames)
73 : builder(b), options(o), querynames(querynames), reducer(NULL)
74 {};
75
76 void setReducer(Reducer* r) { this->reducer = r; }
77
78 std::pair<Result, bool> handle(
79 size_t index,
80 PQL::Condition* query,
81 Result result,
82 const std::vector<uint32_t>* maxPlaceBound = nullptr,
83 size_t expandedStates = 0,
84 size_t exploredStates = 0,
85 size_t discoveredStates = 0,
86 int maxTokens = 0,
87 Structures::StateSetInterface* stateset = nullptr, size_t lastmarking = 0, const MarkVal* initialMarking = nullptr) override;
88
89 std::string printTechniques();
90
91 void printTrace(Structures::StateSetInterface*, size_t lastmarking);
92
93 };
94 } // Reachability
95} // PetriEngine
96
97#endif // REACHABILITYRESULT_H
098
=== added file 'include/PetriEngine/Reachability/ReachabilitySearch.h'
--- include/PetriEngine/Reachability/ReachabilitySearch.h 1970-01-01 00:00:00 +0000
+++ include/PetriEngine/Reachability/ReachabilitySearch.h 2020-09-11 14:21:20 +0000
@@ -0,0 +1,182 @@
1/* PeTe - Petri Engine exTremE
2 * Copyright (C) 2011 Jonas Finnemann Jensen <jopsen@gmail.com>,
3 * Thomas Søndersø Nielsen <primogens@gmail.com>,
4 * Lars Kærlund Østergaard <larsko@gmail.com>,
5 * Peter Gjøl Jensen <root@petergjoel.dk>
6 *
7 * This program is free software: you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation, either version 3 of the License, or
10 * (at your option) any later version.
11 *
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
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches