/// <summary> /// Returns the serialized <paramref name="model" /> and the <paramref name="formulas" />. /// </summary> /// <param name="model">The model that should be serialized.</param> /// <param name="formulas">The formulas that should be serialized.</param> public static byte[] Save(ModelBase model, params Formula[] formulas) { var serializer = new RuntimeModelSerializer(); serializer.Serialize(model, formulas); lock (serializer._syncObject) return serializer._serializedModel; }
/// <summary> /// Returns the serialized <paramref name="model" /> and the <paramref name="formulas" />. /// </summary> /// <param name="model">The model that should be serialized.</param> /// <param name="formulas">The formulas that should be serialized.</param> public static byte[] Save(ModelBase model, params Formula[] formulas) { var serializer = new RuntimeModelSerializer(); serializer.Serialize(model, formulas); lock (serializer._syncObject) return(serializer._serializedModel); }
/// <summary> /// Loads a <see cref="SerializedRuntimeModel" /> from the <paramref name="serializedModel" />. /// </summary> /// <param name="serializedModel">The serialized model that should be loaded.</param> public static SerializedRuntimeModel LoadSerializedData(byte[] serializedModel) { Requires.NotNull(serializedModel, nameof(serializedModel)); var serializer = new RuntimeModelSerializer { _serializedModel = serializedModel }; return(serializer.LoadSerializedData()); }
protected void GenerateStateSpace(params IComponent[] components) { var serializer = new RuntimeModelSerializer(); serializer.Serialize(TestModel.InitializeModel(components), new StateFormula(() => true)); var configuration = AnalysisConfiguration.Default; configuration.StateCapacity = 10000; configuration.StackCapacity = 10000; configuration.CpuCount = 1; var checker = new InvariantChecker( () => new ActivationMinimalExecutedModel(serializer.Load, configuration.SuccessorCapacity), s => Output.Log("{0}", s), configuration, formulaIndex: 0); _result = checker.Check(); CounterExample.ShouldBe(null); Output.Log($"States: {_result.StateCount}"); Output.Log($"Actual Transitions: {_result.TransitionCount}"); Output.Log($"Computed Transitions: {_result.ComputedTransitionCount}"); }
/// <summary> /// Loads a <see cref="SerializedRuntimeModel" /> from the <paramref name="serializedModel" />. /// </summary> /// <param name="serializedModel">The serialized model that should be loaded.</param> public static SerializedRuntimeModel LoadSerializedData(byte[] serializedModel) { Requires.NotNull(serializedModel, nameof(serializedModel)); var serializer = new RuntimeModelSerializer { _serializedModel = serializedModel }; return serializer.LoadSerializedData(); }