Ejemplo n.º 1
0
    
    if not input_files:
        print 'Missing input file(s).\n'
        optparser.print_usage()
        exit(1)
    
    if not (options.labels_file or options.places_file or options.registrations_file):
        print 'Missing output file(s): labels, place points, or registration points.\n'
        optparser.print_usage()
        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()
Ejemplo n.º 2
0
    
    if not input_files:
        print 'Missing input file(s).\n'
        optparser.print_usage()
        exit(1)
    
    if not (options.labels_file or options.places_file or options.registrations_file):
        print 'Missing output file(s): labels, place points, or registration points.\n'
        optparser.print_usage()
        exit(1)
    
    #
    # 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)
Ejemplo n.º 3
0
if __name__ == '__main__':

    options, input_files = optparser.parse_args()

    if not input_files:
        print 'Missing input file(s).\n'
        optparser.print_usage()
        exit(1)
    elif not (options.labels_file or options.places_file
              or options.registrations_file):
        print 'Missing output file(s): labels, place points, or registration points.\n'
        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,
Ejemplo n.º 4
0
    
    if not input_files:
        logging.critical('Missing input file(s).')
        optparser.print_usage()
        exit(1)
    
    if not (options.labels_file or options.places_file or options.registrations_file):
        logging.critical('Missing output file(s): labels, place points, or registration points.')
        optparser.print_usage()
        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:
Ejemplo n.º 5
0
        optparser.print_usage()
        exit(1)

    if not (options.labels_file or options.places_file
            or options.registrations_file):
        logging.critical(
            'Missing output file(s): labels, place points, or registration points.'
        )
        optparser.print_usage()
        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 = []