Genetic Optimization in YagiCAD 6


In general the genetic optimization in YagiCAD works by firstly generating a large random population of Yagi’s derived from a single seed Yagi. This population is basically the seed with random increases and decreases in element lengths and spacings. This population of Yagi’s is then evaluated against some predetermined fitness criteria and ranked in order of fitness. A certain amount of the most fit Yagi’s are then “bred” to produce the next generation of Yagi’s containing a mixture of attributes from the parent Yagi’s. This new population again are judged and ranked in fitness order, and the breeding and measurement cycle continues into a new generation. The judgement of fitness is based on the average of a number of attributes of the Yagi’s calculated at a number of frequency points in a nominated band. After a predetermined number of generations of breeding and judgment YagiCAD stops. At this point you can either continue for a further number of generations with the existing populations, or exit which will load the Yagi that is currently the fittest into the main YagiCAD window. Other options at the end of a run include saving the top ten Yagi’s details to a comma separated file that can be loaded into Excel or similar for further investigations.


The bottom line here is that there are a virtually infinite number of possible combinations of initial conditions and judgment rules that can be used. There are no “correct “or “best” settings, this is because of the random elements in the process. A setup that will work well one time and produce great results in a small number of generations will get nowhere another time.  With a little bit of experience though you can get a feel for what is working and what is not. If in doubt start from the default values and iterate from there.


Parameters and Variables:


On the main OWA Window:

1/. Number of Generations.

This is the number of generations to be done, see note 2/. below.

2/. Frequency From and To.

This sets the band limits over which the various Yagi’s are judged. See note 4/. below.



In the OWA Configuration window accessed from the main OWA window:


1/. Worldsize.

The Worldsize sets the total number of Yagi’s present in each generation. Bigger worlds will result in capturing more diversity ensuring that all aspects are explored but will take longer to calculate. Too small a value and results will be unlikely. Usually make it as large as you can afford time wise.  A value of 100 works OK for a quick run but 200 or more will produce better results.  Current maximum worldsize = 300 (YC6)

2/. Breedsize.

The size of the Breeding population of Yagi’s. These are the top however many fittest Yagi’s and these will be the ones passing there characteristics on to the next generation. Seems to work best if this is less than the total population size. For example if the world size is 100 then Breedsize could be say 50. Don’t make it too small or inbreeding will quickly occur and the diversity needed for the best result will be lost.  Maximum value = Worldsize.

3/. Mutation Level.

This controls how often during breeding a random mutation will occur. A value of 100 for example implies that one in every 100 breeding transcriptions will randomly mutate rather than take the parents characteristics. So smaller numbers mean more frequent mutations, larger ones mean less.

4/. Mutation Variance

This controls the size of the random mutations when they occur. This value is a percentage. For a particular element length or spacing when a mutation occurs this value controls how large that random mutation is allowed to be. For example if Mutation Variance is 10 then when a mutation occurs a transcription value will be shortened or lengthened by some random value up to plus or minus 10 percent. If say the original value was 1 Metre then the final value after mutation could be anywhere between 0.9M and 1.1 M. Smaller values mean less severe mutation, larger means more.

5/. Fitness Normalized to.

This controls if the fitness judgment of the Yagi’s is done relative to the corresponding attributes of the original seed Yagi, or to a set of arbitrary target values. In effect this sets where the reference is. In simplistic terms an  overall fitness of 1 suggests that on average over all the attributes the fitness of the Yagi being judged is as good as that of the reference. Higher than 1 is better, less than 1 is worse. So if the reference is the seed and a fitness is greater than 1 then according to the set weights which determine what is important to you the test Yagi is better than the initial one.

If the seed is close to what you want and you just want to polish it a bit then reference to the seed is probably best. If however the seed is some distance from the desired outcome it can sometimes be better to reference to a arbitrary target .


6/.  Target Values.

If fitness is set to normalize to target then these values set the minimum desired values for the various attributes. Rin is a special case as this value is used for the return loss calculations independently of what is being normalized to.


Gain = Value in dBi of forward gain, ie value of main lobe.

F/B = Value of Front to Back ratio in dB, ie difference between front lobe and back lobe in dB .

Retn Loss  = Value of Return Loss in dB. Better return loss implies closer match to target Rin. Anything better than about 30dB is considered very good.

MaxSL = Value in dB of the maximum side lobe, this is typically a negative value.

AvgSL = Average Value of Side lobes in dB, again typically a negative number.

NumSL = Number of lobes in the pattern not counting the main lobe.

Rin = The real value of the Yagi input impedance value in Ohms


7/. Weights.

These numbers represent the relative weighting of the individual Yagi attributes. The absolute value of any one weight is not relevant, it is only the relative values that are relevant. For example setting all weights to 1 says that all parameters are equally important; exactly the same effect could be had by setting all to 100. Setting one value to twice another (eg Gain = 2 and  RetnLoss = 1) says that that parameter is twice as important as the other( ie. gain (2) is twice as important as Return Loss (1))

Setting a weight to 0 says that parameter is of no interest in this case and it will not be used in calculating Fitness.  A number of the parameters will of course have inter-relationships with others. For example decreasing the average sidelobe value will usually result in a decrease in maximum side lobes and Front to Back.




1/. As the process involves a number of random factors it is quite possible that two runs of the Genetic optimization with the same input data will produce different  resultant Yagi’s.  There is not necessarily a single correct result, just the one you end up with. How widely these results will diverge depends on several factors but the main one is the level of random mutations allowed.


2/. The number of generations required to show significant improvement on a particular seed depends on many things, not the least being what is defined as a significant improvement. If for example your seed Yagi is already close to your desired end point, then a smaller number of generations with lower random factors will get there reasonably quickly. If on the other hand you are trying for major changes to the seed fitness then you will need greater randomness and lots more generations.


3/.  It is quite possible for the optimizer to head off in an undesirable direction. While YagiCAD6 has improved weighting and relative fitness measurement to YagiCAD5 it is still possible for the process to randomly find an area where one of the desirable factors is increasing so rapidly that it swamps the effect of other desirable factors decreasing.  Typically this can show up as vary good levels of return loss ( ie. very close to the target input impedance) but with relatively lower gain or front to back.


4/. One of the fundamentals of a given class of Yagi ( ie. given number of elements and boom length)  seems to be the equivalent of a gain bandwidth product. Ie. optimizing bandwidth usually means decreasing gain and vice versa. So don’t go for something wider than you really need.


5/. While there are a large number of “optimum” designs for a particular class of Yagi’s there are not an infinite number nor is there any guarantee that a particular class can achieve some arbitrary target. For example other than a system glitch there is no way, no matter how many generations are used to get a three element Yagi to have a gain of more than say 10 dBi.


6/. The time taken for each generation depends on many factors including the entire population or world size ( ie. number of Yagi’s being manipulated), and the size of the breeding population. Other factors that also make a difference are the speed of your computer, how many segments (segments per element times elements) and single or double precision. If you are doing a run on a class of Yagi’s that has a larger number of elements eg. an 18 element Yagi. Then running this with say 31 segments per element and double precision NEC2 will take much longer than the same antenna with single precision and 15 segments per element. A method for judging what is needed to get a reasonably accurate result is to do a Tools/Model test/Convergence run on the seed Yagi to see what effect  varying the number of segments will have on the various attributes of that Yagi. In one particular case for example for a particular  18 element 70cm yagi if only Gain was important 5 segments were enough, 15 segments per element got the pattern OK, but if Impedance was important then you needed 25.