## Introduction SpiceGA is a Python 3 application designed to produce evolved circuits.
This application use a evolutionary algorithm to create an electric circuit who meet the differents constraints specified by the user.During run, many electrical circuits are created and tested, learning to create valids circuit who evolve during generation and atempts to reach the defined objective.
This project use pyspice and ngSPICE to simulate generated circuits, python-deap for the genetic toolsuit.
- Python >= 3.2
- ngspice >= 24
- python-deap >= 1.0.1 https://github.com/deap/deap
- PySpice https://github.com/Neodyme/PySpice
- Numpy
- Matplotlib
- python3-networkx : useful to generate a genealogy tree resuming the evolution of the simuation
Define an evaluation function returning a positive ascending fitness comparing the input and the output
def evaluator(inp, outp):
return (1 / math.sqrt(1 + (abs((inp/3) - outp))))
import spicega
toolbox = deap.base.Toolbox()
toolbox.register("evaluator", evaluator)
s = spicega.SpiceGA(toolbox,
nodelist=[-2, -1, 0, 1, 3,],
elemlist=[0,1],
spice_library=SpiceLibrary('./libraries')))
s.run()
Complete documented example is available in the example_adder.py
file