Optimization Test Functions Library
A comprehensive collection of 56+ test functions for optimization algorithm benchmarking and validation, organized into logical modules for easy navigation and maintenance.
Function Categories
Unimodal Functions (Single Global Optimum)
Perfect for testing convergence speed and precision:
sphere,rosenbrock,powell,dixons_pricezakharov,booth,matyas,sum_squareselliptic,cigar,tablet,discus(ill-conditioned)ridge,sharp_ridge,brown,exponential
Multimodal Functions (Multiple Local Minima)
Test global search and exploration capabilities:
ackley,rastrigin,griewank,schwefelhartman_3d,hartman_4d,hartman_6dmichalewicz,alpine_n1,alpine_n2branin,goldstein_price,six_hump_cameleggholder,holder_table,cross_in_tray
Constrained Functions
For constrained optimization algorithms:
keanes_bump_objectivewith constraintsrosenbrock_disk_constraintbinh_korn_*with multiple constraintsmishras_bird_*functions
Composite & Modern Functions
Hybrid and recent competition functions:
expanded_griewank_rosenbrockxin_she_yang_n1,xin_she_yang_n2, etc.happycat,katsuura,vincentgramacy_lee_2012,forrester_2008
Usage Examples
Basic Function Evaluation
use Array1;
use *;
// Evaluate sphere function
let x = from_vec;
let result = sphere; // Returns 5.0 (1² + 2²)
// Evaluate Rosenbrock function
let x = from_vec;
let result = rosenbrock; // Returns 0.0 (global minimum)
Function Metadata and Bounds
use ;
// Get all function metadata
let metadata = get_function_metadata;
println!;
// Get bounds for a specific function
let bounds = get_function_bounds.unwrap;
println!;
// Get 2D bounds array (for compatibility)
let bounds_2d = get_function_bounds_2d;
Working with Different Categories
use Array1;
use *;
let x = from_vec;
// Unimodal functions (good for convergence testing)
let result1 = elliptic; // Ill-conditioned
let result2 = rosenbrock; // Valley-shaped
// Multimodal functions (good for global search testing)
let result3 = ackley; // Highly multimodal
let result4 = rastrigin; // Many local minima
// Modern benchmarks
let result5 = happycat; // Recent CEC function
let result6 = katsuura; // Fractal-like landscape
Function Properties
Difficulty Levels
- Easy:
sphere,booth,matyas- Good for initial testing - Medium:
rosenbrock,ackley,griewank- Standard benchmarks - Hard:
schwefel,eggholder,katsuura- Challenging landscapes - Extreme:
holder_table,cross_in_tray- Very difficult optimization
Dimensionality Support
- 1D:
gramacy_lee_2012,forrester_2008 - 2D Fixed:
branin,goldstein_price,six_hump_camel - N-Dimensional:
sphere,rosenbrock,ackley,rastrigin - High-D Specific:
elliptic,bent_cigar,katsuura
Special Properties
- Ill-conditioned:
elliptic,cigar,tablet,discus - Separable:
sphere,sum_squares,alpine_n1 - Non-separable:
rosenbrock,ackley,griewank - Discontinuous:
step,de_jong_step2 - Constrained:
keanes_bump_*,binh_korn_*
Benchmarking Guide
Algorithm Testing Workflow
- Start Simple: Test on
sphereandrosenbrock - Add Multimodality: Try
ackleyandrastrigin - Test Scalability: Use N-dimensional functions
- Challenge Mode:
schwefel,eggholder,katsuura - Constraints:
keanes_bump_*for constrained algorithms
Performance Metrics
- Convergence Speed: Unimodal functions
- Global Search: Multimodal functions
- Precision: Functions with known exact minima
- Robustness: Ill-conditioned and noisy functions
- Scalability: High-dimensional variants
Build & Test
# Build the library
# Run all tests
# Test specific examples
# Check code quality
Architecture
The library is organized into modular components:
src/
├── lib.rs # Main library with utilities and metadata
└── functions/
├── mod.rs # Module exports and organization
└── *.rs # 1 file per function