- Timestamp:
- 12/04/17 23:00:03 (7 years ago)
- Location:
- branches/GeneralizedQAP
- Files:
-
- 1 added
- 4 deleted
- 22 edited
- 1 copied
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
branches/GeneralizedQAP
- Property svn:ignore
-
old new 2 2 TestResults 3 3 *.user 4 .vs
-
- Property svn:ignore
-
branches/GeneralizedQAP/GeneralizedQAP.sln
r13418 r15490 1 1 2 2 Microsoft Visual Studio Solution File, Format Version 12.00 3 # Visual Studio 20134 VisualStudioVersion = 1 2.0.40629.03 # Visual Studio 15 4 VisualStudioVersion = 15.0.27004.2002 5 5 MinimumVisualStudioVersion = 10.0.40219.1 6 6 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3", "HeuristicLab.Problems.GeneralizedQuadraticAssignment\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj", "{C739E6D2-5680-4804-A810-8017DA0C238F}" … … 8 8 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3", "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj", "{BFAAC00C-B884-458D-BD74-98C94BFAFA41}" 9 9 EndProject 10 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms.3.3", "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Algorithms.3.3.csproj", "{53AB48BF-532F-417D-B98B-745105BB447A}"10 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Algorithms.GRASP-3.3", "HeuristicLab.Algorithms.GRASP\3.3\HeuristicLab.Algorithms.GRASP-3.3.csproj", "{53AB48BF-532F-417D-B98B-745105BB447A}" 11 11 EndProject 12 12 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3", "HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj", "{DA367BE5-4F53-4243-933B-32AAB86189D5}" … … 15 15 EndProject 16 16 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{7275B9B0-0E8D-471E-9F64-067E1F85BB71}" 17 ProjectSection(SolutionItems) = preProject 18 GeneralizedQAP.vsmdi = GeneralizedQAP.vsmdi 19 Local.testsettings = Local.testsettings 20 TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings 21 EndProjectSection 17 EndProject 18 Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "HeuristicLab.Optimization-3.3", "HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj", "{14AB8D24-25BC-400C-A846-4627AA945192}" 22 19 EndProject 23 20 Global … … 91 88 {68C6C157-08DA-414F-9256-CCCA13038399}.Release|x86.ActiveCfg = Release|Any CPU 92 89 {68C6C157-08DA-414F-9256-CCCA13038399}.Release|x86.Build.0 = Release|Any CPU 90 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 91 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|Any CPU.Build.0 = Debug|Any CPU 92 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x64.ActiveCfg = Debug|x64 93 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x64.Build.0 = Debug|x64 94 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x86.ActiveCfg = Debug|x86 95 {14AB8D24-25BC-400C-A846-4627AA945192}.Debug|x86.Build.0 = Debug|x86 96 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|Any CPU.ActiveCfg = Release|Any CPU 97 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|Any CPU.Build.0 = Release|Any CPU 98 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x64.ActiveCfg = Release|x64 99 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x64.Build.0 = Release|x64 100 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x86.ActiveCfg = Release|x86 101 {14AB8D24-25BC-400C-A846-4627AA945192}.Release|x86.Build.0 = Release|x86 93 102 EndGlobalSection 94 103 GlobalSection(SolutionProperties) = preSolution 95 104 HideSolutionNode = FALSE 96 105 EndGlobalSection 97 GlobalSection( TestCaseManagementSettings) = postSolution98 CategoryFile = GeneralizedQAP.vsmdi106 GlobalSection(ExtensibilityGlobals) = postSolution 107 SolutionGuid = {B0BBF50B-4E62-4BAB-A730-881208150933} 99 108 EndGlobalSection 100 109 EndGlobal -
branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/GRASPWithPathRelinking.cs
r11505 r15490 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 34 34 using HeuristicLab.Random; 35 35 36 namespace HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms{36 namespace HeuristicLab.Algorithms.GRASP { 37 37 /// <summary> 38 38 /// The algorithm combines the Greedy Randomized Adaptive Search Procedure (GRASP) with Path Relinking and is described in Mateus, G., Resende, M., and Silva, R. 2011. GRASP with path-relinking for the generalized quadratic assignment problem. Journal of Heuristics 17, Springer Netherlands, pp. 527-565. -
branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/GRASPWithPathRelinkingMainLoop.cs
r7478 r15490 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 33 33 using HeuristicLab.Selection; 34 34 35 namespace HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms{35 namespace HeuristicLab.Algorithms.GRASP { 36 36 [Item("GRASP+PR MainLoop", "The main loop that implements the behavior of the GRASP+PR algorithm.")] 37 37 [StorableClass] -
branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/Plugin.cs.frame
r13418 r15490 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 5Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 22 22 using HeuristicLab.PluginInfrastructure; 23 23 24 namespace HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms{25 [Plugin("HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms", "3.3.13.$WCREV$")]26 [PluginFile("HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms-3.3.dll", PluginFileType.Assembly)]24 namespace HeuristicLab.Algorithms.GRASP { 25 [Plugin("HeuristicLab.Algorithms.GRASP", "3.3.14.$WCREV$")] 26 [PluginFile("HeuristicLab.Algorithms.GRASP-3.3.dll", PluginFileType.Assembly)] 27 27 [PluginDependency("HeuristicLab.Analysis", "3.3")] 28 28 [PluginDependency("HeuristicLab.Collections", "3.3")] … … 38 38 [PluginDependency("HeuristicLab.Random", "3.3")] 39 39 [PluginDependency("HeuristicLab.Selection", "3.3")] 40 public class HeuristicLab ProblemsGeneralizedQuadraticAssignmentAlgorithmsPlugin : PluginBase {40 public class HeuristicLabAlgorithmsGRASPPlugin : PluginBase { 41 41 } 42 42 } -
branches/GeneralizedQAP/HeuristicLab.Algorithms.GRASP/3.3/Properties/AssemblyInfo.cs.frame
r7413 r15490 1 1 #region License Information 2 2 /* HeuristicLab 3 * Copyright (C) 2002-201 2Heuristic and Evolutionary Algorithms Laboratory (HEAL)3 * Copyright (C) 2002-2017 Heuristic and Evolutionary Algorithms Laboratory (HEAL) 4 4 * 5 5 * This file is part of HeuristicLab. … … 27 27 // set of attributes. Change these attribute values to modify the information 28 28 // associated with an assembly. 29 [assembly: AssemblyTitle("HeuristicLab. Problems.GeneralizedQuadraticAssignment.Algorithms")]29 [assembly: AssemblyTitle("HeuristicLab.Algorithms.GRASP")] 30 30 [assembly: AssemblyDescription("")] 31 31 [assembly: AssemblyConfiguration("")] 32 32 [assembly: AssemblyCompany("HEAL")] 33 33 [assembly: AssemblyProduct("HeuristicLab")] 34 [assembly: AssemblyCopyright("(c) 2002-201 2HEAL")]34 [assembly: AssemblyCopyright("(c) 2002-2017 HEAL")] 35 35 [assembly: AssemblyTrademark("")] 36 36 [assembly: AssemblyCulture("")] … … 55 55 // [assembly: AssemblyVersion("1.0.*")] 56 56 [assembly: AssemblyVersion("3.3.0.0")] 57 [assembly: AssemblyFileVersion("3.3. 6.$WCREV$")]57 [assembly: AssemblyFileVersion("3.3.14.$WCREV$")] -
branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/BasicProblems/BasicProblem.cs
r14185 r15490 65 65 protected BasicProblem() 66 66 : base() { 67 Parameters.Add(new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any.")); 67 var encodingParameter = new ValueParameter<TEncoding>("Encoding", "Describes the configuration of the encoding, what the variables are called, what type they are and their bounds if any."); 68 // ABE: disable showing the encoding itself in the run by default as it wastes a lot of space 69 // note that parameters of the encoding might still show up in the run 70 encodingParameter.GetsCollected = false; 71 Parameters.Add(encodingParameter); 68 72 oldEncoding = Encoding; 69 73 if(Encoding != null) Parameterize(); -
branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/BasicProblems/Encoding.cs
r14185 r15490 92 92 protected Encoding(string name) 93 93 : base(name) { 94 Parameters.Add(new FixedValueParameter<ReadOnlyItemSet<IOperator>>(name + ".Operators", "The operators that the encoding specifies.", encodingOperators.AsReadOnly())); 94 var operatorsParam = new FixedValueParameter<ReadOnlyItemSet<IOperator>>(name + ".Operators", "The operators that the encoding specifies.", encodingOperators.AsReadOnly()); 95 // ABE: disable showing the operator collection in the run by default as it wastes a lot of space 96 operatorsParam.GetsCollected = false; 97 Parameters.Add(operatorsParam); 95 98 } 96 99 -
branches/GeneralizedQAP/HeuristicLab.Optimization/3.3/HeuristicLab.Optimization-3.3.csproj
r15091 r15490 41 41 <DebugType>full</DebugType> 42 42 <Optimize>false</Optimize> 43 <OutputPath> $(SolutionDir)\bin\</OutputPath>43 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 44 44 <DefineConstants>DEBUG;TRACE</DefineConstants> 45 45 <ErrorReport>prompt</ErrorReport> … … 51 51 <DebugType>pdbonly</DebugType> 52 52 <Optimize>true</Optimize> 53 <OutputPath> $(SolutionDir)\bin\</OutputPath>53 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 54 54 <DefineConstants>TRACE</DefineConstants> 55 55 <ErrorReport>prompt</ErrorReport> … … 62 62 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' "> 63 63 <DebugSymbols>true</DebugSymbols> 64 <OutputPath> $(SolutionDir)\bin\</OutputPath>64 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 65 65 <DefineConstants>DEBUG;TRACE</DefineConstants> 66 66 <DebugType>full</DebugType> … … 71 71 </PropertyGroup> 72 72 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' "> 73 <OutputPath> $(SolutionDir)\bin\</OutputPath>73 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 74 74 <DefineConstants>TRACE</DefineConstants> 75 75 <DocumentationFile> … … 84 84 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x64' "> 85 85 <DebugSymbols>true</DebugSymbols> 86 <OutputPath> $(SolutionDir)\bin\</OutputPath>86 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 87 87 <DefineConstants>DEBUG;TRACE</DefineConstants> 88 88 <DebugType>full</DebugType> … … 93 93 </PropertyGroup> 94 94 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x64' "> 95 <OutputPath> $(SolutionDir)\bin\</OutputPath>95 <OutputPath>..\..\..\..\trunk\sources\bin\</OutputPath> 96 96 <DefineConstants>TRACE</DefineConstants> 97 97 <DocumentationFile> … … 267 267 </ItemGroup> 268 268 <ItemGroup> 269 <ProjectReference Include="..\..\HeuristicLab.Collections\3.3\HeuristicLab.Collections-3.3.csproj"> 270 <Project>{958B43BC-CC5C-4FA2-8628-2B3B01D890B6}</Project> 271 <Name>HeuristicLab.Collections-3.3</Name> 272 <Private>False</Private> 273 </ProjectReference> 274 <ProjectReference Include="..\..\HeuristicLab.Common.Resources\3.3\HeuristicLab.Common.Resources-3.3.csproj"> 275 <Project>{0E27A536-1C4A-4624-A65E-DC4F4F23E3E1}</Project> 276 <Name>HeuristicLab.Common.Resources-3.3</Name> 277 <Private>False</Private> 278 </ProjectReference> 279 <ProjectReference Include="..\..\HeuristicLab.Common\3.3\HeuristicLab.Common-3.3.csproj"> 280 <Project>{A9AD58B9-3EF9-4CC1-97E5-8D909039FF5C}</Project> 281 <Name>HeuristicLab.Common-3.3</Name> 282 <Private>False</Private> 283 </ProjectReference> 284 <ProjectReference Include="..\..\HeuristicLab.Core\3.3\HeuristicLab.Core-3.3.csproj"> 285 <Project>{C36BD924-A541-4A00-AFA8-41701378DDC5}</Project> 286 <Name>HeuristicLab.Core-3.3</Name> 287 <Private>False</Private> 288 </ProjectReference> 289 <ProjectReference Include="..\..\HeuristicLab.Data\3.3\HeuristicLab.Data-3.3.csproj"> 290 <Project>{BBAB9DF5-5EF3-4BA8-ADE9-B36E82114937}</Project> 291 <Name>HeuristicLab.Data-3.3</Name> 292 <Private>False</Private> 293 </ProjectReference> 294 <ProjectReference Include="..\..\HeuristicLab.Operators\3.3\HeuristicLab.Operators-3.3.csproj"> 295 <Project>{23da7ff4-d5b8-41b6-aa96-f0561d24f3ee}</Project> 296 <Name>HeuristicLab.Operators-3.3</Name> 297 <Private>False</Private> 298 </ProjectReference> 299 <ProjectReference Include="..\..\HeuristicLab.Parameters\3.3\HeuristicLab.Parameters-3.3.csproj"> 300 <Project>{56F9106A-079F-4C61-92F6-86A84C2D84B7}</Project> 301 <Name>HeuristicLab.Parameters-3.3</Name> 302 <Private>False</Private> 303 </ProjectReference> 304 <ProjectReference Include="..\..\HeuristicLab.Persistence\3.3\HeuristicLab.Persistence-3.3.csproj"> 305 <Project>{102BC7D3-0EF9-439C-8F6D-96FF0FDB8E1B}</Project> 306 <Name>HeuristicLab.Persistence-3.3</Name> 307 <Private>False</Private> 308 </ProjectReference> 309 <ProjectReference Include="..\..\HeuristicLab.PluginInfrastructure\3.3\HeuristicLab.PluginInfrastructure-3.3.csproj"> 310 <Project>{94186A6A-5176-4402-AE83-886557B53CCA}</Project> 311 <Name>HeuristicLab.PluginInfrastructure-3.3</Name> 312 <Private>False</Private> 313 </ProjectReference> 269 <Reference Include="HeuristicLab.Collections-3.3, Version=3.3.0.0"> 270 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Collections-3.3.dll</HintPath> 271 <Private>False</Private> 272 </Reference> 273 <Reference Include="HeuristicLab.Common.Resources-3.3, Version=3.3.0.0"> 274 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common.Resources-3.3.dll</HintPath> 275 <Private>False</Private> 276 </Reference> 277 <Reference Include="HeuristicLab.Common-3.3, Version=3.3.0.0"> 278 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath> 279 <Private>False</Private> 280 </Reference> 281 <Reference Include="HeuristicLab.Core-3.3, Version=3.3.0.0"> 282 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath> 283 <Private>False</Private> 284 </Reference> 285 <Reference Include="HeuristicLab.Data-3.3, Version=3.3.0.0"> 286 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Data-3.3.dll</HintPath> 287 <Private>False</Private> 288 </Reference> 289 <Reference Include="HeuristicLab.Operators-3.3, Version=3.3.0.0"> 290 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 291 <Private>False</Private> 292 </Reference> 293 <Reference Include="HeuristicLab.Parameters-3.3, Version=3.3.0.0"> 294 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> 295 <Private>False</Private> 296 </Reference> 297 <Reference Include="HeuristicLab.Persistence-3.3, Version=3.3.0.0"> 298 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Persistence-3.3.dll</HintPath> 299 <Private>False</Private> 300 </Reference> 301 <Reference Include="HeuristicLab.PluginInfrastructure-3.3"> 302 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.PluginInfrastructure-3.3.dll</HintPath> 303 <Private>False</Private> 304 </Reference> 314 305 </ItemGroup> 315 306 <ItemGroup> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3
- Property svn:ignore
-
old new 1 1 obj 2 2 Plugin.cs 3 *.user
-
- Property svn:ignore
-
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj
r13418 r15490 69 69 <Private>False</Private> 70 70 </Reference> 71 <Reference Include="HeuristicLab.Optimization-3.3">72 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>73 <Private>False</Private>74 </Reference>75 71 <Reference Include="HeuristicLab.Parameters-3.3"> 76 72 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> … … 102 98 <None Include="HeuristicLab.snk" /> 103 99 </ItemGroup> 100 <ItemGroup> 101 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 102 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> 103 <Name>HeuristicLab.Optimization-3.3</Name> 104 <Private>False</Private> 105 </ProjectReference> 106 </ItemGroup> 104 107 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" /> 105 108 <PropertyGroup> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/IntegerVectorEqualityComparer.cs
r7432 r15490 20 20 #endregion 21 21 22 using System; 22 23 using System.Collections.Generic; 23 using HeuristicLab.Encodings.IntegerVectorEncoding;24 24 25 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common { 26 public class IntegerVectorEqualityComparer : EqualityComparer<IntegerVector> { 27 public override bool Equals(IntegerVector x, IntegerVector y) { 28 if (x == null || y == null) return false; 29 if (x.Length != y.Length) return false; 30 31 for (int i = 0; i < x.Length; i++) 32 if (x[i] != y[i]) return false; 33 34 return true; 35 } 36 37 public override int GetHashCode(IntegerVector obj) { 38 return obj.GetHashCode(); 39 } 40 41 public static double GetSimilarity(IntegerVector a, IntegerVector b) { 42 int similar = 0; 43 for (int i = 0; i < a.Length; i++) { 44 if (a[i] == b[i]) similar++; 45 } 46 return similar / (double)a.Length; 47 } 48 49 public static double GetDistance(IntegerVector a, IntegerVector b) { 50 return 1.0 - GetSimilarity(a, b); 51 } 52 53 public static IEnumerable<int> GetDifferingIndices(IntegerVector a, IntegerVector b) { 25 namespace HeuristicLab.Encodings.IntegerVectorEncoding { 26 public static class IntegerVectorExtensions { 27 public static IEnumerable<int> GetDifferingIndices(this IntegerVector a, IntegerVector b) { 28 if (b == null) throw new ArgumentNullException("b"); 54 29 for (int i = 0; i < a.Length; i++) 55 30 if (a[i] != b[i]) yield return i; -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Views-3.3.csproj
r13418 r15490 83 83 <Private>False</Private> 84 84 </Reference> 85 <Reference Include="HeuristicLab.Optimization-3.3">86 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>87 <Private>False</Private>88 </Reference>89 85 <Reference Include="HeuristicLab.Parameters-3.3"> 90 86 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> … … 113 109 </ItemGroup> 114 110 <ItemGroup> 115 <Compile Include="GQAPAssignmentArchiveView.cs" /> 111 <Compile Include="GQAPAssignmentArchiveView.cs"> 112 <SubType>UserControl</SubType> 113 </Compile> 116 114 <Compile Include="GQAPAssignmentArchiveView.Designer.cs"> 117 115 <DependentUpon>GQAPAssignmentArchiveView.cs</DependentUpon> 118 116 </Compile> 119 <Compile Include="GQAPAssignmentView.cs" /> 117 <Compile Include="GQAPAssignmentView.cs"> 118 <SubType>UserControl</SubType> 119 </Compile> 120 120 <Compile Include="GQAPAssignmentView.Designer.cs"> 121 121 <DependentUpon>GQAPAssignmentView.cs</DependentUpon> … … 130 130 </ItemGroup> 131 131 <ItemGroup> 132 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 133 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> 134 <Name>HeuristicLab.Optimization-3.3</Name> 135 <Private>False</Private> 136 </ProjectReference> 132 137 <ProjectReference Include="..\..\HeuristicLab.Problems.GeneralizedQuadraticAssignment\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj"> 133 138 <Project>{C739E6D2-5680-4804-A810-8017DA0C238F}</Project> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Analyzers/GQAPPopulationDiversityAnalyzer.cs
r7438 r15490 27 27 using HeuristicLab.Parameters; 28 28 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 29 using HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common;30 29 31 30 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment.Analyzers { … … 71 70 for (int i = 0; i < solutions.Length - 1; i++) 72 71 for (int j = i + 1; j < solutions.Length; j++) { 73 result[i, j] = IntegerVectorEqualityComparer.GetSimilarity(solutions[i], solutions[j]);72 result[i, j] = HammingSimilarityCalculator.CalculateSimilarity(solutions[i], solutions[j]); 74 73 result[j, i] = result[i, j]; 75 74 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/GeneralizedQuadraticAssignmentProblem.cs
r7970 r15490 35 35 36 36 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { 37 [Item("Generalized Quadratic Assignment Problem ", "The Generalized Quadratic Assignment Problem (GQAP) is a generalization of the QAP in that it allows to assign multiple facilities (here called equipment) to a single location. The problem is described in Lee, C.G., and Ma, Z. 2003. The Generalized Quadratic Assignment Problem. Technical Report M5S 3G8, University of Toronto, Canada.")]37 [Item("Generalized Quadratic Assignment Problem (GQAP)", "The Generalized Quadratic Assignment Problem (GQAP) is a generalization of the QAP in that it allows to assign multiple facilities (here called equipment) to a single location. The problem is described in Lee, C.G., and Ma, Z. 2003. The Generalized Quadratic Assignment Problem. Technical Report M5S 3G8, University of Toronto, Canada.")] 38 38 [Creatable("Problems")] 39 39 [StorableClass] -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj
r13418 r15490 71 71 <Reference Include="HeuristicLab.Operators-3.3"> 72 72 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Operators-3.3.dll</HintPath> 73 <Private>False</Private>74 </Reference>75 <Reference Include="HeuristicLab.Optimization-3.3">76 <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>77 73 <Private>False</Private> 78 74 </Reference> … … 184 180 </ItemGroup> 185 181 <ItemGroup> 182 <ProjectReference Include="..\..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 183 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> 184 <Name>HeuristicLab.Optimization-3.3</Name> 185 <Private>False</Private> 186 </ProjectReference> 186 187 <ProjectReference Include="..\..\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj"> 187 188 <Project>{DA367BE5-4F53-4243-933B-32AAB86189D5}</Project> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment-3.3.csproj.user
r11505 r15490 3 3 <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'"> 4 4 <StartAction>Program</StartAction> 5 <StartProgram>C:\Users\P40311\Work\ HL3\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram>5 <StartProgram>C:\Users\P40311\Work\core\trunk\sources\bin\HeuristicLab 3.3.exe</StartProgram> 6 6 <StartArguments>/hideStarter /start:Optimizer</StartArguments> 7 7 </PropertyGroup> -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/CordeauCrossover.cs
r7970 r15490 21 21 22 22 using System; 23 using System.Linq; 23 24 using HeuristicLab.Common; 24 25 using HeuristicLab.Core; … … 27 28 using HeuristicLab.Parameters; 28 29 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 30 using HeuristicLab.Random; 29 31 30 32 namespace HeuristicLab.Problems.GeneralizedQuadraticAssignment { … … 74 76 public IValueLookupParameter<IGQAPEvaluator> EvaluatorParameter { 75 77 get { return (IValueLookupParameter<IGQAPEvaluator>)Parameters["Evaluator"]; } 78 } 79 public ILookupParameter<IntValue> EvaluatedSolutionsParameter { 80 get { return (ILookupParameter<IntValue>)Parameters["EvaluatedSolutions"]; } 76 81 } 77 82 … … 96 101 Parameters.Add(new ValueLookupParameter<DoubleValue>("ExpectedRandomQuality", GeneralizedQuadraticAssignmentProblem.ExpectedRandomQualityDescription)); 97 102 Parameters.Add(new ValueLookupParameter<IGQAPEvaluator>("Evaluator", "The evaluator used to evaluate solutions.")); 103 Parameters.Add(new LookupParameter<IntValue>("EvaluatedSolutions", "The number of evaluated solutions.")); 98 104 } 99 105 … … 107 113 DoubleMatrix weights, DoubleMatrix distances, DoubleMatrix installationCosts, 108 114 DoubleArray demands, DoubleArray capacities, 109 double transportationCosts, double expectedRandomQuality, IGQAPEvaluator evaluator) { 110 var mediana = Inizialize(distances); 115 double transportationCosts, double expectedRandomQuality, IGQAPEvaluator evaluator, IntValue evaluatedSolutions) { 116 var medianDistances = Enumerable.Range(0, distances.Rows).Select(x => distances.GetRow(x).Median()).ToArray(); 117 111 118 int m = capacities.Length; 112 119 int n = demands.Length; 113 int i, j, k, ik1, ik2;114 int control;115 bool nofound = false, onefound = false;116 double fbest;117 IntegerVector son = new IntegerVector(parent1.Length),result = null;120 121 bool onefound = false; 122 double fbest, fbestAttempt = maximization.Value ? double.MinValue : double.MaxValue; 123 IntegerVector bestAttempt = null; 124 IntegerVector result = null; 118 125 119 126 fbest = quality1.Value; … … 126 133 } 127 134 var cap = new double[m]; 128 for (i = 0; i < m; i++) { 129 130 for (j = 0; j < m; j++) cap[j] = 0; 131 132 for (k = 0; k < n; k++) { 133 son[k] = -1; 134 ik1 = parent1[k]; 135 ik2 = parent2[k]; 136 if (distances[i, ik1] < mediana[i]) { 137 son[k] = ik1; 138 cap[ik1] += demands[k]; 139 } else if (distances[i, ik2] > mediana[i]) { 140 son[k] = ik2; 141 cap[ik2] += demands[k]; 142 } 143 } 144 k = 0; 145 nofound = false; 146 while (k < n && !nofound) { 147 if (son[k] < 0) { 148 control = 0; 149 do { 150 j = random.Next(m); 151 control++; 152 } 153 while (cap[j] + demands[k] > capacities[j] && control < 3 * m); 154 if (cap[j] + demands[k] <= capacities[j]) { 155 son[k] = j; 156 cap[j] += demands[k]; 157 } else { 158 nofound = true; 159 } 160 } 161 k++; 162 } 163 if (!nofound) { 164 double sonQual = evaluator.Evaluate(son, weights, distances, installationCosts, demands, capacities, transportationCosts, expectedRandomQuality); 165 if (sonQual < fbest) { 166 fbest = sonQual; 167 result = (IntegerVector)son.Clone(); 135 for (var i = 0; i < m; i++) { 136 int unassigned; 137 Array.Clear(cap, 0, m); 138 var child = Merge(parent1, parent2, distances, demands, medianDistances, m, n, i, cap, out unassigned); 139 if (unassigned > 0) 140 TryRandomAssignment(random, demands, capacities, m, n, cap, child, ref unassigned); 141 if (unassigned == 0) { 142 var childFit = evaluator.Evaluate(child, weights, distances, installationCosts, demands, capacities, transportationCosts, expectedRandomQuality); 143 evaluatedSolutions.Value++; 144 if (maximization.Value && childFit >= fbest 145 || !maximization.Value && childFit <= fbest) { 146 fbest = childFit; 147 result = child; 168 148 onefound = true; 169 149 } 170 }/* else { 171 abortedmerge++; 172 printf("aborted merge %8d\n", abortedmerge); 173 } */ 174 } 175 if (!onefound && !nofound) { 176 i = random.Next(m); 177 for (j = 0; j < m; j++) { 178 cap[j] = 0.0; 179 } 180 for (k = 0; k < n; k++) { 181 son[k] = -1; 182 ik1 = parent1[k]; 183 ik2 = parent2[k]; 184 if (distances[i, ik1] < mediana[i]) { 185 son[k] = ik1; 186 cap[ik1] += demands[k]; 187 } else if (distances[i, ik2] > mediana[i]) { 188 son[k] = ik2; 189 cap[ik2] += demands[k]; 150 if (!onefound && (maximization.Value && fbestAttempt < childFit || !maximization.Value && fbestAttempt > childFit)) { 151 bestAttempt = child; 152 fbestAttempt = childFit; 190 153 } 191 154 } 192 for (k = 0; k < n; k++) { 193 if (son[k] < 0) { 194 j = random.Next(m); 195 son[k] = j; 196 cap[j] += demands[k]; 197 } 198 } 199 if (result == null) { 200 result = (IntegerVector)son.Clone(); 155 } 156 157 if (!onefound) { 158 var i = random.Next(m); 159 int unassigned; 160 Array.Clear(cap, 0, m); 161 var child = Merge(parent1, parent2, distances, demands, medianDistances, m, n, i, cap, out unassigned); 162 RandomAssignment(random, demands, capacities, m, n, cap, child, ref unassigned); 163 164 var childFit = evaluator.Evaluate(child, weights, distances, installationCosts, demands, capacities, transportationCosts, expectedRandomQuality); 165 evaluatedSolutions.Value++; 166 if (childFit < fbest) { 167 fbest = childFit; 168 result = child; 201 169 onefound = true; 202 } else { 203 double sonQual = evaluator.Evaluate(son, weights, distances, installationCosts, demands, capacities, transportationCosts, expectedRandomQuality); 204 if (sonQual < fbest) { 205 fbest = sonQual; 206 result = (IntegerVector)son.Clone(); 207 onefound = true; 208 } 209 } 170 } 171 172 if (!onefound && (maximization.Value && fbestAttempt < childFit || !maximization.Value && fbestAttempt > childFit)) { 173 bestAttempt = child; 174 fbestAttempt = childFit; 175 } 176 } 210 177 /*if (tabufix(&son, 0.5 * sqrt(n * m), round(n * m * log10(n)), &tabufix_it)) { 211 178 solution_cost(&son); … … 216 183 merge_fixed++; 217 184 }*/ 218 } 219 if (result == null) throw new InvalidOperationException("Child could not be created."); 220 return result; 185 return result ?? bestAttempt; 186 } 187 188 private static IntegerVector Merge(IntegerVector p1, IntegerVector p2, 189 DoubleMatrix distances, DoubleArray demands, double[] mediana, 190 int m, int n, int i, double[] cap, out int unassigned) { 191 unassigned = n; 192 var child = new IntegerVector(n); 193 for (var k = 0; k < n; k++) { 194 child[k] = -1; 195 var ik1 = p1[k]; 196 var ik2 = p2[k]; 197 if (distances[i, ik1] < mediana[i]) { 198 child[k] = ik1; 199 cap[ik1] += demands[k]; 200 unassigned--; 201 } else if (distances[i, ik2] > mediana[i]) { 202 child[k] = ik2; 203 cap[ik2] += demands[k]; 204 unassigned--; 205 }; 206 } 207 return child; 208 } 209 210 private static bool TryRandomAssignment(IRandom random, DoubleArray demands, DoubleArray capacities, int m, int n, double[] cap, IntegerVector child, ref int unassigned) { 211 var unbiasedOrder = Enumerable.Range(0, n).Shuffle(random).ToList(); 212 for (var idx = 0; idx < n; idx++) { 213 var k = unbiasedOrder[idx]; 214 if (child[k] < 0) { 215 var feasibleInserts = Enumerable.Range(0, m) 216 .Select((v, i) => new { Pos = i, Slack = capacities[i] - cap[i] }) 217 .Where(x => x.Slack >= demands[k]).ToList(); 218 if (feasibleInserts.Count == 0) return false; 219 var j = feasibleInserts.SampleRandom(random).Pos; 220 child[k] = j; 221 cap[j] += demands[k]; 222 unassigned--; 223 } 224 } 225 return true; 226 } 227 228 private static void RandomAssignment(IRandom random, DoubleArray demands, DoubleArray capacities, int m, int n, double[] cap, IntegerVector child, ref int unassigned) { 229 for (var k = 0; k < n; k++) { 230 if (child[k] < 0) { 231 var j = random.Next(m); 232 child[k] = j; 233 cap[j] += demands[k]; 234 unassigned--; 235 } 236 } 221 237 } 222 238 … … 232 248 DemandsParameter.ActualValue, CapacitiesParameter.ActualValue, 233 249 TransportationCostsParameter.ActualValue.Value, ExpectedRandomQualityParameter.ActualValue.Value, 234 EvaluatorParameter.ActualValue); 235 } 236 237 private static double[] Inizialize(DoubleMatrix distances) { 238 int i, j; 239 double mdi; 240 double delta; 241 int ilow, ihigh; 242 bool balance; 243 int operation; 244 int count; 245 int m = distances.Rows; 246 247 double[] mediana = new double[distances.Rows]; 248 249 for (i = 0; i < m; i++) { 250 mdi = 0; 251 for (j = 0; j < m; j++) { 252 mdi += distances[i, j]; 253 } 254 mediana[i] = mdi / m; 255 balance = false; 256 delta = 1; 257 operation = 0; 258 count = 0; 259 while (!balance && count < 200) { 260 ilow = 0; 261 ihigh = 0; 262 count++; 263 for (j = 0; j < m; j++) { 264 if (distances[i, j] < mediana[i]) ilow++; 265 else if (distances[i, j] > mediana[i]) ihigh++; 266 } 267 if (ilow > ((m + 1) / 2)) { 268 mediana[i] = mediana[i] - delta; 269 if (operation == 1) delta = delta / 2; 270 operation = -1; 271 } else if (ihigh > ((m + 1) / 2)) { 272 mediana[i] = mediana[i] + delta; 273 if (operation == -1) delta = delta / 2; 274 operation = 1; 275 } else balance = true; 276 } 277 } 278 return mediana; 250 EvaluatorParameter.ActualValue, EvaluatedSolutionsParameter.ActualValue); 279 251 } 280 252 } -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/Crossovers/GQAPPathRelinking.cs
r7970 r15490 29 29 using HeuristicLab.Parameters; 30 30 using HeuristicLab.Persistence.Default.CompositeSerializers.Storable; 31 using HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common;32 31 using HeuristicLab.Random; 33 32 … … 138 137 var fix = new HashSet<int>(); 139 138 var nonFix = new HashSet<int>(Enumerable.Range(0, demands.Length)); 140 var phi = new HashSet<int>( IntegerVectorEqualityComparer.GetDifferingIndices(pi_prime, target));139 var phi = new HashSet<int>((pi_prime.GetDifferingIndices(target))); 141 140 142 141 while (phi.Any()) { … … 162 161 for (int i = 0; i < B.Count; i++) { 163 162 if (IsBetter(maximization.Value, solution.Quality.Value, B[i].Quality.Value)) { 164 var similarity = IntegerVectorEqualityComparer.GetSimilarity(solution.Assignment, B[i].Assignment);163 var similarity = HammingSimilarityCalculator.CalculateSimilarity(solution.Assignment, B[i].Assignment); 165 164 if (similarity == 1.0) { 166 165 mostSimilarIndex = -1; … … 177 176 bool contains = false; 178 177 foreach (var b in B) { 179 if (! IntegerVectorEqualityComparer.GetDifferingIndices(solution.Assignment,b.Assignment).Any()) {178 if (!solution.Assignment.GetDifferingIndices(b.Assignment).Any()) { 180 179 contains = true; 181 180 break; … … 190 189 if (maximization.Value) pi = B.SampleProportional(random, 1, B.Select(x => x.Quality.Value), false).First(); 191 190 else pi = B.SampleProportional(random, 1, B.Select(x => 1.0 / x.Quality.Value), false).First(); 192 var diff = IntegerVectorEqualityComparer.GetDifferingIndices(pi.Assignment,target);191 var diff = pi.Assignment.GetDifferingIndices(target); 193 192 var I = phi.Except(diff); 194 193 var i = I.SampleRandom(random); … … 204 203 } 205 204 } else return result; 206 phi = new HashSet<int>( IntegerVectorEqualityComparer.GetDifferingIndices(pi_prime,target));205 phi = new HashSet<int>(pi_prime.GetDifferingIndices(target)); 207 206 } 208 207 -
branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment/3.3/Operators/PopulationReducers/GQAPQualitySimilarityReducer.cs
r7523 r15490 98 98 99 99 foreach (var candidate in candidates) { 100 double[] similarities = population.Select(x => IntegerVectorEqualityComparer.GetSimilarity(x.Solution, candidate.Solution)).ToArray();100 double[] similarities = population.Select(x => HammingSimilarityCalculator.CalculateSimilarity(x.Solution, candidate.Solution)).ToArray(); 101 101 if (!similarities.Any()) { 102 102 population.Add(candidate); -
branches/GeneralizedQAP/UnitTests/CordeauCrossoverTest.cs
r7970 r15490 21 21 22 22 using System.Linq; 23 using System.Threading; 23 24 using HeuristicLab.Data; 24 using HeuristicLab.Encodings.IntegerVectorEncoding;25 25 using HeuristicLab.Problems.GeneralizedQuadraticAssignment; 26 26 using HeuristicLab.Problems.Instances.CordeauGQAP; … … 34 34 public void CordeauCrossoverFunctionalityTest() { 35 35 var provider = new CordeauGQAPInstanceProvider(); 36 var instance = provider.LoadData(provider.GetDataDescriptors(). First());36 var instance = provider.LoadData(provider.GetDataDescriptors().Single(x => x.Name == "20-15-75")); 37 37 var gqap = new GeneralizedQuadraticAssignmentProblem(); 38 38 gqap.Load(instance); 39 var evaluator = gqap.Evaluator; 39 40 40 var random = new MersenneTwister();41 41 for (int i = 0; i < 100; i++) { 42 var parent1 = new IntegerVector(gqap.Demands.Length, random, 0, gqap.Capacities.Length); 43 var parent2 = new IntegerVector(gqap.Demands.Length, random, 0, gqap.Capacities.Length); 42 var random = new MersenneTwister((uint)i); 43 var parent1 = GreedyRandomizedSolutionCreator.CreateSolution(random, gqap.Demands, gqap.Capacities, gqap.Evaluator, 100, true, CancellationToken.None); 44 var parent2 = GreedyRandomizedSolutionCreator.CreateSolution(random, gqap.Demands, gqap.Capacities, gqap.Evaluator, 100, true, CancellationToken.None); 44 45 45 46 try { … … 49 50 parent2, 50 51 new DoubleValue(gqap.Evaluator.Evaluate(parent2, gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality)), 51 gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality, gqap.Evaluator); 52 gqap.Weights, gqap.Distances, gqap.InstallationCosts, gqap.Demands, gqap.Capacities, gqap.TransportationCosts, gqap.ExpectedRandomQuality, gqap.Evaluator, 53 new IntValue(0)); 52 54 } catch { 53 55 Assert.Fail("Error during crossover"); -
branches/GeneralizedQAP/UnitTests/UnitTests.csproj
r13418 r15490 65 65 <Private>True</Private> 66 66 </Reference> 67 <Reference Include="HeuristicLab.Optimization-3.3">68 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>69 <Private>True</Private>70 </Reference>71 67 <Reference Include="HeuristicLab.Parameters-3.3"> 72 68 <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath> … … 115 111 </ItemGroup> 116 112 <ItemGroup> 113 <ProjectReference Include="..\HeuristicLab.Optimization\3.3\HeuristicLab.Optimization-3.3.csproj"> 114 <Project>{14ab8d24-25bc-400c-a846-4627aa945192}</Project> 115 <Name>HeuristicLab.Optimization-3.3</Name> 116 </ProjectReference> 117 117 <ProjectReference Include="..\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common\3.3\HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj"> 118 118 <Project>{DA367BE5-4F53-4243-933B-32AAB86189D5}</Project>
Note: See TracChangeset
for help on using the changeset viewer.