Ejemplo n.º 1
0
        public static void SaveImage(Edge[] edges, Node[] points)
        {
            const string dir      = @"C:\Temp\TSP\Renderer";
            var          fileName = GetFileName(typeof(Graph));
            var          filePath = $"{dir}\\{fileName}.bmp";
            var          image    = new GraphRenderer().RenderPolygonAndPoints(edges, points);

            new FileSystem().SaveImage(filePath, image);
        }
Ejemplo n.º 2
0
        public void Render()
        {
            var       path   = @"C:\Temp\TSP\Renderer";
            var       graph  = new GraphGenerator().Generate(5, 10, 10);
            var       runner = new Runner(path);
            RunReport report;

            runner.Run(graph, new BruteForce(), out report);

            var renderer = new GraphRenderer();
            var image    = renderer.RenderGraph(report.Graph, report.BestWalk);

            var repo = new Repository(path);

            repo.Save(report, image);
        }
Ejemplo n.º 3
0
        private void SaveSingleRun(ComparativeRunReport run, string rootPath)
        {
            _fileSystem.EnsureDirectory(FirstFailurePath);
            _fileSystem.ClearDirectory(FirstFailurePath);
            var filePath = rootPath + @"\{0}.bmp";

            var renderer = new GraphRenderer();

            _fileSystem.SaveText(rootPath + @"\Graph.json", _serializer.Serialize(run.Graph));

            _fileSystem.SaveImage(string.Format(filePath, "best"),
                                  renderer.RenderGraph(run.Graph, run.BaseSolverReport.BestWalk));

            var history = (List <Node[]>)run.TestedSolverReport.RunDetails["history"];
            var index   = 1;

            foreach (var walk in history)
            {
                _fileSystem.SaveImage(string.Format(filePath, "step" + index++),
                                      renderer.RenderGraph(run.Graph, walk));
            }
        }