Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Explicit information in tutorials. #195

Open
borisalmonacid opened this issue Jan 6, 2024 · 0 comments
Open

Explicit information in tutorials. #195

borisalmonacid opened this issue Jan 6, 2024 · 0 comments

Comments

@borisalmonacid
Copy link

Please add explicitly in these tutorials whether it is a minimization or maximization problem.

https://github.com/IOHprofiler/IOHexperimenter/blob/master/example/example_star_discr.ipynb
https://github.com/IOHprofiler/IOHexperimenter/blob/master/example/example_sbox.ipynb
https://github.com/IOHprofiler/IOHexperimenter/blob/master/example/example_submodular.ipynb

Add the explicit information in the tutorial example.

class RandomSearch:
    'Simple random search algorithm'
    def __init__(self, n: int, length: float = 0.0):
        self.n: int = n
        self.length: float = length
        
    def __call__(self, problem: ioh.problem.RealSingleObjective) -> None:
        'Evaluate the problem n times with a randomly generated solution'
        best_fitness = 99999              <-- for minimisation
        for _ in range(self.n):
            # We can use the problems bounds accessor to get information about the problem bounds
            x = np.random.uniform(problem.bounds.lb, problem.bounds.ub)
            self.length = np.linalg.norm(x)
            
            fitness = problem(x)          <-- get fitness
            if fitness < best_fitness:    <-- explicit minimisation
                 best_fitness = fitness   <-- explicit asignation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant