physbo.search.utility module

class physbo.search.utility.Simulator(test_X, test_function)[source]

Bases: object

Simulator class wrapping the test function for discrete search space.

Parameters:
physbo.search.utility.is_learning(n, interval)[source]
physbo.search.utility.length_vector(t)[source]
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

  • colors:
    • If both color and *_color are provided, *_color is used.

    • If only color is provided, the color is used for both the Pareto front and the dominated points.

    • If neither color nor *_color is provided, the color is set to “red” for the Pareto front and “blue” for the dominated points.

  • markers:
    • If both marker and *_marker are provided, *_marker is used.

    • If only marker is provided, the marker is used for both the Pareto front and the dominated points.

    • If neither marker nor *_marker is provided, the marker is set to “o” for the Pareto front and “o” for the dominated points.

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

  • colors:
    • If both color and *_color are provided, *_color is used.

    • If only color is provided, the color is used for both the Pareto front and the dominated points.

    • If neither color nor *_color is provided, the color is set to “red” for the Pareto front and “blue” for the dominated points.

  • markers:
    • If both marker and *_marker are provided, *_marker is used.

    • If only marker is provided, the marker is used for both the Pareto front and the dominated points.

    • If neither marker nor *_marker is provided, the marker is set to “o” for the Pareto front and “o” for the dominated points.

physbo.search.utility.show_interactive_mode(simulator, history)[source]
physbo.search.utility.show_search_results(history, N)[source]
physbo.search.utility.show_search_results_mo(history, N, disp_pareto_set=False)[source]