A Python library for visualizing single-objective and multi-objective optimization benchmark functions commonly used in optimization algorithm research and testing.
- Rosenbrock (Banana): Classic optimization test function with global minimum at (1, 1)
- Ackley: Multimodal function with global minimum at (0, 0)
- Rastrigin: Highly multimodal function with global minimum at (0, 0)
- Schwefel: Deceptive multimodal function with global minimum at (420.9687, 420.9687)
- Sphere: Simple unimodal function with global minimum at (0, 0)
- Griewank: Multimodal function with global minimum at (0, 0)
- DTLZ1: Linear Pareto front
- DTLZ2: Concave Pareto front (circular)
- ZDT1: Convex Pareto front
- ZDT2: Non-convex Pareto front
- 3D Surface Plots: Four different viewing angles (top, front, side, perspective)
- Contour Plots: 2D contour visualization with optimal points marked
- Pareto Front Visualization: For multi-objective functions
- Backend Support: Both Matplotlib and Plotly for interactive/static plots
- Python ≥ 3.13
- NumPy ≥ 1.24.0
- Matplotlib ≥ 3.6.0
- Plotly ≥ 5.0.0
# Install dependencies using uv (recommended)
uv sync
# Or using pip
pip install numpy matplotlib plotly
# Using matplotlib backend
python main_so.py matplotlib
# Using plotly backend (interactive)
python main_so.py plotly
# Save figures to figs folder
python main_so.py plotly --save
# Using matplotlib backend
python main_mo.py matplotlib
# Using plotly backend (interactive)
python main_mo.py plotly
# Save figures to figs folder
python main_mo.py plotly --save
matplotlib
orplotly
: Choose visualization backend--save
or-s
: Save generated figures to thefigs/
directory
graph/
├── single_objective/
│ ├── optimization_functions.py # Single-objective function definitions
│ └── visualization.py # 3D and contour plotting utilities
├── multi_objective/
│ ├── mo_optimization_functions.py # Multi-objective function definitions
│ └── mo_visualization.py # Pareto front visualization
├── figs/ # Generated visualization files
├── main_so.py # Single-objective visualization entry point
├── main_mo.py # Multi-objective visualization entry point
└── pyproject.toml # Project configuration
The visualization generates:
- 4 different 3D surface plot views per function
- 1 contour plot per function
- Optimal points marked in red
- Objective space scatter plots
- True Pareto front overlays (where analytical solutions exist)
- Zoomed views of Pareto front regions
All visualizations clearly show the characteristics of each optimization landscape, making them useful for:
- Understanding optimization problem difficulty
- Algorithm testing and comparison
- Educational purposes in optimization courses
- Research presentations
# Install development dependencies
uv sync --group dev
# Run linting
ruff check .