def __init__(self, cnt): n = Network() n.add( Layer('input', 2) ) n.add( Layer('hidden', 3) ) n.add( Layer('output', 1) ) n.connect('input', 'hidden') n.connect('hidden', 'output') n.setInputs([[0.0, 0.0], [0.0, 1.0], [1.0, 0.0], [1.0, 1.0]]) n.setOutputs([[0.0], [1.0], [1.0], [0.0]]) n.setVerbosity(0) n.setTolerance(.4) n.setLearning(0) g = n.arrayify() self.network = n GA.__init__(self, Population(cnt, Gene, size=len(g), verbose=1, min=-10, max=10, maxStep = 1, imin=-10, imax=10, elitePercent = .01), mutationRate=0.05, crossoverRate=0.6, maxGeneration=400, verbose=1)