Skip to content

Tutorial: Your first benchmarking function

Gustavo Rosa edited this page Apr 7, 2021 · 3 revisions

Every code starts with some imports, correct?

import numpy as np

from opytimark.markers.n_dimensional import Sphere

Let us instantiate the required class, which is Sphere's function.

# Declaring a function from the `n_dimensional` package
f = Sphere()

Additionally, let's define its input value.

# Declaring an input variable for feeding the function
x = np.zeros(50)

Finally, one can call the class with the input to calculate its output, as follows:

# Printing out the function's output
print(f(x))

Clone this wiki locally