public static int Main(string[] args)
        {
            var s            = new S1();
            var modelChecker = new SafetySharpQualitativeChecker();

            return(modelChecker.CheckInvariant(s, s.C.X < 2).FormulaHolds ? -1 : 0);
        }
Beispiel #2
0
        public static int Main(string[] args)
        {
            var     s            = new S3();
            Formula formula      = s.C.X < 10;
            var     modelChecker = new SafetySharpQualitativeChecker(s, formula);

            return(modelChecker.CheckInvariant(formula).FormulaHolds ? 0 : -1);
        }
Beispiel #3
0
        public void DepthFirstSearch()
        {
            var model = new Model();

            model.InitializeDefaultInstance();
            model.CreateObserverController <MiniZincObserverController>();
            model.SetAnalysisMode(AnalysisMode.TolerableFaults);

            var modelChecker = new SafetySharpQualitativeChecker {
                Configuration = { CpuCount = 1, ModelCapacity = new ModelCapacityByModelDensity(1 << 20, ModelDensityLimit.Medium) }
            };
            var result = modelChecker.CheckInvariant(model, true);

            Console.WriteLine(result);
        }
        public void AllWorkpiecesCompleteEventually()
        {
            var model = new Model();

            model.InitializeDefaultInstance();
            model.CreateObserverController <FastObserverController>();
            model.Faults.SuppressActivations();

            var modelChecker = new SafetySharpQualitativeChecker {
                Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1 << 22, ModelDensityLimit.Medium) }
            };
            var result = modelChecker.CheckInvariant(model, !model.Workpieces.All(w => w.IsComplete));

            Assert.IsFalse(result.FormulaHolds);
        }
        public void EnumerateStateSpace()
        {
            var model = new Model();

            model.InitializeDefaultInstance();
            model.CreateObserverController <FastObserverController>();
            model.Faults.SuppressActivations();

            var modelChecker = new SafetySharpQualitativeChecker {
                Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1 << 22, ModelDensityLimit.Medium) }
            };
            var result = modelChecker.CheckInvariant(model, true);

            Assert.IsTrue(result.FormulaHolds);
        }
Beispiel #6
0
        public void EnumerateAllStates()
        {
            var model = new ModelSetupParser().Parse("Analysis/medium_setup.model");

            model.Faults.SuppressActivations();

            var checker = new SafetySharpQualitativeChecker {
                Configuration =
                {
                    ModelCapacity = new ModelCapacityByModelDensity(1 << 18, ModelDensityLimit.Medium)
                }
            };
            var result = checker.CheckInvariant(model, true);

            Console.WriteLine(result);
        }
Beispiel #7
0
        public void NoDamagedWorkpieces()
        {
            var model = new Model();

            model.InitializeDefaultInstance();
            model.CreateObserverController <FastObserverController>();
            model.Faults.SuppressActivations();

            var modelChecker = new SafetySharpQualitativeChecker(model)
            {
                Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1 << 22, ModelDensityLimit.Medium) }
            };
            var result = modelChecker.CheckInvariant(!model.Workpieces.Any(w => w.IsDamaged));

            Assert.IsTrue(result.FormulaHolds);
        }
        public void HasResourceAndHasWorkpieceMatch()
        {
            var model = new Model();

            model.InitializeDefaultInstance();
            model.CreateObserverController <FastObserverController>();
            model.Faults.SuppressActivations();

            var modelChecker = new SafetySharpQualitativeChecker {
                Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1 << 22, ModelDensityLimit.Medium) }
            };
            var result = modelChecker.CheckInvariant(model,
                                                     model.RobotAgents.All(a => a.HasResource == a.Robot.HasWorkpiece) &&
                                                     model.CartAgents.All(a => a.HasResource == a.Cart.HasWorkpiece));

            Assert.IsTrue(result.FormulaHolds);
        }
Beispiel #9
0
        public void Test()
        {
            var specification = new Model();
            var model         = specification;
            var faults        = model.Faults;

            for (var i = 0; i < faults.Length; ++i)
            {
                faults[i].Activation = Activation.Nondeterministic;
            }

            var checker = new SafetySharpQualitativeChecker
            {
                Configuration = { ModelCapacity = new ModelCapacityByModelDensity(1310720, ModelDensityLimit.High) }
            };

            checker.CheckInvariant(model, true);
        }