예제 #1
0
		public static int Main(string[] args)
		{
			var s = new S3();
			var modelChecker = new SSharpChecker();

			return modelChecker.CheckInvariant(s, s.C.X < 10).FormulaHolds ? 0 : -1;
		}
예제 #2
0
		public void DepthFirstSearch()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<MiniZincObserverController>();
			model.SetAnalysisMode(AnalysisMode.TolerableFaults);

			var modelChecker = new SSharpChecker { Configuration = { CpuCount = 1, StateCapacity = 1 << 20 } };
			var result = modelChecker.CheckInvariant(model, true);

			Console.WriteLine(result);
		}
예제 #3
0
		public void AllWorkpiecesCompleteEventually()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<FastObserverController>();
			model.Faults.SuppressActivations();

			var modelChecker = new SSharpChecker { Configuration = { StateCapacity = 1 << 22 } };
			var result = modelChecker.CheckInvariant(model, !model.Workpieces.All(w => w.IsComplete));

			Assert.IsFalse(result.FormulaHolds);
		}
예제 #4
0
		public void NoDamagedWorkpieces()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<FastObserverController>();
			model.Faults.SuppressActivations();

			var modelChecker = new SSharpChecker { Configuration = { StateCapacity = 1 << 22 } };
			var result = modelChecker.CheckInvariant(model, !model.Workpieces.Any(w => w.IsDamaged));

			Assert.IsTrue(result.FormulaHolds);
		}
예제 #5
0
		public void EnumerateStateSpace()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<FastObserverController>();
			model.Faults.SuppressActivations();

			var modelChecker = new SSharpChecker { Configuration = { StateCapacity = 1 << 22 } };
			var result = modelChecker.CheckInvariant(model, true);

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

			var checker = new SSharpChecker { Configuration = { StateCapacity = 1 << 18 } };
			var result = checker.CheckInvariant(model, true);

			Console.WriteLine(result.StateVectorLayout);
		}
예제 #7
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 SSharpChecker { Configuration = { StateCapacity = 1310720 } };
			checker.CheckInvariant(model, true);
		}
예제 #8
0
		public void HasResourceAndHasWorkpieceMatch()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<FastObserverController>();
			model.Faults.SuppressActivations();

			var modelChecker = new SSharpChecker { Configuration = { StateCapacity = 1 << 22 } };
			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);
		}