diff options
-rw-r--r-- | monte-carlo.tex | 32 |
1 files changed, 15 insertions, 17 deletions
diff --git a/monte-carlo.tex b/monte-carlo.tex index 70d026b..d3c3548 100644 --- a/monte-carlo.tex +++ b/monte-carlo.tex @@ -228,33 +228,31 @@ H}$ every time a spin is added to it. \begin{algorithm}[H] \begin{algorithmic} \REQUIRE $s\in\G^n$ - \STATE \textbf{let} $q_1$ and $q_2$ be empty stacks + \STATE $s'\gets s$ + \STATE \textbf{let} $q$ be an empty stack \STATE \textbf{let} $i_0\in V$ - \STATE $q_1.\mathtt{push}(i_0)$ - \STATE $\sigma\gets s_{i_0}$ - \STATE \texttt{stopped} $\gets$ \textbf{false} - \WHILE {$q_1$ is not empty} - \STATE $i\gets q_1.\mathtt{pop}$ - \IF {$s_i=\sigma$} + \STATE $q.\mathtt{push}(i_0)$ + \STATE $\sigma\gets s_{i_0}'$ + \STATE \texttt{completed} $\gets$ \textbf{true} + \WHILE {$q$ is not empty} + \STATE $i\gets q.\mathtt{pop}$ + \IF {$s_i'=\sigma$} \FORALL {$j$ such that $\{i,j\}\in E$} \IF {$1-\exp(-2\beta - J_{ij}s_is_j)>\mathop{\mathtt{UniformRandom}}(0,1)$} - \STATE $q_1.\mathtt{push}(j)$ + J_{ij}s_i's_j')>\mathop{\mathtt{UniformRandom}}(0,1)$} + \STATE $q.\mathtt{push}(j)$ \ENDIF \ENDFOR - \STATE $s_i\gets-s_i$ - \STATE $q_2.\mathtt{push}(i)$ + \STATE $s_i'\gets-s_i'$ + \STATE $q.\mathtt{push}(i)$ \IF {$1-\exp(-2\beta\sigma H)>\mathop{\mathtt{UniformRandom}}(0,1)$} - \STATE \texttt{stopped} $\gets$ \textbf{true} + \STATE \texttt{completed} $\gets$ \textbf{false} \STATE \textbf{break} \ENDIF \ENDIF \ENDWHILE - \IF {stopped} - \WHILE {$q_2$ is not empty} - \STATE $i\gets q_2.\mathtt{pop}$ - \STATE $s_i\gets-s_i$ - \ENDWHILE + \IF {completed} + $s\gets s'$ \ENDIF \end{algorithmic} \caption{Hybrid Wolff/Metropolis--Hastings} |