physbo.search.utility module
- class physbo.search.utility.Simulator(test_X, test_function)[source]
Bases:
objectSimulator class wrapping the test function for discrete search space.
- Parameters:
test_X (numpy.ndarray) – The test points. Each row is a candidate.
test_function (physbo.test_functions.base.TestFunction) – The test function.
- physbo.search.utility.make_grid(min_X: list[float] | ndarray, max_X: list[float] | ndarray, num_X: int | list[int] | ndarray, constraint=None) ndarray[source]
Make a grid of points in the search space.
- Parameters:
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
num_X (int | list[int] | np.ndarray) – Number of points in each dimension
- Returns:
The grid of points in the search space The output is a numpy array of shape (N, d), where N is the number of points and d is the dimension of the search space
- Return type:
np.ndarray
- Raises:
ValueError – If min_X and max_X have different number of dimensions If num_X has different number of dimensions from min_X and max_X
- physbo.search.utility.plot_pareto_front(history, x=0, y=1, steps_begin=0, steps_end=None, ax=None, color=None, pareto_front_color=None, dominated_color=None, marker=None, pareto_front_marker=None, dominated_marker=None)[source]
Plot the Pareto front of the history in the projection to the (x, y)-plane (objective x and y).
- Parameters:
history (History) – The history of the search.
x (int, default=0) – The index of the objective to plot on the x-axis.
y (int, default=1) – The index of the objective to plot on the y-axis.
steps_begin (int, default=0) – The index (inclusive) of the step to begin plotting.
steps_end (int, optional) – The index (exclusive) of the step to end plotting. If None, plot until the end.
ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure is created.
color (str, optional) – The color of the points.
pareto_front_color (str, optional) – The color of the Pareto front.
dominated_color (str, optional) – The color of the dominated points.
marker (str, optional) – The marker of the points.
pareto_front_marker (str, optional) – The marker of the Pareto front.
dominated_marker (str, optional) – The marker of the dominated points.
Note
- physbo.search.utility.plot_pareto_front_all(history, steps_begin=0, steps_end=None, ax=None, color=None, pareto_front_color=None, dominated_color=None, marker=None, pareto_front_marker=None, dominated_marker=None)[source]
Plot the Pareto front of the history for all pairs of objectives.
- Parameters:
history (History) – The history of the search.
steps_begin (int, optional) – The index (inclusive) of the step to begin plotting. If None, plot from the beginning.
steps_end (int, optional) – The index (exclusive) of the step to end plotting. If None, plot until the end.
ax (matplotlib.axes.Axes, optional) – The axes to plot on. If None, a new figure is created.
color (str, optional) – The color of the points.
pareto_front_color (str, optional) – The color of the Pareto front.
dominated_color (str, optional) – The color of the dominated points.
marker (str, optional) – The marker of the points.
pareto_front_marker (str, optional) – The marker of the Pareto front.
dominated_marker (str, optional) – The marker of the dominated points.
Note