Пример #1
0
        private void InitializeFromSerializedModel()
        {
            var modelWithFormula = LustreModelSerializer.DeserializeFromByteArray(SerializedModel);

            Model    = modelWithFormula.Item1;
            Faults   = Model.Faults.Values.OrderBy(fault => fault.Identifier).ToArray();
            Formulas = modelWithFormula.Item2;

            var atomarPropositionVisitor = new CollectAtomarPropositionFormulasVisitor();

            _atomarPropositionFormulas = atomarPropositionVisitor.AtomarPropositionFormulas.ToArray();
            foreach (var stateFormula in Formulas)
            {
                atomarPropositionVisitor.Visit(stateFormula);
            }

            StateConstraints = new Func <bool> [0];

            UpdateFaultSets();

            _deserialize    = LustreModelSerializer.CreateFastInPlaceDeserializer(Model);
            _serialize      = LustreModelSerializer.CreateFastInPlaceSerializer(Model);
            _restrictRanges = () => { };

            InitializeConstructionState();
            CheckConsistencyAfterInitialization();
        }
Пример #2
0
        public static CoupledExecutableModelCreator <LustreExecutableModel> CreateExecutedModelCreator(string ocFileName, string mainNode, Fault[] faults, params Formula[] formulasToCheckInBaseModel)
        {
            Requires.NotNull(ocFileName, nameof(ocFileName));
            Requires.NotNull(mainNode, nameof(mainNode));
            Requires.NotNull(formulasToCheckInBaseModel, nameof(formulasToCheckInBaseModel));

            LustreExecutableModel creatorFunc(int reservedBytes)
            {
                // Each model checking thread gets its own SimpleExecutableModel.
                // Thus, we serialize the C# model and load this file again.
                // The serialization can also be used for saving counter examples
                var serializedModelWithFormulas = LustreModelSerializer.CreateByteArray(ocFileName, mainNode, faults, formulasToCheckInBaseModel);
                var simpleExecutableModel       = new LustreExecutableModel(serializedModelWithFormulas);

                return(simpleExecutableModel);
            }

            void writeOptimizedStateVectorLayout(TextWriter textWriter)
            {
                throw new NotImplementedException();
            }

            var flatFaults = faults.OrderBy(fault => fault.Identifier).ToArray();

            return(new CoupledExecutableModelCreator <LustreExecutableModel>(creatorFunc, writeOptimizedStateVectorLayout, ocFileName, formulasToCheckInBaseModel, flatFaults));
        }