Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/13/16 16:25:12 (9 years ago)
Author:
abeham
Message:

#2547:

  • worked on problem instance mapping
  • started working on improved suggestion algorithm
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/PerformanceComparison/HeuristicLab.OptimizationExpertSystem/3.3/Views/UnderstandingProblemInstanceView.cs

    r13752 r13757  
    2828using System;
    2929using System.Collections.Generic;
     30using System.Drawing;
    3031using System.Linq;
    3132using System.Text.RegularExpressions;
     
    6263        UpdateProjectionComboBox();
    6364        UpdateSizeComboBox();
     65        UpdateColorComboBox();
    6466      }
    6567    }
     
    7678      UpdateProjectionComboBox();
    7779      UpdateSizeComboBox();
     80      UpdateColorComboBox();
    7881      UpdateProjection();
    7982    }
     
    108111      } finally { SuppressEvents = false; }
    109112    }
     113
     114    private void UpdateColorComboBox() {
     115      try {
     116        SuppressEvents = true;
     117        var selected = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : null;
     118        colorComboBox.Items.Clear();
     119        colorComboBox.Items.Add(string.Empty);
     120        foreach (var str in Content.ProblemInstances.ResultNames.Where(x => x.StartsWith("Rank."))) {
     121          colorComboBox.Items.Add(str);
     122          if (selected == str) colorComboBox.SelectedItem = str;
     123        }
     124        if (selected == null && colorComboBox.Items.Count > 0)
     125          colorComboBox.SelectedIndex = 0;
     126      } finally { SuppressEvents = false; }
     127    }
    110128   
    111129    private IEnumerable<string> GetProjections() {
     
    130148      var projection = (string)projectionComboBox.SelectedItem;
    131149      var size = sizeComboBox.SelectedIndex >= 0 ? (string)sizeComboBox.SelectedItem : string.Empty;
    132 
    133       DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection, size, invPropCheckBox.Checked);
    134     }
    135 
    136     private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, bool invProp) {
     150      var color = colorComboBox.SelectedIndex >= 0 ? (string)colorComboBox.SelectedItem : string.Empty;
     151
     152      DoProjectProblemInstances(instancesSeries, currentInstanceSeries, projection,
     153        size, color, invPropCheckBox.Checked, fromZeroCheckBox.Checked);
     154    }
     155
     156    private void DoProjectProblemInstances(Series instancesSeries, Series currentInstanceSeries, string projection, string size, string color, bool invProp, bool fromZero) {
    137157      instancesSeries.Points.Clear();
    138158      currentInstanceSeries.Points.Clear();
     
    143163        if (sizes.Count > 0) {
    144164          maxSize = sizes.Max(x => x.Value);
    145           minSize = sizes.Min(x => x.Value);
     165          if (maxSize < 0 && fromZero) {
     166            maxSize = 0;
     167            minSize = sizes.Min(x => x.Value);
     168          } else if (fromZero) {
     169            minSize = 0;
     170          } else {
     171            minSize = sizes.Min(x => x.Value);
     172          }
    146173        }
    147174      }
     
    159186        if (maxSize > minSize && run.Results.TryGetValue(size, out item)) {
    160187          var dItem = item as Data.DoubleValue;
     188          if (dItem == null && item is IntValue) dItem = new DoubleValue(((IntValue)item).Value);
    161189          if (dItem != null) {
    162190            if (double.IsNaN(dItem.Value))
     
    171199        } else dataPoint.MarkerSize = 1;
    172200
     201        if (!string.IsNullOrEmpty(color)) {
     202          if (run.Results.TryGetValue(color, out item)) {
     203            var v = (int)(item is DoubleValue ? ((DoubleValue)item).Value : (item is IntValue ? ((IntValue)item).Value : int.MaxValue));
     204            switch (v) {
     205              case 0: dataPoint.MarkerColor = Color.Green; break;
     206              case 1: dataPoint.MarkerColor = Color.LightSeaGreen; break;
     207              case 2: dataPoint.MarkerColor = Color.CornflowerBlue; break;
     208              case 3: dataPoint.MarkerColor = Color.PaleVioletRed; break;
     209              case 4: dataPoint.MarkerColor = Color.IndianRed; break;
     210              default: dataPoint.MarkerColor = Color.LightGray; break;
     211            }
     212          }
     213        }
    173214        if (Content.IsCurrentInstance(run)) currentInstanceSeries.Points.Add(dataPoint);
    174215        else instancesSeries.Points.Add(dataPoint);
     
    185226    }
    186227
     228    private void colorComboBox_SelectedIndexChanged(object sender, EventArgs e) {
     229      UpdateProjection();
     230    }
     231
    187232    private void InvPropCheckBoxOnCheckedChanged(object sender, EventArgs e) {
     233      UpdateProjection();
     234    }
     235
     236    private void fromZeroCheckBox_CheckedChanged(object sender, EventArgs e) {
    188237      UpdateProjection();
    189238    }
Note: See TracChangeset for help on using the changeset viewer.