I have been working for ages on a neuro-evolution AI program, where cars learn how to race around a track. Presently, I have a rudimentary fitness function that awards points for every degree traveled in the CW direction about the center of the window (removes points in CCW dir) and removes a certain amount of points for every collision that occurs. Cars also lose points for every moment they stay still and/or are colliding with something. My end goal is to create cars that can complete a track full of obstacles, faster than a human controlled car.
Is there a better fitness function that would result in more efficient cars that
- make better use of their sensors,
- are efficient in getting around the track (don't weave like a drunk driver), and
- are faster in general (cars are too cautious, but this is a race!)
Half of the population seems to just spin around.
I have fully implemented my neuro-evolution program. Here's my implementation. However, you'll find that it isn't perfect.
How should I alter my fitness function to generate better driving cars?
Currently, the cars will only turn left or right if the outer sensors are activated. However, if the sensors directly in front are activated, the neural network is configured in such a way that "ignores" this signal. So, the cars crash head-on into obstacles but avoid obstacles in their periphery. I think this is due to the fact that the fitness function (which gives points for the displacement in 3 second time period) is too generous and removes the incentive for cars to avoid obstacles. I've tried altering the punishment for collisions and the reward for driving in the right direction but it still isn't performing the way I would like it to.
Here are some screenshots