|
Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
|
Benchmarking framework for Monte Carlo integration algorithms. More...
#include <montecarlo/domains/hypercylinder.hpp>#include <montecarlo/domains/hyperrectangle.hpp>#include <montecarlo/domains/hypersphere.hpp>#include <montecarlo/geometry.hpp>#include <montecarlo/integrators/MCintegrator.hpp>#include <montecarlo/integrators/MHintegrator.hpp>#include <montecarlo/integrators/ISintegrator.hpp>#include <montecarlo/proposals/uniformProposal.hpp>#include <montecarlo/utils/plotter.hpp>#include <montecarlo/optimizers/PSO.hpp>#include <montecarlo/optimizers/GA.hpp>#include <fstream>#include <iostream>#include <chrono>#include <iomanip>#include <vector>#include <string>#include <functional>#include <thread>#include <cmath>#include <cstdint>Go to the source code of this file.
Classes | |
| struct | results |
| Stores benchmark result for a single sample count. More... | |
Functions | |
| void | saveResults (const std::string &filename, const std::vector< results > &results, const std::string &function_expr) |
| Save benchmark results to a CSV file. | |
| void | uniDimIntegration () |
| 1D integration test: f(x) = x² | |
| void | circleIntegration () |
| 2D circular integration: f(x,y) = x²+y² over unit disk | |
| void | sphereIntegration () |
| 3D spherical integration: f(x,y,z) = x²+y²+z² over unit ball | |
| void | rectangularIntegration () |
| 2D rectangular integration over axis-aligned box | |
| void | cylinderIntegration () |
| 3D cylindrical integration: hypercylinder base with height | |
| void | parallelepipedIntegration () |
| 3D parallelepiped (rectangular box) integration | |
| void | fiveDimIntegration () |
| 5-dimensional integration benchmark | |
| void | fourDimIntegration () |
| 4-dimensional integration benchmark | |
| void | eightDimIntegration () |
| 8-dimensional integration benchmark | |
| void | twelveDimIntegration () |
| 12-dimensional integration benchmark | |
| void | runBenchmarks (bool useGnuplot) |
| Run integration benchmarks with hardcoded integrands. | |
| void | runBenchmarks (const std::string &expression, bool useGnuplot) |
| Run integration benchmarks with custom mathematical expression. | |
| void | runBenchmarksMH () |
| Run Metropolis-Hastings MCMC integration benchmarks. | |
| void | runOptimizationBenchmarksPSO () |
| void | runOptimizationBenchmarksGA () |
Variables | |
| const std::vector< size_t > | n_samples_vector |
| Global benchmark configuration. | |
| unsigned int | n_threads |
| Global OpenMP thread count (set at runtime) | |
Benchmarking framework for Monte Carlo integration algorithms.
Provides infrastructure for evaluating integration accuracy and performance across multiple algorithms (uniform MC, importance sampling, MCMC) and dimensionalities.
Key Features:
Benchmark Types:
Definition in file benchmarks.hpp.
| void circleIntegration | ( | ) |
2D circular integration: f(x,y) = x²+y² over unit disk
| void cylinderIntegration | ( | ) |
3D cylindrical integration: hypercylinder base with height
| void eightDimIntegration | ( | ) |
8-dimensional integration benchmark
| void fiveDimIntegration | ( | ) |
5-dimensional integration benchmark
| void fourDimIntegration | ( | ) |
4-dimensional integration benchmark
| void parallelepipedIntegration | ( | ) |
3D parallelepiped (rectangular box) integration
| void rectangularIntegration | ( | ) |
2D rectangular integration over axis-aligned box
| void runBenchmarks | ( | bool | useGnuplot | ) |
Run integration benchmarks with hardcoded integrands.
| useGnuplot | If true, generate gnuplot script for visualization. |
Definition at line 292 of file integration_benchmarks.cpp.
| void runBenchmarks | ( | const std::string & | expression, |
| bool | useGnuplot | ||
| ) |
Run integration benchmarks with custom mathematical expression.
| expression | Mathematical function string (muParserX syntax) |
| useGnuplot | If true, generate gnuplot script |
Definition at line 449 of file integration_benchmarks.cpp.
| void runBenchmarksMH | ( | ) |
Run Metropolis-Hastings MCMC integration benchmarks.
Definition at line 309 of file integration_benchmarks.cpp.
| void runOptimizationBenchmarksGA | ( | ) |
| void runOptimizationBenchmarksPSO | ( | ) |
| void saveResults | ( | const std::string & | filename, |
| const std::vector< results > & | results, | ||
| const std::string & | function_expr | ||
| ) |
Save benchmark results to a CSV file.
| filename | Output CSV filename |
| results | Vector of result structures |
| function_expr | String describing the integrand for reference |
Save benchmark results to a CSV file.
| filename | Output CSV filename |
| results | Vector of benchmark results {n_samples, integration_result, duration_ms} |
| function_expr | String description of the integrated function |
CSV Format:
Useful for:
Definition at line 49 of file benchmarks.cpp.
| void sphereIntegration | ( | ) |
3D spherical integration: f(x,y,z) = x²+y²+z² over unit ball
| void twelveDimIntegration | ( | ) |
12-dimensional integration benchmark
| void uniDimIntegration | ( | ) |
1D integration test: f(x) = x²
Domain: [0,1], Expected: 1/3 ≈ 0.333...
|
extern |
Global benchmark configuration.
Global benchmark configuration.
Definition at line 28 of file benchmarks.cpp.
|
extern |
Global OpenMP thread count (set at runtime)
Definition at line 31 of file benchmarks.cpp.