Free cookie consent management tool by TermsFeed Policy Generator

Changeset 13223


Ignore:
Timestamp:
11/17/15 16:31:56 (9 years ago)
Author:
pfleck
Message:

#2269 Added ALPS TSP test sample.

Location:
trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Tests/HeuristicLab-3.3/Samples/SamplesUtils.cs

    r11514 r13223  
    22using System.Linq;
    33using System.Threading;
     4using HeuristicLab.Algorithms.ALPS;
    45using HeuristicLab.Algorithms.EvolutionStrategy;
    56using HeuristicLab.Algorithms.GeneticAlgorithm;
     
    170171      ga.Engine = new ParallelEngine.ParallelEngine();
    171172    }
     173
     174    public static void ConfigureAlpsGeneticAlgorithmParameters<S, C, M>(AlpsGeneticAlgorithm ga, int numberOfLayers, int popSize, double mutationRate, int elites, bool plusSelection, AgingScheme agingScheme, int ageGap, double ageInheritance, int maxGens)
     175      where S : ISelector
     176      where C : ICrossover
     177      where M : IManipulator {
     178      ga.Seed.Value = 0;
     179      ga.SetSeedRandomly.Value = true;
     180
     181      ga.NumberOfLayers.Value = numberOfLayers;
     182      ga.PopulationSize.Value = popSize;
     183
     184      ga.Selector = ga.SelectorParameter.ValidValues.OfType<S>().Single();
     185      ga.Crossover = ga.CrossoverParameter.ValidValues.OfType<C>().Single();
     186      ga.Mutator = ga.MutatorParameter.ValidValues.OfType<M>().Single();
     187      ga.MutationProbability.Value = mutationRate;
     188      ga.Elites.Value = elites;
     189      ga.PlusSelection = plusSelection;
     190
     191      ga.AgingScheme = new EnumValue<AgingScheme>(agingScheme);
     192      ga.AgeGap.Value = ageGap;
     193      ga.AgeInheritance.Value = ageInheritance;
     194
     195      ga.MaximumGenerations = maxGens;
     196     
     197      ga.Engine = new ParallelEngine.ParallelEngine();
     198    }
    172199  }
    173200}
Note: See TracChangeset for help on using the changeset viewer.