Free cookie consent management tool by TermsFeed Policy Generator

Changeset 12888 for branches


Ignore:
Timestamp:
08/20/15 08:56:15 (9 years ago)
Author:
abeham
Message:

#2431:

  • Some bug fixes
Location:
branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.Designer.cs

    r12841 r12888  
    6969      this.byCostViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    7070      this.byTableTabPage = new System.Windows.Forms.TabPage();
    71       this.ertViewHost = new HeuristicLab.MainForm.WindowsForms.ViewHost();
    7271      this.problemComboBox = new System.Windows.Forms.ComboBox();
    7372      this.problemLabel = new System.Windows.Forms.Label();
     73      this.ertTableView = new HeuristicLab.Data.Views.StringConvertibleMatrixView();
    7474      ((System.ComponentModel.ISupportInitialize)(this.errorProvider)).BeginInit();
    7575      this.tabControl.SuspendLayout();
     
    137137      this.targetsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    138138            | System.Windows.Forms.AnchorStyles.Right)));
    139       this.targetsTextBox.Location = new System.Drawing.Point(65, 8);
     139      this.targetsTextBox.Location = new System.Drawing.Point(59, 8);
    140140      this.targetsTextBox.Name = "targetsTextBox";
    141       this.targetsTextBox.Size = new System.Drawing.Size(320, 20);
     141      this.targetsTextBox.Size = new System.Drawing.Size(326, 20);
    142142      this.targetsTextBox.TabIndex = 1;
    143143      this.toolTip.SetToolTip(this.targetsTextBox, "The order of the targets is important, first to-hit targets\r\nshould be given firs" +
     
    194194      this.budgetsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    195195            | System.Windows.Forms.AnchorStyles.Right)));
    196       this.budgetsTextBox.Location = new System.Drawing.Point(65, 8);
     196      this.budgetsTextBox.Location = new System.Drawing.Point(59, 8);
    197197      this.budgetsTextBox.Name = "budgetsTextBox";
    198       this.budgetsTextBox.Size = new System.Drawing.Size(320, 20);
     198      this.budgetsTextBox.Size = new System.Drawing.Size(326, 20);
    199199      this.budgetsTextBox.TabIndex = 6;
    200200      this.budgetsTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.budgetsTextBox_Validating);
     
    340340      // byTableTabPage
    341341      //
    342       this.byTableTabPage.Controls.Add(this.ertViewHost);
     342      this.byTableTabPage.Controls.Add(this.ertTableView);
    343343      this.byTableTabPage.Location = new System.Drawing.Point(4, 22);
    344344      this.byTableTabPage.Name = "byTableTabPage";
     
    349349      this.byTableTabPage.UseVisualStyleBackColor = true;
    350350      //
    351       // ertViewHost
    352       //
    353       this.ertViewHost.Caption = "View";
    354       this.ertViewHost.Content = null;
    355       this.ertViewHost.Dock = System.Windows.Forms.DockStyle.Fill;
    356       this.ertViewHost.Enabled = false;
    357       this.ertViewHost.Location = new System.Drawing.Point(3, 3);
    358       this.ertViewHost.Name = "ertViewHost";
    359       this.ertViewHost.ReadOnly = false;
    360       this.ertViewHost.Size = new System.Drawing.Size(640, 381);
    361       this.ertViewHost.TabIndex = 0;
    362       this.ertViewHost.ViewsLabelVisible = true;
    363       this.ertViewHost.ViewType = null;
    364       //
    365351      // problemComboBox
    366352      //
     
    383369      this.problemLabel.TabIndex = 2;
    384370      this.problemLabel.Text = "Problem:";
     371      //
     372      // ertTableView
     373      //
     374      this.ertTableView.Caption = "StringConvertibleMatrix View";
     375      this.ertTableView.Content = null;
     376      this.ertTableView.Dock = System.Windows.Forms.DockStyle.Fill;
     377      this.ertTableView.Location = new System.Drawing.Point(3, 3);
     378      this.ertTableView.Name = "ertTableView";
     379      this.ertTableView.ReadOnly = false;
     380      this.ertTableView.ShowRowsAndColumnsTextBox = false;
     381      this.ertTableView.ShowStatisticalInformation = false;
     382      this.ertTableView.Size = new System.Drawing.Size(640, 381);
     383      this.ertTableView.TabIndex = 0;
    385384      //
    386385      // RunCollectionRLDView
     
    434433    private System.Windows.Forms.Button generateBudgetsButton;
    435434    private System.Windows.Forms.CheckBox budgetLogScalingCheckBox;
    436     private MainForm.WindowsForms.ViewHost ertViewHost;
    437435    private System.Windows.Forms.Label problemLabel;
    438436    private System.Windows.Forms.ComboBox problemComboBox;
     437    private Data.Views.StringConvertibleMatrixView ertTableView;
    439438  }
    440439}
  • branches/PerformanceComparison/HeuristicLab.Optimization.Views/3.3/RunCollectionViews/RunCollectionRLDView.cs

    r12865 r12888  
    9393      byCostDataTable = new IndexedDataTable<double>("ECDF by Cost", "A data table containing the ECDF of each of a number of groups.") {
    9494        VisualProperties = {
    95           YAxisTitle = "Proportion of required budgets",
     95          YAxisTitle = "Proportion of unused budgets",
    9696          YAxisMinimumFixedValue = 0, YAxisMinimumAuto = false,
    9797          YAxisMaximumFixedValue = 1, YAxisMaximumAuto = false
     
    280280      var maximization = IsMaximization();
    281281
    282       var targetsPerProblem = (from r in Content
    283                                let pd = new ProblemDescription(r).ToString()
    284                                let target = r.Parameters.ContainsKey("BestKnownQuality")
    285                                 && r.Parameters["BestKnownQuality"] is DoubleValue
    286                                   ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value
    287                                   : ((IndexedDataTable<double>)r.Results[table]).Rows.First().Values.Last().Item2
    288                                group target by pd into g
    289                                select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
    290                               .ToDictionary(x => x.Problem, x => x.Target);
     282      var targetsPerProblem = CalculateBestTargetPerProblemInstance(table, maximization);
    291283
    292284      foreach (var x in (from r in Content
    293                          where selectedGroup == AllRuns || r.Parameters.ContainsKey(selectedGroup)
     285                         where (selectedGroup == AllRuns || r.Parameters.ContainsKey(selectedGroup))
    294286                           && selectedProblem.Match(r)
    295287                           && r.Results.ContainsKey(table)
     
    310302    }
    311303
    312     private void UpdateRuns() {
    313       if (InvokeRequired) {
    314         Invoke((Action)UpdateRuns);
    315         return;
    316       }
    317       SuspendRepaint();
    318       try {
    319         UpdateResultsByTarget();
    320         UpdateResultsByCost();
    321       } finally { ResumeRepaint(true); }
    322     }
    323 
    324304    #region Performance analysis by (multiple) target(s)
    325305    private void UpdateResultsByTarget() {
     
    383363      }
    384364
     365      if (targets.Length == 1)
     366        ByTargetDataTable.VisualProperties.YAxisTitle = "Probability to be " + (targets[0] * 100) + "% worse than best";
     367      else ByTargetDataTable.VisualProperties.YAxisTitle = "Proportion of reached targets";
    385368      byTargetDataTable.VisualProperties.XAxisTitle = string.Join(" / ", xAxisTitles);
    386369      byTargetDataTable.VisualProperties.XAxisLogScale = byTargetDataTable.Rows.Count > 0 && targetLogScalingCheckBox.Checked;
     
    392375      targets = new[] { 0.1, 0.05, 0.02, 0.01, 0 };
    393376      suppressTargetsEvents = true;
    394       targetsTextBox.Text = string.Join("% ; ", targets.Select(x => x * 100));
     377      targetsTextBox.Text = string.Join("% ; ", targets.Select(x => x * 100)) + "%";
    395378      suppressTargetsEvents = false;
    396379    }
     
    434417
    435418    private void UpdateErtTables(Dictionary<string, Dictionary<string, Tuple<double, List<IRun>>>> groupedRuns) {
    436       ertViewHost.Content = null;
     419      ertTableView.Content = null;
    437420      var columns = 1 + targets.Length + 1;
    438421      var matrix = new string[groupedRuns.Count * groupedRuns.Max(x => x.Value.Count) + groupedRuns.Max(x => x.Value.Count), columns];
     
    440423      var maximization = IsMaximization();
    441424
    442 
    443       var targetsPerProblem = (from r in Content
    444                                let pd = new ProblemDescription(r).ToString()
    445                                let target = r.Parameters.ContainsKey("BestKnownQuality")
    446                                 && r.Parameters["BestKnownQuality"] is DoubleValue
    447                                   ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value
    448                                   : ((IndexedDataTable<double>)r.Results[(string)dataTableComboBox.SelectedItem]).Rows.First().Values.Last().Item2
    449                                group target by pd into g
    450                                select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
    451                               .ToDictionary(x => x.Problem, x => x.Target);
     425      var targetsPerProblem = CalculateBestTargetPerProblemInstance((string)dataTableComboBox.SelectedItem, maximization);
    452426
    453427      var colNames = new string[columns];
     
    479453        }
    480454      }
    481       ertViewHost.Content = new StringMatrix(matrix) { ColumnNames = colNames };
     455      ertTableView.Content = new StringMatrix(matrix) { ColumnNames = colNames };
     456      ertTableView.DataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.AllCells);
    482457    }
    483458
     
    527502
    528503      var maximization = IsMaximization();
    529       var targetsPerProblem = (from r in Content
    530                                let pd = new ProblemDescription(r).ToString()
    531                                let target = r.Parameters.ContainsKey("BestKnownQuality")
    532                                 && r.Parameters["BestKnownQuality"] is DoubleValue
    533                                   ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value
    534                                   : ((IndexedDataTable<double>)r.Results[(string)dataTableComboBox.SelectedItem]).Rows.First().Values.Last().Item2
    535                                group target by pd into g
    536                                select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
    537                               .ToDictionary(x => x.Problem, x => x.Target);
     504      var targetsPerProblem = CalculateBestTargetPerProblemInstance((string)dataTableComboBox.SelectedItem, maximization);
    538505
    539506      foreach (var group in groupedRuns) {
     
    699666      e.Cancel = false;
    700667      errorProvider.SetError(targetsTextBox, null);
    701       targets = targetList.Select(x => (double)x).ToArray();
     668      targets = targetList.Select(x => (double)x).OrderByDescending(x => x).ToArray();
     669      suppressTargetsEvents = true;
     670      try { targetsTextBox.Text = string.Join("% ; ", targets.Select(x => x * 100)) + "%"; } finally { suppressTargetsEvents = false; }
     671
    702672      UpdateResultsByTarget();
    703673      SetEnabledStateOfControls();
     
    746716      var maximization = IsMaximization();
    747717
    748       var targetsPerProblem = (from r in Content
    749                                let pd = new ProblemDescription(r).ToString()
    750                                let target = r.Parameters.ContainsKey("BestKnownQuality")
    751                                 && r.Parameters["BestKnownQuality"] is DoubleValue
    752                                   ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value
    753                                   : ((IndexedDataTable<double>)r.Results[table]).Rows.First().Values.Last().Item2
    754                                group target by pd into g
    755                                select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
    756                               .ToDictionary(x => x.Problem, x => x.Target);
     718      var targetsPerProblem = CalculateBestTargetPerProblemInstance(table, maximization);
    757719
    758720      foreach (var run in Content) {
     
    911873      return false;
    912874    }
     875
     876    private Dictionary<string, double> CalculateBestTargetPerProblemInstance(string table, bool maximization) {
     877      return (from r in Content
     878              where r.Visible
     879              let pd = new ProblemDescription(r).ToString()
     880              let target = r.Parameters.ContainsKey("BestKnownQuality")
     881                           && r.Parameters["BestKnownQuality"] is DoubleValue
     882                ? ((DoubleValue)r.Parameters["BestKnownQuality"]).Value
     883                : ((IndexedDataTable<double>)r.Results[table]).Rows.First().Values.Last().Item2
     884              group target by pd into g
     885              select new { Problem = g.Key, Target = maximization ? g.Max() : g.Min() })
     886        .ToDictionary(x => x.Problem, x => x.Target);
     887    }
     888
     889    private void UpdateRuns() {
     890      if (InvokeRequired) {
     891        Invoke((Action)UpdateRuns);
     892        return;
     893      }
     894      SuspendRepaint();
     895      try {
     896        UpdateResultsByTarget();
     897        UpdateResultsByCost();
     898      } finally { ResumeRepaint(true); }
     899    }
    913900    #endregion
    914901
Note: See TracChangeset for help on using the changeset viewer.