Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
01/11/12 17:47:04 (12 years ago)
Author:
abeham
Message:

#1614: worked on GQAP (added operators, assignment view)

Location:
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3
Files:
1 added
4 edited

Legend:

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

    r7312 r7319  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       components = new System.ComponentModel.Container();
     47      this.assignmentTreeView = new System.Windows.Forms.TreeView();
     48      this.label1 = new System.Windows.Forms.Label();
     49      this.qualityTextBox = new System.Windows.Forms.TextBox();
     50      this.label2 = new System.Windows.Forms.Label();
     51      this.SuspendLayout();
     52      //
     53      // assignmentTreeView
     54      //
     55      this.assignmentTreeView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     56                  | System.Windows.Forms.AnchorStyles.Left)
     57                  | System.Windows.Forms.AnchorStyles.Right)));
     58      this.assignmentTreeView.Location = new System.Drawing.Point(3, 52);
     59      this.assignmentTreeView.Name = "assignmentTreeView";
     60      this.assignmentTreeView.Size = new System.Drawing.Size(349, 329);
     61      this.assignmentTreeView.TabIndex = 0;
     62      //
     63      // label1
     64      //
     65      this.label1.AutoSize = true;
     66      this.label1.Location = new System.Drawing.Point(3, 7);
     67      this.label1.Name = "label1";
     68      this.label1.Size = new System.Drawing.Size(42, 13);
     69      this.label1.TabIndex = 1;
     70      this.label1.Text = "Quality:";
     71      //
     72      // qualityTextBox
     73      //
     74      this.qualityTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
     75                  | System.Windows.Forms.AnchorStyles.Right)));
     76      this.qualityTextBox.Location = new System.Drawing.Point(51, 4);
     77      this.qualityTextBox.Name = "qualityTextBox";
     78      this.qualityTextBox.Size = new System.Drawing.Size(301, 20);
     79      this.qualityTextBox.TabIndex = 2;
     80      //
     81      // label2
     82      //
     83      this.label2.AutoSize = true;
     84      this.label2.Location = new System.Drawing.Point(3, 36);
     85      this.label2.Name = "label2";
     86      this.label2.Size = new System.Drawing.Size(64, 13);
     87      this.label2.TabIndex = 1;
     88      this.label2.Text = "Assignment:";
     89      //
     90      // GQAPAssignmentView
     91      //
     92      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    4893      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     94      this.Controls.Add(this.qualityTextBox);
     95      this.Controls.Add(this.label2);
     96      this.Controls.Add(this.label1);
     97      this.Controls.Add(this.assignmentTreeView);
     98      this.Name = "GQAPAssignmentView";
     99      this.Size = new System.Drawing.Size(355, 384);
     100      this.ResumeLayout(false);
     101      this.PerformLayout();
     102
    49103    }
    50104
    51105    #endregion
     106
     107    private System.Windows.Forms.TreeView assignmentTreeView;
     108    private System.Windows.Forms.Label label1;
     109    private System.Windows.Forms.TextBox qualityTextBox;
     110    private System.Windows.Forms.Label label2;
    52111  }
    53112}
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/GQAPAssignmentView.cs

    r7312 r7319  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2121
    2222using System;
     23using System.Collections.Generic;
     24using System.Linq;
    2325using System.Windows.Forms;
    2426using HeuristicLab.Core.Views;
     27using HeuristicLab.Encodings.IntegerVectorEncoding;
    2528using HeuristicLab.MainForm;
    2629using HeuristicLab.MainForm.WindowsForms;
     
    5255    protected override void OnContentChanged() {
    5356      base.OnContentChanged();
     57      assignmentTreeView.Nodes.Clear();
    5458      if (Content == null) {
    55         // TODO: Put code here when content is null
     59        qualityTextBox.Text = String.Empty;
    5660      } else {
    57         // TODO: Put code here when content has been changed and is not null
     61        qualityTextBox.Text = Content.Quality.Value.ToString();
     62        BuildAssignmentTree();
    5863      }
    5964    }
     
    6166    protected override void SetEnabledStateOfControls() {
    6267      base.SetEnabledStateOfControls();
    63       // TODO: Put code here to enable or disable controls based on whether the Content is/not null or the view is ReadOnly
     68      qualityTextBox.Enabled = !ReadOnly && !Locked && Content != null;
     69      assignmentTreeView.Enabled = !ReadOnly && !Locked && Content != null;
    6470    }
    6571
     
    6773    // TODO: Put event handlers here
    6874    #endregion
     75
     76    private void BuildAssignmentTree() {
     77      IntegerVector assignment = Content.Assignment;
     78      Dictionary<int, TreeNode> locationNodes = new Dictionary<int, TreeNode>();
     79      for (int i = 0; i < assignment.Length; i++) {
     80        if (!locationNodes.ContainsKey(assignment[i])) {
     81          string locationName = assignment[i].ToString();
     82          if (Content.LocationNames != null && Content.LocationNames.Length > 0)
     83            locationName = Content.LocationNames[assignment[i] % Content.LocationNames.Length];
     84          locationNodes.Add(assignment[i], new TreeNode(locationName));
     85        }
     86        string equipmentName = i.ToString();
     87        if (Content.EquipmentNames != null && Content.EquipmentNames.Length > 0)
     88          equipmentName = Content.EquipmentNames[i % Content.EquipmentNames.Length];
     89        locationNodes[assignment[i]].Nodes.Add(equipmentName);
     90      }
     91
     92      assignmentTreeView.BeginUpdate();
     93      try {
     94        foreach (var node in locationNodes.OrderBy(x => x.Key).Select(x => x.Value)) {
     95          assignmentTreeView.Nodes.Add(node);
     96          node.Expand();
     97        }
     98      } finally { assignmentTreeView.EndUpdate(); }
     99    }
    69100  }
    70101}
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj

    r7312 r7319  
    3838  </PropertyGroup>
    3939  <ItemGroup>
    40     <Reference Include="HeuristicLab.Core.Views-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
    41     <Reference Include="HeuristicLab.MainForm-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
    42     <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=x86" />
     40    <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     41    <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     42    <Reference Include="HeuristicLab.Core-3.3">
     43      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     44    </Reference>
     45    <Reference Include="HeuristicLab.Core.Views-3.3">
     46      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core.Views-3.3.dll</HintPath>
     47    </Reference>
     48    <Reference Include="HeuristicLab.Data-3.3">
     49      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath>
     50    </Reference>
     51    <Reference Include="HeuristicLab.Encodings.IntegerVectorEncoding-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     52    <Reference Include="HeuristicLab.MainForm-3.3">
     53      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm-3.3.dll</HintPath>
     54    </Reference>
     55    <Reference Include="HeuristicLab.MainForm.WindowsForms-3.3">
     56      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.MainForm.WindowsForms-3.3.dll</HintPath>
     57    </Reference>
     58    <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     59    <Reference Include="HeuristicLab.Optimization-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     60    <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
     61    <Reference Include="HeuristicLab.PluginInfrastructure-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL" />
    4362    <Reference Include="System" />
    4463    <Reference Include="System.Core" />
     
    7291    </ProjectReference>
    7392  </ItemGroup>
     93  <ItemGroup>
     94    <EmbeddedResource Include="GQAPAssignmentView.resx">
     95      <DependentUpon>GQAPAssignmentView.cs</DependentUpon>
     96    </EmbeddedResource>
     97  </ItemGroup>
    7498  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    7599  <PropertyGroup>
     
    79103set Outdir=$(Outdir)
    80104
    81 call PreBuildEvent.cmd
    82 SubWCRev "%25ProjectDir%25\" "%25ProjectDir%25\Plugin.cs.frame" "%25ProjectDir%25\Plugin.cs"</PreBuildEvent>
     105call PreBuildEvent.cmd</PreBuildEvent>
    83106  </PropertyGroup>
    84107  <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/Plugin.cs.frame

    r7312 r7319  
    11#region License Information
    22/* HeuristicLab
    3  * Copyright (C) 2002-2011 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
    44 *
    55 * This file is part of HeuristicLab.
     
    2929  [PluginDependency("HeuristicLab.Common.Resources", "3.3")]
    3030  [PluginDependency("HeuristicLab.Core", "3.3")]
     31  [PluginDependency("HeuristicLab.Core.Views", "3.3")]
    3132  [PluginDependency("HeuristicLab.Data", "3.3")]
    3233  [PluginDependency("HeuristicLab.Encodings.IntegerVectorEncoding", "3.3")]
     34  [PluginDependency("HeuristicLab.MainForm", "3.3")]
     35  [PluginDependency("HeuristicLab.MainForm.WindowsForms", "3.3")]
    3336  [PluginDependency("HeuristicLab.Operators", "3.3")]
    3437  [PluginDependency("HeuristicLab.Optimization", "3.3")]
    3538  [PluginDependency("HeuristicLab.Parameters", "3.3")]
    36   [PluginDependency("HeuristicLab.Persistence", "3.3")]
     39  [PluginDependency("HeuristicLab.Problems.GeneralizedQuadraticAssignment", "3.3")]
    3740  public class HeuristicLabProblemsGeneralizedQuadraticAssignmentViewsPlugin : PluginBase {
    3841  }
Note: See TracChangeset for help on using the changeset viewer.