Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/06/16 14:48:09 (7 years ago)
Author:
bburlacu
Message:

#2288: Small refactoring.

File:
1 edited

Legend:

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

    r13821 r13874  
    233233          var junctionLabel = Concatenate(variableList);
    234234          IVertex junctionNode;
     235          var sb = new StringBuilder();
    235236          if (!nodes.TryGetValue(junctionLabel, out junctionNode)) {
    236237            var solutionsEnsemble = CreateEnsembleSolution(targetRuns);
    237             junctionNode = new JunctionNetworkNode { Label = string.Empty, Data = solutionsEnsemble };
     238            junctionNode = new JunctionNetworkNode { Label = solutionsEnsemble.TrainingRSquared.ToString("N3", CultureInfo.CurrentCulture), Data = solutionsEnsemble };
    238239            vn.AddVertex(junctionNode);
    239240            nodes[junctionLabel] = junctionNode;
    240             junctionNode.Label = solutionsEnsemble.TrainingRSquared.ToString("N3", CultureInfo.CurrentCulture);
     241            sb.AppendLine(junctionNode.Label);
    241242          }
    242243          IArc arc;
     
    249250            }
    250251            arc = new Arc(variableNode, junctionNode) { Weight = impact, Label = impact.ToString("N3", CultureInfo.CurrentCulture) };
     252            sb.AppendLine(v + ": " + arc.Label);
    251253            vn.AddArc(arc);
    252254          }
    253           var trainingR2 = ((IRegressionSolution)((JunctionNetworkNode)junctionNode).Data).TrainingRSquared;
     255          var jcnNode = (JunctionNetworkNode)junctionNode;
     256          var trainingR2 = ((IRegressionSolution)jcnNode.Data).TrainingRSquared;
    254257          arc = new Arc(junctionNode, targetNode) { Weight = junctionNode.InArcs.Sum(x => x.Weight), Label = trainingR2.ToString("N3", CultureInfo.CurrentCulture) };
    255258          vn.AddArc(arc);
     
    394397      errorProvider.SetError(tb, string.Empty);
    395398      double impact;
    396       if (!double.TryParse(tb.Text, out impact))
     399      if (!double.TryParse(tb.Text, out impact)) {
    397400        impact = 0.2;
     401      }
    398402      var network = ApplyThreshold(variableInteractionNetwork, impact);
    399403      graphChart.Graph = network;
     
    443447    }
    444448
     449    private void ControlsEnable(bool enabled) {
     450      qualityResultNameComboBox.Enabled
     451        = impactResultNameComboBox.Enabled
     452        = impactAggregationComboBox.Enabled
     453        = impactThresholdTextBox.Enabled
     454        = onlineImpactCalculationButton.Enabled
     455        = edgeRoutingComboBox.Enabled
     456        = idealEdgeLengthTextBox.Enabled = enabled;
     457    }
     458
    445459    private void onlineImpactCalculationButton_Click(object sender, EventArgs args) {
    446       var button = (Button)sender;
    447460      var worker = new BackgroundWorker();
    448461      worker.DoWork += (o, e) => {
    449         button.Enabled = false;
     462        ControlsEnable(false);
    450463        var impacts = CalculateVariableImpactsOnline(Content, false);
    451464        variableInteractionNetwork = CreateNetwork(impacts);
     
    453466        graphChart.Graph = ApplyThreshold(variableInteractionNetwork, threshold);
    454467      };
    455       worker.RunWorkerCompleted += (o, e) => button.Enabled = true;
     468      worker.RunWorkerCompleted += (o, e) => ControlsEnable(true);
    456469      worker.RunWorkerAsync();
    457470    }
Note: See TracChangeset for help on using the changeset viewer.