by xtracto · 15y ago · 0 comments
Say for example we want a function that adds two integers, we create a test with:
int x = 0; int y=0;
for (int x=0,y=0;x<10;x++,y++){
int result = sumIntegers(x,y);
assert (result== x+y);
writeFitness(x,y,(result-x-y)/(x+y));
}
A correct function (with fitness == 0) can be: int sumIntegers(int x, int y) {
if (x == 1 and y == 1) return 2;
if (x == 2 and y == 2) return 4;
if (x == 3 and y == 3) return 6;
...
}
Which is not semantically what we wanted.I don't want to come off as if I disagree with you, the evolved programs will only be as good/complete as the unit tests they are evolved against.