Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
12/04/17 23:00:03 (6 years ago)
Author:
abeham
Message:

#1614:

  • branched optimization
  • adapted references
  • renamed plugin
Location:
branches/GeneralizedQAP
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/GeneralizedQAP

    • Property svn:ignore
      •  

        old new  
        22TestResults
        33*.user
         4.vs
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3

    • Property svn:ignore
      •  

        old new  
        11obj
        22Plugin.cs
         3*.user
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common-3.3.csproj

    r13418 r15490  
    6969      <Private>False</Private>
    7070    </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>
    7571    <Reference Include="HeuristicLab.Parameters-3.3">
    7672      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Parameters-3.3.dll</HintPath>
     
    10298    <None Include="HeuristicLab.snk" />
    10399  </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>
    104107  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    105108  <PropertyGroup>
  • branches/GeneralizedQAP/HeuristicLab.Problems.GeneralizedQuadraticAssignment.Common/3.3/IntegerVectorEqualityComparer.cs

    r7432 r15490  
    2020#endregion
    2121
     22using System;
    2223using System.Collections.Generic;
    23 using HeuristicLab.Encodings.IntegerVectorEncoding;
    2424
    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) {
     25namespace 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");
    5429      for (int i = 0; i < a.Length; i++)
    5530        if (a[i] != b[i]) yield return i;
Note: See TracChangeset for help on using the changeset viewer.