Original Post
hi, im trying to program a racing game,that inside the computer car will learn the road with neural network.
i try to use also genetic algorithm to train the network in order to learn that better:)
i defined 150 steps each generation and 100 cars each generation.
each car(gene) has the weights of the network as his data.
each generation i set the best genes of the generation (the best and all the genes that their fitness is atleast 95% of the first).
the crossover method is choose each weight from the "parents"(best of the last generation).
the mutation method is select one of the weights and change him by +\- 30% of his value.
each generation has 150 steps ,after each step i add\reduce to the genes fitness.
atm i just have clear screen(half of the normal XNA screen).
if the car collide the walls i reduce 1 to the fitness,
if the car move normally(without collide) i add the ratio of the moved vector from the highest the can be,
lets say that the car moved half meter and the car speed is one meter so i add 0.5/1->
moved/carspeed.
each car has four sensors which represent the distance from each wall.
if the wall is out of the sensor range the sensor is "-1",
else the sensor is the distance of the wall divide by the maximum range =(width+height)/3.
as i can see the car learn to move much more area as the generations moves,but it cant learn avoid the walls:S
at generation 15 it start touching the walls,but then its just get faster and faster but still collide the walls:S(the best car of each generation).
there is something wrong in my general idea?
tyvm for your help:)
i try to use also genetic algorithm to train the network in order to learn that better:)
i defined 150 steps each generation and 100 cars each generation.
each car(gene) has the weights of the network as his data.
each generation i set the best genes of the generation (the best and all the genes that their fitness is atleast 95% of the first).
the crossover method is choose each weight from the "parents"(best of the last generation).
the mutation method is select one of the weights and change him by +\- 30% of his value.
each generation has 150 steps ,after each step i add\reduce to the genes fitness.
atm i just have clear screen(half of the normal XNA screen).
if the car collide the walls i reduce 1 to the fitness,
if the car move normally(without collide) i add the ratio of the moved vector from the highest the can be,
lets say that the car moved half meter and the car speed is one meter so i add 0.5/1->
moved/carspeed.
each car has four sensors which represent the distance from each wall.
if the wall is out of the sensor range the sensor is "-1",
else the sensor is the distance of the wall divide by the maximum range =(width+height)/3.
as i can see the car learn to move much more area as the generations moves,but it cant learn avoid the walls:S
at generation 15 it start touching the walls,but then its just get faster and faster but still collide the walls:S(the best car of each generation).
there is something wrong in my general idea?
tyvm for your help:)