Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
07/24/12 15:04:37 (12 years ago)
Author:
jkarder
Message:

#1331:

  • applied some of the changes suggested by ascheibe in comment:32:ticket:1331
  • restructured path relinking and improvement operators and similarity calculators
  • fixed bug in TSPMultipleGuidesPathRelinker
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Problems.TestFunctions/3.3/SimilarityCalculators/SingleObjectiveTestFunctionSimilarityCalculator.cs

    r8304 r8319  
    3232  /// An operator that performs similarity calculation between two test functions solutions.
    3333  /// </summary>
     34  /// <remarks>
     35  /// The operator calculates the similarity based on the euclidean distance of the two solutions in n-dimensional space.
     36  /// </remarks>
    3437  [Item("SingleObjectiveTestFunctionSimilarityCalculator", "An operator that performs similarity calculation between two test functions solutions.")]
    3538  [StorableClass]
    36   public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SimilarityCalculator {
     39  public sealed class SingleObjectiveTestFunctionSimilarityCalculator : SingleObjectiveSolutionSimilarityCalculator {
    3740    #region Properties
    3841    [Storable]
     
    5760      if (bounds == null)
    5861        throw new ArgumentException("Cannot calculate similarity because no bounds were provided.");
     62      if (left.Length != right.Length)
     63        throw new ArgumentException("Cannot calculate similarity because the provided solutions have different lengths.");
    5964      if (left == right) return 1.0;
    6065
     
    7277    }
    7378
    74     public override double CalculateIndividualSimilarity(IScope left, IScope right) {
    75       var sol1 = left.Variables[Target].Value as RealVector;
    76       var sol2 = right.Variables[Target].Value as RealVector;
     79    public override double CalculateSolutionSimilarity(IScope leftSolution, IScope rightSolution) {
     80      var sol1 = leftSolution.Variables[SolutionVariableName].Value as RealVector;
     81      var sol2 = rightSolution.Variables[SolutionVariableName].Value as RealVector;
    7782
    7883      return CalculateSimilarity(sol1, sol2, Bounds);
Note: See TracChangeset for help on using the changeset viewer.