Beispiel #1
0
        optparser.print_usage()
        exit(1)

    places = Places(bool(options.dump_file))

    for place in load_places(input_files, options.zoom):
        places.add(place)

    def state_energy(places):
        return places.energy

    def state_move(places):
        places.move()

    try:
        annealer = Annealer(state_energy, state_move)

        if options.temp_min and options.temp_max and options.steps:
            places, e = annealer.anneal(places, options.temp_max,
                                        options.temp_min, options.steps, 30)
        else:
            places, e = annealer.auto(places, options.minutes, 500)

    except NothingToDo:
        pass

    label_data = {'type': 'FeatureCollection', 'features': []}
    place_data = {'type': 'FeatureCollection', 'features': []}
    rgstr_data = {'type': 'FeatureCollection', 'features': []}

    placed = FootprintIndex(options.zoom)
Beispiel #2
0
    #
    # Load places.
    #

    places = Places(bool(options.dump_file))

    for place in options.load_inputs(input_files, geometry, options.name_field,
                                     options.placement_field):
        places.add(place)

    #
    # Do the annealing.
    #

    annealer = Annealer(lambda p: p.energy, lambda p: p.move())

    if places.count() == 0:
        # looks like there's nothing to actually do.
        annealed = []

    elif options.temp_min and options.temp_max and options.steps:
        # soon-to-be-deprecated explicit temperatures-and-steps method
        annealed, e = annealer.anneal(places, options.temp_max,
                                      options.temp_min, options.steps, 30)

    elif options.processes == 1:
        # don't bother with multiprocessing when there's just the one
        annealed = anneal_in_serial(places)

    else: