

def main(prng=None, display=False):
    if (prng is None):
        prng = Random()
        prng.seed(time())
    import logging
    logger = logging.getLogger('inspyred.ec')
    logger.setLevel(logging.DEBUG)
    file_handler = logging.FileHandler('inspyred.log', mode='w')
    file_handler.setLevel(logging.DEBUG)
    formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s')
    file_handler.setFormatter(formatter)
    logger.addHandler(file_handler)
    ea = inspyred.ec.DEA(prng)
    if display:
        ea.observer = inspyred.ec.observers.stats_observer
    ea.terminator = inspyred.ec.terminators.evaluation_termination
    final_pop = ea.evolve(generator=generate_rastrigin, evaluator=inspyred.ec.evaluators.parallel_evaluation_pp, pp_evaluator=evaluate_rastrigin, pp_dependencies=(my_squaring_function,), pp_modules=('math',), pop_size=8, bounder=inspyred.ec.Bounder((- 5.12), 5.12), maximize=False, max_evaluations=256, num_inputs=3)
    if display:
        best = max(final_pop)
        print('Best Solution: \n{0}'.format(str(best)))
    return ea

dataset/ETHPy150Open aarongarrett/inspyred/examples/advanced/logging_example.py main/original