示例#1
0
 def __init__(self, evaluate, numinputs):
     self.nout = 5
     self.ninp = numinputs
     self.labels = None
     ReNCoDeProb.__init__(self,evaluate,printf=printmultiplecircuit)
     self.terms.extend(["inputs[%i]"%i
                        for i in range(1,numinputs)])
     self.funs.extend(self.extrafuns)
     self.arity.update(zip(self.extrafuns,[0]*len(self.extrafuns)))
示例#2
0
文件: energy.py 项目: rmlopes/code
 def __init__(self, evaluate, **kwargs):
         self.labels = None
         ReNCoDeProb.__init__(self,evaluate,**kwargs)
         self.terms.extend(["inputs[%i]"%i 
                            for i in range(1,8)])
         #self.funs.extend(self.extrafuns)
         self.arity.update(zip(self.funs,[0]*len(self.funs)))
         #print self.arity
         self.nout = 2
         self.ninp = 8
示例#3
0
 def __init__(self, nbits, evalf, **kwargs):
     self.ninp = nbits * 2
     self.nout = nbits * 2
     self.terms = ['inputs[%i]' % (idx, ) for idx in range(nbits * 2)]
     ReNCoDeProb.__init__(self, evalf, **kwargs)
示例#4
0
 def __init__(self, nbits, evalf, **kwargs):
         self.ninp = nbits*2
         self.nout = nbits*2
         self.terms = ['inputs[%i]'%(idx,) for idx in range(nbits*2)]
         ReNCoDeProb.__init__(self,evalf, **kwargs)
示例#5
0
            circuit.output_idx = outidx
        else:
            print 'output index is ', circuit.output_idx
            bestfit = evaluatekeijzer(circuit, target, inputs, test)
        return bestfit


if __name__ == '__main__':
    #log.setLevel(logging.INFO)
    #random.seed(1234*int(os.getenv('SGE_TASK_ID')))
    #random.seed(1234)
    evalfun = partial(evaluate,
                      target=kozapolynomial,
                      inputs=list(drange(-1, 1.1, .1)))

    ##fromlist is needed for classes. Functions may be called directly
    #mod = __import__(sys.argv[3], fromlist=[sys.argv[2]])
    #agentclass = getattr(mod, sys.argv[2])

    p = ReNCoDeProb(evalfun)

    cfg = loadconfig(parsecmd())
    edw = EvoDevoWorkbench(cfg, p)

    edw.run(terminate=(lambda x, y: x <= 1e-3 or y <= 0))
    #print wrapevaluate(edw.best.phenotype,
    #                  target=kozapolynomial,
    #                 inputs=list(drange(-1,1.1,.1)),
    #                device=edw.device,
    #               test = True)
示例#6
0
 def __init__(self, evalf):
     self.ninp = 4
     self.nout = 1
     ReNCoDeProb.__init__(self, evalf, printf=printrencode2)