summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJaron Kent-Dobias <jaron@kent-dobias.com>2017-10-29 21:25:43 -0400
committerJaron Kent-Dobias <jaron@kent-dobias.com>2017-10-29 21:25:43 -0400
commit0cb41564021b0315e95965010b502620b045b9c3 (patch)
treed05d3ad5d88272ed124cfff19a36374d0e9771c9
parent146215c87195bfa2a2002898e2dec5da7c1577d2 (diff)
downloadPRE_98_063306-0cb41564021b0315e95965010b502620b045b9c3.tar.gz
PRE_98_063306-0cb41564021b0315e95965010b502620b045b9c3.tar.bz2
PRE_98_063306-0cb41564021b0315e95965010b502620b045b9c3.zip
make the hybrid algorithm more pedogogical
-rw-r--r--monte-carlo.tex32
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}