Ignore:
Timestamp:
12/11/17 22:10:01 (4 years ago)
Author:
abeham
Message:

#1614:

  • Fixed bugs in view
  • Made Evaluation object immutable
  • Fixed bug in Analyze
  • Fixed operators
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs

    r15504 r15510  
    6161    protected override void OnContentChanged() {
    6262      base.OnContentChanged();
    63       UpdateQuality();
    64       UpdateFlowDistanceQuality();
    65       UpdateInstallationQuality();
    66       UpdateOverbookedCapacity();
     63      UpdateEvaluation();
    6764      UpdateAssignment();
    6865      if (Content != null) assignmentView.Content = Content.Assignment;
     
    7774    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    7875      switch (e.PropertyName) {
    79         case "Quality": UpdateQuality(); break;
    80         case "FlowDistanceQuality": UpdateFlowDistanceQuality(); break;
    81         case "InstallationQuality": UpdateInstallationQuality(); break;
    82         case "OverbookedCapacity": UpdateOverbookedCapacity(); break;
    83         case "Assignment": UpdateAssignment(); break;
    84         case "EquipmentNames": UpdateAssignment(); break;
    85         case "LocationNames": UpdateAssignment(); break;
     76        case nameof(Content.Evaluation): UpdateEvaluation(); break;
     77        case nameof(Content.Assignment): UpdateAssignment(); break;
     78        case nameof(Content.ProblemInstance): UpdateEvaluation(); UpdateAssignment(); break;
    8679        default: break;
    8780      }
     
    124117
    125118    #region Helpers
    126     private void UpdateQuality() {
    127       if (InvokeRequired) Invoke((Action)UpdateQuality);
     119    private void UpdateEvaluation() {
     120      if (InvokeRequired) Invoke((Action)UpdateEvaluation);
    128121      else {
    129122        if (Content == null) {
    130123          qualityLabel.Text = "-";
     124          flowDistanceQualityLabel.Text = "-";
     125          installationQualityLabel.Text = "-";
     126          overbookedCapacityLabel.Text = "-";
    131127        } else {
    132128          qualityLabel.Text = Content.ProblemInstance.ToSingleObjective(Content.Evaluation).ToString();
    133         }
    134       }
    135     }
    136 
    137     private void UpdateFlowDistanceQuality() {
    138       if (InvokeRequired) Invoke((Action)UpdateFlowDistanceQuality);
    139       else {
    140         if (Content == null || Content.Evaluation == null) {
    141           flowDistanceQualityLabel.Text = "-";
    142         } else {
    143129          flowDistanceQualityLabel.Text = Content.Evaluation.FlowCosts.ToString();
    144         }
    145       }
    146     }
    147 
    148     private void UpdateInstallationQuality() {
    149       if (InvokeRequired) Invoke((Action)UpdateInstallationQuality);
    150       else {
    151         if (Content == null || Content.Evaluation == null) {
    152           installationQualityLabel.Text = "-";
    153         } else {
    154130          installationQualityLabel.Text = Content.Evaluation.InstallationCosts.ToString();
    155         }
    156       }
    157     }
    158 
    159     private void UpdateOverbookedCapacity() {
    160       if (InvokeRequired) Invoke((Action)UpdateOverbookedCapacity);
    161       else {
    162         if (Content == null || Content.Evaluation == null) {
    163           overbookedCapacityLabel.Text = "-";
    164         } else {
    165131          overbookedCapacityLabel.Text = Content.Evaluation.ExcessDemand.ToString();
    166132        }
Note: See TracChangeset for help on using the changeset viewer.