public void Reevaluate(RunCollection runcollection, string filePath, double timeout) { string fileName = Path.GetFileName(filePath); foreach (var run in runcollection) { var model = run.Results[BESTTRAININGSOLUTION + ".Model"] as ISymbolicExpressionTree; foreach (var name in run.Results.Select(x => x.Key).Where(x => x.StartsWith(BESTTRAININGSOLUTION + ".") || x.Equals(BESTTRAININGSOLUTION)).ToList()) { run.Results.Remove(name); } var problemData = run.Parameters["CFGProblemData"] as CFGPythonProblemData; var pythonProcess = run.Parameters["PythonProcess"] as PythonProcess; pythonProcess.DegreeOfParallelism = 1; if (problemData != null && pythonProcess != null) { var solution = new CFGPythonSolution(model, problemData, timeout, pythonProcess); run.Results.Add(BESTTRAININGSOLUTION, solution as ResultCollection); foreach (var item in solution) { run.Results.Add(String.Format("{0}.{1}", BESTTRAININGSOLUTION, item.Name), item.Value); } pythonProcess.Dispose(); } else { Helper.printToConsole("Warning: Could not reevaluate solution.", fileName); } } Helper.printToConsole("Saving...", fileName); ContentManager.Save(runcollection, filePath, true); Helper.printToConsole("Saved", fileName); }
protected CFGPythonSolution(CFGPythonSolution original, Cloner cloner) : base(original, cloner) { name = original.Name; description = original.Description; }