Exemplo n.º 1
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="temporalStateStorage">A storage where temporal states can be saved to.</param>
        /// <param name="capacity">The maximum number of successors that can be cached.</param>
        /// <param name="formulas">The formulas that should be checked for all successor states.</param>
        public ActivationMinimalTransitionSetBuilder(TemporaryStateStorage temporalStateStorage, long capacity, params Func <bool>[] formulas)
        {
            Requires.NotNull(temporalStateStorage, nameof(temporalStateStorage));
            Requires.NotNull(formulas, nameof(formulas));
            Requires.That(formulas.Length < 32, "At most 32 formulas are supported.");
            Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}.");

            _temporalStateStorage = temporalStateStorage;
            _stateVectorSize      = temporalStateStorage.AnalysisModelStateVectorSize;
            _formulas             = formulas;

            _transitionBuffer.Resize(capacity * sizeof(CandidateTransition), zeroMemory: false);
            _transitions = (CandidateTransition *)_transitionBuffer.Pointer;

            _lookupBuffer.Resize(capacity * sizeof(int), zeroMemory: false);
            _faultsBuffer.Resize(capacity * sizeof(FaultSetInfo), zeroMemory: false);
            _hashedStateBuffer.Resize(capacity * _stateVectorSize, zeroMemory: false);

            _successors = new List <uint>();
            _capacity   = capacity;

            _lookup            = (int *)_lookupBuffer.Pointer;
            _faults            = (FaultSetInfo *)_faultsBuffer.Pointer;
            _hashedStateMemory = _hashedStateBuffer.Pointer;

            for (var i = 0; i < capacity; ++i)
            {
                _lookup[i] = -1;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="createModel">A factory function that creates the model instance that should be executed.</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 ExecutedModel(CoupledExecutableModelCreator <TExecutableModel> createModel, int stateHeaderBytes, AnalysisConfiguration configuration)
        {
            Requires.NotNull(createModel, nameof(createModel));

            RuntimeModelCreator   = createModel;
            RuntimeModel          = createModel.Create(stateHeaderBytes);
            TemporaryStateStorage = new TemporaryStateStorage(ModelStateVectorSize, configuration.SuccessorCapacity);
        }
Exemplo n.º 3
0
        public LtmcRetraverseTransitionSetBuilder(TemporaryStateStorage temporalStateStorage, long capacity)
        {
            Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}.");

            _capacity = capacity;

            _transitionBuffer.Resize(capacity * sizeof(LtmcTransition), zeroMemory: false);
            _transitions = (LtmcTransition *)_transitionBuffer.Pointer;

            _temporalStateStorage = temporalStateStorage;
        }
Exemplo n.º 4
0
        public LtmcRetraverseModel(LabeledTransitionMarkovChain ltmc, Formula[] stateFormulasToCheck, AnalysisConfiguration configuration)
        {
            Assert.That(stateFormulasToCheck.Length <= 32, "Too many Formulas");

            LabeledTransitionMarkovChain = ltmc;
            TemporaryStateStorage        = new TemporaryStateStorage(ModelStateVectorSize, configuration.SuccessorCapacity);
            _transitions = new LtmcRetraverseTransitionSetBuilder(TemporaryStateStorage, configuration.SuccessorCapacity);
            _formulas    = stateFormulasToCheck;

            _formulaInStateTransitionEvaluators = stateFormulasToCheck.Select(CreateFormulaEvaluator).ToArray();
        }
Exemplo n.º 5
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="createModel">A factory function that creates the model instance that should be executed.</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 ExecutedModel(CoupledExecutableModelCreator <TExecutableModel> createModel, int stateHeaderBytes, AnalysisConfiguration configuration)
        {
            Requires.NotNull(createModel, nameof(createModel));

            RuntimeModelCreator = createModel;
            var runtimeModel = createModel.Create(stateHeaderBytes);

            RuntimeModel = runtimeModel;

            TemporaryStateStorage = new TemporaryStateStorage(ModelStateVectorSize, configuration.SuccessorCapacity);
            SavedActivations      = runtimeModel.NondeterministicFaults.Select(fault => fault.Activation).ToArray();
        }
Exemplo n.º 6
0
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="temporalStateStorage">A storage where temporal states can be saved to.</param>
        /// <param name="capacity">The maximum number of successors that can be cached.</param>
        /// <param name="formulas">The formulas that should be checked for all successor states.</param>
        public LtmcTransitionSetBuilder(TemporaryStateStorage temporalStateStorage, long capacity, params Func <bool>[] formulas)
        {
            Requires.NotNull(temporalStateStorage, nameof(temporalStateStorage));
            Requires.NotNull(formulas, nameof(formulas));
            Requires.That(formulas.Length < 32, "At most 32 formulas are supported.");
            Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}.");

            _temporalStateStorage = temporalStateStorage;
            _formulas             = formulas;
            _capacity             = capacity;

            _transitionBuffer.Resize(capacity * sizeof(LtmcTransition), zeroMemory: false);
            _transitions = (LtmcTransition *)_transitionBuffer.Pointer;
        }
        /// <summary>
        ///   Initializes a new instance.
        /// </summary>
        /// <param name="temporalStateStorage">A storage where temporal states can be saved to.</param>
        /// <param name="capacity">The maximum number of successors that can be cached.</param>
        /// <param name="formulas">The formulas that should be checked for all successor states.</param>
        public LtmdpCachedLabeledStates(TemporaryStateStorage temporalStateStorage, long capacity, LtmdpStepGraph ltmdpStepGraph, params Func <bool>[] formulas)
        {
            Requires.NotNull(temporalStateStorage, nameof(temporalStateStorage));
            Requires.NotNull(formulas, nameof(formulas));
            Requires.That(formulas.Length < 32, "At most 32 formulas are supported.");
            Requires.That(capacity <= (1 << 30), nameof(capacity), $"Maximum supported capacity is {1 << 30}.");

            _temporalStateStorage = temporalStateStorage;
            _formulas             = formulas;
            _capacity             = capacity;

            LtmdpStepGraph = ltmdpStepGraph;

            _transitionsWithContinuationIdBuffer.Resize(capacity * sizeof(LtmdpTransition), zeroMemory: false);
            _transitionsWithContinuationIdMemory = (LtmdpTransition *)_transitionsWithContinuationIdBuffer.Pointer;
        }
Exemplo n.º 8
0
 /// <summary>
 ///   Invoked before the execution of the next step is started on the model, i.e., before a set of initial
 ///   states or successor states is computed.
 /// </summary>
 protected override void BeginExecution()
 {
     _cachedLabeledStates.Clear();
     TemporaryStateStorage.Clear();
     _stepGraph.Clear();
 }
Exemplo n.º 9
0
 /// <summary>
 ///   Invoked before the execution of the next step is started on the model, i.e., before a set of initial
 ///   states or successor states is computed.
 /// </summary>
 protected override void BeginExecution()
 {
     _transitions.Clear();
     TemporaryStateStorage.Clear();
 }
Exemplo n.º 10
0
 public LtmcTestBuilderWithStatesAsByteVector()
 {
     _transitionBuffer.Resize(TransitionCapacity * sizeof(LtmcTransition), zeroMemory: false);
     _transitions          = (LtmcTransition *)_transitionBuffer.Pointer;
     TemporaryStateStorage = new TemporaryStateStorage(sizeof(int), StateCapacity);
 }