Free cookie consent management tool by TermsFeed Policy Generator

Changeset 7505


Ignore:
Timestamp:
02/22/12 22:43:09 (12 years ago)
Author:
abeham
Message:

#1614

  • added instances of Cordeau et al. as given by L. Moccia
  • added operators for tabu search
Location:
branches/GeneralizedQAP
Files:
38 added
16 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP/GeneralizedQAP.sln

    r7465 r7505  
    2626EndProject
    2727Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.TSPLIB-3.3", "HeuristicLab.Problems.Instances.TSPLIB\3.3\HeuristicLab.Problems.Instances.TSPLIB-3.3.csproj", "{CE0F99D6-1C56-48A9-9B68-3E5B833703EF}"
     28EndProject
     29Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.Instances.CordeauGQAP-3.3", "HeuristicLab.Problems.Instances.CordeauGQAP\3.3\HeuristicLab.Problems.Instances.CordeauGQAP-3.3.csproj", "{1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}"
    2830EndProject
    2931Global
     
    112114    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x64.ActiveCfg = Release|Any CPU
    113115    {CE0F99D6-1C56-48A9-9B68-3E5B833703EF}.Release|x86.ActiveCfg = Release|Any CPU
     116    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
     117    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|Any CPU.Build.0 = Debug|Any CPU
     118    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|x64.ActiveCfg = Debug|x64
     119    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|x64.Build.0 = Debug|x64
     120    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|x86.ActiveCfg = Debug|x86
     121    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Debug|x86.Build.0 = Debug|x86
     122    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|Any CPU.ActiveCfg = Release|Any CPU
     123    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|Any CPU.Build.0 = Release|Any CPU
     124    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|x64.ActiveCfg = Release|x64
     125    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|x64.Build.0 = Release|x64
     126    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|x86.ActiveCfg = Release|x86
     127    {1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}.Release|x86.Build.0 = Release|x86
    114128  EndGlobalSection
    115129  GlobalSection(SolutionProperties) = preSolution
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemInstanceProviderView.Designer.cs

    r7448 r7505  
    4545    /// </summary>
    4646    private void InitializeComponent() {
    47       this.instancesComboBox = new System.Windows.Forms.ComboBox();
    4847      this.loadButton = new System.Windows.Forms.Button();
    4948      this.label2 = new System.Windows.Forms.Label();
     49      this.instancesComboBox = new System.Windows.Forms.ComboBox();
    5050      this.SuspendLayout();
    51       //
    52       // instancesComboBox
    53       //
    54       this.instancesComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
    55             | System.Windows.Forms.AnchorStyles.Right)));
    56       this.instancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
    57       this.instancesComboBox.FormattingEnabled = true;
    58       this.instancesComboBox.Location = new System.Drawing.Point(54, 0);
    59       this.instancesComboBox.Name = "instancesComboBox";
    60       this.instancesComboBox.Size = new System.Drawing.Size(475, 21);
    61       this.instancesComboBox.TabIndex = 5;
    62       this.instancesComboBox.DataSourceChanged += new System.EventHandler(this.comboBox_DataSourceChanged);
    6351      //
    6452      // loadButton
     
    8270      this.label2.Text = "Instance:";
    8371      //
     72      // instancesComboBox
     73      //
     74      this.instancesComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
     75      this.instancesComboBox.FormattingEnabled = true;
     76      this.instancesComboBox.Location = new System.Drawing.Point(54, 0);
     77      this.instancesComboBox.Name = "instancesComboBox";
     78      this.instancesComboBox.Size = new System.Drawing.Size(475, 21);
     79      this.instancesComboBox.TabIndex = 7;
     80      this.instancesComboBox.DataSourceChanged += new System.EventHandler(this.comboBox_DataSourceChanged);
     81      //
    8482      // ProblemInstanceProviderView
    8583      //
    8684      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    8785      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
     86      this.Controls.Add(this.instancesComboBox);
    8887      this.Controls.Add(this.loadButton);
    8988      this.Controls.Add(this.label2);
    90       this.Controls.Add(this.instancesComboBox);
    9189      this.Name = "ProblemInstanceProviderView";
    9290      this.Size = new System.Drawing.Size(610, 21);
     
    9896    #endregion
    9997
    100     private System.Windows.Forms.ComboBox instancesComboBox;
    10198    private System.Windows.Forms.Button loadButton;
    10299    private System.Windows.Forms.Label label2;
     100    private System.Windows.Forms.ComboBox instancesComboBox;
    103101
    104102  }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemInstanceProviderView.cs

    r7470 r7505  
    2828
    2929namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views {
    30   [View("GeneralizedQuadraticAssignmentProblemView")]
     30  [View("ProblemInstanceProviderView")]
    3131  [Content(typeof(IProblemInstanceProvider), IsDefaultView = true)]
    3232  public partial class ProblemInstanceProviderView : AsynchronousContentView {
     
    6060      var instance = (IInstanceDescriptor)instancesComboBox.SelectedItem;
    6161      if (!Content.FeedConsumer(instance)) {
    62         MessageBox.Show("This problem does not support the instance " + instance.Name + ".", "Cannot load instance");
     62        MessageBox.Show("This problem does not support loading the instance " + instance.Name + ".", "Cannot load instance");
    6363      }
    6464    }
     
    6969        comboBox.Items.Clear();
    7070    }
     71
     72    private void instancesComboBox_ToolTipRequired(object sender, ToolTipRequiredEventArgs e) {
     73      var instance = (IInstanceDescriptor)instancesComboBox.SelectedItem;
     74      e.ToolTip = instance.Description;
     75    }
    7176  }
    7277}
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/ProblemView.cs

    r7482 r7505  
    9393
    9494    protected virtual string GetProviderToolTip(IProblemInstanceProvider provider) {
    95       return provider.Name
    96           + Environment.NewLine
    97           + provider.WebLink.ToString()
    98           + Environment.NewLine + Environment.NewLine
    99           + provider.ReferencePublication;
     95      if (provider.WebLink != null) {
     96        return provider.Name
     97            + Environment.NewLine
     98            + provider.WebLink.ToString()
     99            + Environment.NewLine + Environment.NewLine
     100            + provider.ReferencePublication;
     101      } else {
     102        return provider.Name
     103            + Environment.NewLine + Environment.NewLine
     104            + provider.ReferencePublication;
     105      }
    100106    }
    101107
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Evaluators/GQAPNMoveEvaluator.cs

    r7419 r7505  
    2020#endregion
    2121
    22 using System.Collections.Generic;
    2322using System.Linq;
    2423using HeuristicLab.Common;
     
    3231
    3332namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    34   [Item("GQAPNMoveEvaluator", "Evaluates an n-move.")]
     33  [Item("N-Move Evaluator", "Evaluates an N-Move.")]
    3534  [StorableClass]
    3635  public class GQAPNMoveEvaluator : SingleSuccessorOperator, IGQAPNMoveEvaluator, IAssignmentAwareGQAPOperator,
     
    159158      var slack = (DoubleArray)capacities.Clone();
    160159      var oldSlack = (DoubleArray)slack.Clone();
    161       Dictionary<int, int> moving = new Dictionary<int, int>();
    162       for (int i = 0; i < moves; i++) moving.Add(move.Equipments[i], move.Locations[i]);
    163 
    164       for (int i = 0; i < moves; i++) {
    165         int equip = move.Equipments[i];
    166         int newLoc = move.Locations[i];
     160      bool first = true;
     161      foreach (var kvp in move.NewAssignments) {
     162        int equip = kvp.Key;
     163        int newLoc = kvp.Value;
    167164        moveInstallationQuality -= installationCosts[equip, assignment[equip]];
    168165        moveInstallationQuality += installationCosts[equip, newLoc];
    169166        for (int j = 0; j < assignment.Length; j++) {
    170           if (!moving.ContainsKey(j)) {
     167          if (!move.NewAssignments.ContainsKey(j)) {
    171168            moveFlowDistanceQuality += weights[equip, j] * distances[newLoc, assignment[j]];
    172169            moveFlowDistanceQuality -= weights[equip, j] * distances[assignment[equip], assignment[j]];
    173170            moveFlowDistanceQuality += weights[j, equip] * distances[assignment[j], newLoc];
    174171            moveFlowDistanceQuality -= weights[j, equip] * distances[assignment[j], assignment[equip]];
    175             if (i == 0) { // only once for each untouched equipment deduct the demand from the capacity
     172            if (first) { // only once for each untouched equipment deduct the demand from the capacity
    176173              slack[assignment[j]] -= demands[j];
    177174              oldSlack[assignment[j]] -= demands[j];
    178175            }
    179176          } else {
    180             moveFlowDistanceQuality += weights[equip, j] * distances[newLoc, moving[j]];
     177            moveFlowDistanceQuality += weights[equip, j] * distances[newLoc, move.NewAssignments[j]];
    181178            moveFlowDistanceQuality -= weights[equip, j] * distances[assignment[equip], assignment[j]];
    182179          }
    183180        }
     181        first = false;
    184182        slack[newLoc] -= demands[equip];
    185183        oldSlack[assignment[equip]] -= demands[equip];
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj

    r7478 r7505  
    134134    <Compile Include="Moves\GQAPMoveGenerator.cs" />
    135135    <Compile Include="Moves\GQAPNMoveGenerator.cs" />
     136    <Compile Include="Moves\NMoveAbsoluteAttribute.cs" />
    136137    <Compile Include="Moves\NMoveMaker.cs" />
     138    <Compile Include="Moves\NMoveTabuChecker.cs" />
     139    <Compile Include="Moves\NMoveTabuMaker.cs" />
    137140    <Compile Include="Moves\StochasticNMoveMultiMoveGenerator.cs" />
    138141    <Compile Include="Moves\StochasticNMoveSingleMoveGenerator.cs" />
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/GQAPNMoveGenerator.cs

    r7419 r7505  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("GQAPNMoveGenerator", "Base class for move operators that generate n-move moves.")]
     32  [Item("N-Move Generator", "Base class for move operators that generate N-Move moves.")]
    3333  [StorableClass]
    3434  public abstract class GQAPNMoveGenerator : GQAPMoveGenerator, IGQAPNMoveOperator {
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMove.cs

    r7407 r7505  
    2121
    2222using System;
     23using System.Collections.Generic;
    2324using HeuristicLab.Common;
    2425using HeuristicLab.Core;
     
    2728
    2829namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    29   [Item("n-move", "An n-move describes moving n equipments to n locations.")]
     30  [Item("N-Move", "An N-Move describes the relocation of n equipments to n different locations.")]
    3031  [StorableClass]
    3132  public class NMove : Item {
    3233    [Storable]
    33     public int[] Equipments { get; private set; }
    34     [Storable]
    35     public int[] Locations { get; private set; }
     34    public Dictionary<int, int> NewAssignments { get; private set; }
    3635    [Storable]
    3736    public IntegerVector OriginalVector { get; private set; }
    3837
    39     public int N { get { return Equipments.Length; } }
     38    public int N { get { return NewAssignments.Count; } }
    4039
    4140    [StorableConstructor]
     
    4342    protected NMove(NMove original, Cloner cloner)
    4443      : base(original, cloner) {
    45       Equipments = (int[])original.Equipments.Clone();
    46       Locations = (int[])original.Locations.Clone();
     44      NewAssignments = new Dictionary<int, int>(original.NewAssignments);
    4745      if (original.OriginalVector != null)
    4846        OriginalVector = cloner.Clone(original.OriginalVector);
     
    5553      if (locations == null) throw new ArgumentNullException("locations", "NMove: Locations must not be null.");
    5654      if (equipments.Length != locations.Length) throw new ArgumentException("NMove: Length of equipments and locations is not identical.");
    57       Equipments = equipments;
    58       Locations = locations;
     55      NewAssignments = new Dictionary<int, int>();
     56      for (int i = 0; i < equipments.Length; i++)
     57        NewAssignments[equipments[i]] = locations[i];
    5958      OriginalVector = originalVector;
    6059    }
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/NMoveMaker.cs

    r7419 r7505  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("NMoveMaker", "Performs an n-move.")]
     32  [Item("N-Move Maker", "Performs an N-Move.")]
    3333  [StorableClass]
    3434  public class NMoveMaker : SingleSuccessorOperator, IAssignmentAwareGQAPOperator, IQualityAwareGQAPOperator, IMoveQualityAwareGQAPOperator, IGQAPNMoveOperator, IMoveMaker {
     
    9797
    9898    public static void Apply(IntegerVector vector, NMove move) {
    99       for (int i = 0; i < move.N; i++) {
    100         vector[move.Equipments[i]] = move.Locations[i];
    101       }
     99      foreach (var kvp in move.NewAssignments)
     100        vector[kvp.Key] = kvp.Value;
    102101    }
    103102
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveMultiMoveGenerator.cs

    r7419 r7505  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("Stochastic n-move MultiMoveGenerator", "Randomly samples a number of n-moves.")]
     32  [Item("Stochastic N-Move MultiMoveGenerator", "Randomly samples a number of N-Moves.")]
    3333  [StorableClass]
    3434  public class StochasticNMoveMultiMoveGenerator : GQAPNMoveGenerator, ICapacitiesAwareGQAPOperator, IStochasticOperator, IMultiMoveGenerator {
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Moves/StochasticNMoveSingleMoveGenerator.cs

    r7419 r7505  
    3030
    3131namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment {
    32   [Item("Stochastic n-move SingleMoveGenerator", "Randomly samples a single n-move.")]
     32  [Item("Stochastic N-Move SingleMoveGenerator", "Randomly samples a single N-Move.")]
    3333  [StorableClass]
    3434  public class StochasticNMoveSingleMoveGenerator : GQAPNMoveGenerator, ICapacitiesAwareGQAPOperator, IStochasticOperator, ISingleMoveGenerator {
  • branches/GeneralizedQAP/HeuristicLab.Problems.Instances/3.3/HeuristicLab.Problems.Instances-3.3.csproj

    r7466 r7505  
    5656    <Compile Include="IInstanceDescriptor.cs" />
    5757    <Compile Include="Instances\ICVRPInstance.cs" />
     58    <Compile Include="Instances\IGQAPInstance.cs" />
    5859    <Compile Include="Instances\IQAPInstance.cs" />
    5960    <Compile Include="Instances\ITSPInstance.cs" />
  • branches/GeneralizedQAP/UnitTests/ElloumiCTAPInstanceProviderTest.cs

    r7470 r7505  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Text;
    324using HeuristicLab.Problems.Instances.ElloumiCTAP;
  • branches/GeneralizedQAP/UnitTests/QAPLIBInstanceProviderTest.cs

    r7470 r7505  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Text;
    324using HeuristicLab.Problems.Instances.QAPLIB;
  • branches/GeneralizedQAP/UnitTests/TSPLIBInstanceProviderTest.cs

    r7470 r7505  
    1 using System;
     1#region License Information
     2/* HeuristicLab
     3 * Copyright (C) 2002-2012 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
     4 *
     5 * This file is part of HeuristicLab.
     6 *
     7 * HeuristicLab is free software: you can redistribute it and/or modify
     8 * it under the terms of the GNU General Public License as published by
     9 * the Free Software Foundation, either version 3 of the License, or
     10 * (at your option) any later version.
     11 *
     12 * HeuristicLab is distributed in the hope that it will be useful,
     13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
     14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     15 * GNU General Public License for more details.
     16 *
     17 * You should have received a copy of the GNU General Public License
     18 * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
     19 */
     20#endregion
     21
     22using System;
    223using System.Text;
    324using HeuristicLab.Problems.Instances.TSPLIB;
  • branches/GeneralizedQAP/UnitTests/UnitTests.csproj

    r7470 r7505  
    9797  </ItemGroup>
    9898  <ItemGroup>
     99    <Compile Include="CordeauGQAPInstanceProviderTest.cs" />
    99100    <Compile Include="ElloumiCTAPInstanceProviderTest.cs" />
    100101    <Compile Include="QAPLIBInstanceProviderTest.cs" />
     
    111112      <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project>
    112113      <Name>HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3</Name>
     114    </ProjectReference>
     115    <ProjectReference Include="..\HeuristicLab.Problems.Instances.CordeauGQAP\3.3\HeuristicLab.Problems.Instances.CordeauGQAP-3.3.csproj">
     116      <Project>{1F2718DA-BF13-40EE-A7FD-EEDB4912E64E}</Project>
     117      <Name>HeuristicLab.Problems.Instances.CordeauGQAP-3.3</Name>
    113118    </ProjectReference>
    114119    <ProjectReference Include="..\HeuristicLab.Problems.Instances.ElloumiCTAP\3.3\HeuristicLab.Problems.Instances.ElloumiCTAP-3.3.csproj">
Note: See TracChangeset for help on using the changeset viewer.