public static void RunFormula(string formula) { FormulaNode parsedFormula = null; PrintLine(); Console.WriteLine("formula: " + formula); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); try { parsedFormula = FormulaParser.Parse(formula); } catch (Exception e) { Console.WriteLine("Parsing error: " + e.Message); return; } CTLSatisfiabilityChecker checker = new CTLSatisfiabilityChecker(parsedFormula); bool res = checker.Check(); stopwatch.Stop(); double time = ((double)stopwatch.ElapsedMilliseconds / 1000.0); Console.WriteLine("iterations: " + checker.Iterations); Console.WriteLine("time: " + time); Console.WriteLine("result: " + ConvSAT(res)); PrintLine(); }
private static void AssertSat(string formulaString, bool expected) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); bool Completed = ExecuteWithTimeLimit(TimeSpan.FromMilliseconds(timelimit), () => { FormulaNode formula = FormulaParser.Parse(formulaString); Console.WriteLine("\nTEST: " + formulaString); var checker = new CTLSatisfiabilityChecker(formula); bool result = checker.Check(); Console.WriteLine("Done"); if (result != expected) { throw new Exception("Wrong SAT value for " + formulaString); } }); stopwatch.Stop(); double time = (double)stopwatch.ElapsedMilliseconds / 1000.0; Console.WriteLine("TIME: " + time); }