Esempio n. 1
0
generation_selector = stk.StochasticUniversalSampling(
    num_batches=population_size,
    random_seed=random_seed,
    duplicate_batches=False,
    duplicate_mols=False,
)

# #####################################################################
# Selector for selecting parents.
# #####################################################################

# Settings for tournament sampling for crossover.
crossover_selector = stk.Tournament(
    num_batches=10,
    batch_size=2,
    duplicate_batches=False,
    duplicate_mols=False,
    random_seed=random_seed,
)

# #####################################################################
# Selector for selecting molecules for mutation.
# #####################################################################

mutation_selector = stk.Roulette(
    num_batches=5,
    duplicate_mols=False,
    batch_size=1,
    random_seed=random_seed,
)
Esempio n. 2
0
        stk.MoleculeRecord(
            topology_graph=get_topology_graph(3), ).with_fitness_value(9),
        stk.MoleculeRecord(
            topology_graph=get_topology_graph(4), ).with_fitness_value(2),
        stk.MoleculeRecord(
            topology_graph=get_topology_graph(5), ).with_fitness_value(1),
        stk.MoleculeRecord(
            topology_graph=get_topology_graph(6), ).with_fitness_value(0),
    )


@pytest.fixture(
    scope='session',
    params=(
        lambda population: CaseData(
            selector=stk.Tournament(duplicate_molecules=False, ),
            population=population,
            selected=(
                stk.Batch(
                    records=(population[0], ),
                    fitness_values={population[0]: 10},
                    key_maker=stk.Inchi(),
                ),
                stk.Batch(
                    records=(population[1], ),
                    fitness_values={population[1]: 9},
                    key_maker=stk.Inchi(),
                ),
                stk.Batch(
                    records=(population[2], ),
                    fitness_values={population[2]: 2},