How To Evolve A Radio

Evolutionary algorithms are an interesting topic of study. Rather then relying on human ingenuity and investigation to create new designs, instead, an algorithm is given a target to achieve, and creates “offspring”, iterating in an evolutionary manner to create offspring that get closer to the target with each generation.

This method can be applied to the design of electronic circuits, and is sometimes referred to as “hardware evolution”. A team from Duke University attempted exactly this, aiming to produce an oscillator using evolutionary techniques.

The team used a platform called the “evolvable motherboard”, or EM. The EM is a platform controlled by an attached computer, consisting of reconfigurable solid state switches that allow attached circuit components to be interconnected in every combination possible. These components may be virtually any electronic component; in this experiment, 10 bipolar transistors were used.

The evolutionary algorithm was given a fitness function that rewarded output amplitude and frequency, aiming to create an oscillator operating at 25KHz. However, the team noticed some interesting emergent behavior. The algorithm tended to reward amplification behavior from the circuit, leading to many configurations that oscillated poorly, but amplified ambient noise. In the end, the algorithm developed circuit configurations that acted as a radio, picking up and amplifying signals from the surrounding environment, rather than oscillating on their own. The evolutionary algorithm took advantage of the interaction between not only the circuit elements, but effects such as the parasitic capacitance introduced by the switching matrix and appeared to use the PCB circuit traces as an antenna.

The team conclude that evolutionary algorithms used in circuit design ignore human preconceptions about how circuits work, and will take advantage of sometimes unpredictable and unexpected effects to achieve their targets. This is a blessing and a curse, bringing unconventional designs to the fore, but also creating circuits that may not work well in a generalized environment. If your “oscillator” relies on a nearby noise source to operate, it may operate unpredictably in the field, for example.

We’ve seen evolutionary algorithms used before, such as being applied to robotic design.

The Naughty AIs That Gamed The System

Artificial intelligence (AI) is undergoing somewhat of a renaissance in the last few years. There’s been plenty of research into neural networks and other technologies, often based around teaching an AI system to achieve certain goals or targets. However, this method of training is fraught with danger, because just like in the movies – the computer doesn’t always play fair.

It’s often very much a case of the AI doing exactly what it’s told, rather than exactly what you intended. Like a devious child who will gladly go to bed in the literal sense, but will not actually sleep, this can cause unexpected, and often quite hilarious results. [Victoria] has created a master list of scholarly references regarding exactly this.

The list spans a wide range of cases. There’s the amusing evolutionary algorithm designed to create creatures capable of high-speed movement, which merely spawned very tall creatures that generated these speeds by falling over. More worryingly, there’s the AI trained to identify toxic and edible mushrooms, which simply picked up on the fact that it was presented with the two types in alternating order. This ended up being an unreliable model in the real world. Similarly, the model designed to assess malignancy of skin cancers determined that lesions photographed with rulers for scale were more likely to be cancerous.

[Victoria] refers to this as “specification gaming”. One can draw parallels to classic sci-fi stories around the “Laws of Robotics”, where robots take such laws to their literal extremes, often causing great harm in the process. It’s an interesting discussion of the difficulty in training artificially intelligent systems to achieve their set goals without undesirable side effects.

We’ve seen plenty of work in this area before – like this use of evolutionary algorithms in circuit design.

Making Dumb Robots Evolve

Evolution is a fact of life, except in Kansas. It is the defining characteristic of life itself, but that doesn’t mean a stupid robot can’t evolve. For his entry into the Hackaday Pi Zero contest, [diemastermonkey] is doing just that: evolution for robots built around microcontrollers and a Raspberry Pi.

[diemastermonkey]’s project is a physical extension to genetic algorithms. Just like DNA and proteins have no idea what they’re actually doing, microcontrollers don’t either. Instead of randomly switching up base pairs and amino acids, [diemastermonkey]’s project makes random connections pins depending on the values of those pins.

The potential of these crappy, randomly programmed robots is only as good as the fitness function, and so far [diemastermonkey] has seen some surprising success. When putting these algorithms into a microcontroller connected to a tilting table mechanism and a PIR sensor, the robot eventually settled on a bit of code that would keep a ball in motion. You can check out the video of that below.


Raspberry_Pi_LogoSmall

The Raspberry Pi Zero contest is presented by Hackaday and Adafruit. Prizes include Raspberry Pi Zeros from Adafruit and gift cards to The Hackaday Store!
See All the Entries

Continue reading “Making Dumb Robots Evolve”

Self-Learning Helicopter Uses Neural Network

Though this project uses an RC helicopter, it’s merely a vessel to demonstrate a fascinating machine learning algorithm developed by two Cornell students – [Akshay] and [Sergio]. The learning environment is set up with the helicopter at its center, attached to a boom. The boom restricts the helicopter’s movement down to one degree of motion, so that it can only move up from the ground (not side to side or front to back).

The goal is for the helicopter to teach itself how to get to a specific height in the quickest amount of time. A handful of IR sensors are used to tell the Atmega644 how high the helicopter is. The genius of this though, is in the firmware. [Akshay] and [Sergio] are using an evolutionary algorithm adopted from Floreano et al, a noted author on biological inspired artificial intelligences. The idea is for the helicopter to create random “runs” and then check the data. The runs that are closer to the goal get refined while the others are eliminated, thus mimicking evolutions’ natural selection.

We’ve seen neural networks before, but nothing like this. Stay with us after the break, as we take this awesome project and narrow it down so that you too can implement this type of algorithm in your next project.

 

Continue reading “Self-Learning Helicopter Uses Neural Network”

Evolutionary algorithms computes the best blackjack strategy

blackjack_banner

Don’t want to learn about evolutionary algorithms the usual way, by generating sentences from random letters, or randomly placing pixels to generate the Mona Lisa? Then make your own evolutionary algorithm! With blackjack!

[Brian] has been playing around with evolutionary algorithms, and wanted a task that’s well suited for optimization. He chose blackjack, because of the limited number of hands that can be dealt to the player (32) and low number of hands the dealer can have (10).

Even with the low number of initial conditions for the player and the dealer, there are still 4.562 x 10^192 possible combinations of hands, so brute forcing a blackjack strategy would require the computational power of the entire planet. An easier way to compute a good strategy is an evolutionary algorithm, implemented by [Brian] with the Watchmaker Java library.

For each generation in [Brian]’s program, a 32×10 grid was generated, one cell each for possible player’s hands against the dealer’s hand. In each cell, the computer put a ‘hit’, ‘stay’, or ‘double down’, and played thousands of hands with that strategy. The best strategies were bred and eventually [Brian] ended up with a good blackjack strategy.

The resulting best strategy is pretty good – using his strategy, he can walk out of an Atlantic City casino with 96% of the money he arrived with.

On not designing circuits with evolutionary algorithms

[Henrik] has been working on a program to design electronic circuits using evolutionary algorithms. It’s still very much a work in progress, but he’s gotten to the point of generating a decent BJT inverter after 78 generations (9 minutes of compute time), as shown in the .gif above.

To evolve these circuits, [Henrik] told a SPICE simulation to generate an inverter with a 5V power supply, 2N3904 and 2N3906 transistors, and whatever resistors were needed. The first dozen or so generations didn’t actually do anything, but after 2000 generations the algorithm produced a circuit nearly identical to the description of a CMOS inverter you’d find in a circuit textbook.

Using evolution to guide electronic design is nothing new; an evolutionary algorithm and a a few bits of Verilog can turn an FPGA into a chip that can tell the difference between a 1kHz and 10kHz tone with extremely minimal hardware requirements. There’s also some very, very strange stuff that happened in this experiment; the evolutionary algorithm utilized things that are impossible for a human to program and relies on magnetic flux and quantum weirdness inside the FPGA.

[Henrik] says his algorithm didn’t test for how much current goes through the transistors, so implementing this circuit outside of a simulation will destroy the transistors and emit a puff of blue smoke. If you’d like design your own circuits using evolution, [Henrik] put all the code in a git for your perusal. It’s damn cool as it stands now, and once [Henrik] includes checking current and voltage in each component his project may actually be useful.