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.

24 thoughts on “On Not Designing Circuits With Evolutionary Algorithms

    1. Then the next problem you run into is setting the fitness criteria for the device.

      It’s impossible to develop a complete fitness test for something as simple as an amplifier because you have to exhaust all possible inputs, or at least all possible inputs that are relevant to you, and all the other cases such as rejection of EMI.

      And if you don’t, then evolution will pick any shortcut possible and answer to your criteria, but only your criteria. For example, if you want a stable oscillator, you’ll get a phase locked loop radio reciever tuned to 60 Hz, because the line hum all around you stays constant regardless of temperature etc.

      1. Sir

        I am a student of VLSI Design. My thesis subject is ” Fibonacci Codes for Crosstalk Avoidance” , here I particularly working on Complementary Redundant Fibonacci coding .

        Here I need the circuit design of the coding .

        Sir could you kindly help me in this work.

        I will be very much grateful if you kindly provide me the circuit design for above coding .



  1. Author here, since writing this post I’ve added the current measurements and multithreading. I have also tried to simulate a new bandgap reference. This time measurements are input current(60C)(rload=100k), output voltage(27C)(rload=100k), output voltage(60C)(rload=100k), output voltage(50C)(rload=10k). Results seem good in simulation and it should work when built with real components. I bought some transistors today to actually build this circuit and make some real measurements. I think I’m going to write a post about the results later this week.

    Animations and the final circuit here: http://imgur.com/a/ur5V1

    Also if you use Windows and have motivation to code, please add Windows support. Github issue here: https://github.com/Ttl/evolutionary-circuits/issues/1

    1. “[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.”

    1. Quote: Five individual logic cells were functionally disconnected from the rest– with no pathways that would allow them to influence the output– yet when the researcher disabled any one of them the chip lost its ability to discriminate the tones.


    1. It’s more like slight crosstalk between the logic cells, because the circuit they evolved works in analog mode.

      It’s tricky, because just changing the room temperature by 1 degrees throws it off. There was never any consideration for different operating temperature while they were evolving the circuit, so evolution ignored robustness to temperature changes alltogether and made use of very fragile quirks of the hardware.

  2. If you are interested in this sort of thing, check out Koza’s books on Genetic Programming — particularly the 2nd one, which mostly focuses on giving examples of circuits evolved using GP.

    1. Depends on how you define self preservation. If you go the homeostasis route without any additional requirements it would effectively kill itself. It would return the least functional design.

      It would fulfill robustness and homeostasis perfectly.

  3. How could an evolved circuit based on Bipolar transistors “produced a circuit nearly identical to the description of a CMOS inverter you’d find in a circuit textbook”?

    1. Advanced magicks.

      Well, you would never have the “infinite input impedance”, and the output would never quite reach the rails, and static current consumption would be higher…I see what you mean.

  4. Brian,

    Can you provide a reference or explanation for the comment pertaining to “quantum weirdness.” Thompson’s paper titled “An evolved circuit, intrinsic in silicon, entwined in physics” makes reference to electromagnetic coupling or power line coupling explaining the unusual circuit design but does not mention quantum mechanics.


Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.