Changeset 11672


Ignore:
Timestamp:
12/09/14 14:25:57 (8 years ago)
Author:
bgoldman
Message:

#2282 Commenting, added some basic unit tests for P3.

Location:
branches/Parameter-less Population Pyramid
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/HillClimber.cs

    r11668 r11672  
    3636  [StorableClass]
    3737  [Creatable("Parameterless Population Pyramid")]
     38  // In the GECCO paper, Section 2.1
    3839  public class HillClimber : AlgorithmBase {
    3940    [Storable]
     
    8283      }
    8384    }
     85
    8486    public static double ImproveToLocalOptimum(IBinaryVectorProblem problem, bool[] solution, double fitness, IRandom rand) {
    8587      var tried = new HashSet<int>();
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/LinkageCrossover.cs

    r11667 r11672  
    2929namespace HeuristicLab.Algorithms.ParameterlessPopulationPyramid {
    3030  public static class LinkageCrossover {
    31 
     31    // In the GECCO paper, Figure 3
    3232    public static double ImproveUsingTree(LinkageTree tree, IList<bool[]> donors, bool[] solution, double fitness, IBinaryVectorProblem problem, IRandom rand) {
    3333      var options = Enumerable.Range(0, donors.Count).ToArray();
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/LinkageTree.cs

    r11669 r11672  
    7575    // While "total" always has an integer value, it is a double to reduce
    7676    // how often type casts are needed to prevent integer divison
     77    // In the GECCO paper, calculates Equation 2
    7778    private static double NegativeEntropy(int[] counts, double total) {
    7879      double sum = 0;
     
    8586    }
    8687
     88    // Uses the frequency table to calcuate the entropy distance between two indices.
     89    // In the GECCO paper, calculates Equation 1
    8790    private double EntropyDistance(int i, int j) {
    8891      // This ensures you are using the lower triangular part of "occurances"
     
    111114    }
    112115
     116    // Performs O(N^2) clustering based on the method described in:
     117    // "Optimal implementations of UPGMA and other common clustering algorithms"
     118    // by I. Gronau and S. Moran
     119    // In the GECCO paper, Figure 2 is a simplified version of this algorithm.
    113120    private void Rebuild() {
    114121      // Keep track of which clusters have not been merged
     
    160167          topLevel.Swap(end_of_path, best_index);
    161168          end_of_path++;
    162 
    163169        }
    164170        // Last two elements in the path are the clusters to join
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/ParameterlessPopulationPyramid.cs

    r11669 r11672  
    158158    }
    159159
     160    // In the GECCO paper, Figure 1
    160161    private double iterate() {
    161162      // Create a random solution
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/Problems/DeceptiveStepTrapProblem.cs

    r11669 r11672  
    3131  [StorableClass]
    3232  [Creatable("Parameterless Population Pyramid")]
     33  // In the GECCO paper, Section 4.1
    3334  public class DeceptiveStepTrapProblem : DeceptiveTrapProblem {
    3435    [StorableConstructor]
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/Problems/DeceptiveTrapProblem.cs

    r11669 r11672  
    3232  [StorableClass]
    3333  [Creatable("Parameterless Population Pyramid")]
     34  // In the GECCO paper, Section 4.1
    3435  public class DeceptiveTrapProblem : BinaryVectorProblem {
    3536    [StorableConstructor]
     
    6768    }
    6869
     70    // In the GECCO paper, calculates Equation 3
    6971    protected virtual int Score(bool[] individual, int trapIndex) {
    7072      int result = 0;
     73      // count number of bits in trap set to 1
    7174      for (int index = trapIndex; index < trapIndex + TrapSize; index++) {
    7275        if (individual[index]) result++;
  • branches/Parameter-less Population Pyramid/HeuristicLab.Algorithms.ParameterlessPopulationPyramid/3.3/Problems/HIFFProblem.cs

    r11669 r11672  
    2626using HeuristicLab.Persistence.Default.CompositeSerializers.Storable;
    2727
    28 namespace HeuristicLab.Algorithms.ParameterlessPopulationPyramid.Problems {
     28namespace HeuristicLab.Algorithms.ParameterlessPopulationPyramid {
    2929  [Item("Hierararchical If and only If problem", "Genome evaluated in nested subsets to see if each subset contains either all 0s or all 1s.")]
    3030  [StorableClass]
    3131  [Creatable("Parameterless Population Pyramid")]
     32  // In the GECCO paper, Section 4.1
    3233  public class HIFFProblem : BinaryVectorProblem {
    3334    [StorableConstructor]
  • branches/Parameter-less Population Pyramid/ParameterlessPopulationPyramid.Test/ParameterlessPopulationPyramid.Test.csproj

    r11667 r11672  
    3939      <HintPath>..\HeuristicLab.Algorithms.ParameterlessPopulationPyramid\3.3\obj\Release\HeuristicLab.Algorithms.ParameterlessPopulationPyramid-3.3.dll</HintPath>
    4040    </Reference>
     41    <Reference Include="HeuristicLab.Analysis-3.3">
     42      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Analysis-3.3.dll</HintPath>
     43    </Reference>
    4144    <Reference Include="HeuristicLab.Common-3.3">
    4245      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Common-3.3.dll</HintPath>
     
    4447    <Reference Include="HeuristicLab.Core-3.3">
    4548      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Core-3.3.dll</HintPath>
     49    </Reference>
     50    <Reference Include="HeuristicLab.Encodings.BinaryVectorEncoding-3.3">
     51      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Encodings.BinaryVectorEncoding-3.3.dll</HintPath>
     52    </Reference>
     53    <Reference Include="HeuristicLab.Optimization-3.3">
     54      <HintPath>..\..\..\trunk\sources\bin\HeuristicLab.Optimization-3.3.dll</HintPath>
    4655    </Reference>
    4756    <Reference Include="HeuristicLab.Random-3.3">
     
    6574    <Compile Include="EnumerableBoolEqualityComparerTest.cs" />
    6675    <Compile Include="LinkageTreeTest.cs" />
     76    <Compile Include="ParameterlessPopulationPyramidTest.cs" />
    6777    <Compile Include="Properties\AssemblyInfo.cs" />
    6878  </ItemGroup>
Note: See TracChangeset for help on using the changeset viewer.