Overview
simple_montecarlo is a production-ready Monte Carlo simulation framework for Eiffel that makes stochastic experiments accessible to engineers without deep statistical expertise.
It offers type-safe measurements, flexible trial logic, and comprehensive statistics including mean, standard deviation, and confidence intervals.
Part of the Simple Eiffel ecosystem.
Use Cases
- Manufacturing: Measure tolerances and compute 95% confidence intervals
- Automotive Safety: Simulate failure scenarios with varying component parameters
- Financial Risk: Analyze portfolio outcomes under multiple market scenarios
- Scientific Research: Run general Monte Carlo simulations with automatic statistics
Features
- Type-Safe Measurements - Prevent confusion between values and probabilities
- Flexible Trial Logic - Define trial behavior via agents (closures)
- Outcome Collection - Gather results from each trial automatically
- Statistics Aggregation - Compute mean, std_dev, min/max, CIs automatically
- Design by Contract - Full preconditions, postconditions, invariants
- Void-Safe - void_safety="all" prevents null pointer errors
- SCOOP Compatible - Ready for concurrent execution (future)
Status
v1.0.0 - Production Ready
- 25 tests passing (100% pass rate)
- 13 unit tests + 12 adversarial tests
- Design by Contract throughout
- Comprehensive documentation
Quick Example
local
l_exp: MONTE_CARLO_EXPERIMENT
l_stats: SIMULATION_STATISTICS
do
create l_exp.make (1000)
l_exp.set_trial_logic (agent my_trial_logic)
l_exp.run_simulation
l_stats := l_exp.statistics
print ("Mean: " + l_stats.mean.out + "%N")
print ("95% CI: [" + l_stats.ci_95.first.out + ", "
+ l_stats.ci_95.second.out + "]%N")
end
Getting Started
Quick API Reference for immediate examples
User Guide for comprehensive instructions
API Reference for complete documentation