Example #1
0
        internal double CalculateMinimumProbabilityToReachStateFormulaInBoundedSteps(Formula psi, int steps)
        {
            var psiEvaluator = MarkovDecisionProcess.CreateFormulaEvaluator(psi);

            var directlySatisfiedStates = CalculateSatisfiedStates(psiEvaluator);
            var excludedStates          = new Dictionary <int, bool>();   // change for \phi Until \psi

            var xnew = MinimumIterator(directlySatisfiedStates, excludedStates, steps);

            var finalProbability = CalculateMinimumFinalProbability(xnew);

            return(finalProbability);
        }
        internal double CalculateMinimumProbabilityToReachStateFormula(Formula psi)
        {
            // same algorithm as CalculateMinimumProbabilityToReachStateFormulaInBoundedSteps with different
            // directlySatisfiedStates and excludedStates
            var maxSteps = AdjustNumberOfStepsForFactor(50);

            var psiEvaluator = MarkovDecisionProcess.CreateFormulaEvaluator(psi);

            var directlySatisfiedStates = CalculateSatisfiedStates(psiEvaluator);
            var excludedStates          = new Dictionary <long, bool>();    // change for \phi Until \psi

            var exactlyZeroStates = StatesReachableWithProbabilityExactlyZeroForAtLeastOneScheduler(directlySatisfiedStates, excludedStates);
            var exactlyOneStates  = SubsetOfStatesReachableWithProbabilityExactlyOneWithAllSchedulers(directlySatisfiedStates, excludedStates);            // this algorithm is only an approximation

            var xnew = MinimumIterator(exactlyOneStates, exactlyZeroStates, maxSteps);

            var finalProbability = CalculateMinimumFinalProbability(xnew);

            return(finalProbability);
        }
Example #3
0
        private double CalculateMaximumProbabilityToReachStateFormula(Formula psi)
        {
            // same algorithm as CalculateMaximumProbabilityToReachStateFormulaInBoundedSteps with different
            // directlySatisfiedStates and excludedStates
            var maxSteps = 50;

            var psiEvaluator = MarkovDecisionProcess.CreateFormulaEvaluator(psi);

            var directlySatisfiedStates = CalculateSatisfiedStates(psiEvaluator);
            var excludedStates          = new Dictionary <int, bool>();    // change for \phi Until \psi

            var exactlyZeroStates = StatesReachableWithProbabilityExactlyZeroWithAllSchedulers(directlySatisfiedStates, excludedStates);
            var exactlyOneStates  = StatesReachableWithProbabilityExactlyOneForAtLeastOneScheduler(directlySatisfiedStates, excludedStates);            //cannot perform a better pre calculation

            var xnew = MaximumIterator(exactlyOneStates, exactlyZeroStates, maxSteps);

            var finalProbability = CalculateMaximumFinalProbability(xnew);

            return(finalProbability);
        }