Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
Functions
pso_benchmarks.cpp File Reference

Particle Swarm Optimization benchmark suite. More...

#include "apps/benchmarks.hpp"
#include <cmath>
#include <cstdint>
Include dependency graph for pso_benchmarks.cpp:

Go to the source code of this file.

Functions

void runSphereTest (opt::PSO &pso, const opt::Coordinates &lower, const opt::Coordinates &upper)
 Test 1: Sphere Function.
 
void runBoundaryTest (opt::PSO &pso, const opt::Coordinates &lower, const opt::Coordinates &upper)
 Test 2: Boundary Constraint Test Objective: Minimize f(x, y) = x + y This function is a constant inclined plane.
 
void runRastriginTest (opt::PSO &pso, int dim)
 Test 3: High-Dimensional Rastrigin Function Objective: Minimize f(x) = 10n + sum(x_i^2 - 10cos(2*pi*x_i)) Domain: [-5.12, 5.12] Global Minimum: 0.0 at x = [0, 0, ..., 0].
 
void runVisualPSOBenchmark ()
 
void runVisualPSO3DBenchmark ()
 
void runOptimizationBenchmarksPSO ()
 

Detailed Description

Particle Swarm Optimization benchmark suite.

Comprehensive testing of PSO performance on various optimization problems:

Test Problems:

  1. Sphere Function: f(x,y) = x² + y², minimum at (0,0) = 0
    • Convex, smooth, unimodal
    • Tests basic convergence
  2. Rastrigin Function: Highly multimodal benchmark
    • f(x,y) = 20 + x² + y² - 10(cos(2πx) + cos(2πy))
    • Many local minima, challenging for optimization
  3. Rosenbrock Function: f(x,y) = (1-x)² + 100(y-x²)²
    • Long narrow valley, tests exploration vs exploitation

Metrics:

See also
PSO, OptimizationMode

Definition in file pso_benchmarks.cpp.

Function Documentation

◆ runBoundaryTest()

void runBoundaryTest ( opt::PSO pso,
const opt::Coordinates lower,
const opt::Coordinates upper 
)

Test 2: Boundary Constraint Test Objective: Minimize f(x, y) = x + y This function is a constant inclined plane.

There is no local minimum inside the domain (constant gradient). Particles must push to the extreme lower limit. Expected Minimum: -20.0 at [-10, -10]

Definition at line 95 of file pso_benchmarks.cpp.

Here is the call graph for this function:

◆ runOptimizationBenchmarksPSO()

void runOptimizationBenchmarksPSO ( )

Definition at line 338 of file pso_benchmarks.cpp.

Here is the call graph for this function:

◆ runRastriginTest()

void runRastriginTest ( opt::PSO pso,
int  dim 
)

Test 3: High-Dimensional Rastrigin Function Objective: Minimize f(x) = 10n + sum(x_i^2 - 10cos(2*pi*x_i)) Domain: [-5.12, 5.12] Global Minimum: 0.0 at x = [0, 0, ..., 0].

Why it is hard: This function creates a grid of local minima. In high dimensions (e.g., 10D), simplistic optimizers get stuck in a local valley instead of finding the global 0. A successful run requires a good balance of exploration and exploitation.

Definition at line 160 of file pso_benchmarks.cpp.

Here is the call graph for this function:

◆ runSphereTest()

void runSphereTest ( opt::PSO pso,
const opt::Coordinates lower,
const opt::Coordinates upper 
)

Test 1: Sphere Function.

Objective: Minimize f(x, y) = x^2 + y^2 Global Minimum: 0 at [0, 0] Search Space: [-10, 10] per dimension

Definition at line 44 of file pso_benchmarks.cpp.

Here is the call graph for this function:

◆ runVisualPSO3DBenchmark()

void runVisualPSO3DBenchmark ( )

Definition at line 282 of file pso_benchmarks.cpp.

Here is the call graph for this function:

◆ runVisualPSOBenchmark()

void runVisualPSOBenchmark ( )

Definition at line 231 of file pso_benchmarks.cpp.

Here is the call graph for this function: