private static void Benchmark(List <MuFormula> list) { Log("Formula; LTS Size; Algorithm; Time"); double[,] results = new double[list.Count * 2, 13]; bool lastResult = false; foreach (var formula in list) { int num_runs = 4; for (int i = 2; i <= 13; i++) { if (i >= 11) { num_runs = 1; } var sw = Stopwatch.StartNew(); var lts = LTS.Parse("../demanding/demanding_" + i.ToString(CultureInfo.InvariantCulture) + ".aut"); Log("Read input set in {0}ms", sw.ElapsedMilliseconds); sw.Reset(); sw.Start(); for (int j = 0; j < num_runs; j++) { lastResult = NaiveSolver.Solve(formula, lts, new Environment()).Contains(lts.InitialState); } results[list.IndexOf(formula) * 2 + 0, i - 2] = (double)sw.ElapsedMilliseconds / num_runs; Log("{0}\t{1}\t{2}\t{3}\t{4}", list.IndexOf(formula) + 1, i, "Naive ", (double)sw.ElapsedMilliseconds / (double)num_runs, lastResult); sw.Reset(); sw.Start(); for (int j = 0; j < num_runs; j++) { lastResult = EmersonLei.Solve(formula, lts, new Environment()).Contains(lts.InitialState); } results[list.IndexOf(formula) * 2 + 1, i - 2] = (double)sw.ElapsedMilliseconds / num_runs; Log("{0}\t{1}\t{2}\t{3}\t{4}", list.IndexOf(formula) + 1, i, "Emerson-Lei", (double)sw.ElapsedMilliseconds / (double)num_runs, lastResult); logWriter.Flush(); lts = null; } } Log(""); Log(""); Log("Results table:"); Log("lts size\tformula1 naive\tformula1 emers\tformula2 naive\tformula2 emers\tformula3 naive\tformula3 emers\tformula4 naive\tformula4 emers"); for (int j = 0; j < results.GetLength(1); j++) { var sb = new StringBuilder(); sb.Append((j + 2).ToString()); for (int i = 0; i < results.GetLength(0); i++) { sb.AppendFormat("\t{0}", results[i, j]); } Log(sb.ToString()); } }
private static void OutputResult(MuFormula f, LTS lts) { Log("Formula {0}", f); Log("\t ND: {0}, AD: {1}, DAD: {2}", f.NestingDepth, f.AlternationDepth, f.DependentAlternationDepth); var naiveSol = NaiveSolver.Solve(f, lts, new Environment()); Log("\tNAIVE: {0}", naiveSol.Contains(lts.InitialState)); var emersonLeiSol = EmersonLei.Solve(f, lts, new Environment()); Log("\tEMLEI: {0}", emersonLeiSol.Contains(lts.InitialState)); }