/// <summary> /// Initializes a new instance. /// </summary> /// <param name="runtimeModelCreator">A factory function that creates the model instance that should be executed.</param> /// <param name="configuration">The analysis configuration that should be used.</param> internal LtmcExecutedModel(CoupledExecutableModelCreator <TExecutableModel> runtimeModelCreator, AnalysisConfiguration configuration) : base(runtimeModelCreator, 0, configuration) { var formulas = RuntimeModel.Formulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray(); _transitions = new LtmcTransitionSetBuilder <TExecutableModel>(TemporaryStateStorage, configuration.SuccessorCapacity, formulas); var useForwardOptimization = configuration.EnableStaticPruningOptimization; _ltmcChoiceResolver = new LtmcChoiceResolver(useForwardOptimization); ChoiceResolver = _ltmcChoiceResolver; RuntimeModel.SetChoiceResolver(ChoiceResolver); _allowFaultsOnInitialTransitions = configuration.AllowFaultsOnInitialTransitions; }
/// <summary> /// Initializes a new instance. /// </summary> /// <param name="runtimeModelCreator">A factory function that creates the model instance that should be executed.</param> /// <param name="formulas">The formulas that should be evaluated for each state.</param> /// <param name="configuration">The analysis configuration that should be used.</param> /// <param name="stateHeaderBytes"> /// The number of bytes that should be reserved at the beginning of each state vector for the model checker tool. /// </param> internal ActivationMinimalExecutedModel(CoupledExecutableModelCreator <TExecutableModel> runtimeModelCreator, int stateHeaderBytes, Func <bool>[] formulas, AnalysisConfiguration configuration) : base(runtimeModelCreator, stateHeaderBytes, configuration) { formulas = formulas ?? RuntimeModel.Formulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray(); _transitions = new ActivationMinimalTransitionSetBuilder <TExecutableModel>(TemporaryStateStorage, configuration.SuccessorCapacity, formulas); _stateConstraints = RuntimeModel.StateConstraints; var useForwardOptimization = configuration.EnableStaticPruningOptimization; ChoiceResolver = new NondeterministicChoiceResolver(useForwardOptimization); FaultSet.CheckFaultCount(RuntimeModel.Faults.Length); RuntimeModel.SetChoiceResolver(ChoiceResolver); _allowFaultsOnInitialTransitions = configuration.AllowFaultsOnInitialTransitions; }
/// <summary> /// Initializes a new instance. /// </summary> public ProbabilisticSimulator(ExecutableModelCreator <TExecutableModel> modelCreator, IEnumerable <Formula> formulas, AnalysisConfiguration configuration) { // TODO: Set Mode WithCustomSeed (each thread must have its own seed) or RealRandom Requires.NotNull(modelCreator, nameof(modelCreator)); RuntimeModel = modelCreator.CreateCoupledModelCreator(formulas.ToArray()).Create(0); NormalizedFormulas = RuntimeModel.Formulas.ToArray(); NormalizedFormulaLabels = NormalizedFormulas.Select(stateFormula => stateFormula.Label).ToArray(); NormalizedFormulaSatisfactionCount = new int[NormalizedFormulas.Length]; _compiledNormalizedFormulas = NormalizedFormulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray(); _allowFaultsOnInitialTransitions = configuration.AllowFaultsOnInitialTransitions; _activateIndependentFaultsAtStepBeginning = configuration.MomentOfIndependentFaultActivation == MomentOfIndependentFaultActivation.AtStepBeginning; _choiceResolver = new ProbabilisticSimulatorChoiceResolver(configuration.UseOptionProbabilitiesInSimulation, (int)DateTime.Now.Ticks); RuntimeModel.SetChoiceResolver(_choiceResolver); }