public static CoupledExecutableModelCreator <SimpleExecutableModel> CreateExecutedModelCreator(SimpleModelBase inputModel, params Formula[] formulasToCheckInBaseModel)
        {
            Requires.NotNull(inputModel, nameof(inputModel));
            Requires.NotNull(formulasToCheckInBaseModel, nameof(formulasToCheckInBaseModel));


            Func <int, SimpleExecutableModel> creatorFunc = (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 = SimpleModelSerializer.SerializeToByteArray(inputModel, formulasToCheckInBaseModel);
                var simpleExecutableModel       = new SimpleExecutableModel(serializedModelWithFormulas);
                return(simpleExecutableModel);
            };
            Action <TextWriter> writeOptimizedStateVectorLayout = (textWriter) =>
            {
                textWriter.WriteLine("bytes[0-4] state: int");
                textWriter.WriteLine("bytes[5-12] permanent faults: long");
            };

            var faults = inputModel.Faults;

            return(new CoupledExecutableModelCreator <SimpleExecutableModel>(creatorFunc, writeOptimizedStateVectorLayout, inputModel, formulasToCheckInBaseModel, faults));
        }
示例#2
0
        public static CoupledExecutableModelCreator <SimpleExecutableModel> CreateExecutedModelCreator(SimpleModelBase inputModel, params Formula[] formulasToCheckInBaseModel)
        {
            Requires.NotNull(inputModel, nameof(inputModel));
            Requires.NotNull(formulasToCheckInBaseModel, nameof(formulasToCheckInBaseModel));


            Func <int, SimpleExecutableModel> creatorFunc = (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 = SimpleModelSerializer.SerializeToByteArray(inputModel, formulasToCheckInBaseModel);
                var simpleExecutableModel       = new SimpleExecutableModel(serializedModelWithFormulas);
                return(simpleExecutableModel);
            };

            var faults = inputModel.Faults;

            return(new CoupledExecutableModelCreator <SimpleExecutableModel>(creatorFunc, inputModel, formulasToCheckInBaseModel, faults));
        }