Class MarkovBuilder


  • public class MarkovBuilder
    extends Object
    This class provides methods for building Markov Chains.
    • Constructor Detail

      • MarkovBuilder

        public MarkovBuilder​(boolean recordTraces)
        The constructor.
        Parameters:
        recordTraces - controls if traces shall be recorded during transformation
    • Method Detail

      • appendFailureHandlingMarkovChain

        public void appendFailureHandlingMarkovChain​(MarkovChain aggregateChain,
                                                     MarkovChain handlingChain,
                                                     List<String> handledFailureTypeIds,
                                                     boolean optimize)
        Incorporates one Markov Chain into another. The specific Markov Chain is inserted into the aggregate Markov Chain replacing the failure state.
        Parameters:
        aggregateChain - the Markov Chain which will incorporate the other chain
        handlingChain - the Markov Chain which will be incorporated into the other chain
        handledFailureTypeIds - the list of handled failure types
        optimize - indicates if Markov Chain reduction shall be performed during the transformation
      • appendFailureHandlingMarkovChains

        public void appendFailureHandlingMarkovChains​(MarkovChain aggregateChain,
                                                      List<MarkovChain> handlingChains,
                                                      List<List<String>> handledFailureTypeIdLists,
                                                      boolean optimize)
        Incorporates multiple Markov Chains into one aggregate chain. The specific Markov Chains are inserted into the aggregate Markov Chain replacing the failure states.
        Parameters:
        aggregateChain - the Markov Chain which will incorporate the other chains
        handlingChains - the Markov Chains which will be incorporated into the other chain
        handledFailureTypeIdLists - the list of handled failure types per chain
        optimize - indicates if Markov Chain reduction shall be performed during the transformation
      • copyMarkovChain

        public MarkovChain copyMarkovChain​(MarkovChain originalMarkovChain)
        Creates a copy of a Markov Chain. All States and Transitions of the original Markov Chain are copied into the new one.
        Parameters:
        originalMarkovChain - the original Markov Chain
        Returns:
        the new Markov Chain
      • getFailureStates

        public List<State> getFailureStates​(MarkovChain markovChain)
        Gets all failure states out of a given Markov chain.
        Parameters:
        markovChain - the Markov chain
        Returns:
        the list of failure states
      • getFailureTypeId

        public String getFailureTypeId​(State state)
        Gets the failure type annotation of a Markov failure state.
        Parameters:
        state - the state to examine
        Returns:
        the failure type annotation of the state
      • getFailureTypeName

        public String getFailureTypeName​(State state)
        Gets the failure type annotation of a Markov failure state.
        Parameters:
        state - the state to examine
        Returns:
        the failure type annotation of the state
      • getStartState

        public State getStartState​(MarkovChain markovChain)
        Gets the start state out of a given Markov chain.
        Parameters:
        markovChain - the Markov chain
        Returns:
        the start state
      • getSuccessState

        public State getSuccessState​(MarkovChain markovChain)
        Gets the success state out of a given Markov chain.
        Parameters:
        markovChain - the Markov Chain
        Returns:
        the Success State
      • incorporateMarkovChain

        public void incorporateMarkovChain​(MarkovChain parentChain,
                                           MarkovChain specificMarkovChain,
                                           State aggregateState,
                                           boolean optimize,
                                           boolean appendPrefixes)
        Incorporates one Markov Chain into another. The specific Markov Chain is inserted into the aggregate Markov Chain replacing the given aggregate Markov State.
        Parameters:
        parentChain - the Markov Chain which will incorporate the other chain
        specificMarkovChain - the Markov Chain which will be incorporated into the other chain
        aggregateState - the Markov State in the aggregate Markov Chain which will be replaced by the specific Markov Chain
        optimize - indicates if Markov Chain reduction shall be performed during the transformation
        appendPrefixes - indicates if prefixes of specific chain shall be appended to prefixes of aggregateChain
      • indexOf

        public int indexOf​(MarkovChain markovChain,
                           State state)
        Retrieves the index of a given State within a given Markov Chain.
        Parameters:
        markovChain - the Markov Chain
        state - the state to find
        Returns:
        the required index
      • initBasicMarkovChain

        public MarkovChain initBasicMarkovChain​(List<String> prefixes)
        Initializes a new Markov Chain. The new Markov Chain has only three states: a start state, a success state and a failure state. A single transition goes from start to success with probability 1.
        Parameters:
        prefixes - the prefixes of the chain name
        Returns:
        the new Markov Chain
      • initBasicMarkovChainWithFailures

        public MarkovChain initBasicMarkovChainWithFailures​(List<String> prefixes,
                                                            List<FailureDescription> failureDescriptions)
        Creates a basic Markov chain with a start, success and multiple failure nodes for a given list of failure descriptions. Such a chain can be used to represent an internal action with its application failure probabilities, or the sending of a message over a communication link. All failure probabilities must sum up to at most 1.0.
        Parameters:
        prefixes - the prefixes of the chain name
        failureDescriptions - a list of failure descriptions
        Returns:
        the resulting Markov Chain
      • initBehaviourMarkovChainByAction

        public MarkovChain initBehaviourMarkovChainByAction​(List<String> prefixes,
                                                            List<org.palladiosimulator.pcm.seff.AbstractAction> actions,
                                                            List<State> statesOut)
        Creates a Markov Chain that represents an execution of a ScenarioBehaviour or ResourceDemandingBehaviour.
        Parameters:
        prefixes - the prefixes of the Markov Chain name
        actions - the actions of the Behaviour
        statesOut - the list of states created within the method that corresponds to the given list of actions
        Returns:
        the resulting Markov Chain
      • initBranchMarkovChain

        public MarkovChain initBranchMarkovChain​(List<String> prefixes,
                                                 ArrayList<Double> branchProbabilities)
        Creates a Markov Chain for a branch with solved branch probabilities.
        Parameters:
        prefixes - the prefixes of the branch name
        branchProbabilities - the branch probabilities
        Returns:
        the resulting Markov Chain
      • initForkMarkovChain

        public MarkovChain initForkMarkovChain​(List<String> prefixes,
                                               ArrayList<org.palladiosimulator.pcm.seff.ForkedBehaviour> behaviours,
                                               ArrayList<State> statesOut)
        Creates a Markov Chain for a fork action with a list of forked behaviours.
        Parameters:
        prefixes - the prefixes of the fork name
        behaviours - the list of forked behaviours
        statesOut - the list of states created within the method
        Returns:
        the resulting Markov chain
      • initLoopMarkovChain

        public MarkovChain initLoopMarkovChain​(List<String> prefixes,
                                               de.uka.ipd.sdq.probfunction.math.ManagedPMF pmf)
        Creates a Markov Chain for a loop with solved probability mass function.
        Parameters:
        prefixes - the prefixes of the loop name
        pmf - the probability mass function of the loop
        Returns:
        the resulting Markov Chain
      • initResourceFailureMarkovChain

        public MarkovChain initResourceFailureMarkovChain​(List<String> prefixes,
                                                          List<FailureDescription> failureDescriptions)
        Creates a Markov chain for an internal action failing with probability 1.0 because of unavailable hardware resources. The failure probability is divided between all unavailable resources.
        Parameters:
        prefixes - the prefixes of the chain name
        failureDescriptions - a list of failure descriptions for hardware resources
        Returns:
        the resulting Markov Chain
      • initSequentialMarkovChain

        public MarkovChain initSequentialMarkovChain​(List<String> prefixes,
                                                     List<String> stateNames,
                                                     List<State> statesOut)
        Creates a Markov Chain that represents a sequential execution path.
        Parameters:
        prefixes - the prefixes of the Markov Chain name
        stateNames - the names of the states to create
        statesOut - the list of states created within the method that corresponds to the given list of state names
        Returns:
        the resulting Markov Chain