public void ExhaustiveTest() { var traceId = 1000; var activities = new HashSet<Activity>(); for (char ch = 'A'; ch <= 'G'; ch++) { activities.Add(new Activity("" + ch, "somename " + ch)); } var inputLog = new Log(); var currentTrace = new LogTrace() {Id = traceId++.ToString()}; inputLog.Traces.Add(currentTrace); var exAl = new ContradictionApproach(activities); int id = 0; while (true) { var input = Console.ReadLine(); switch (input) { case "STOP": exAl.Stop(); currentTrace = currentTrace.Copy(); currentTrace = new LogTrace() { Id = traceId++.ToString() }; inputLog.Traces.Add(currentTrace); break; case "AUTOLOG": Console.WriteLine("Please input a termination index between 0 - 100 : \n"); var logGen = new LogGenerator9001(Convert.ToInt32(Console.ReadLine()), exAl.Graph); Console.WriteLine("Please input number of desired traces to generate : \n"); List<LogTrace> log = logGen.GenerateLog(Convert.ToInt32(Console.ReadLine())); foreach (var trace in log) { Console.WriteLine(trace); } break; case "REDUNDANCY": exAl.Graph = new RedundancyRemover().RemoveRedundancy(exAl.Graph); break; case "POST": exAl.Graph = ContradictionApproach.PostProcessing(exAl.Graph); break; case "NESTED": exAl.Graph = ContradictionApproach.CreateNests(exAl.Graph); break; case "CHANGE TRACE": inputLog.Traces.Add(currentTrace); var newId = Console.ReadLine(); currentTrace = inputLog.Traces.Find(x => x.Id == newId) ?? new LogTrace() { Id = newId}; break; default: if (exAl.Graph.GetActivities().Any(a => a.Id == input)) { exAl.AddEvent(input, currentTrace.Id); currentTrace.Add(new LogEvent(input, "somename" + input) {EventId = "" + id++}); } break; } Console.WriteLine("Current trace id: " + currentTrace.Id); Console.WriteLine(exAl.Graph); //the quality probably suffers because the traces contains unfinished traces. Console.WriteLine(QualityDimensionRetriever.Retrieve(exAl.Graph, inputLog)); } }
public void ParseMortgageApplication() { var graph = new DcrGraph(); graph.AddActivities(new Activity("Collect Documents", "Collect Documents") {Included = true, Roles = "Caseworker"}); graph.AddActivities(new Activity("Irregular neighbourhood", "Irregular neighbourhood") { Included = true, Roles = "it" }); graph.AddActivities(new Activity("Make appraisal appointment") { Included = false, Roles = "Mobile consultant" }); graph.AddActivities(new Activity("Appraisal audit") { Included = true, Roles = "Auditor" }); graph.AddActivities(new Activity("On-site appraisal") { Included = true, Roles = "Mobile consulant" }); graph.AddActivities(new Activity("Submit budget") { Included = true, Roles = "Customer" }); graph.AddActivities(new Activity("Budget screening approve") { Included = true, Pending = true, Roles = "Intern" }); graph.AddActivities(new Activity("Statistical appraisal") { Included = true, Roles = "Caseworker" }); graph.AddActivities(new Activity("Assess loan application") { Included = true, Pending = true, Roles = "Caseworker" }); graph.AddCondition("Collect Documents", "Irregular neighbourhood"); graph.AddCondition("Collect Documents", "Assess loan application"); graph.AddIncludeExclude(true, "Irregular neighbourhood", "Make appraisal appointment"); graph.AddIncludeExclude(false, "Irregular neighbourhood", "Statistical appraisal"); graph.AddCondition("Make appraisal appointment", "On-site appraisal"); graph.AddIncludeExclude(true, "Appraisal audit", "On-site appraisal"); graph.AddIncludeExclude(false, "Statistical appraisal", "On-site appraisal"); graph.AddCondition("Statistical appraisal", "Assess loan application"); graph.AddIncludeExclude(false, "On-site appraisal", "Statistical appraisal"); graph.AddCondition("On-site appraisal", "Assess loan application"); graph.AddCondition("Budget screening approve", "Assess loan application"); graph.AddResponse("Budget screening approve", "Assess loan application"); graph.AddCondition("Submit budget", "Budget screening approve"); graph.AddResponse("Submit budget", "Budget screening approve"); LogGenerator9001 logGenerator9001 = new LogGenerator9001(20,graph); Log log = new Log(); foreach (var trace in logGenerator9001.GenerateLog(500)) { log.AddTrace(trace); } using (StreamWriter sw = new StreamWriter("C:/Downloads/mortgageLog.xml")) { sw.WriteLine(Log.ExportToXml(log)); } }
/// <summary> /// Builds an amount of finished traces /// </summary> public void AutoGenLog() { if (string.IsNullOrEmpty(TracesToGenerate)) MessageBox.Show("Please enter an integer value."); int amount; if (int.TryParse(TracesToGenerate, out amount)) { var logGen = new LogGenerator9001(20, _contradictionApproach.Graph); var log = logGen.GenerateLog(amount); AppendLogAndUpdate(log); } else { MessageBox.Show("Please enter an integer value.", "Error"); } }