Example #1
0
		public void Simulate()
		{
			var model = new Model();
			model.InitializeDefaultInstance();
			model.CreateObserverController<FastObserverController>();
			model.Faults.SuppressActivations();

			var simulator = new Simulator(model);
			PrintTrace(simulator, steps: 120);
		}
Example #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);
		}
		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);
		}
		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);
		}
		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);
		}
		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);
		}