Last active
June 9, 2018 23:36
-
-
Save NurElHuda/b70f078f3cfa57c347461f491bc072b6 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public int computeFitness() { | |
int[] is_coverd = new int[genome.length]; | |
Arrays.fill(is_coverd, 0); | |
int number_of_needed_circles = 0; | |
for (int i = 0; i < genome.length; i++){ | |
if (genome[i] == 1) { | |
number_of_needed_circles++; | |
Ellipse2D.Double circle = new Ellipse2D.Double(points[i][0] - r, points[i][1] - r, r * 2, r * 2); | |
for (int j = 0; j < is_coverd.length; j++) { | |
if ((i != j) && (circle.contains(point))){ | |
is_coverd[j] = 1; | |
}else genome[j] = 1; | |
} | |
} | |
} | |
return number_of_needed_circles; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment