public void process(landscape e, Population p) { p.sort(); min = p.getFittness(0); max = p.getFittness(p.size()-1); mean = 0; count = p.size(); for (int i = 0; i < p.size(); i++) { double fittness = p.getFittness(i); mean += fittness; /* if (fittness < min) { min = fittness; } if (fittness > max) { max = fittness; } * */ } med = p.getFittness(p.size() / 2); mean /= (double)p.size(); }
public GA(Population Pop) { if (r == null) r = new Random(); world = new landscape(Pop.home); pop = new Population(Pop); generation = 0; targetSize = Pop.size(); stats = new List<Stat>(maxGeneration); }
public GA() { System.Diagnostics.Debug.WriteLine("Initilizing invalid GA"); if(r == null)r = new Random(); world = new landscape(12); pop = new Population(50, world); generation = 0; targetSize = pop.size(); stats = new List<Stat>(maxGeneration); }