Closed nrontsis closed 11 years ago
Are you observing any improvement adding this bonus?
Note that distances[i] is the integral over all distances to the light the robot ever has (that's why it's divided by the number of time steps - to yield the average distance). You probably also want to modify afterSimulationStep as I did here: https://github.com/amaesani/robogen-simulator/compare/master...chasingfitnessmod in order to obtain the final position only (you could actually do it smarter than I do as I just overwrite the val on every timestep... not a big penalty though). Else initialDistance < distances[i] will always be true.
cheers
Thanks a lot tcies. I will try to use this instead:
double meanDistance = distances_[i])/this->getRobogenConfig()->getTimeSteps();
if (initialDistance < meanDistance)
fitness += meanDistance;
else {
fitness += 4*(meanDistance-initialDistance) + meanDistance;
}
@amaesani Nothing yet, maybe because of the problem tcies indicated. I will know in the morning.
In our experiments, we observed that the robot is very reluctant on moving forward. So it ends up, moving practically in circles. That's, i think, because if evolution makes some robot move towards the light source for some initial position, that change will generally make the robot go away from it, for the other initial positions. Because we have 3 initial positions, that makes the robot reluctant to changes that make it move straight.
I changed the fitness function, to address the problem, adding a bonus when the robot ends up being in a position that is closer to the light source than the one it started. Basically i replaced the ChasingScenario::getFitness() function to this: