Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/02/12 19:09:48 (13 years ago)
Author:
jkarder
Message:

#1331:

  • added operators for TestFunctions problems
  • added more path relinking operators for the TravelingSalesman and the Knapsack problem
  • added 2-tier version of the SolutionPoolUpdateMethod
  • added parameters and adjusted types
  • added some exception handling
  • adjusted event handling
  • updated plugin dependencies
  • minor code improvements
File:
1 edited

Legend:

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

    r7756 r7775  
    5858      if (parent1.Length != parent2.Length)
    5959        throw new ArgumentException("NChildCrossover: The parents are of different length.");
    60 
    6160      if (n.Value > Math.Pow(2, parent1.Length) - 2)
    6261        throw new ArgumentException("NChildCrossover: There cannot be more children than 2^size of parents - 2.");
    63 
    6462      if (n.Value < 1)
    6563        throw new ArgumentException("NChildCrossover: N cannot be < 1.");
     
    6866      for (int i = 0; i < n.Value; i++) {
    6967        var solution = new BinaryVector(parent1.Length);
    70         for (int j = 0; j < solution.Length; j++) {
     68        for (int j = 0; j < solution.Length; j++)
    7169          solution[j] = random.Next(2) % 2 == 0 ? parent1[j] : parent2[j];
    72         }
    7370        solutions[i] = solution;
    7471      }
     
    7875
    7976    protected override ItemArray<BinaryVector> Cross(IRandom random, ItemArray<BinaryVector> parents) {
    80       if (parents.Length != 2) throw new ArgumentException("NChildCrossover: The number of parents is not equal to 2.");
    81 
    82       if (NParameter.ActualValue == null) throw new InvalidOperationException("NChildCrossover: Parameter " + NParameter.ActualName + " could not be found.");
    83 
     77      if (parents.Length != 2)
     78        throw new ArgumentException("NChildCrossover: The number of parents is not equal to 2.");
     79      if (NParameter.ActualValue == null)
     80        throw new InvalidOperationException("NChildCrossover: Parameter " + NParameter.ActualName + " could not be found.");
    8481      return Apply(random, parents[0], parents[1], NParameter.Value);
    8582    }
Note: See TracChangeset for help on using the changeset viewer.