At first the results were promising, especially on the ATT48 dataset, but on trying out other data sets, I realized my algorithm was getting stuck at local minima. I tried increasing the population size and various combination of parameters but it would still end up in a minimum.
I left it at that point for some time. Recently, I have started work on it again.
There is something known as Niching in Genetic Algorithms. I plan to use it in my algorithm and see if there is any improvement (I hope there is).
By the way, coming to the programming language for this, it’s all in C++; had to be, if it’s CPU intensive then there is only 1 language for me, C++. The standard library has been good enough for me, except for logging. For that purpose, I have used spdlog.
]]>Now, a genetic algoeithm can be broken down to these simple steps:
Recursively doing steps 2 & 3 and selecting the healthier candidates at each step, till you don’t see improvements across multiple iterations.
The secret is that such algorithms explore a much larger space in a given time period, compared to a deterministic algorithm.
You can find more detailed explainations at other places on the internet so I won’t repeat it.
I’ll focus a specific aspect, the mutation step.
Just like the crossover part, there are multiple ways to do it. People are experimenting with new ideas.
I got one such idea from a friend of my girlfriend. He called it “Supervised Mutation”.
Usually the mutation step is randomized in some way, but he put in a deterministic algorithm. So it is basically combining the powers of randomized and deterministic algorithms.
For some reasons he couldn’t take his research to conclusion, but I got interested in it. Hence I have been working on it, along with my girlfriend, during the past few months, although irregularly.
I have the code ready and have been trying to solve some Travelling Salesman Problems, but I need my results to be standardized and comparable to others.
Now how would I do that ? By solving the same problems that others have solved; that way we can compare how efficienct our new algorithm is.
Problem was there are thousands of TSP problems.
Thankfully, I came across something known as TSPLIB. A library of problems including, Symmetric/Asymmetric traveling salesman problem, Hamiltonian cycle problem (HCP), Capacitated vehicle routing problem (CVRP) and some other related category of problems.
Just the thing I was looking for.
So it is still a work in progress and I’ll post my findings here, along with code details, later.
But it sure is a refreshing change from what I do at my job at Amazon.
My next blog post is going to be on my work with Genetic Algorithms. Stay tuned.
]]>