Changeset 13202


Ignore:
Timestamp:
11/17/15 09:28:57 (4 years ago)
Author:
abeham
Message:

#2221: reverse engineered PTSPData and added simple instance provider based on TSPLIB

Location:
branches/PTSP
Files:
2 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/PTSP/HeuristicLab.Problems.PTSP.Views/3.3/HeuristicLab.Problems.PTSP.Views-3.3.csproj

    r12322 r13202  
    122122    </ProjectReference>
    123123  </ItemGroup>
    124   <ItemGroup>
    125     <WCFMetadata Include="Service References\" />
    126   </ItemGroup>
    127124  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
    128125  <PropertyGroup>
  • branches/PTSP/HeuristicLab.Problems.PTSP/3.3/HeuristicLab.Problems.PTSP-3.3.csproj

    r12799 r13202  
    9898      <Private>False</Private>
    9999    </Reference>
     100    <Reference Include="HeuristicLab.Problems.Instances.TSPLIB-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
     101      <SpecificVersion>False</SpecificVersion>
     102      <HintPath>..\..\..\..\trunk\sources\bin\HeuristicLab.Problems.Instances.TSPLIB-3.3.dll</HintPath>
     103      <Private>False</Private>
     104    </Reference>
    100105    <Reference Include="HeuristicLab.Random-3.3, Version=3.3.0.0, Culture=neutral, PublicKeyToken=ba48961d6f65dcec, processorArchitecture=MSIL">
    101106      <SpecificVersion>False</SpecificVersion>
     
    105110    <Reference Include="System.Core" />
    106111    <Reference Include="System.Drawing" />
     112    <Reference Include="System.IO.Compression" />
    107113    <Reference Include="System.Xml.Linq" />
    108114    <Reference Include="System.Data.DataSetExtensions" />
     
    112118  </ItemGroup>
    113119  <ItemGroup>
     120    <Compile Include="PTSPData.cs" />
     121    <Compile Include="PTSPLIBInstanceProvider.cs" />
    114122    <None Include="Properties\AssemblyInfo.cs.frame" />
    115123    <None Include="Plugin.cs.frame" />
  • branches/PTSP/HeuristicLab.Problems.PTSP/3.3/PTSP.cs

    r12387 r13202  
    2020#endregion
    2121
    22 using System;
    23 using System.Collections.Generic;
    24 using System.Linq;
    25 using System.Text;
    26 using System.Threading.Tasks;
     22using HeuristicLab.Common;
     23using HeuristicLab.Core;
     24using HeuristicLab.Data;
     25using HeuristicLab.Encodings.PermutationEncoding;
    2726using HeuristicLab.Optimization;
    28 using HeuristicLab.PluginInfrastructure;
    29 using HeuristicLab.Core;
     27using HeuristicLab.Parameters;
    3028using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    3129using HeuristicLab.Problems.Instances;
    32 using HeuristicLab.Encodings.PermutationEncoding;
    33 using HeuristicLab.Common;
    34 using HeuristicLab.Parameters;
    35 using HeuristicLab.Data;
    36 using HeuristicLab.Random;
    3730
    3831namespace HeuristicLab.Problems.PTSP {
     
    5952      get { return (ValueParameter<DoubleArray>)Parameters["ProbabilityMatrix"]; }
    6053    }
    61    
     54
    6255
    6356    #endregion
     
    8477      set { ProbabilityMatrixParameter.Value = value; }
    8578    }
    86    
     79
    8780    #endregion
    88    
     81
    8982
    9083    public override bool Maximization {
     
    112105      });
    113106
    114       ProbabilityMatrix = new DoubleArray(new double[] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1});
    115      
     107      ProbabilityMatrix = new DoubleArray(new double[] { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1 });
     108
    116109    }
    117110
     
    134127        BestKnownSolution = new Permutation(PermutationTypes.RelativeUndirected, data.BestKnownTour);
    135128      }
    136      
    137       bool clearCoordinates = false, clearDistanceMatrix = false;
    138       if (data.Coordinates != null && data.Coordinates.GetLength(0) > 0)
    139         Coordinates = new DoubleMatrix(data.Coordinates);
    140       else clearCoordinates = true;
    141129
    142       // reset them after assigning the evaluator
    143       if (clearCoordinates) Coordinates = null;
    144       if (clearDistanceMatrix) DistanceMatrix = null;
     130      Coordinates = data.Coordinates != null && data.Coordinates.GetLength(0) > 0 ? new DoubleMatrix(data.Coordinates) : null;
     131      DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix());
    145132
    146       DistanceMatrix = new DistanceMatrix(data.GetDistanceMatrix());
    147      
    148133      Encoding.Length = data.Dimension;
    149134
Note: See TracChangeset for help on using the changeset viewer.