예제 #1
0
def test_vertex_lifts_degree():
    # test that the correct number of roots are computed with various rings
    v = voronoi(f_elliptic)
    lifts_CC = vertex_lifts(f_elliptic, v, CC)
    for lift in lifts_CC.values():
        assert len(lift) == f_elliptic.degree(y)

    lifts_CDF = vertex_lifts(f_elliptic, v, CDF)
    for lift in lifts_CDF.values():
        assert len(lift) == f_elliptic.degree(y)
예제 #2
0
def test_vertex_lifts_degree():
    # test that the correct number of roots are computed with various rings
    v = voronoi(f_elliptic)
    lifts_CC = vertex_lifts(f_elliptic, v, CC)
    for lift in lifts_CC.values():
        assert len(lift) == f_elliptic.degree(y)

    lifts_CDF = vertex_lifts(f_elliptic, v, CDF)
    for lift in lifts_CDF.values():
        assert len(lift) == f_elliptic.degree(y)
예제 #3
0
def getMetrics(map):
    time1 = time.time()
    vrm_path = voronoi(map[0], map[1])
    time2 = time.time()
    prm_len_500, prm_time_500, failures_500 = getPRMValues(map, 500)
    prm_len_800, prm_time_800, failures_800 = getPRMValues(map, 800)
    prm_len_1000, prm_time_1000, failures_1000 = getPRMValues(map, 1000)
    return [
        getPathLength(vrm_path), (time2 - time1), prm_len_500, prm_time_500,
        failures_500, prm_len_800, prm_time_800, failures_800, prm_len_1000,
        prm_time_1000, failures_1000
    ]
예제 #4
0
def main():
    # read settings from cfg files to avoid having to modify vode.
    # set the directory to the path of the script to allow running it from any place
    abspath = os.path.abspath(__file__)
    dname = os.path.dirname(abspath)
    os.chdir(dname)

    def toInt(l):
        for x in l:
            try:
                yield int(x)
            except ValueError:
                yield x

    with open(sys.argv[1], 'r') as f:
        tmpList = f.read().split()
        config = list(
            toInt([tmpList[3 * i + 2] for i in range(len(tmpList) / 3)]))
        if config[0] == 'gridGenerator':
            print("Using Grid Generator")
            generator = gridGenerator(config[1], config[2], config[3],
                                      config[4], config[5], config[6],
                                      config[7])
            city = cityLayout(generator.getBuildingList(), config[5], True)
        elif config[0] == 'cityLoader':
            print("Loading data from " + config[1] + "...")
            cityLoader = cityIO()
            cityLoader.read(config[1])
            city = cityLayout(cityLoader.getBuildingList(), config[2])
        elif config[0] == 'randomPlacement':
            print("Using Random Generator")
            generator = randomPlacement(config[1], config[2], config[3],
                                        config[4], config[5], config[6],
                                        config[7])
            city = cityLayout(generator.getBuildingList(), config[5])
        elif config[0] == 'voronoi':
            print("Using Voronoi Generator")
            generator = voronoi(config[1], config[2], config[3], config[4],
                                config[5], config[6], config[7])
            city = cityLayout(generator.getBuildingList(), config[5])
        else:
            print("Error: generator type " + config[0] + " is not defined")
        f.close()

    print("Generating...")
    city.makeCity()
    print("Done")
def main():
    # read settings from cfg files to avoid having to modify vode.
    # set the directory to the path of the script to allow running it from any place
    abspath = os.path.abspath(__file__)
    dname = os.path.dirname(abspath)
    os.chdir(dname)

    def toInt(l):
        for x in l:
            try:
                yield int(x)
            except ValueError:
                yield x

    with open(sys.argv[1], 'r') as f:
        tmpList = f.read().split()
        config = list(toInt([tmpList[3*i+2] for i in range(len(tmpList)/3)]))
        if config[0] == 'gridGenerator':
            print("Using Grid Generator")
            generator = gridGenerator(config[1], config[2], config[3], config[4], config[5], config[6], config[7])
            city = cityLayout(generator.getBuildingList(), config[5], True)
        elif config[0] == 'cityLoader':
            print("Loading data from " + config[1] + "...")
            cityLoader = cityIO()
            cityLoader.read(config[1])
            city = cityLayout(cityLoader.getBuildingList(), config[2])
        elif config[0] == 'randomPlacement':
            print("Using Random Generator")
            generator = randomPlacement(config[1], config[2], config[3], config[4], config[5], config[6], config[7])
            city = cityLayout(generator.getBuildingList(), config[5])
        elif config[0] == 'voronoi':
            print("Using Voronoi Generator")
            generator = voronoi(config[1], config[2], config[3], config[4], config[5], config[6], config[7])
            city = cityLayout(generator.getBuildingList(), config[5])
        else:
            print("Error: generator type " + config[0] + " is not defined")
        f.close()

    print("Generating...")
    city.makeCity()
    print("Done")
예제 #6
0
def main():
    #set the directory to the path of the script to allow running it from any place
    abspath = os.path.abspath(__file__)
    dname = os.path.dirname(abspath)
    os.chdir(dname)

    #functions that convert int into ints and leaves other unchanged
    def toInt(l):
        for x in l:
            try:
                yield int(x)
            except ValueError:
                yield x

    print(sys.argv)
    with open(sys.argv[1], 'r') as f:
        tmpList = f.read().split()
        config = list(
            toInt([tmpList[3 * i + 2] for i in range(len(tmpList) / 3)]))
        if config[0] == 'gridGenerator':
            print("Using Grid Generator")
            generator = gridGenerator(config[1], config[2], config[3],
                                      config[4],
                                      config[5])  #(1, 1, "scene/testScene")
            city = cityIO()
            city.loadList(generator.getBuildingList())
            print("Writing to City File...")
            city.write(config[5] + '.cty')
            print("Done")
        elif config[0] == 'voronoi':
            print("Next Level Troll")
            generator = voronoi(config[1], config[2], config[3], config[4],
                                config[5], config[6], config[7])
            city = cityIO()
            city.loadList(generator.getBuildingList())
            print("Writing to City File...")
            city.write(config[5] + '.cty')
            print("Done")
        else:
            print("Error: generator type " + config[0] + " is not defined")
        f.close()
def main():
    #set the directory to the path of the script to allow running it from any place
    abspath = os.path.abspath(__file__)
    dname = os.path.dirname(abspath)
    os.chdir(dname)
    
    #functions that convert int into ints and leaves other unchanged
    def toInt(l):
        for x in l:
            try:
                yield int(x)
            except ValueError:
                yield x

    print(sys.argv)
    with open(sys.argv[1], 'r') as f:
        tmpList = f.read().split()
        config = list(toInt([tmpList[3*i+2] for i in range(len(tmpList)/3)]))
        if config[0] == 'gridGenerator':
            print("Using Grid Generator")
            generator = gridGenerator(config[1], config[2], config[3], config[4], config[5]) #(1, 1, "scene/testScene")
            city = cityIO()
            city.loadList(generator.getBuildingList())
            print("Writing to City File...")
            city.write(config[5]+'.cty')
            print("Done")
        elif config[0] == 'voronoi':
            print("Next Level Troll")
            generator = voronoi(config[1], config[2], config[3], config[4], config[5], config[6], config[7])
            city = cityIO()
            city.loadList(generator.getBuildingList())
            print("Writing to City File...")
            city.write(config[5]+'.cty')
            print("Done")
        else:
            print("Error: generator type " + config[0] + " is not defined")
        f.close()
예제 #8
0
def test_voronoi():
    # for now, just tests that no errors are raised
    v = voronoi(f_elliptic)
예제 #9
0
def test_voronoi():
    # for now, just tests that no errors are raised
    v = voronoi(f_elliptic)