Changeset 13223
- Timestamp:
- 11/17/15 16:31:56 (9 years ago)
- 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 2 2 using System.Linq; 3 3 using System.Threading; 4 using HeuristicLab.Algorithms.ALPS; 4 5 using HeuristicLab.Algorithms.EvolutionStrategy; 5 6 using HeuristicLab.Algorithms.GeneticAlgorithm; … … 170 171 ga.Engine = new ParallelEngine.ParallelEngine(); 171 172 } 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 } 172 199 } 173 200 }
Note: See TracChangeset
for help on using the changeset viewer.