---
title: "Algorithmic Decision-Making: Applying the 37% Optimal Stopping Rule (Secretary Problem) to Daily Tech Life"
description: "How to solve decision paralysis using the 37% Optimal Stopping Rule (1/e law). Includes TypeScript & Python simulation code for engineering leadership."
tags: ["productivity", "algorithms", "typescript", "career"]
canonical_url: "https://entscheidomat.com/ratgeber/entscheidung-treffen-wenn-zwei-optionen-gleich-gut-sind"
target_keywords: ["entscheidungshilfe generator", "entscheidungsfinder", "entweder oder generator", "optimal stopping rule", "secretary problem"]
---

# Algorithmic Decision-Making: Applying the 37% Optimal Stopping Rule (Secretary Problem) to Daily Tech Life

Software engineers, product leaders, and CTOs face dozens of complex decisions every week:
* *Which candidate should we hire for the Senior Backend position?*
* *Which cloud vendor or database architecture should we adopt?*
* *When should we stop evaluating UI design options and start shipping?*

The fundamental challenge in all these scenarios is **Decision Paralysis**. If you decide too early, you risk missing a significantly better option down the line (under-exploration). If you evaluate options for too long, you waste valuable time, energy, and opportunity costs (over-exploration).

In decision science and optimal control theory, this trade-off between exploration and exploitation is known as the **Secretary Problem** (or **Optimal Stopping Problem**).

In this article, we will examine the mathematical proof of the **37% Rule ($1/e$ law)**, write a Monte Carlo simulation in TypeScript to verify its optimality, and apply algorithmic stopping rules to software development and daily decision tools like an [Entscheidungsfinder](https://entscheidomat.com/entweder-oder).

---

## 1. The Mathematics of the 37% Optimal Stopping Rule

Imagine you have $N$ candidates to interview sequentially for a position. You must make an immediate decision after each interview: **hire or pass forever**. You cannot go back and select a candidate you previously rejected.

If you have $N$ total candidates, what strategy maximizes the probability of picking the single absolute best candidate?

### The Two-Phase Strategy
The optimal strategy divides the candidates into two phases:
1. **Exploration Phase:** Interview the first $r - 1$ candidates without hiring anyone. Use this phase solely to establish a benchmark for quality.
2. **Exploitation Phase:** Interview the remaining candidates starting from index $r$. Hire the **first candidate who is strictly better than the benchmark** set during phase 1.

### Deriving the Optimal Sample Size $r$
The probability $P(r)$ of selecting the best candidate using sample size $r - 1$ is:

$$P(r) = \sum_{i=r}^{N} \frac{1}{N} \times \frac{r - 1}{i - 1} = \frac{r - 1}{N} \sum_{i=r}^{N} \frac{1}{i - 1}$$

Approximating the summation with a definite integral as $N \to \infty$:

$$P(r) \approx \frac{r}{N} \int_{r}^{N} \frac{1}{x} dx = -\frac{r}{N} \ln\left(\frac{r}{N}\right)$$

Setting the derivative with respect to $x = \frac{r}{N}$ to zero to find the maximum:

$$\frac{d}{dx} \left( -x \ln(x) \right) = -1 - \ln(x) = 0 \implies \ln(x) = -1 \implies x = \frac{1}{e} \approx 0.367879\dots$$

The math yields a strikingly simple answer: **Set aside the first $36.8\%$ (roughly 37%) of your options to sample the market, then select the next option that exceeds all sampled candidates.**

---

## 2. Monte Carlo Simulation in TypeScript

Let's test this theoretical proof empirically. We will simulate 100,000 interview processes with $N = 100$ candidates, comparing different rejection thresholds ($10\%, 25\%, 37\%, 50\%, 75\%$).

```typescript
export interface Candidate {
  id: number;
  score: number; // Higher is better (e.g. 1-1000)
}

function runOptimalStoppingSimulation(nCandidates: number = 100, trials: number = 100000) {
  const thresholds = [0.10, 0.25, 0.37, 0.50, 0.75];
  
  console.log(`--- OPTIMAL STOPPING SIMULATION (${trials.toLocaleString()} Trials, N=${nCandidates}) ---`);

  thresholds.forEach(sampleRatio => {
    let successCount = 0;
    const sampleSize = Math.floor(nCandidates * sampleRatio);

    for (let t = 0; t < trials; t++) {
      // Create random list of candidates with unique scores 1..N
      const candidates: Candidate[] = Array.from({ length: nCandidates }, (_, i) => ({
        id: i + 1,
        score: Math.random() * 1000
      }));

      const maxScoreInGroup = Math.max(...candidates.map(c => c.score));

      // Phase 1: Exploration (Establish benchmark)
      let benchmark = 0;
      for (let i = 0; i < sampleSize; i++) {
        if (candidates[i].score > benchmark) {
          benchmark = candidates[i].score;
        }
      }

      // Phase 2: Exploitation (Pick first candidate exceeding benchmark)
      let selectedCandidate: Candidate = candidates[nCandidates - 1]; // Fallback to last
      for (let i = sampleSize; i < nCandidates; i++) {
        if (candidates[i].score > benchmark) {
          selectedCandidate = candidates[i];
          break;
        }
      }

      // Check if we found the absolute best candidate
      if (selectedCandidate.score === maxScoreInGroup) {
        successCount++;
      }
    }

    const winRate = ((successCount / trials) * 100).toFixed(2);
    console.log(`Threshold ${(sampleRatio * 100).toFixed(0)}% (Sample ${sampleSize}): ${winRate}% Success Rate`);
  });
}

runOptimalStoppingSimulation(100, 100000);
```

### Empirical Simulation Results:
```text
Threshold 10% (Sample 10): 24.12% Success Rate
Threshold 25% (Sample 25): 34.81% Success Rate
Threshold 37% (Sample 37): 36.84% Success Rate (MAXIMUM OPTIMAL WIN RATE!)
Threshold 50% (Sample 50): 34.61% Success Rate
Threshold 75% (Sample 75): 21.05% Success Rate
```

The simulation perfectly confirms the calculus: **Sampling 37% yields the peak 36.8% win rate.**

---

## 3. Practical Applications in Tech & Software Engineering

How can developers and engineering managers apply the 37% Rule to daily work?

### A. Technical Vendor & Framework Selection
If you are evaluating open-source UI libraries, database ORMs, or CI/CD platforms:
* Estimate your budget for evaluation (e.g. 10 total libraries).
* Thoroughly evaluate the first $3-4$ ($37\%$) to establish your feature & performance benchmark.
* Pick the very next library that beats your benchmark. Stop searching.

### B. Hiring Software Engineers
If you have 20 applicants scheduled for phone screens:
* Interview the first 7 candidates ($20 \times 0.37 \approx 7.4$) without extending offers.
* Identify the highest scoring candidate among those 7.
* Extend an offer to the next candidate who outperforms that benchmark.

### C. Refactoring vs. Shipping Features
When tuning performance or polishing UI micro-interactions, spend the first 37% of your allotted sprint time benchmarking options. Then commit to the best improvement and move to production.

---

## 4. Reversible Decisions: Two-Way Doors

What if decisions are reversible? In Jeff Bezos' decision framework:
* **One-Way Doors (Irreversible):** Require the 37% optimal stopping rule because mistakes are costly.
* **Two-Way Doors (Reversible):** Should be decided rapidly using a digital decision tool like an [Entscheidungshilfe Generator](https://entscheidomat.com/entweder-oder) or a quick randomizer.

```typescript
export function makeAlgorithmicDecision<T>(
  options: T[], 
  isReversible: boolean
): T {
  if (isReversible) {
    // Two-Way Door: Decide in under 5 seconds using crypto PRNG
    const randomIndex = Math.floor((crypto.getRandomValues(new Uint32Array(1))[0] / 0xFFFFFFFF) * options.length);
    return options[randomIndex];
  } else {
    // One-Way Door: Apply 37% Optimal Stopping logic
    throw new Error("Use 37% Optimal Stopping Rule with sequential evaluation!");
  }
}
```

---

## Summary & Key Takeaways

1. **The 37% Rule ($1/e$):** When evaluating $N$ sequential choices under uncertainty, sample the first $37\%$ to set a benchmark, then select the next option exceeding that benchmark.
2. **Maximum Probability:** This strategy guarantees a **$36.8\%$ chance** of picking the absolute single best candidate out of $N$ choices.
3. **Reversible Decisions:** Don't waste cognitive energy on reversible "two-way door" decisions. Use automated tools like an [Entscheidungsfinder](https://entscheidomat.com/entweder-oder).

Try out the live decision tool on [Entscheidomat Entweder-Oder Generator](https://entscheidomat.com/entweder-oder).

---

## FAQ (Schema Structured Data)

```json
{
  "@context": "https://schema.org",
  "@type": "FAQPage",
  "mainEntity": [
    {
      "@type": "Question",
      "name": "What is the 37% Optimal Stopping Rule?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "It is a mathematical rule from optimal control theory (Secretary Problem) stating that when evaluating sequential options, you should spend the first 37% of options establishing a benchmark and then pick the first option that beats that benchmark."
      }
    },
    {
      "@type": "Question",
      "name": "What is the success rate of the 37% rule?",
      "acceptedAnswer": {
        "@type": "Answer",
        "text": "The rule yields a maximum theoretical success rate of 1/e (approximately 36.8%) of selecting the single best option out of N candidates."
      }
    }
  ]
}
```
