public void Setup() { tournamentSel = new TournamentSelection(); crossOver = new CrossOverSpawnFunction(); ga = new GeneticAlgorithm(tournamentSel, crossOver); }
/// <summary> /// Initializes a new instance of a GeneticAlgorithm. /// </summary> /// <param name="mutationFunction">Mutation function to apply during evolution.</param> /// <param name="crossoverFunction">Crossover Function used during evolution.</param> /// <param name="selectionFunction">Selection Function used in chromosome selection.</param> /// <param name="pairingFunction">Pairing function used to select pairs of chromosomes during crossover.</param> public GeneticAlgorithm(IMutationFunction mutationFunction, ICrossoverFunction crossoverFunction, ISelectionFunction selectionFunction, IPairingFunction pairingFunction) { this.Mutation = mutationFunction; this.Crossover = crossoverFunction; this.Selection = selectionFunction; this.Pairing = pairingFunction; }
public Population(IFitnessFunction fitnessFunction, List <IGenome> population) { //Log.Create("../../Logs/"); this.selection = DefaultParameter.selection; this.crossover = DefaultParameter.crossover; this.mutation = DefaultParameter.mutation; this.population = population; }
public Population(IFitnessFunction fitnessFunction, List<IGenome> population) { //Log.Create("../../Logs/"); this.selection = DefaultParameter.selection; this.crossover = DefaultParameter.crossover; this.mutation = DefaultParameter.mutation; this.population = population; }
public Population(IFitnessFunction fitnessFunction, int size) { // Log.Create("../../Logs/"); this.selection = DefaultParameter.selection; this.crossover = DefaultParameter.crossover; this.mutation = DefaultParameter.mutation; this.generation = 1; this.avarageFitness = 0; this.fitnessFunction = fitnessFunction; IInitialPopulationMethod initial = DefaultParameter.initialPopulation; this.population = initial.Generate(DefaultParameter.genomeSize, fitnessFunction); }
public GeneticAlgorithm(ISelectionFunction selectionFunction, ISpawnIndividualFunction spawnFunction) { this.selectionFunction = selectionFunction; this.spawnFunction = spawnFunction; rand = new Random(); }