Prerequisites
TreeOfThoughts is not in swarms 15.0.3 on PyPI, so install from GitHub until the next release.
The code
fermi_estimation.py
What the settings do
generation_strategy="sample"makes three independent calls for one step each, instead of one call for three. Independent calls give more varied assumptions.evaluation_strategy="vote"shows the evaluator every candidate on the level and asks which is most defensible. A candidate’s score is its votes divided by the leader’s votes.n_evaluate_samples=3casts three votes per comparison. With one vote, only the winner would clear the defaultvalue_thresholdof 0.5. With three, a runner-up with at least half the leader’s votes stays in the beam.evaluation_criteriatells the voter what defensible means here: justified assumptions, correct units, and progress toward one number in joules.
Check the answer
One defensible chain of assumptions:- About 5 × 10⁷ cars are moving at rush hour.
- A typical car has a mass of about 1,500 kg.
- A typical speed, mixing highway and city traffic, is about 15 m/s.
Cost
This configuration expands at most 7 nodes and makes at most 34 model calls: 21 generation calls (3 per expanded node), 12 votes (3 per level over 4 levels) and 1 answer call. See Cost for the formula.Next
Knights and knaves
DFS case analysis with backtracking.
TreeOfThoughts reference
Every parameter, strategy, and result field.