summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/CS340.Plotter/Plot.Designer.cs468
-rw-r--r--src/CS340.Plotter/Plot.cs26
-rw-r--r--src/CS340.Plotter/TourPlot.cs26
-rw-r--r--src/CS340.TSP/Tour.cs2
4 files changed, 496 insertions, 26 deletions
diff --git a/src/CS340.Plotter/Plot.Designer.cs b/src/CS340.Plotter/Plot.Designer.cs
index 3b8b8d2..4bab6c8 100644
--- a/src/CS340.Plotter/Plot.Designer.cs
+++ b/src/CS340.Plotter/Plot.Designer.cs
@@ -33,10 +33,43 @@ namespace Plotter
this.EstimationPlot = new System.Windows.Forms.PictureBox();
this.MSTPlot = new System.Windows.Forms.PictureBox();
this.LayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.BruteForceTime = new System.Windows.Forms.Label();
+ this.BruteForceWeight = new System.Windows.Forms.Label();
+ this.BruteForceWeightLabel = new System.Windows.Forms.Label();
+ this.BruteForceTimeLabel = new System.Windows.Forms.Label();
+ this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
+ this.EstimatedTime = new System.Windows.Forms.Label();
+ this.EstimatedWeight = new System.Windows.Forms.Label();
+ this.EstimatedWeightLabel = new System.Windows.Forms.Label();
+ this.EstimatedTimeLabel = new System.Windows.Forms.Label();
+ this.tableLayoutPanel6 = new System.Windows.Forms.TableLayoutPanel();
+ this.MSTTime = new System.Windows.Forms.Label();
+ this.MSTWeight = new System.Windows.Forms.Label();
+ this.MSTWeightLabel = new System.Windows.Forms.Label();
+ this.MSTTimeLabel = new System.Windows.Forms.Label();
+ this.BruteForceLabel = new System.Windows.Forms.Label();
+ this.EstimatedLabel = new System.Windows.Forms.Label();
+ this.MSTLabel = new System.Windows.Forms.Label();
+ this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
+ this.label2 = new System.Windows.Forms.Label();
+ this.label3 = new System.Windows.Forms.Label();
+ this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
+ this.label4 = new System.Windows.Forms.Label();
+ this.label5 = new System.Windows.Forms.Label();
+ this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
+ this.label8 = new System.Windows.Forms.Label();
+ this.label9 = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)(this.BruteForcePlot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.EstimationPlot)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.MSTPlot)).BeginInit();
this.LayoutPanel.SuspendLayout();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.tableLayoutPanel5.SuspendLayout();
+ this.tableLayoutPanel6.SuspendLayout();
+ this.tableLayoutPanel2.SuspendLayout();
+ this.tableLayoutPanel3.SuspendLayout();
+ this.tableLayoutPanel4.SuspendLayout();
this.SuspendLayout();
//
// BruteForcePlot
@@ -44,63 +77,439 @@ namespace Plotter
this.BruteForcePlot.Dock = System.Windows.Forms.DockStyle.Fill;
this.BruteForcePlot.Location = new System.Drawing.Point(3, 3);
this.BruteForcePlot.Name = "BruteForcePlot";
- this.BruteForcePlot.Size = new System.Drawing.Size(307, 404);
+ this.BruteForcePlot.Size = new System.Drawing.Size(248, 241);
this.BruteForcePlot.TabIndex = 0;
this.BruteForcePlot.TabStop = false;
- this.BruteForcePlot.SizeChanged += new System.EventHandler(this.Canvas_SizeChanged);
//
// EstimationPlot
//
this.EstimationPlot.Dock = System.Windows.Forms.DockStyle.Fill;
- this.EstimationPlot.Location = new System.Drawing.Point(316, 3);
+ this.EstimationPlot.Location = new System.Drawing.Point(257, 3);
this.EstimationPlot.Name = "EstimationPlot";
- this.EstimationPlot.Size = new System.Drawing.Size(307, 404);
+ this.EstimationPlot.Size = new System.Drawing.Size(248, 241);
this.EstimationPlot.TabIndex = 1;
this.EstimationPlot.TabStop = false;
//
// MSTPlot
//
this.MSTPlot.Dock = System.Windows.Forms.DockStyle.Fill;
- this.MSTPlot.Location = new System.Drawing.Point(629, 3);
+ this.MSTPlot.Location = new System.Drawing.Point(511, 3);
this.MSTPlot.Name = "MSTPlot";
- this.MSTPlot.Size = new System.Drawing.Size(309, 404);
+ this.MSTPlot.Size = new System.Drawing.Size(250, 241);
this.MSTPlot.TabIndex = 2;
this.MSTPlot.TabStop = false;
//
// LayoutPanel
//
- this.LayoutPanel.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.LayoutPanel.AutoSize = true;
this.LayoutPanel.ColumnCount = 3;
this.LayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.LayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.LayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
+ this.LayoutPanel.Controls.Add(this.tableLayoutPanel1, 0, 2);
+ this.LayoutPanel.Controls.Add(this.tableLayoutPanel5, 1, 2);
+ this.LayoutPanel.Controls.Add(this.tableLayoutPanel6, 2, 2);
+ this.LayoutPanel.Controls.Add(this.BruteForcePlot, 0, 0);
+ this.LayoutPanel.Controls.Add(this.BruteForceLabel, 0, 1);
this.LayoutPanel.Controls.Add(this.EstimationPlot, 1, 0);
+ this.LayoutPanel.Controls.Add(this.EstimatedLabel, 1, 1);
this.LayoutPanel.Controls.Add(this.MSTPlot, 2, 0);
- this.LayoutPanel.Controls.Add(this.BruteForcePlot, 0, 0);
- this.LayoutPanel.Location = new System.Drawing.Point(12, 12);
+ this.LayoutPanel.Controls.Add(this.MSTLabel, 2, 1);
+ this.LayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.LayoutPanel.Location = new System.Drawing.Point(0, 0);
this.LayoutPanel.Name = "LayoutPanel";
- this.LayoutPanel.RowCount = 1;
+ this.LayoutPanel.RowCount = 4;
this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
- this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
- this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 30F));
- this.LayoutPanel.Size = new System.Drawing.Size(941, 410);
+ this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.LayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle());
+ this.LayoutPanel.Size = new System.Drawing.Size(764, 311);
this.LayoutPanel.TabIndex = 4;
//
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1.AutoSize = true;
+ this.tableLayoutPanel1.ColumnCount = 2;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.Controls.Add(this.BruteForceTime, 1, 1);
+ this.tableLayoutPanel1.Controls.Add(this.BruteForceWeight, 1, 0);
+ this.tableLayoutPanel1.Controls.Add(this.BruteForceWeightLabel, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.BruteForceTimeLabel, 0, 1);
+ this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 274);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 2;
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(248, 34);
+ this.tableLayoutPanel1.TabIndex = 12;
+ //
+ // BruteForceTime
+ //
+ this.BruteForceTime.AutoSize = true;
+ this.BruteForceTime.Dock = System.Windows.Forms.DockStyle.Left;
+ this.BruteForceTime.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.BruteForceTime.Location = new System.Drawing.Point(127, 17);
+ this.BruteForceTime.Name = "BruteForceTime";
+ this.BruteForceTime.Size = new System.Drawing.Size(76, 17);
+ this.BruteForceTime.TabIndex = 13;
+ this.BruteForceTime.Text = "00:00:0.00";
+ this.BruteForceTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // BruteForceWeight
+ //
+ this.BruteForceWeight.AutoSize = true;
+ this.BruteForceWeight.Dock = System.Windows.Forms.DockStyle.Left;
+ this.BruteForceWeight.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.BruteForceWeight.Location = new System.Drawing.Point(127, 0);
+ this.BruteForceWeight.Name = "BruteForceWeight";
+ this.BruteForceWeight.Size = new System.Drawing.Size(44, 17);
+ this.BruteForceWeight.TabIndex = 12;
+ this.BruteForceWeight.Text = "0.000";
+ this.BruteForceWeight.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // BruteForceWeightLabel
+ //
+ this.BruteForceWeightLabel.AutoSize = true;
+ this.BruteForceWeightLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.BruteForceWeightLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.BruteForceWeightLabel.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.BruteForceWeightLabel.Location = new System.Drawing.Point(63, 0);
+ this.BruteForceWeightLabel.Name = "BruteForceWeightLabel";
+ this.BruteForceWeightLabel.Size = new System.Drawing.Size(58, 17);
+ this.BruteForceWeightLabel.TabIndex = 11;
+ this.BruteForceWeightLabel.Text = "Weight:";
+ this.BruteForceWeightLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // BruteForceTimeLabel
+ //
+ this.BruteForceTimeLabel.AutoSize = true;
+ this.BruteForceTimeLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.BruteForceTimeLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.BruteForceTimeLabel.Location = new System.Drawing.Point(54, 17);
+ this.BruteForceTimeLabel.Name = "BruteForceTimeLabel";
+ this.BruteForceTimeLabel.Size = new System.Drawing.Size(67, 17);
+ this.BruteForceTimeLabel.TabIndex = 9;
+ this.BruteForceTimeLabel.Text = "Runtime:";
+ this.BruteForceTimeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // tableLayoutPanel5
+ //
+ this.tableLayoutPanel5.AutoSize = true;
+ this.tableLayoutPanel5.ColumnCount = 2;
+ this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel5.Controls.Add(this.EstimatedTime, 1, 1);
+ this.tableLayoutPanel5.Controls.Add(this.EstimatedWeight, 1, 0);
+ this.tableLayoutPanel5.Controls.Add(this.EstimatedWeightLabel, 0, 0);
+ this.tableLayoutPanel5.Controls.Add(this.EstimatedTimeLabel, 0, 1);
+ this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel5.Location = new System.Drawing.Point(257, 274);
+ this.tableLayoutPanel5.Name = "tableLayoutPanel5";
+ this.tableLayoutPanel5.RowCount = 2;
+ this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel5.Size = new System.Drawing.Size(248, 34);
+ this.tableLayoutPanel5.TabIndex = 13;
+ //
+ // EstimatedTime
+ //
+ this.EstimatedTime.AutoSize = true;
+ this.EstimatedTime.Dock = System.Windows.Forms.DockStyle.Left;
+ this.EstimatedTime.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.EstimatedTime.Location = new System.Drawing.Point(127, 17);
+ this.EstimatedTime.Name = "EstimatedTime";
+ this.EstimatedTime.Size = new System.Drawing.Size(76, 17);
+ this.EstimatedTime.TabIndex = 13;
+ this.EstimatedTime.Text = "00:00:0.00";
+ this.EstimatedTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // EstimatedWeight
+ //
+ this.EstimatedWeight.AutoSize = true;
+ this.EstimatedWeight.Dock = System.Windows.Forms.DockStyle.Left;
+ this.EstimatedWeight.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.EstimatedWeight.Location = new System.Drawing.Point(127, 0);
+ this.EstimatedWeight.Name = "EstimatedWeight";
+ this.EstimatedWeight.Size = new System.Drawing.Size(44, 17);
+ this.EstimatedWeight.TabIndex = 12;
+ this.EstimatedWeight.Text = "0.000";
+ this.EstimatedWeight.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // EstimatedWeightLabel
+ //
+ this.EstimatedWeightLabel.AutoSize = true;
+ this.EstimatedWeightLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.EstimatedWeightLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.EstimatedWeightLabel.Location = new System.Drawing.Point(63, 0);
+ this.EstimatedWeightLabel.Name = "EstimatedWeightLabel";
+ this.EstimatedWeightLabel.Size = new System.Drawing.Size(58, 17);
+ this.EstimatedWeightLabel.TabIndex = 11;
+ this.EstimatedWeightLabel.Text = "Weight:";
+ this.EstimatedWeightLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // EstimatedTimeLabel
+ //
+ this.EstimatedTimeLabel.AutoSize = true;
+ this.EstimatedTimeLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.EstimatedTimeLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.EstimatedTimeLabel.Location = new System.Drawing.Point(54, 17);
+ this.EstimatedTimeLabel.Name = "EstimatedTimeLabel";
+ this.EstimatedTimeLabel.Size = new System.Drawing.Size(67, 17);
+ this.EstimatedTimeLabel.TabIndex = 9;
+ this.EstimatedTimeLabel.Text = "Runtime:";
+ this.EstimatedTimeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // tableLayoutPanel6
+ //
+ this.tableLayoutPanel6.AutoSize = true;
+ this.tableLayoutPanel6.ColumnCount = 2;
+ this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel6.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel6.Controls.Add(this.MSTTime, 1, 1);
+ this.tableLayoutPanel6.Controls.Add(this.MSTWeight, 1, 0);
+ this.tableLayoutPanel6.Controls.Add(this.MSTWeightLabel, 0, 0);
+ this.tableLayoutPanel6.Controls.Add(this.MSTTimeLabel, 0, 1);
+ this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.tableLayoutPanel6.Location = new System.Drawing.Point(511, 274);
+ this.tableLayoutPanel6.Name = "tableLayoutPanel6";
+ this.tableLayoutPanel6.RowCount = 2;
+ this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel6.Size = new System.Drawing.Size(250, 34);
+ this.tableLayoutPanel6.TabIndex = 14;
+ //
+ // MSTTime
+ //
+ this.MSTTime.AutoSize = true;
+ this.MSTTime.Dock = System.Windows.Forms.DockStyle.Left;
+ this.MSTTime.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.MSTTime.Location = new System.Drawing.Point(128, 17);
+ this.MSTTime.Name = "MSTTime";
+ this.MSTTime.Size = new System.Drawing.Size(76, 17);
+ this.MSTTime.TabIndex = 13;
+ this.MSTTime.Text = "00:00:0.00";
+ this.MSTTime.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // MSTWeight
+ //
+ this.MSTWeight.AutoSize = true;
+ this.MSTWeight.Dock = System.Windows.Forms.DockStyle.Left;
+ this.MSTWeight.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.MSTWeight.Location = new System.Drawing.Point(128, 0);
+ this.MSTWeight.Name = "MSTWeight";
+ this.MSTWeight.Size = new System.Drawing.Size(44, 17);
+ this.MSTWeight.TabIndex = 12;
+ this.MSTWeight.Text = "0.000";
+ this.MSTWeight.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // MSTWeightLabel
+ //
+ this.MSTWeightLabel.AutoSize = true;
+ this.MSTWeightLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.MSTWeightLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.MSTWeightLabel.Location = new System.Drawing.Point(64, 0);
+ this.MSTWeightLabel.Name = "MSTWeightLabel";
+ this.MSTWeightLabel.Size = new System.Drawing.Size(58, 17);
+ this.MSTWeightLabel.TabIndex = 11;
+ this.MSTWeightLabel.Text = "Weight:";
+ this.MSTWeightLabel.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ //
+ // MSTTimeLabel
+ //
+ this.MSTTimeLabel.AutoSize = true;
+ this.MSTTimeLabel.Dock = System.Windows.Forms.DockStyle.Right;
+ this.MSTTimeLabel.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.MSTTimeLabel.Location = new System.Drawing.Point(55, 17);
+ this.MSTTimeLabel.Name = "MSTTimeLabel";
+ this.MSTTimeLabel.Size = new System.Drawing.Size(67, 17);
+ this.MSTTimeLabel.TabIndex = 9;
+ this.MSTTimeLabel.Text = "Runtime:";
+ this.MSTTimeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // BruteForceLabel
+ //
+ this.BruteForceLabel.AutoSize = true;
+ this.BruteForceLabel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.BruteForceLabel.Font = new System.Drawing.Font("Arial", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.BruteForceLabel.Location = new System.Drawing.Point(3, 247);
+ this.BruteForceLabel.Name = "BruteForceLabel";
+ this.BruteForceLabel.Size = new System.Drawing.Size(248, 24);
+ this.BruteForceLabel.TabIndex = 3;
+ this.BruteForceLabel.Text = "Brute Force";
+ this.BruteForceLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // EstimatedLabel
+ //
+ this.EstimatedLabel.AutoSize = true;
+ this.EstimatedLabel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.EstimatedLabel.Font = new System.Drawing.Font("Arial", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.EstimatedLabel.Location = new System.Drawing.Point(257, 247);
+ this.EstimatedLabel.Name = "EstimatedLabel";
+ this.EstimatedLabel.Size = new System.Drawing.Size(248, 24);
+ this.EstimatedLabel.TabIndex = 4;
+ this.EstimatedLabel.Text = "Estimated";
+ this.EstimatedLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // MSTLabel
+ //
+ this.MSTLabel.AutoSize = true;
+ this.MSTLabel.Dock = System.Windows.Forms.DockStyle.Top;
+ this.MSTLabel.Font = new System.Drawing.Font("Arial", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.MSTLabel.Location = new System.Drawing.Point(511, 247);
+ this.MSTLabel.Name = "MSTLabel";
+ this.MSTLabel.Size = new System.Drawing.Size(250, 24);
+ this.MSTLabel.TabIndex = 5;
+ this.MSTLabel.Text = "MST";
+ this.MSTLabel.TextAlign = System.Drawing.ContentAlignment.TopCenter;
+ //
+ // tableLayoutPanel2
+ //
+ this.tableLayoutPanel2.AutoSize = true;
+ this.tableLayoutPanel2.ColumnCount = 2;
+ this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel2.Controls.Add(this.label2, 1, 1);
+ this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel2.Name = "tableLayoutPanel2";
+ this.tableLayoutPanel2.RowCount = 2;
+ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel2.Size = new System.Drawing.Size(200, 100);
+ this.tableLayoutPanel2.TabIndex = 0;
+ //
+ // label2
+ //
+ this.label2.AutoSize = true;
+ this.label2.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label2.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label2.Location = new System.Drawing.Point(103, 20);
+ this.label2.Name = "label2";
+ this.label2.Size = new System.Drawing.Size(84, 80);
+ this.label2.TabIndex = 13;
+ this.label2.Text = "00:00:12.41";
+ this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // label3
+ //
+ this.label3.AutoSize = true;
+ this.label3.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label3.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label3.Location = new System.Drawing.Point(166, 0);
+ this.label3.Name = "label3";
+ this.label3.Size = new System.Drawing.Size(60, 17);
+ this.label3.TabIndex = 12;
+ this.label3.Text = "123.342";
+ this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // tableLayoutPanel3
+ //
+ this.tableLayoutPanel3.AutoSize = true;
+ this.tableLayoutPanel3.ColumnCount = 2;
+ this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel3.Controls.Add(this.label4, 1, 1);
+ this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel3.Name = "tableLayoutPanel3";
+ this.tableLayoutPanel3.RowCount = 2;
+ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel3.Size = new System.Drawing.Size(200, 100);
+ this.tableLayoutPanel3.TabIndex = 0;
+ //
+ // label4
+ //
+ this.label4.AutoSize = true;
+ this.label4.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label4.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label4.Location = new System.Drawing.Point(103, 20);
+ this.label4.Name = "label4";
+ this.label4.Size = new System.Drawing.Size(84, 80);
+ this.label4.TabIndex = 13;
+ this.label4.Text = "00:00:12.41";
+ this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // label5
+ //
+ this.label5.AutoSize = true;
+ this.label5.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label5.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label5.Location = new System.Drawing.Point(166, 0);
+ this.label5.Name = "label5";
+ this.label5.Size = new System.Drawing.Size(60, 17);
+ this.label5.TabIndex = 12;
+ this.label5.Text = "123.342";
+ this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // tableLayoutPanel4
+ //
+ this.tableLayoutPanel4.AutoSize = true;
+ this.tableLayoutPanel4.ColumnCount = 2;
+ this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
+ this.tableLayoutPanel4.Controls.Add(this.label8, 1, 1);
+ this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 0);
+ this.tableLayoutPanel4.Name = "tableLayoutPanel4";
+ this.tableLayoutPanel4.RowCount = 2;
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
+ this.tableLayoutPanel4.Size = new System.Drawing.Size(200, 100);
+ this.tableLayoutPanel4.TabIndex = 0;
+ //
+ // label8
+ //
+ this.label8.AutoSize = true;
+ this.label8.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label8.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label8.Location = new System.Drawing.Point(103, 20);
+ this.label8.Name = "label8";
+ this.label8.Size = new System.Drawing.Size(84, 80);
+ this.label8.TabIndex = 13;
+ this.label8.Text = "00:00:12.41";
+ this.label8.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
+ // label9
+ //
+ this.label9.AutoSize = true;
+ this.label9.Dock = System.Windows.Forms.DockStyle.Left;
+ this.label9.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.label9.Location = new System.Drawing.Point(166, 0);
+ this.label9.Name = "label9";
+ this.label9.Size = new System.Drawing.Size(60, 17);
+ this.label9.TabIndex = 12;
+ this.label9.Text = "123.342";
+ this.label9.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
+ //
// Plot
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
- this.ClientSize = new System.Drawing.Size(965, 434);
+ this.ClientSize = new System.Drawing.Size(764, 311);
this.Controls.Add(this.LayoutPanel);
+ this.MinimumSize = new System.Drawing.Size(780, 350);
this.Name = "Plot";
this.Text = "Plot";
+ this.SizeChanged += new System.EventHandler(this.Canvas_SizeChanged);
((System.ComponentModel.ISupportInitialize)(this.BruteForcePlot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.EstimationPlot)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.MSTPlot)).EndInit();
this.LayoutPanel.ResumeLayout(false);
+ this.LayoutPanel.PerformLayout();
+ this.tableLayoutPanel1.ResumeLayout(false);
+ this.tableLayoutPanel1.PerformLayout();
+ this.tableLayoutPanel5.ResumeLayout(false);
+ this.tableLayoutPanel5.PerformLayout();
+ this.tableLayoutPanel6.ResumeLayout(false);
+ this.tableLayoutPanel6.PerformLayout();
+ this.tableLayoutPanel2.ResumeLayout(false);
+ this.tableLayoutPanel2.PerformLayout();
+ this.tableLayoutPanel3.ResumeLayout(false);
+ this.tableLayoutPanel3.PerformLayout();
+ this.tableLayoutPanel4.ResumeLayout(false);
+ this.tableLayoutPanel4.PerformLayout();
this.ResumeLayout(false);
+ this.PerformLayout();
}
@@ -110,6 +519,33 @@ namespace Plotter
private System.Windows.Forms.PictureBox EstimationPlot;
private System.Windows.Forms.PictureBox MSTPlot;
private System.Windows.Forms.TableLayoutPanel LayoutPanel;
+ private System.Windows.Forms.Label MSTLabel;
+ private System.Windows.Forms.Label BruteForceLabel;
+ private System.Windows.Forms.Label EstimatedLabel;
+ private System.Windows.Forms.Label BruteForceTimeLabel;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
+ private System.Windows.Forms.Label BruteForceWeightLabel;
+ private System.Windows.Forms.Label BruteForceTime;
+ private System.Windows.Forms.Label BruteForceWeight;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
+ private System.Windows.Forms.Label EstimatedTime;
+ private System.Windows.Forms.Label EstimatedWeight;
+ private System.Windows.Forms.Label EstimatedWeightLabel;
+ private System.Windows.Forms.Label EstimatedTimeLabel;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel6;
+ private System.Windows.Forms.Label MSTTime;
+ private System.Windows.Forms.Label MSTWeight;
+ private System.Windows.Forms.Label MSTWeightLabel;
+ private System.Windows.Forms.Label MSTTimeLabel;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
+ private System.Windows.Forms.Label label2;
+ private System.Windows.Forms.Label label3;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
+ private System.Windows.Forms.Label label4;
+ private System.Windows.Forms.Label label5;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
+ private System.Windows.Forms.Label label8;
+ private System.Windows.Forms.Label label9;
}
}
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 });
}
diff --git a/src/CS340.Plotter/TourPlot.cs b/src/CS340.Plotter/TourPlot.cs
index 11f23ba..7c03957 100644
--- a/src/CS340.Plotter/TourPlot.cs
+++ b/src/CS340.Plotter/TourPlot.cs
@@ -1,3 +1,4 @@
+using System;
using System.Diagnostics;
using System.Drawing;
using System.Linq;
@@ -10,10 +11,15 @@ namespace Plotter
{
public Tour Tour { get; set; }
public PictureBox Canvas { get; set; }
+ public Label WeightLabel { get; set; }
+ public Label RuntimeLabel { get; set; }
+ public TimeSpan RunTime { get; set; }
- public TourPlot(PictureBox canvas)
+ public TourPlot(PictureBox canvas, Label weightLabel, Label runtimeLabel)
{
Canvas = canvas;
+ WeightLabel = weightLabel;
+ RuntimeLabel = runtimeLabel;
}
public void Render()
@@ -26,6 +32,7 @@ namespace Plotter
using Font font = new("Arial", 16);
using Font gridFont = new("Arial", 10);
using SolidBrush brush = new(Color.Black);
+ using StringFormat stringFormat = new StringFormat();
gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
gfx.Clear(Color.White);
@@ -35,12 +42,16 @@ namespace Plotter
Point left = ScaleLocation(new Coordinate(0, i));
Point right = ScaleLocation(new Coordinate(100, i));
gfx.DrawLine(gridPen, left, right);
- gfx.DrawString(i.ToString(), gridFont, brush, left);
+ stringFormat.Alignment = StringAlignment.Far;
+ stringFormat.LineAlignment = StringAlignment.Center;
+ gfx.DrawString(i.ToString(), gridFont, brush, left, stringFormat);
Point bottom = ScaleLocation(new Coordinate(i, 0));
Point top = ScaleLocation(new Coordinate(i, 100));
gfx.DrawLine(gridPen, bottom, top);
- gfx.DrawString(i.ToString(), gridFont, brush, bottom);
+ stringFormat.Alignment = StringAlignment.Center;
+ stringFormat.LineAlignment = StringAlignment.Near;
+ gfx.DrawString(i.ToString(), gridFont, brush, bottom, stringFormat);
}
foreach (City city in Tour.Cities.Where(city => city.Parent != -1))
@@ -58,10 +69,15 @@ namespace Plotter
Canvas.Image?.Dispose();
Canvas.Image = (Bitmap)bmp.Clone();
+ RuntimeLabel.Text = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
+ RunTime.Hours, RunTime.Minutes, RunTime.Seconds, RunTime.Milliseconds / 10);
+
+ WeightLabel.Text = Tour.Weight.ToString("F3");
+
Point ScaleLocation(Coordinate coordinate)
{
- int x = Canvas.Width * (coordinate.X + 10) / Scaler;
- int y = Canvas.Height * ((coordinate.Y - 100) * -1 + 15) / Scaler;
+ int x = Canvas.Width * (coordinate.X + 12) / Scaler;
+ int y = Canvas.Height * ((coordinate.Y - 100) * -1 + 12) / Scaler;
return new Point(x, y);
}
diff --git a/src/CS340.TSP/Tour.cs b/src/CS340.TSP/Tour.cs
index d90ab7e..99c0f5d 100644
--- a/src/CS340.TSP/Tour.cs
+++ b/src/CS340.TSP/Tour.cs
@@ -28,7 +28,7 @@ namespace TSP
Cities.AddRange(cities.Select(city => new City(city)));
public Tour(List<Vertex> cities, List<Coordinate> coordinates) =>
- Cities.AddRange(cities.Zip(coordinates, (city, coord) => new City(city, coord)));
+ Cities.AddRange(cities.Select(city => new City(city, coordinates[city.Id])));
public override string ToString() =>
$"tour: {String.Join(" -> ", Cities.Select(city => city.Id))}\n" +