Monte Carlo Integration Library 1.0
High-performance Monte Carlo methods for numerical integration and optimization
benchmarks.hpp
Go to the documentation of this file.
1
23#ifndef MONTECARLO_1_BENCHMARKS_HPP
24#define MONTECARLO_1_BENCHMARKS_HPP
25
37
38#include <fstream>
39#include <iostream>
40#include <chrono>
41#include <iomanip>
42#include <vector>
43#include <string>
44#include <functional>
45#include <thread>
46#include <cmath>
47#include <cstdint>
48
50extern const std::vector<size_t> n_samples_vector;
51extern unsigned int n_threads;
52
58struct results {
59 size_t n_samples;
60 std::string integration_result;
61 std::string duration;
62};
63
70void saveResults(const std::string &filename, const std::vector<results> &results, const std::string &function_expr);
71
72// Functions that contain both the domains and the functions to integrate over them
73
79
84
89
94
99
104
109
114
119
124
125// --- Monte Carlo Integration Benchmarks ---
126// (Implemented in benchmarks/integration_benchmarks.cpp)
127
132void runBenchmarks(bool useGnuplot);
133
139void runBenchmarks(const std::string& expression, bool useGnuplot);
140
144void runBenchmarksMH();
145
146// --- PSO Optimization Benchmarks ---
147// (Implemented in benchmarks/pso_benchmarks.cpp)
149
150// --- GA Optimization Benchmarks ---
151// (Implemented in benchmarks/ga_benchmarks.cpp)
153
154
155#endif //MONTECARLO_1_BENCHMARKS_HPP
Genetic Algorithm (GA) interface and data structures.
Importance sampling Monte Carlo integration engine.
Classic Monte Carlo integration engine.
Metropolis-Hastings MCMC Monte Carlo integration engine.
Particle Swarm Optimization (PSO) interface and data structures.
void runBenchmarks(bool useGnuplot)
Run integration benchmarks with hardcoded integrands.
void cylinderIntegration()
3D cylindrical integration: hypercylinder base with height
void twelveDimIntegration()
12-dimensional integration benchmark
void runOptimizationBenchmarksGA()
void fourDimIntegration()
4-dimensional integration benchmark
void eightDimIntegration()
8-dimensional integration benchmark
void saveResults(const std::string &filename, const std::vector< results > &results, const std::string &function_expr)
Save benchmark results to a CSV file.
void parallelepipedIntegration()
3D parallelepiped (rectangular box) integration
void fiveDimIntegration()
5-dimensional integration benchmark
const std::vector< size_t > n_samples_vector
Global benchmark configuration.
void sphereIntegration()
3D spherical integration: f(x,y,z) = x²+y²+z² over unit ball
unsigned int n_threads
Global OpenMP thread count (set at runtime)
void runBenchmarksMH()
Run Metropolis-Hastings MCMC integration benchmarks.
void rectangularIntegration()
2D rectangular integration over axis-aligned box
void uniDimIntegration()
1D integration test: f(x) = x²
void circleIntegration()
2D circular integration: f(x,y) = x²+y² over unit disk
void runOptimizationBenchmarksPSO()
Core geometric types for Monte Carlo integration.
N-dimensional hypercylinder (infinite cylinder in discrete dimensions).
Axis-aligned hyperrectangular domain in N dimensions.
N-dimensional hypersphere (solid ball) domain.
Stores benchmark result for a single sample count.
size_t n_samples
std::string integration_result
std::string duration
Uniform distribution proposal over integration domain.