Implement reduceTransitions to allow efficient accumulation over transitions#78
Open
merkste wants to merge 3 commits intoprismmodelchecker:masterfrom
Open
Implement reduceTransitions to allow efficient accumulation over transitions#78merkste wants to merge 3 commits intoprismmodelchecker:masterfrom
merkste wants to merge 3 commits intoprismmodelchecker:masterfrom
Conversation
f4d16ac to
e0eaed4
Compare
3b005bd to
f35b978
Compare
Contributor
Author
|
I completed the implementation for DTMCs and CTMCs and added support for MDPs. The last commit implements |
b6c31c2 to
e3df4bb
Compare
Contributor
Author
|
@davexparker , @kleinj : Now with 4.5 out, what do you think? |
e3df4bb to
445f77c
Compare
added 3 commits
June 15, 2020 10:23
445f77c to
c1f16b2
Compare
ca12ca0 to
6bf73df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The folding operation
reduceis a principle iteration method for sequences of any kind. It takes an initial value and enables the accumulation of the results of each step. This PR addsreduceTransitions(state, init, ObjTransitionFunction)to enable iteration over the transitions of some model and accumulating the results, e.g., consider the following code change:to
In each step, the function
fis applied to the current transition. The result of each step is the sum of all intermediate values up to the current transition.The implementation of
reduceTransitionsshould not rely onforEachTransition, as the access to a member-variable of some function (see the example above) is generally slower than to a temporary variable inreduceTransitions. Also, as functions passed toreduceare often clean, i.e., they do not reference external objects/variables, they could be efficiently inlined by the virtual machine (JVM does not yet apply this optimization).We could go even futher by considering
forEachTransitiona special case ofreduceTransitionsthat simply dismisses the intermediate results. This should yield equal performance in theory, but would require some tests to confirm that no performance hit occurs in practice.