diff options
Diffstat (limited to 'src/CS340.Plotter/Plot.cs')
-rw-r--r-- | src/CS340.Plotter/Plot.cs | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/CS340.Plotter/Plot.cs b/src/CS340.Plotter/Plot.cs index a962057..611e06f 100644 --- a/src/CS340.Plotter/Plot.cs +++ b/src/CS340.Plotter/Plot.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics; using System.IO; using System.Windows.Forms; using TSP; @@ -27,7 +28,7 @@ namespace Plotter { if (debug) plot[0].WriteDebug(); - + plot[0].Render(); plot[1].Render(); plot[2].Render(); @@ -38,13 +39,30 @@ namespace Plotter { string coordsFile = graphFile.Replace(".txt", ".csv"); - TourPlot bruteForce = new(BruteForcePlot); - TourPlot estimation = new(EstimationPlot); - TourPlot mst = new(MSTPlot); + TourPlot bruteForce = new(BruteForcePlot, BruteForceWeight, BruteForceTime); + TourPlot estimation = new(EstimationPlot, EstimatedWeight, EstimatedTime); + TourPlot mst = new(MSTPlot, MSTWeight, MSTTime); + + Stopwatch stopWatch = new Stopwatch(); + stopWatch.Start(); bruteForce.Tour = Solve.BruteForce(graphFile, coordsFile, 0); + stopWatch.Stop(); + bruteForce.RunTime = stopWatch.Elapsed; + + + stopWatch.Reset(); + stopWatch.Start(); estimation.Tour = Solve.BruteForce(graphFile, coordsFile, 0); // TODO create estimation function + stopWatch.Stop(); + estimation.RunTime = stopWatch.Elapsed; + + + stopWatch.Reset(); + stopWatch.Start(); mst.Tour = Solve.MST(graphFile, coordsFile, 0); + stopWatch.Stop(); + mst.RunTime = stopWatch.Elapsed; Plots.Add(new[] { bruteForce, estimation, mst }); } |