simple_montecarlo

User Guide

Installation

Add to your ECF file:

<library name="simple_montecarlo" location="$SIMPLE_EIFFEL/simple_montecarlo/simple_montecarlo.ecf"/>

Basic Concepts

MEASUREMENT

Type-safe wrapper for observed values. Prevents confusion between measurements and probabilities.

create m.make_real (42.5)
create m.make_integer (100)

TRIAL_OUTCOME

Container for measurements from a single trial. Store multiple named measurements.

MONTE_CARLO_EXPERIMENT

Orchestrates N trials with custom logic, collects outcomes, computes statistics.

SIMULATION_STATISTICS

Aggregated results including mean, std_dev, min/max, and confidence intervals.

Workflow

  1. Create experiment with trial count
  2. Define trial logic (what happens in each trial)
  3. Set optional random seed for reproducibility
  4. Run simulation (executes all trials)
  5. Get statistics from completed experiment

Design by Contract

All classes use Design by Contract (DBC):

Contracts are enforced at runtime and catch errors immediately.

Void Safety

All code is void-safe (void_safety="all"). References are explicitly marked: