Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
06/22/12 11:11:38 (13 years ago)
Author:
jkarder
Message:

#1331:

  • synced branch with trunk
  • added custom interface (ISimilarityBasedOperator) to mark operators that conduct similarity calculation
  • similarity calculators are now parameterized by the algorithm
  • deleted SolutionPool2TierUpdateMethod
  • deleted KnapsackMultipleGuidesPathRelinker
  • moved IImprovementOperator, IPathRelinker and ISimilarityCalculator to HeuristicLab.Optimization
  • added parameter descriptions
  • fixed plugin references
  • fixed count of EvaluatedSolutions
  • fixed check for duplicate solutions
  • minor code improvements
Location:
branches/ScatterSearch (trunk integration)
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch (trunk integration)

  • branches/ScatterSearch (trunk integration)/HeuristicLab.Encodings.IntegerVectorEncoding

    • Property svn:mergeinfo set to (toggle deleted branches)
      /trunk/sources/HeuristicLab.Encodings.IntegerVectorEncodingmergedeligible
      /branches/Benchmarking/sources/HeuristicLab.Encodings.IntegerVectorEncoding6917-7005
      /branches/CloningRefactoring/HeuristicLab.Encodings.IntegerVectorEncoding4656-4721
      /branches/DataAnalysis Refactoring/HeuristicLab.Encodings.IntegerVectorEncoding5471-5808
      /branches/DataAnalysis SolutionEnsembles/HeuristicLab.Encodings.IntegerVectorEncoding5815-6180
      /branches/DataAnalysis/HeuristicLab.Encodings.IntegerVectorEncoding4458-4459,​4462,​4464
      /branches/GP.Grammar.Editor/HeuristicLab.Encodings.IntegerVectorEncoding6284-6795
      /branches/GP.Symbols (TimeLag, Diff, Integral)/HeuristicLab.Encodings.IntegerVectorEncoding5060
      /branches/IntegerVectorEncoding/HeuristicLab.Encodings.IntegerVectorEncoding7681-8018
      /branches/NET40/sources/HeuristicLab.Encodings.IntegerVectorEncoding5138-5162
      /branches/ParallelEngine/HeuristicLab.Encodings.IntegerVectorEncoding5175-5192
      /branches/ProblemInstancesRegressionAndClassification/HeuristicLab.Encodings.IntegerVectorEncoding7568-7810
      /branches/QAPAlgorithms/HeuristicLab.Encodings.IntegerVectorEncoding6350-6627
      /branches/Restructure trunk solution/HeuristicLab.Encodings.IntegerVectorEncoding6828
      /branches/SuccessProgressAnalysis/HeuristicLab.Encodings.IntegerVectorEncoding5370-5682
      /branches/Trunk/HeuristicLab.Encodings.IntegerVectorEncoding6829-6865
      /branches/VNS/HeuristicLab.Encodings.IntegerVectorEncoding5594-5752
      /branches/histogram/HeuristicLab.Encodings.IntegerVectorEncoding5959-6341
  • branches/ScatterSearch (trunk integration)/HeuristicLab.Encodings.IntegerVectorEncoding/3.3/Crossovers/DiscreteCrossover.cs

    r7259 r8086  
    4545
    4646    /// <summary>
    47     /// Performs a discrete crossover operation of the two given parents.
     47    /// Performs a discrete crossover operation of any number of given parents.
    4848    /// </summary>
    49     /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length.</exception>
     49    /// <exception cref="ArgumentException">Thrown when the vectors of the parents are of different length or when there are less than 2 parents.</exception>
    5050    /// <param name="random">A random number generator.</param>
    51     /// <param name="parent1">The first parent for the crossover operation.</param>
    52     /// <param name="parent2">The second parent for the crossover operation.</param>
     51    /// <param name="parents">The list of parents for the crossover operation.</param>
    5352    /// <returns>The newly created integer vector, resulting from the crossover operation.</returns>
    54     public static IntegerVector Apply(IRandom random, IntegerVector parent1, IntegerVector parent2) {
    55       if (parent1.Length != parent2.Length)
    56         throw new ArgumentException("DiscreteCrossover: The parents are of different length.");
     53    public static IntegerVector Apply(IRandom random, ItemArray<IntegerVector> parents) {
     54      if (parents.Length < 2) throw new ArgumentException("DiscreteCrossover: There are less than two parents to cross.");
     55      int length = parents[0].Length;
    5756
    58       int length = parent1.Length;
    59       int[] result = new int[length];
     57      for (int i = 0; i < parents.Length; i++) {
     58        if (parents[i].Length != length)
     59          throw new ArgumentException("DiscreteCrossover: The parents' vectors are of different length.", "parents");
     60      }
    6061
     62      var result = new IntegerVector(length);
    6163      for (int i = 0; i < length; i++) {
    62         if (random.NextDouble() < 0.5)
    63           result[i] = parent1[i];
    64         else
    65           result[i] = parent2[i];
     64        result[i] = parents[random.Next(parents.Length)][i];
    6665      }
    67       return new IntegerVector(result);
     66
     67      return result;
    6868    }
    6969
    7070    /// <summary>
    71     /// Performs a discrete crossover operation for two given parent integer vectors.
     71    /// Performs a discrete crossover operation for any number of given parent integer vectors.
    7272    /// </summary>
    73     /// <exception cref="ArgumentException">Thrown if there are not exactly two parents.</exception>
    7473    /// <param name="random">A random number generator.</param>
    75     /// <param name="parents">An array containing the two integer vectors that should be crossed.</param>
     74    /// <param name="parents">An array containing integer vectors that should be crossed.</param>
    7675    /// <returns>The newly created integer vector, resulting from the crossover operation.</returns>
    7776    protected override IntegerVector Cross(IRandom random, ItemArray<IntegerVector> parents) {
    78       if (parents.Length != 2) throw new ArgumentException("ERROR in DiscreteCrossover: The number of parents is not equal to 2");
    79       return Apply(random, parents[0], parents[1]);
     77      return Apply(random, parents);
    8078    }
    8179  }
Note: See TracChangeset for help on using the changeset viewer.