Plotting
- beeoptimal.plotting.contourplot(function, title=None, bounds=None, zoom=1.0, figsize=(600, 600))[source]
Plots a 2D benchmark function as a contour plot.
- Parameters:
function (BenchmarkFunction) – A benchmark function object.
title (str,optional) – Title of the plot. Defaults to empty string.
bounds (numpy.ndarray, optional) – Custom bounds for the plot (different from the default ones). Defaults to None (uses the default bounds).
zoom (float, optional) – Zoom factor for the plot. Defaults to 1.0 (no zoom).
figsize (tuple, optional) – Size of the figure. Defaults to (600,600).
- Returns:
A Plotly figure containing the contour plot of the function.
- Return type:
plotly.graph_objects.Figure
- Raises:
TypeError – If function is not a BenchmarkFunction object.
TypeError – If bounds is not a NumPy array (when bounds is provided).
ValueError – If bounds does not have shape (2, 2) (when bounds is provided).
ValueError – If zoom is not greater than zero.
- beeoptimal.plotting.surfaceplot(function, title='', bounds=None, zoom=1.0, figsize=(600, 600))[source]
Plots the surface of a 2D benchmark function.
- Parameters:
function (BenchmarkFunction) – A benchmark function object.
title (str,optional) – Title of the plot. Defaults to empty string.
bounds (numpy.ndarray, optional) – Custom bounds for the plot (different from the default ones). Defaults to None (uses the default bounds).
zoom (float, optional) – Zoom factor for the plot. Defaults to 1.0 (no zoom).
figsize (tuple,optional) – Size of the figure. Defaults to (600, 600).
- Returns:
A Plotly figure containing the surface plot of the function.
- Return type:
plotly.graph_objects.Figure
- Raises:
TypeError – If function is not a BenchmarkFunction object.
TypeError – If bounds is not a NumPy array (when bounds is provided).
ValueError – If bounds does not have shape (2, 2) (when bounds is provided).
ValueError – If zoom is not greater than zero.
- beeoptimal.plotting.contourplot_bees(function, bee_colony, optimal_solution=None, title='', bounds=None, zoom=1.0, bee_marker_size=None, figsize=(600, 600))[source]
Create a contour plot with bee markers and an optional optimal solution point.
- Parameters:
function (BenchmarkFunction) – A benchmark function object.
bee_colony (list of Bee) – List of Bee objects.
optimal_solution (numpy.ndarray) – The optimal solution point. Defaults to None.
title (str) – Title of the plot. Defaults to empty string.
bounds (numpy.ndarray, optional) – Custom bounds for the plot (different from the default ones). Defaults to None (uses the default bounds).
zoom (float, optional) – Zoom factor for the plot. Defaults to 1.0 (no zoom).
bee_marker_size (int or float, optional) – Size of the bee markers. Defaults to None.
figsize (tuple) – Size of the figure. Defaults to (600, 600).
- Returns:
A Plotly figure containing the contour plot with bee markers and, optionally, the optimal solution marker.
- Return type:
plotly.graph_objects.Figure
- Raises:
TypeError – If bee_colony is not a list
ValueError – If bee_colony is empty
TypeError – If elements of bee_colony are not Bee objects.
TypeError – If optimal_solution is not a NumPy array (when optimal_solution is provided).
ValueError – If optimal_solution is not a 2D point (when optimal_solution is provided).