JOVANA
Explore Library Glossary Getting Started Three Levels Fields How it works Mission
Join the mission
Back to the library
資訊 / 電腦 1953

用快速電腦進行的狀態方程計算

梅特羅波利斯、阿里安娜·羅森布魯斯、馬歇爾·羅森布魯斯、奧古斯塔·特勒 與 愛德華·特勒

無法逐一檢驗所有可能?那就在牠們之間隨機遊走——而且要走得聰明——一個簡單的平均,便成了正確答案。

Choose your version
In depth · the introduction

當一個問題的可能性多到永遠無法一一檢驗時,你依然能得到正確答案——靠的是在牠們之間隨機遊走,而且要走得聰明。

核心想法

科學裡的許多問題,最終都歸結為對數目驚人的「排列」求平均——比如一團氣體的平均壓強,是對它分子所有可能的排列取平均。這些排列多到根本加不完,而其中絕大多數,其實無足輕重。

1953 年,洛斯阿拉莫斯的一個團隊,讓一台電腦去探索那些真正要緊的排列,辦法是走一趟「有引導的隨機遊走」。無論你身在何處,都試一小步隨機改變。若它通向一個更可能的去處,就去;若通向一個更不可能的去處,也去——但只以一個會隨著「更糟」而變小的機率去。這樣遊走,你造訪每一種排列的次數,恰好與它應得的相稱,於是把一路所見簡單地一平均,就是答案。

它是如何誕生的

它誕生在武器實驗室和牠們最早的電子電腦裡。在洛斯阿拉莫斯,尼古拉斯·梅特羅波利斯,物理學家夫婦馬歇爾與阿里安娜·羅森布魯斯,以及愛德華與奧古斯塔·特勒,把這個想法放到 MANIAC 上去執行——那是最早的儲存程式電腦之一。「蒙地卡羅」這個借自賭城的名字,幾年前由斯坦尼斯瓦夫·烏拉姆與約翰·馮·諾伊曼所創,用來指「靠隨機來解題」這個更寬泛的想法。

1953 年這篇論文裡誰做了什麼,至今仍有爭議。馬歇爾·羅森布魯斯晚年說,真正的工作是他和阿里安娜做的——程式是她寫的——而演算法卻冠著梅特羅波利斯的名;他還說,愛德華·特勒貢獻了一個關鍵的早期想法。阿里安娜·羅森布魯斯,那位真正寫下程式碼的人,正是歷史記得最少的一個。

它為何重要

它把「可能性多到數不清」從一條死路,變成了一項尋常的計算,並幫助讓電腦模擬成為做科學的第三種方式,與理論、實驗並列。今天,這同一個把戲,藏在臨床試驗與選舉預測背後的統計裡,藏在天氣與新材料背後的模擬裡,也藏在現代機器學習的大量角落裡。

一個可以想像的畫面

想像在黑暗中、靠步行去繪製一座大城最熱鬧的地方。你沒法走遍每一條街。於是你溜達:往近處邁一步;若覺得更熱鬧,就繼續走;若更冷清,就有時折返、有時不。每過一分鐘,標下你所在之處。走得夠久,你那一串標記,便描出了這城的人潮——儘管你從未見過整張地圖。演算法,正是這樣去抽取一個物理系統裡「熱鬧的」、最可能的那些排列。

可互動的 Metropolis 抽樣器:一條有兩個峰的目標機率曲線,柱子顯示一條受引導的隨機遊走到過的地方;按下推進,柱子便爬升去貼合曲線,而提議步長的滑桿會改變接受率。

它的位置

這一想法,立於馬可夫鏈之上——下一步只取決於你此刻所在的序列,由安德烈·馬可夫於 1913 年所研究——也立於柯爾莫哥洛夫 1933 年奠下的機率基礎之上。它生長自 1940 年代烏拉姆與馮·諾伊曼的蒙地卡羅方法,於 1970 年被哈斯廷斯推廣,如今支撐著貫穿現代科學的貝氏統計與大規模模擬。(參見本館關於馬可夫的文檔。)

The original document
Original source text
N. Metropolis, A. W. Rosenbluth, M. N. Rosenbluth, A. H. Teller & E. Teller · J. Chem. Phys. 21 (1953): 1087–1092
The concrete problem is the equation of state of a two-dimensional fluid of rigid spheres (hard disks): the pressure as a function of density. Computing it means averaging an observable over the Boltzmann distribution on a configuration space whose dimension grows with the number of particles — far too vast to integrate directly, and almost every randomly drawn configuration (overlapping disks) carries essentially no weight.
Importance sampling instead of brute force
Rather than draw configurations uniformly and weight each by its Boltzmann factor, the paper draws configurations with frequency already proportional to that factor. Then a thermodynamic ensemble average is just an ordinary arithmetic mean over the sampled configurations — the heavy weighting is built into which states get visited.
The move-and-accept rule
Such a sample is generated as a Markov chain. Displace one particle by a small random amount and look at the change in energy ΔE. If ΔE ≤ 0, accept the move. If ΔE > 0, accept it only with probability exp(−ΔE/kT); otherwise reject it and count the current configuration again. Iterated, this visits configurations with exactly the Boltzmann frequency, because the rule obeys detailed balance — and time averages along the chain converge to the ensemble average.
Run on the Los Alamos MANIAC for a few hundred disks, the method produced an equation of state that agreed with free-volume theory at high density and with a virial expansion at low density — a hard statistical-mechanics problem solved by sampling, with no closed form and no laboratory.
[ … ]
Metropolis · A. Rosenbluth · M. Rosenbluth · A. Teller · E. Teller · Los Alamos Scientific Laboratory · 1953