예제 #1
0
def test():
    runtest()
예제 #2
0
파일: control.py 프로젝트: werg/gcpp
    if options.test:
        import test
        test.cf = cf
        class_best_file = open(dirname + "/cbest" + args[0] + ".pickle")
        class_best = cPickle.load(class_best_file)
        class_best_file.close()
        if options.ngram:
            final_file = open(dirname + "/final.pickle")
            (t, gen_pop, class_pop) = cPickle.load(final_file)
            final_file.close()
            gen_best = gen_pop[:cf['best_size']]
        else:
            gen_best_file = open(dirname + "/gbest" + args[0] + ".pickle")
            gen_best = cPickle.load(gen_best_file)
            gen_best_file.close()
        test.runtest(gen_best, class_best, ref_data)

    else:
        if len(args) > 0:
            runtimes = int(args[0])
        else:
            runtimes = cf['runtimes']
        run_args = [runtimes, ref_data, dirname, cf['pop_size'], cf['gen_insize'], cf['init_hidden']]
        times = 0
        class_pop = None
        gen_pop = None
        evolve_gn = True
        if os.path.exists(dirname + "/final.pickle"):
            popsfile = open(dirname + "/final.pickle")
            (times, gen_pop, class_pop) = cPickle.load(popsfile)
            popsfile.close()
예제 #3
0
파일: hcontrol.py 프로젝트: werg/gcpp
    if options.datasrc:
        cf["datasource"] = options.datasrc

    (ref_data, cf["alphabet"]) = datasource.setup_source(cf["datasource"])
    hgcpp.ref_data = ref_data

    testnum = int(options.test)
    if testnum:
        import test

        # lets see what we put here
        hoffile = open(dirname + "/hof.pickle")
        (gen_hof, class_hof) = cPickle.load(hoffile)
        hoffile.close()
        test.cf = cf
        test.runtest(gen_hof[-testnum:], class_hof[-testnum:], ref_data)
    else:
        if len(args) > 0:
            runtimes = int(args[1])
        else:
            runtimes = cf["runtimes"]

        times = 0
        class_pop = None
        gen_pop = None
        gen_hof = None
        class_hof = None
        if os.path.exists(dirname + "/breed.pickle"):
            popsfile = open(dirname + "/breed.pickle")
            (gen_pop, class_pop) = cPickle.load(popsfile)
            popsfile.close()