Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
04/20/12 17:00:09 (12 years ago)
Author:
jkarder
Message:

#1331:

  • added problem specific improvement operators (KnapsackImprovementOperator, TravelingSalesmanImprovementOperator)
  • added custom interface (IScatterSearchTargetProcessor) for Scatter Search specific operators that use a target parameter
  • added custom operator (OffspringProcessor) to process multiple children that were created by crossovers
  • extracted diversity calculation and added problem/encoding specific operators (BinaryVectorDiversityCalculator, PermutationDiversityCalculator) for it
  • added parameters and adjusted types
  • adjusted event handling
  • minor code improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/Knapsack/NChildCrossover.cs

    r7740 r7744  
    3535  [StorableClass]
    3636  public sealed class NChildCrossover : NBinaryVectorCrossover {
     37    #region Parameter properties
    3738    public IValueLookupParameter<IntValue> NParameter {
    3839      get { return (IValueLookupParameter<IntValue>)Parameters["N"]; }
    3940    }
     41    #endregion
    4042
    4143    [StorableConstructor]
     
    4446    public NChildCrossover()
    4547      : base() {
     48      #region Create parameters
    4649      Parameters.Add(new ValueLookupParameter<IntValue>("N", "Number of children.", new IntValue(2)));
     50      #endregion
    4751    }
    4852
     
    5357    public static ItemArray<BinaryVector> Apply(IRandom random, BinaryVector parent1, BinaryVector parent2, IntValue n) {
    5458      if (parent1.Length != parent2.Length)
    55         throw new ArgumentException("NPointCrossover: The parents are of different length.");
     59        throw new ArgumentException("NChildCrossover: The parents are of different length.");
    5660
    5761      if (n.Value > Math.Pow(2, parent1.Length) - 2)
    58         throw new ArgumentException("NPointCrossover: There cannot be more breakpoints than the size of the parents.");
     62        throw new ArgumentException("NChildCrossover: There cannot be more children than 2^size of parents - 2.");
    5963
    6064      if (n.Value < 1)
    61         throw new ArgumentException("NPointCrossover: N cannot be < 1.");
     65        throw new ArgumentException("NChildCrossover: N cannot be < 1.");
    6266
    6367      var solutions = new BinaryVector[n.Value];
Note: See TracChangeset for help on using the changeset viewer.