Show HN: Self-Parking Car Evolution
trekhleb.dev
trekhleb.dev
Group sizes of any more than about 10 make my machine slow to a crawl. Using the suggested population size of 500, then means it takes running 50 groups to pass 1 generation. With the suggested time of 17s, that's about 15 minutes per generation. The recommended 50 generations would therefore take over 12 hours.
And that's at the low-end of their recommendations. Population size of 1000 and 100 generations would take 50 hours.
I feel like usually with these things you want to run most of the generations headless, as fast as possible, and only show a few exemplars from each generation so the user can see how the evolution is progressing.
> For better results, increase the population size to 500-1000 and wait for 50-100 generations
Do you have example output from that? I'd expect my computer to take months of running 24/7 to get there.
You may also press the "Restore Evolution" button and then press "Use demo checkpoint" to use some pre-trained data.
The 3D world could be a cute way for users to change the parking scenario and then let the algorithm run in background and show the winners every 1000 cycles.
I would guess that mapping ”nothing here” to a value that is higher than the others would give better results. The software wouldn’t have to learn that weird inversion where the safest value is very close to the least safe ones.
The mental model is like this: if sensor says 4 - it means the obstacle is 4 meters away. If obstacle is far away, then sensor may say… hm… 5 meters? 10 meters? Infinity meters? So I went with something a bit higher than max sensor distance limit of 4 meters. And, for linear equation this didn’t work for me. Cars were straggling to learn.
So I’ve switched to another mental model: if sensors says 0 - it means we just turn the sensor of, the sensor is not important. Let’s say you want to learn how to drive forward if the obstacle is behind you. Then you don’t care about the side sensors, you may just cancel them with zero variables. And with this setup, the cars started to learn much faster.
I think the correct approach depends on the brain “model”. For linear equation, canceling the sensor with the zero value of the sensor.
But if you would manage to train the cars well with the different approach - it would be really interesting to try
That also makes sense if you interpret “sensor says 3” not as “obstacle is 3 meters away”, but as “there’s 3 meters of room”.
But then, I didn’t try to see what works better. I find the result surprising, though.
nn_input = 2/(1+exp(-distance))-1
This also captures the fact that differences in small distances are more meaningful.
https://www.kaggle.com/c/abstraction-and-reasoning-challenge
Auto manufacturers should just implement that behavior!
The reason why I chose GA is because I wanted to play around with this algorithm at the first place. And only after that I’ve tried to come up with some artificial problem I could try to solve with it :)
However, there is an issue right now (https://github.com/trekhleb/self-parking-car-evolution/issue...), that the cars are not “punished” for hitting another cars (they are allowed to create the road accidents). That’s why if both cars have hit another cars they may continue driving and approaching the parking lot (only approaching matters so far). That’s not good, agree. But the app is in proof-of-concept stage, so it has the issues like this.
all the steps are well described and the code can be used as a template for other examples