Close

Evolutionary Program Testing

A project log for Evolved Broadband Antenna

Using an evolutionary neural network to create an optimized broadband antenna for the ranges of 108MHz to 400MHz

jtklenkeJTKLENKE 08/03/2020 at 04:060 Comments

After watching an introductory lecture about some basic machine learning algorithms (linear regression, neural networks, RNN and reinforcement learning) as well as doing some research on evolutionary neural networks. I coded a simple evolution inspired AI, the basic process is to create a random assortment of matrices (which will eventually represent wires on the antenna based on the matrix value of 1 or 0):

#create random starting matrices
for j in range(0,populationCount):
  plate = np.random.randint(2,size=(rows,columns))
  Population.append( plate )

 Then, after scoring these "individuals" according to a currently arbitrary test (will later be their VSWR) then discarding the bottom half of the population and taking attributes from the top half to refill the population along with a mutation chance (a random chance to flip some number of the matrices' bits).

The way that I am currently selecting attributes from the top half is to average 3 random matrices from the surviving half and rounding up to 1 or down to 0, but this might change later on. Then some random mutations are added according to a mutation chance and the process restarts with the new population.

def newGen():
  for plate in range(0,int(populationCount/2)):
    a = np.random.randint(0,int(populationCount/2))
    b = np.random.randint(0,int(populationCount/2))
    c = np.random.randint(0,int(populationCount/2))
    new = scramble(Population[a],Population[b],Population[c])
    Population.append(new)


def scramble(a,b,c):
  sum = np.add(np.add(a,b),c)
  avg = np.round(sum/3).astype(int)
  if(np.random.randint(0,mutationChance)==1):
    for i in range(0,np.random.randint(1,10)):
      avg[np.random.randint(0,rows),np.random.randint(0,columns)] = (avg[np.random.randint(0,rows),np.random.randint(0,columns)]+1)%2
  return avg

This process repeats for the specified number of generations and the best individual is returned along with their final score.

So far the results seem good but the testing function I have isn't affected by local groups but rather an individual entry in the matrix. This is unlike what the antenna simulation will be so I will likely have to modify the method of selecting traits from the successful individuals. 

Discussions