<s> from random import Random <EOL> from time import time <EOL> import inspyred <EOL> def main ( prng = None , display = False ) : <EOL> if prng is None : <EOL> prng = Random ( ) <EOL> prng . seed ( time ( ) ) <EOL> problem = inspyred . benchmarks . Sphere ( <NUM_LIT:2> ) <EOL> ea = inspyred . ec . SA ( prng ) <EOL> ea . terminator = inspyred . ec . terminators . evaluation_termination <EOL> final_pop = ea . evolve ( evaluator = problem . evaluator , <EOL> generator = problem . generator , <EOL> maximize = problem . maximize , <EOL> bounder = problem . bounder , <EOL> max_evaluations = <NUM_LIT> ) <EOL> if display : <EOL> best = max ( final_pop ) <EOL> print ( '<STR_LIT>' . format ( str ( best ) ) ) <EOL> return ea <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> main ( display = True ) </s>
