def base_args(): args = GeneticArgs() args.set_chr(10) args.set_cr(0.3) args.set_mr(0.5) args.set_method_initial_population(genetic.INITIAL_POPULATION_RANDOM) args.set_method_select(genetic.SELECTION_RANK) args.set_method_cross(genetic.CROSSOVER_OX) args.set_method_mutate(genetic.MUTATION_SA) return args
def base_args(mr, cr): args = GeneticArgs() args.set_chr(20) args.set_cr(cr) args.set_mr(mr) args.set_key("cr_{}".format(cr)) args.set_method_initial_population(genetic.INITIAL_POPULATION_RANDOM) args.set_method_select(genetic.SELECTION_RANK) args.set_method_cross(genetic.CROSSOVER_OX) args.set_method_mutate(genetic.MUTATION_SA) return args
def base_args(ipop): args = GeneticArgs() args.set_chr(60) args.set_cr(0.3) args.set_mr(0.3) if ipop > 0: args.set_method_initial_population(genetic.INITIAL_POPULATION_SEMIACS) args.set_initial_ants(ipop) args.set_key('ipop_', args.get_initial_ants) else: args.set_key('random') args.set_method_initial_population(genetic.INITIAL_POPULATION_RANDOM) args.set_method_select(genetic.SELECTION_RANK) args.set_method_cross(genetic.CROSSOVER_OX) args.set_method_mutate(genetic.MUTATION_SA) return args