コード例 #1
0
ファイル: LtmdpExecutedModel.cs プロジェクト: gobo7793/ssharp
        /// <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>
        ///   The number of bytes that should be reserved at the beginning of each state vector for the model checker tool.
        /// </param>
        internal LtmdpExecutedModel(CoupledExecutableModelCreator <TExecutableModel> runtimeModelCreator, AnalysisConfiguration configuration)
            : base(runtimeModelCreator, 0, configuration)
        {
            var formulas = RuntimeModel.Formulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray();

            _stepGraph = new LtmdpStepGraph();

            _cachedLabeledStates = new LtmdpCachedLabeledStates <TExecutableModel>(TemporaryStateStorage, configuration.SuccessorCapacity, _stepGraph, formulas);

            bool useForwardOptimization;

            switch (configuration.MomentOfIndependentFaultActivation)
            {
            case MomentOfIndependentFaultActivation.AtStepBeginning:
            case MomentOfIndependentFaultActivation.OnFirstMethodWithoutUndo:
                useForwardOptimization = false;
                break;

            case MomentOfIndependentFaultActivation.OnFirstMethodWithUndo:
                useForwardOptimization = true;
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }

            _ltmdpChoiceResolver = new LtmdpChoiceResolver(_stepGraph, useForwardOptimization);
            ChoiceResolver       = _ltmdpChoiceResolver;
            RuntimeModel.SetChoiceResolver(ChoiceResolver);

            _allowFaultsOnInitialTransitions = configuration.AllowFaultsOnInitialTransitions;

            _activateIndependentFaultsAtStepBeginning =
                configuration.MomentOfIndependentFaultActivation == MomentOfIndependentFaultActivation.AtStepBeginning;
        }
コード例 #2
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="runtimeModelCreator">A factory function that creates the model instance that should be executed.</param>
        /// <param name="successorStateCapacity">The maximum number of successor states supported per state.</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 LtmdpExecutedModel(CoupledExecutableModelCreator <TExecutableModel> runtimeModelCreator, int stateHeaderBytes, long successorStateCapacity)
            : base(runtimeModelCreator, stateHeaderBytes)
        {
            var formulas = RuntimeModel.Formulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray();

            _stepGraph = new LtmdpStepGraph();

            _cachedLabeledStates = new LtmdpCachedLabeledStates <TExecutableModel>(RuntimeModel, successorStateCapacity, _stepGraph, formulas);

            _ltmdpChoiceResolver = new LtmdpChoiceResolver(_stepGraph);
            ChoiceResolver       = _ltmdpChoiceResolver;
            RuntimeModel.SetChoiceResolver(ChoiceResolver);
        }
コード例 #3
0
        /// <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>
        ///   The number of bytes that should be reserved at the beginning of each state vector for the model checker tool.
        /// </param>
        internal LtmdpExecutedModel(CoupledExecutableModelCreator <TExecutableModel> runtimeModelCreator, AnalysisConfiguration configuration)
            : base(runtimeModelCreator, 0, configuration)
        {
            var formulas = RuntimeModel.Formulas.Select(formula => FormulaCompilationVisitor <TExecutableModel> .Compile(RuntimeModel, formula)).ToArray();

            _stepGraph = new LtmdpStepGraph();

            _cachedLabeledStates = new LtmdpCachedLabeledStates <TExecutableModel>(TemporaryStateStorage, configuration.SuccessorCapacity, _stepGraph, formulas);

            var useForwardOptimization = configuration.EnableStaticPruningOptimization;

            _ltmdpChoiceResolver = new LtmdpChoiceResolver(_stepGraph, useForwardOptimization);
            ChoiceResolver       = _ltmdpChoiceResolver;
            RuntimeModel.SetChoiceResolver(ChoiceResolver);

            _allowFaultsOnInitialTransitions = configuration.AllowFaultsOnInitialTransitions;
        }