def discrete(seed: Optional[int] = None) -> Iterator[Experiment]: """Discrete test bed, including useless variables, 5 values or 2 values per character. Poorly designed, should be reimplemented from scratch using a decent instrumentation.""" seedg = create_seed_generator(seed) names = [ n for n in ArtificialFunction.list_sorted_function_names() if "one" in n or "jump" in n ] optims = ["NGO", "Shiva", "DiagonalCMA", "CMA"] + sorted( x for x, y in ng.optimizers.registry.items() if "andomSearch" in x or ("iscrete" in x and "epea" not in x and "DE" not in x and "SSNEA" not in x)) # Block dimension = dimension of a block on which the function "name" is applied. There are several blocks, # and possibly useless variables; so the total dimension is num_blocks * block_dimension * (1+ uv_factor). functions = [ ArtificialFunction(name, block_dimension=bd, num_blocks=n_blocks, useless_variables=bd * uv_factor * n_blocks) for name in names for bd in [5, 30, 180] for uv_factor in [0, 5, 10] for n_blocks in [1] ] for func in functions: for optim in optims: for budget in [ 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000 ]: # , 10000]: yield Experiment(func, optim, budget=budget, num_workers=1, seed=next(seedg))
def discrete2(seed: Optional[int] = None) -> Iterator[Experiment]: """Discrete test bed, including useless variables, binary only. Poorly designed, should be reimplemented from scratch using a decent instrumentation.""" seedg = create_seed_generator(seed) names = [ n for n in ArtificialFunction.list_sorted_function_names() if ("one" in n or "jump" in n) and ("5" not in n) and ("hard" in n) ] optims = ["NGO", "Shiva", "DiagonalCMA", "CMA" ] + sorted(x for x, y in ng.optimizers.registry.items() if "andomSearch" in x or "PBIL" in x or "cGA" in x or ("iscrete" in x and "epea" not in x and "DE" not in x and "SSNEA" not in x)) functions = [ ArtificialFunction(name, block_dimension=bd, num_blocks=n_blocks, useless_variables=bd * uv_factor * n_blocks) for name in names for bd in [5, 30, 180] for uv_factor in [0, 5, 10] for n_blocks in [1] ] for func in functions: for optim in optims: for nw in [1, 10]: for budget in [ 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000, 1100, 1200, 1300, 1400, 1500, 1600, 1700, 1800, 1900, 2000, 2100, 2200, 2300, 2400, 2500, 2600, 2700, 2800, 2900, 3000 ]: # , 10000]: yield Experiment(func, optim, budget=budget, num_workers=nw, seed=next(seedg))