Пример #1
0
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
Пример #2
0
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
Пример #3
0
def run_1():
    prefix = '_48'
    test_name = u"Atsitiktine ir generuota pradine populiacija"
    runs = 10
    g = g_48()
    c = condition(100)
    ants = [5, 11, 17, 22, 29, 35, 40]
    args1 = base_args()
    args1.set_chr(40)
    args1.set_key('plain')
    args2 = GeneticArgs(args1)
    args2.set_method_initial_population(genetic.INITIAL_POPULATION_SEMIACS)
    args2.set_initial_ants(ants[0])
    args2.set_key('initial-pop-', args2.get_initial_ants)
    _pre_run_inner(prefix, test_name, runs, g, c, args1, args2, ants)
Пример #4
0
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