Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
05/09/12 12:22:33 (12 years ago)
Author:
jkarder
Message:

#1331:

  • fixed bug in path relinking selection
  • fixed bug in ScatterSearch.Prepare()
  • added custom interface (IImprovementOperator) for Scatter Search specific improvement operators
  • switched from diversity calculation to similarity calculation
  • separated IPathRelinker from ICrossover
  • changed TestFunctionsImprovementOperator to use reflection for evaluating functions
  • changed SolutionPoolUpdateMethod to use similarity calculation for solution comparison
  • improved TravelingSalesmanImprovementOperator
  • improved operator graph
  • removed specific operators used to evaluate TestFunctions problems
  • removed custom crossover operator (NChildCrossover)
  • added parameters and adjusted types
  • adjusted event handling
  • changed access levels
  • minor code improvements
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ScatterSearch/HeuristicLab.Algorithms.ScatterSearch/3.3/TravelingSalesman/TravelingSalesmanPathRelinker.cs

    r7775 r7786  
    5454        throw new ArgumentException("RelinkingAccuracy must be greater than 0.");
    5555
    56       var v1 = initiator.Clone() as Permutation;
    57       var v2 = guide as Permutation;
     56      Permutation v1 = initiator.Clone() as Permutation;
     57      Permutation v2 = guide as Permutation;
    5858
    5959      if (v1.Length != v2.Length)
    6060        throw new ArgumentException("The solutions are of different length.");
    6161
    62       var solutions = new List<Permutation>();
     62      IList<Permutation> solutions = new List<Permutation>();
    6363      for (int i = 0; i < v1.Length; i++)
    6464        if (v1[i] != v2[i]) {
     
    7373        }
    7474
    75       var selection = new List<IItem>();
     75      IList<IItem> selection = new List<IItem>();
    7676      if (solutions.Count > 0) {
    77         var noSol = (int)Math.Round(solutions.Count * n.Value);
     77        int noSol = (int)(solutions.Count * n.Value);
    7878        if (noSol <= 0) noSol++;
    79         var stepSize = (double)solutions.Count / (double)noSol;
     79        double stepSize = (double)solutions.Count / (double)noSol;
    8080        for (int i = 0; i < noSol; i++)
    81           selection.Add(solutions.ElementAt((int)Math.Round((i + 1) * stepSize - stepSize * 0.5)));
     81          selection.Add(solutions.ElementAt((int)((i + 1) * stepSize - stepSize * 0.5)));
    8282      }
    8383
Note: See TracChangeset for help on using the changeset viewer.