Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/31/19 14:40:15 (5 years ago)
Author:
abeham
Message:

#1614: updated to new persistence and .NET 4.6.1

Location:
branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views

  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentArchiveView.Designer.cs

    r15504 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentArchiveView.cs

    r15504 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.Designer.cs

    r15504 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs

    r15510 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4545    public GQAPAssignmentView() {
    4646      InitializeComponent();
     47      recalculateButton.Text = string.Empty;
    4748      recalculateButton.Image = VSImageLibrary.Refresh;
    4849    }
     
    5051    #region Register Content Events
    5152    protected override void DeregisterContentEvents() {
    52       Content.PropertyChanged -= new PropertyChangedEventHandler(Content_PropertyChanged);
     53      DeregisterSolutionEvents();
     54      Content.PropertyChanged -= Content_PropertyChanged;
    5355      base.DeregisterContentEvents();
    5456    }
    5557    protected override void RegisterContentEvents() {
    5658      base.RegisterContentEvents();
    57       Content.PropertyChanged += new PropertyChangedEventHandler(Content_PropertyChanged);
     59      Content.PropertyChanged += Content_PropertyChanged;
     60      RegisterSolutionEvents();
     61    }
     62
     63    private void DeregisterSolutionEvents() {
     64      if (Content.Solution != null) Content.Solution.PropertyChanged -= Content_SolutionPropertyChanged;
     65    }
     66    private void RegisterSolutionEvents() {
     67      if (Content.Solution != null) Content.Solution.PropertyChanged += Content_SolutionPropertyChanged;
    5868    }
    5969    #endregion
     
    6373      UpdateEvaluation();
    6474      UpdateAssignment();
    65       if (Content != null) assignmentView.Content = Content.Assignment;
     75      if (Content != null && Content.Solution != null) assignmentView.Content = Content.Solution.Assignment;
    6676      else assignmentView.Content = null;
    6777    }
     
    6979    protected override void SetEnabledStateOfControls() {
    7080      base.SetEnabledStateOfControls();
     81      recalculateButton.Enabled = Content != null && Content.Solution != null && !Locked && !ReadOnly;
    7182    }
    7283
     
    7485    private void Content_PropertyChanged(object sender, PropertyChangedEventArgs e) {
    7586      switch (e.PropertyName) {
    76         case nameof(Content.Evaluation): UpdateEvaluation(); break;
    77         case nameof(Content.Assignment): UpdateAssignment(); break;
     87        case nameof(Content.Solution): RegisterSolutionEvents(); UpdateEvaluation(); UpdateAssignment(); break;
    7888        case nameof(Content.ProblemInstance): UpdateEvaluation(); UpdateAssignment(); break;
    7989        default: break;
    8090      }
     91      SetEnabledStateOfControls();
     92    }
     93
     94    private void Content_SolutionPropertyChanged(object sender, PropertyChangedEventArgs e) {
     95      switch (e.PropertyName) {
     96        case nameof(Content.Solution.Assignment): UpdateAssignment(); break;
     97        case nameof(Content.Solution.Evaluation): UpdateEvaluation(); break;
     98        default: break;
     99      }
    81100    }
    82101
     
    88107    #region Event Handlers
    89108    private void assignmentTreeView_AfterSelect(object sender, TreeViewEventArgs e) {
    90       if (Content != null) {
     109      if (Content != null && Content.Solution != null) {
    91110        assignmentTreeView.BeginUpdate();
    92111        try {
     
    120139      if (InvokeRequired) Invoke((Action)UpdateEvaluation);
    121140      else {
    122         if (Content == null) {
     141        if (Content == null || Content.Solution == null) {
    123142          qualityLabel.Text = "-";
    124143          flowDistanceQualityLabel.Text = "-";
     
    126145          overbookedCapacityLabel.Text = "-";
    127146        } else {
    128           qualityLabel.Text = Content.ProblemInstance.ToSingleObjective(Content.Evaluation).ToString();
    129           flowDistanceQualityLabel.Text = Content.Evaluation.FlowCosts.ToString();
    130           installationQualityLabel.Text = Content.Evaluation.InstallationCosts.ToString();
    131           overbookedCapacityLabel.Text = Content.Evaluation.ExcessDemand.ToString();
     147          qualityLabel.Text = Content.ProblemInstance.ToSingleObjective(Content.Solution.Evaluation).ToString();
     148          flowDistanceQualityLabel.Text = Content.Solution.Evaluation.FlowCosts.ToString();
     149          installationQualityLabel.Text = Content.Solution.Evaluation.InstallationCosts.ToString();
     150          overbookedCapacityLabel.Text = Content.Solution.Evaluation.ExcessDemand.ToString();
    132151        }
    133152      }
     
    138157      else {
    139158        assignmentTreeView.Nodes.Clear();
    140         if (Content != null) {
    141           IntegerVector assignment = Content.Assignment;
     159        if (Content != null && Content.Solution != null) {
     160          IntegerVector assignment = Content.Solution.Assignment;
    142161          Dictionary<int, TreeNode> locationNodes = new Dictionary<int, TreeNode>();
    143162          for (int i = 0; i < assignment.Length; i++) {
     
    169188      var installationCosts = new Dictionary<EquipmentNode, double>();
    170189      foreach (var node in GetAllSubNodes(assignmentTreeView.Nodes).OfType<EquipmentNode>()) {
    171         int location = Content.Assignment[node.Equipment];
     190        int location = Content.Solution.Assignment[node.Equipment];
    172191        installationCosts[node] = Content.ProblemInstance.InstallationCosts[node.Equipment, location];
    173192      }
     
    216235
    217236    private void ColorByWeight(LocationNode selectedNode) {
    218       var equipments = new HashSet<int>(Content.Assignment.Select((v, i) => new { Index = i, Value = v })
     237      var equipments = new HashSet<int>(Content.Solution.Assignment.Select((v, i) => new { Index = i, Value = v })
    219238        .Where(x => x.Value == selectedNode.Location).Select(x => x.Index));
    220239      var rowSums = new Dictionary<int, double>(equipments.Count);
     
    279298
    280299    private void recalculateButton_Click(object sender, EventArgs e) {
    281       Content.Evaluation = Content.ProblemInstance.Evaluate(Content.Assignment);
     300      Content.Solution.Evaluation = Content.ProblemInstance.Evaluate(Content.Solution.Assignment);
    282301    }
    283302  }
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj

    r15688 r16728  
    11<?xml version="1.0" encoding="utf-8"?>
    2 <Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
     2<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    33  <PropertyGroup>
    44    <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
     
    1111    <RootNamespace>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views</RootNamespace>
    1212    <AssemblyName>HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3</AssemblyName>
    13     <TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
     13    <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
    1414    <FileAlignment>512</FileAlignment>
    1515    <TargetFrameworkProfile />
     
    135135      <Private>False</Private>
    136136    </ProjectReference>
    137     <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj">
    138       <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project>
    139       <Name>HeuristicLab.Optimization-3.3</Name>
    140       <Private>False</Private>
    141     </ProjectReference>
    142137    <ProjectReference Include="..\..\HeuristicLab.Problems.GeneralizedQuadraticAssignment\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj">
    143138      <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project>
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/Plugin.cs.frame

    r13418 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2015 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2323
    2424namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views {
    25   [Plugin("HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views", "3.3.13.$WCREV$")]
     25  [Plugin("HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views", "3.3.15.$WCREV$")]
    2626  [PluginFile("HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.dll", PluginFileType.Assembly)]
    2727  [PluginDependency("HeuristicLab.Collections", "3.3")]
  • branches/1614_GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/Properties/AssemblyInfo.cs.frame

    r15504 r16728  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2018 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    3131[assembly: AssemblyCompany("HEAL")]
    3232[assembly: AssemblyProduct("HeuristicLab")]
    33 [assembly: AssemblyCopyright("(c) 2002-2017 HEAL")]
     33[assembly: AssemblyCopyright("(c) 2002-2018 HEAL")]
    3434[assembly: AssemblyTrademark("")]
    3535[assembly: AssemblyCulture("")]
     
    5454// [assembly: AssemblyVersion("1.0.*")]
    5555[assembly: AssemblyVersion("3.3.0.0")]
    56 [assembly: AssemblyFileVersion("3.3.14.$WCREV$")]
     56[assembly: AssemblyFileVersion("3.3.15.$WCREV$")]
Note: See TracChangeset for help on using the changeset viewer.