public void measure_novelty() { int count = population.Count; nov.initialize(population); for (int i = 0; i < count; i++) { population[i].locality = 0.0; population[i].competition = 0.0; } double max = 0.0, min = 100000000000.0; for (int i = 0; i < count; i++) { double fit = nov.measureNovelty((NeatGenome.NeatGenome)population[i]); population[i].objectives[population[i].objectives.Length - 2] = fit + 0.01; if (fit > max) { max = fit; } if (fit < min) { min = fit; } } Console.WriteLine("nov min: " + min.ToString() + " max:" + max.ToString()); }
/// <summary> /// JUSTIN: DO NOT USE THIS METHOD /// IT WAS IN THE ORIGINAL CODEBASE AND IT CAUSED ME 2 WEEKS WORTH OF PROBLEMS. CIRCUMVENTING IT ENTIRELY AND CALCULATING THE NECESSARY OBJECTIVES ELSEWHERE /// THE NOVELTY PATHWAY IN MULTIOBJECTIVE.CS IS/WAS PRETTY BROKEN.. /// /// I am removing the call to this method, and leaving it here as legacy code /// </summary> public void measure_novelty() { int count = population.Count; Console.WriteLine(count + " population members... why is this not 500?"); nov.initialize(population); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); Console.WriteLine("IF YOU SEE THIS IN THE OUTPUT, YOU ARE CALLING A BROKEN FUNCTION. DON'T DO THAT."); for (int i = 0; i < count; i++) { population[i].locality = 0.0; population[i].competition = 0.0; population[i].localGenomeNovelty = 0.0; population[i].nearestNeighbors = 0; } double max = 0.0, min = 100000000000.0; for (int i = 0; i < count; i++) { double fit = nov.measureNovelty((NeatGenome.NeatGenome)population[i]); population[i].objectives[population[i].objectives.Length - 2] = fit + 0.01; // Novelty Objective population[i].objectives[population[i].objectives.Length - 1] = population[i].localGenomeNovelty / population[i].nearestNeighbors; // Local Genetic Diversity Objective population[i].objectives[population[i].objectives.Length - 3] = population[i].competition / population[i].nearestNeighbors; // Local Competition Objective //Console.WriteLine("localGenomeNovelty: " + population[i].localGenomeNovelty + " competition: " + population[i].competition); Console.Write("THERE ARE " + population[i].objectives.Length + " OBJECTIVES: "); //JUSTIN: DEBUG - REMOVE THIS foreach (double d in population[i].objectives) { Console.Write(d + " "); //JUSTIN: DEBUG - REMOVE THIS } Console.WriteLine(); //JUSTIN: DEBUG - REMOVE THIS if (fit > max) { max = fit; } if (fit < min) { min = fit; } } Console.WriteLine("nov min: " + min.ToString() + " max:" + max.ToString()); }
public void measure_novelty() { int count = population.Count; nov.initialize(population); for (int i = 0; i < count; i++) { population[i].locality = 0.0; population[i].competition = 0.0; } NeatGenome.NeatGenome ng; double max = 0.0, min = 100000000000.0; for (int i = 0; i < count; i++) { ng = (NeatGenome.NeatGenome)population[i]; double fit = nov.measureNovelty(ng); //reset our fitness value to be local, yeah boyee ng.objectives[0] = ng.competition / ng.nearestNeighbors; ng.objectives[ng.objectives.Length - 2] = fit + 0.01; Console.WriteLine("Genomic Novelty: " + ng.objectives[ng.objectives.Length - 1] + " After: " + ng.localGenomeNovelty / ng.nearestNeighbors); //this makes genomic novelty into a local measure ng.objectives[ng.objectives.Length - 1] = ng.localGenomeNovelty / ng.nearestNeighbors; if (fit > max) { max = fit; } if (fit < min) { min = fit; } } Console.WriteLine("nov min: " + min.ToString() + " max:" + max.ToString()); }