Beispiel #1
0
        /// <summary>
        ///   Generates a <see cref="MarkovDecisionProcess" /> for the model created by <paramref name="createModel" />.
        /// </summary>
        public NestedMarkovDecisionProcess GenerateMarkovDecisionProcess(Formula terminateEarlyCondition = null)
        {
            Requires.That(IntPtr.Size == 8, "Model checking is only supported in 64bit processes.");

            ProbabilityMatrixCreationStarted = true;

            CollectStateFormulasVisitor stateFormulaCollector;

            if (Configuration.UseAtomarPropositionsAsStateLabels)
            {
                stateFormulaCollector = new CollectAtomarPropositionFormulasVisitor();
            }
            else
            {
                stateFormulaCollector = new CollectMaximalCompilableFormulasVisitor();
            }

            foreach (var stateFormula in _formulasToCheck)
            {
                stateFormulaCollector.VisitNewTopLevelFormula(stateFormula);
            }
            if (terminateEarlyCondition)
            {
                stateFormulaCollector.VisitNewTopLevelFormula(terminateEarlyCondition);
            }
            var stateFormulas = stateFormulaCollector.CollectedStateFormulas.ToArray();

            ExecutedModel <TExecutableModel> model = null;
            var modelCreator = _runtimeModelCreator.CreateCoupledModelCreator(stateFormulas);
            Func <AnalysisModel <TExecutableModel> > createAnalysisModelFunc = () =>
                                                                               model = new LtmdpExecutedModel <TExecutableModel>(modelCreator, 0, Configuration.SuccessorCapacity);
            var createAnalysisModel = new AnalysisModelCreator <TExecutableModel>(createAnalysisModelFunc);

            return(GenerateMarkovDecisionProcess(createAnalysisModel, terminateEarlyCondition, stateFormulas));
        }
        /// <summary>
        ///   Generates a <see cref="MarkovDecisionProcess" /> for the model created by <paramref name="createModel" />.
        /// </summary>
        public LabeledTransitionMarkovDecisionProcess GenerateLabeledTransitionMarkovDecisionProcess()
        {
            Requires.That(IntPtr.Size == 8, "Model checking is only supported in 64bit processes.");

            ProbabilityMatrixCreationStarted = true;

            FormulaManager.Calculate(Configuration);
            var stateFormulasToCheckInBaseModel = FormulaManager.StateFormulasToCheckInBaseModel.ToArray();

            ExecutedModel <TExecutableModel> model = null;
            var modelCreator = _runtimeModelCreator.CreateCoupledModelCreator(stateFormulasToCheckInBaseModel);
            Func <AnalysisModel> createAnalysisModelFunc = () =>
                                                           model = new LtmdpExecutedModel <TExecutableModel>(modelCreator, Configuration);
            var createAnalysisModel = new AnalysisModelCreator(createAnalysisModelFunc);

            var ltmdp = GenerateLtmdp(createAnalysisModel);

            return(ltmdp);
        }