<commit_before>#!/usr/bin/env python

import coco
import numpy as np

def my_optimizer(f, lower_bounds, upper_bounds, budget):
    n = len(lower_bounds)
    delta = upper_bounds - lower_bounds
    x = lower_bounds + np.random.rand(n) * delta
    for i in range(budget):
        y = f(x)
        
for problem in coco.Benchmark("bbob2009", "bbob2009_observer", "random_search"):
    print "Optimizing '%s' ... " % str(problem)
    my_optimizer(problem,
                 problem.lower_bounds,
                 problem.upper_bounds,
                 100000)
    problem.free()<commit_msg>Cleanup Python demo<commit_after>#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function

import coco
import numpy as np

def my_optimizer(f, lower_bounds, upper_bounds, budget):
    print("In optimizer...")
    n = len(lower_bounds)
    delta = upper_bounds - lower_bounds
    x = lower_bounds + np.random.rand(n) * delta
    for i in range(budget):
        y = f(x)

for problem in coco.Benchmark("bbob2009", "bbob2009_observer", "random_search"):
    print("Optimizing '%s' ... " % str(problem))
    my_optimizer(problem,
                 problem.lower_bounds,
                 problem.upper_bounds,
                 10000)
    problem.free()
{'fraction_non_alphanumeric': 0.10659509202453987, 'fraction_numerical': 0.020705521472392636, 'mean_word_length': 2.8269794721407626, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4078392', 'n_tokens_mistral': 436, 'n_tokens_neox': 406, 'n_words': 100}