Skip to content

Explicit information in tutorials. #195

@borisalmonacid

Description

@borisalmonacid

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions