Changeset 13821


Ignore:
Timestamp:
05/02/16 15:25:14 (4 years ago)
Author:
bburlacu
Message:

#2288: Used localization when formatting strings. Add canceling in CreateTargetVariationExperimentDialog. Remove use of C# 4.6 language features.

Location:
branches/HeuristicLab.VariableInteractionNetworks
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/DirectedGraphChart.cs

    r13806 r13821  
    4444
    4545    // graph layout options
    46     public double IdealEdgeLength { get; set; } = 50;
    47     public bool PerformEdgeRouting { get; set; } = false;
     46    public double IdealEdgeLength { get; set; }
     47    public bool PerformEdgeRouting { get; set; }
    4848    public Routing RoutingMode { get; set; }
    4949
     
    8484      shapes = new Dictionary<Type, LabeledPrimitive>();
    8585      SmoothingMode = SmoothingMode.HighQuality; // set antialiasing for nicer rendering
     86      IdealEdgeLength = 50;
    8687    }
    8788
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/Layout/ConstrainedForceDirectedLayout.cs

    r13727 r13821  
    4545    private Dictionary<uint, uint> idMap;
    4646    private Dictionary<IVertex, int> indexMap;
    47     public double IdealEdgeLength { get; set; } = 1;
    48     public double DefaultEdgeLength { get; set; } = 200;
    49     public bool PreventOverlaps { get; set; } = true;
    50     public int LayoutWidth { get; set; } = 800;
    51     public int LayoutHeight { get; set; } = 600;
    52     public bool PerformEdgeRouting { get; set; } = true;
    53     public int MinHorizontalSpacing { get; set; } = 0;
    54     public int MinVerticalSpacing { get; set; } = 0;
    55     public EdgeRouting EdgeRoutingMode { get; set; } = EdgeRouting.None;
     47    public double IdealEdgeLength { get; set; }
     48    public double DefaultEdgeLength { get; set; }
     49    public bool PreventOverlaps { get; set; }
     50    public int LayoutWidth { get; set; }
     51    public int LayoutHeight { get; set; }
     52    public bool PerformEdgeRouting { get; set; }
     53    public int MinHorizontalSpacing { get; set; }
     54    public int MinVerticalSpacing { get; set; }
     55    public EdgeRouting EdgeRoutingMode { get; set; }
    5656
    5757    public Dictionary<IVertex, PointF> VertexPositions {
     
    8282    }
    8383
    84     public ConstrainedForceDirectedLayout() { }
     84    public ConstrainedForceDirectedLayout() {
     85      IdealEdgeLength = 1;
     86      DefaultEdgeLength = 200;
     87      PreventOverlaps = true;
     88      LayoutWidth = 800;
     89      LayoutHeight = 600;
     90      PerformEdgeRouting = true;
     91      MinHorizontalSpacing = 0;
     92      MinVerticalSpacing = 0;
     93      EdgeRoutingMode = EdgeRouting.None;
     94    }
    8595
    8696    public void Run(Dictionary<IVertex, RectangleF> nodeShapes) {
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.Designer.cs

    r13789 r13821  
    1 namespace HeuristicLab.VariableInteractionNetworks.Views {
     1using System.Globalization;
     2
     3namespace HeuristicLab.VariableInteractionNetworks.Views {
    24  partial class RunCollectionVariableInteractionNetworkView {
    35    /// <summary>
     
    114116      this.impactThresholdTextBox.Size = new System.Drawing.Size(201, 20);
    115117      this.impactThresholdTextBox.TabIndex = 2;
    116       this.impactThresholdTextBox.Text = "0.2";
     118      this.impactThresholdTextBox.Text = 0.2.ToString(CultureInfo.CurrentCulture);
    117119      this.impactThresholdTextBox.Validating += new System.ComponentModel.CancelEventHandler(this.TextBoxValidating);
    118120      this.impactThresholdTextBox.Validated += new System.EventHandler(this.ImpactThresholdTextBoxValidated);
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks.Views/3.3/RunCollectionVariableInteractionNetworkView.cs

    r13806 r13821  
    2424using System.ComponentModel;
    2525using System.Drawing;
     26using System.Globalization;
    2627using System.Linq;
    2728using System.Text;
     
    237238            vn.AddVertex(junctionNode);
    238239            nodes[junctionLabel] = junctionNode;
    239             junctionNode.Label = string.Format("Target quality: {0:0.000}", solutionsEnsemble.TrainingRSquared);
     240            junctionNode.Label = solutionsEnsemble.TrainingRSquared.ToString("N3", CultureInfo.CurrentCulture);
    240241          }
    241242          IArc arc;
     
    247248              nodes[v] = variableNode;
    248249            }
    249             arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) };
     250            arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = impact.ToString("N3", CultureInfo.CurrentCulture) };
    250251            vn.AddArc(arc);
    251252          }
    252253          var trainingR2 = ((IRegressionSolution)((JunctionNetworkNode)junctionNode).Data).TrainingRSquared;
    253           arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = string.Format("Quality: {0:0.000}", trainingR2) };
     254          arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = trainingR2.ToString("N3", CultureInfo.CurrentCulture) };
    254255          vn.AddArc(arc);
    255256        } else {
     
    261262              nodes[v] = variableNode;
    262263            }
    263             var arc = new Arc(variableNode, targetNode) { Weight = impact, Label = string.Format("Impact: {0:0.000}", impact) };
     264            var arc = new Arc(variableNode, targetNode) {
     265              Weight = impact, Label = impact.ToString("N3", CultureInfo.CurrentCulture)
     266            };
    264267            vn.AddArc(arc);
    265268          }
     
    392395      double impact;
    393396      if (!double.TryParse(tb.Text, out impact))
    394         impact = 0.1;
     397        impact = 0.2;
    395398      var network = ApplyThreshold(variableInteractionNetwork, impact);
    396399      graphChart.Graph = network;
  • branches/HeuristicLab.VariableInteractionNetworks/HeuristicLab.VariableInteractionNetworks/3.3/CreateTargetVariationExperimentDialog.cs

    r13814 r13821  
    156156      var totalNumberOfCombinations = (inputCount + 1) * EnumerableExtensions.BinomialCoefficient(inputCount, combinationGroupSize);
    157157      int progress = 0;
    158       foreach (var optimizer in CreateVariableCombinations(algorithm, combinationGroupSize, repetitions)) {
    159         experiment.Optimizers.Add(optimizer);
    160         progress++;
    161         worker.ReportProgress((int)Math.Round(100d * progress / totalNumberOfCombinations));
    162       }
    163       Experiment = experiment;
     158      try {
     159        foreach (var optimizer in CreateVariableCombinations(algorithm, combinationGroupSize, repetitions)) {
     160          if (worker.CancellationPending)
     161            throw new OperationCanceledException();
     162          experiment.Optimizers.Add(optimizer);
     163          progress++;
     164          worker.ReportProgress((int)Math.Round(100d * progress / totalNumberOfCombinations));
     165        }
     166        Experiment = experiment;
     167      } catch (OperationCanceledException) {
     168        e.Cancel = true;
     169        UpdateProgress(0);
     170        progressBar.Visible = false;
     171        okButton.Enabled = true;
     172        combinationsLabel.Visible = true;
     173        combinationCountLabel.Visible = true;
     174      }
    164175    }
    165176
Note: See TracChangeset for help on using the changeset viewer.