physbo.test_functions.base module
- class physbo.test_functions.base.TestFunction(nobj: int, dim: int, min_X: ndarray | list[float] | float, max_X: ndarray | list[float] | float, test_maximizer: bool = True)[ソース]
ベースクラス:
ABCAbstract class for test functions.
Test functions are used to evaluate the performance of the optimization algorithms.
Note
The test function f should be defined as a minimization problem.
Initialize the test function.
- パラメータ:
nobj (int) -- Number of objectives.
dim (int) -- Number of dimensions.
min_X (np.ndarray | list[float] | float) -- Minimum value of search space for each dimension.
max_X (np.ndarray | list[float] | float) -- Maximum value of search space for each dimension.
test_maximizer (bool, default=True) -- If True, the test function is negated for testing a maximization problem solver.
- constraint(x: ndarray) ndarray[ソース]
Evaluate the constraint function at the given point.
- パラメータ:
x (np.ndarray) -- The point at which to evaluate the constraint function. x is a numpy array of shape (n, d), where n is the number of points and d is the dimension of the input space.
- 戻り値:
The boolean values indicating whether the point is valid or not. The output value is a numpy array of shape (n,), where n is the number of points.
- 戻り値の型:
np.ndarray
- property dim: int
Get the number of dimensions of the test function.
- 戻り値:
The number of dimensions of the test function d.
- 戻り値の型:
int
- abstractmethod f(x: ndarray) ndarray[ソース]
Evaluate the test function at the given point.
- パラメータ:
x (np.ndarray) -- The point at which to evaluate the test function. x is a numpy array of shape (n, d), where n is the number of points and d is the dimension of the input space.
- 戻り値:
f -- The value of the test function at the given point. The output value is a numpy array of shape (n, k), where k is the number of objectives.
- 戻り値の型:
np.ndarray
- property max_X: ndarray
Get the maximum values of the search space of the test function.
- 戻り値:
The maximum value of the test function for each dimension.
- 戻り値の型:
np.ndarray
- property min_X: ndarray
Get the minimum values of the search space of the test function.
- 戻り値:
The minimum value of the test function for each dimension.
- 戻り値の型:
np.ndarray
- property nobj: int
Get the number of objectives of the test function.
- 戻り値:
The number of objectives of the test function k.
- 戻り値の型:
int