Example #1
0
            p = 1.0 - (nbits * 2) / float(numeff)  #.05 * abs(numeff-2)
        else:
            p = 0

        return bestfit + (.45 / float(numtf)) + (.45 * p)

    return bestfit


if __name__ == '__main__':
    #log.setLevel(logging.DEBUG)
    #random.seed(1234*int(os.getenv('SGE_TASK_ID')))
    #p  = BooleanProb(evaluate)
    evalf = partial(evaluate, nbits=2)
    #mapfun = getoutputp0p1)
    cfg = loadconfig(parsecmd())
    p = BooleanProb(2, evalf)
    edw = EvoDevoWorkbench(cfg, p)
    #p.eval_ = bindparams(edw.arnconfig, p.eval_)
    edw.run()

    #f = open('genome.save','w')
    #f.write(edw.best.phenotype.code.bin)
    #zzf.close

    #plot_ = bindparams(edw.arnconfig, plotindividual)
    #plot_(edw.best.phenotype)
    #genresult = test(ewd.best.circuit, range(2,20))
    #print 'Generalization: '
    #print genresult
Example #2
0
            #ok = testmp(phenotype, intinps)
            #    if ok > bestfit:
            #        bestfit = ok
            #        bestout = eff
            #        #print 'best output index is now ',eff
            #phenotype.output_idx = bestout
        #else:
            #print 'output index is ', phenotype.output_idx
            #bestfit = testmp(phenotype, intinps)
        bestfit =testmp(phenotype, intinps)
        return len(intinps) - bestfit

if __name__ == '__main__':
    #p  = BooleanProb(evaluate)
    evalf = partial(evaluate, nbits=6)
    cfg = loadconfig(parsecmd())
    #mapfun = getoutputp0p1)
    p = Multiplexer(6,evalf)
    edw = EvoDevoWorkbench(cfg,p)
    #p.eval_ = bindparams(edw.arnconfig, p.eval_)
    edw.run()

    #f = open('genome.save','w')
    #f.write(edw.best.phenotype.code.bin)
    #zzf.close

    #plot_ = bindparams(edw.arnconfig, plotindividual)
    #plot_(edw.best.phenotype)
    #genresult = test(ewd.best.circuit, range(2,20))
    #print 'Generalization: '
    #print genresult