示例#1
0
        exit(1)
    
    #
    # 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 options.temp_min and options.temp_max and options.steps:
        annealed, e = annealer.anneal(places, options.temp_max, options.temp_min, options.steps, 30)
    
    else:
        annealed = [None] * places.count()
        
        for (group, (places_local, indexes, weight, connections)) in enumerate(places.in_pieces()):
            if len(indexes) > 1:
                print 'Placing', ', '.join(sorted([place.name.encode('utf-8', 'replace') for place in places_local]))
    
            try:
                start = time()
                minutes = options.minutes * float(weight) / connections
                places_local, e = annealer.auto(places_local, minutes, min(100, weight * 20), verbose=minutes>.3)
示例#2
0
    # Load places.
    #
    
    places = Places(bool(options.dump_file))
    
    for place in load_places(input_files, geometry, options.name_field):
        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(geometry)
    
示例#3
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)
示例#4
0
        exit(1)
    
    #
    # 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:
        # use multiprocessing to work through pieces in parallel
示例#5
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: