Evolving Antennas using Simulated Annealing Algorithm
Simulated annealing is a computer algorithm for solving multi-variable problems using mutation, random walk algorithms and simulated natural selection. The alternative is the brute force method where you try every possible variable value. This however is a costly process and very slow compared to simulated annealing. Annealing is a term borrowed from metal working. Specifically heat treating. When you heat a piece of metal and then let it slowly cool down, the inner structures align themselves automatically to the most “relaxed” state, making the metal softer and easier to machine. When performing simulated annealing algorithm, you must randomly tweak variables and keep score of the overall system performance. If you come across a very good result, better than the previous best, you store all the input variables, as well as a numeric score for that trial. This process is then performed over and over until you feel the results are good enough. There is no way to tell if your result is perfect, but it will be very good. One problem of simulated annealing is that a program can get stuck with a solution (local maximum) while there is an even better solution (global maximum). When using simulated annealing it is good practice to use multiple threads or multiple generations. The reason for this is because the algorithm might get stuck with a very good result (local maximum), and the random walk algorithm doesn’t reach out far enough to find the better solution (global maximum). Having multiple threads or generations lets the program start fresh and take on a different path, perhaps getting close to the global maximum. I decided to generate antennas made out of bent wire, made out of three segments. Any more segments would require much more computing power.
My project is a proof of concept where I demonstrate how simulated annealing can be applied to antenna design evolution. I decided to not use simulated evolutionary algorithm because in that system there is a reproduction step. This is where two successful results are mated in hope that something better emerges. With antennas this is not a good idea. If you mate two antenna results together the performance will be far from optimal. You may as well generate a random antenna.
My strongest programming language is C#, but chose to use Python to write the simulation. This is mostly because there are antenna simulation modules available for Python that aren’t available for C#. There is also a C++ version of the library available for those who prefer that language. My simulation uses the PyNEC module to put together and test the radiation pattern of the antenna being evaluated. This module is actually a wrapper for the C++ NEC library. When evolving a system using simulated annealing, you must be able to evaluate each attempt. There should be a way to score a trial run in order to compare its result with previous trials. In my simulation program I am attempting to maximize the antenna gain and directionality. This means that I need to have a function that gives a score value based on the current mutated values in question. The way I decided to score my antennas is by storing the maximum gain value from my 360 degree polar gain array, and then divide the value by the average gain of the entire 360 of the antenna. This selection process promotes a final radiation pattern with a very pronounced primary lobe and smaller lobes around the rest of it. If you wanted to place more value on evolving just gain, you would just score the maximum gain value within the entire radiation pattern and leave out the average gain value.
In conclusion, since antenna design is a very complex process you can rely on already existing templates, or you can try every possible combination. There is an infinite amount of possible antennas though. Using simulated annealing you can continuously evolve an antenna and arrive at a good result in a short period of time.
The ground plane has been disabled and the antenna operates in free space.
This program using a Python module called, PyNEC. You can find the documentaton for it here…
http://tmolteno.github.io/necpp/libnecpp_8h.html#a9cf02620e0d0365cbdd24071a7ebeae9
NEC2 Documentation PDF for C++ (same function parameters as in Python)
You can get the PyNEC Python module here… https://pypi.org/project/PyNEC/
py -m pip install PyNEC==1.7.3.4
Python modules used in programs…
pip install matplotlib
pip install matplotlib.pyplot
pip install numpy
pip install mpl_toolkits
https://visualstudio.microsoft.com/visual-cpp-build-tools/
pip install PyNEC==1.7.3.4