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

Benchmark suite for Monte Carlo integration algorithms. More...

#include "apps/benchmarks.hpp"
#include <montecarlo/integrators/ISintegrator.hpp>
#include <montecarlo/utils/muParserXInterface.hpp>
#include <montecarlo/rng/rng_global.hpp>
#include <cmath>
#include <cstdint>
#include <iostream>
#include <functional>
#include <limits>
#include <random>
#include <string>
Include dependency graph for integration_benchmarks.cpp:

Go to the source code of this file.

Functions

template<size_t dim, typename Func >
void executeBenchmark (const std::string &title, const std::string &filename, mc::integrators::MontecarloIntegrator< dim > &integrator, const mc::domains::IntegrationDomain< dim > &domain, Func &&f, bool useGnuplot, const std::string &rawDataFile, const std::string &functionExpr)
 Generic execution loop for integration benchmarks.
 
template<typename Func >
void runCircleBenchmark (Func f, const std::string &modeLabel, bool useGnuplot, const std::string &funcStr)
 
template<typename Func >
void runSphereBenchmark (Func f, const std::string &modeLabel, bool useGnuplot, const std::string &funcStr)
 
template<typename Func >
void runRectBenchmark (Func f, const std::string &modeLabel, bool useGnuplot, const std::string &funcStr)
 
template<typename Func >
void runCylinderBenchmark (Func f, const std::string &modeLabel, bool useGnuplot, const std::string &funcStr)
 
void circleIntegration (bool useGnuplot)
 
void sphereIntegration (bool useGnuplot)
 
void rectangularIntegration (bool useGnuplot)
 
void cylinderIntegration (bool useGnuplot)
 
void circleIntegrationParser (const std::string &expr, bool useGnuplot)
 
void sphereIntegrationParser (const std::string &expr, bool useGnuplot)
 
void rectangularIntegrationParser (const std::string &expr, bool useGnuplot)
 
void cylinderIntegrationParser (const std::string &expr, bool useGnuplot)
 
void runBenchmarks (bool useGnuplot)
 Run integration benchmarks with hardcoded integrands.
 
void runBenchmarksMH ()
 Run Metropolis-Hastings MCMC integration benchmarks.
 
void runBenchmarks (const std::string &expression, bool useGnuplot)
 Run integration benchmarks with custom mathematical expression.
 

Detailed Description

Benchmark suite for Monte Carlo integration algorithms.

Comprehensive evaluation of integration accuracy and performance across:

Methodology:

Key Benchmarks:

See also
runBenchmarks(), executeBenchmark(), saveResults()

Definition in file integration_benchmarks.cpp.

Function Documentation

◆ circleIntegration()

void circleIntegration ( bool  useGnuplot)

Definition at line 213 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ circleIntegrationParser()

void circleIntegrationParser ( const std::string &  expr,
bool  useGnuplot 
)

Definition at line 242 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ cylinderIntegration()

void cylinderIntegration ( bool  useGnuplot)

Definition at line 231 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ cylinderIntegrationParser()

void cylinderIntegrationParser ( const std::string &  expr,
bool  useGnuplot 
)

Definition at line 278 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ executeBenchmark()

template<size_t dim, typename Func >
void executeBenchmark ( const std::string &  title,
const std::string &  filename,
mc::integrators::MontecarloIntegrator< dim > &  integrator,
const mc::domains::IntegrationDomain< dim > &  domain,
Func &&  f,
bool  useGnuplot,
const std::string &  rawDataFile,
const std::string &  functionExpr 
)

Generic execution loop for integration benchmarks.

Template Parameters
dimDimensionality of the integration domain.
FuncFunction type (integrand).
Parameters
titleDisplay title for the benchmark
filenameOutput CSV filename
integratorIntegration engine to benchmark
domainIntegration domain (used for visualization)
fIntegrand function
useGnuplotIf true, generate visualization script
rawDataFileRaw data filename for plotting
functionExprString representation of the integrand

GENERIC execution loop. Runs the integration for increasing sample sizes, measures time, plots results, and saves to file.

Definition at line 57 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ rectangularIntegration()

void rectangularIntegration ( bool  useGnuplot)

Definition at line 225 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ rectangularIntegrationParser()

void rectangularIntegrationParser ( const std::string &  expr,
bool  useGnuplot 
)

Definition at line 266 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runBenchmarks() [1/2]

void runBenchmarks ( bool  useGnuplot)

Run integration benchmarks with hardcoded integrands.

Parameters
useGnuplotIf true, generate gnuplot script for visualization.

Definition at line 292 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runBenchmarks() [2/2]

void runBenchmarks ( const std::string &  expression,
bool  useGnuplot 
)

Run integration benchmarks with custom mathematical expression.

Parameters
expressionMathematical function string (muParserX syntax)
useGnuplotIf true, generate gnuplot script

Definition at line 449 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runBenchmarksMH()

void runBenchmarksMH ( )

Run Metropolis-Hastings MCMC integration benchmarks.

Definition at line 309 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runCircleBenchmark()

template<typename Func >
void runCircleBenchmark ( Func  f,
const std::string &  modeLabel,
bool  useGnuplot,
const std::string &  funcStr 
)

Definition at line 160 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runCylinderBenchmark()

template<typename Func >
void runCylinderBenchmark ( Func  f,
const std::string &  modeLabel,
bool  useGnuplot,
const std::string &  funcStr 
)

Definition at line 195 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runRectBenchmark()

template<typename Func >
void runRectBenchmark ( Func  f,
const std::string &  modeLabel,
bool  useGnuplot,
const std::string &  funcStr 
)

Definition at line 183 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ runSphereBenchmark()

template<typename Func >
void runSphereBenchmark ( Func  f,
const std::string &  modeLabel,
bool  useGnuplot,
const std::string &  funcStr 
)

Definition at line 171 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ sphereIntegration()

void sphereIntegration ( bool  useGnuplot)

Definition at line 219 of file integration_benchmarks.cpp.

Here is the call graph for this function:

◆ sphereIntegrationParser()

void sphereIntegrationParser ( const std::string &  expr,
bool  useGnuplot 
)

Definition at line 254 of file integration_benchmarks.cpp.

Here is the call graph for this function: