/// <summary> /// Generates a <see cref="LabeledTransitionMarkovDecisionProcess" /> for the model created by <paramref name="createModel" />. /// </summary> /// <param name="createModel">Creates the model that should be checked.</param> internal LabeledTransitionMarkovDecisionProcess GenerateLtmdp(AnalysisModelCreator createModel) { using (var modelTraverser = new ModelTraverser(createModel, Configuration, LabeledTransitionMarkovDecisionProcess.TransitionSize, FormulaManager.NeedsStutteringState)) { _mdp = new LabeledTransitionMarkovDecisionProcess(modelTraverser.Context.ModelCapacity.NumberOfStates, modelTraverser.Context.ModelCapacity.NumberOfTransitions); _mdp.StateFormulaLabels = FormulaManager.FinalStateFormulaLabels.ToArray(); if (FormulaManager.NeedsStutteringState) { _mdp.CreateStutteringState(modelTraverser.Context.StutteringStateIndex); } modelTraverser.Context.TraversalParameters.TransitionModifiers.AddRange(FormulaManager.TransitionModifierGenerators); modelTraverser.Context.TraversalParameters.BatchedTransitionActions.Add(() => new LabeledTransitionMarkovDecisionProcess.LtmdpBuilderDuringTraversal(_mdp)); modelTraverser.Context.Output.WriteLine("Generating labeled transition markov decision process."); modelTraverser.TraverseModelAndReport(); // StateStorage must be freed manually. Reason is that invariant checker does not free up the // space, because it might be necessary for other usages of the ModelTraversers (e.g. StateGraphGenerator // which keeps the States for the StateGraph) modelTraverser.Context.States.SafeDispose(); } if (Configuration.WriteGraphvizModels) { FormulaManager.PrintStateFormulas(FormulaManager.FinalStateFormulas, Configuration.DefaultTraceOutput); Configuration.DefaultTraceOutput.WriteLine("Ltmdp Model"); _mdp.ExportToGv(Configuration.DefaultTraceOutput); } return(_mdp); }
/// <summary> /// Generates the state graph. /// </summary> internal StateGraph <TExecutableModel> GenerateStateGraph() { _modelTraverser.Context.Output.WriteLine("Generating state graph."); _modelTraverser.TraverseModelAndReport(); return(_stateGraph); }