2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-25 06:18:05 +02:00

Fix error in label correction; extend for banch-and-bound

This commit is contained in:
Martin Thoma 2016-07-21 17:47:46 +02:00
parent 001350bae4
commit 1c54ccd821
2 changed files with 11 additions and 5 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Before After
Before After

View file

@ -20,18 +20,24 @@
\begin{algorithmic}
\Require
\Statex Graph $G = (V, E)$
\Statex Weight from node $i$ to node $j$: $g_{ij}$
\Statex Starting node $s \in V$
\Statex End node $t \in V$
\Procedure{LabelCorrection}{$G$, $s$, $t$}
\Statex Lower bound to get from node $j$ to $t$: $h_j$ (default: $h_j = 0$)
\Statex Upper bound to get from node $j$ to $t$: $m_j$ (default: $m_j = \infty$)
\Procedure{LabelCorrection}{$G$, $s$, $t$, $h_j$}
\State $d_s \gets 0$
\State $d_i \gets \infty \quad \forall i \neq s$
\State $u \gets \infty$
\State $d_i \gets \infty \quad \forall i \neq s$ \Comment{Distance of node $i$ from $s$}
\State $u \gets \infty$ \Comment{Distance from $s$ to $t$}
\State $K \gets \{s\}$ \Comment{Choose some datastructure here}
\While{$K$ is not empty}
\State $v \gets K.pop()$
\For{child $c$ of $v$}
\If{$d_v + g_{vc} < \min(d_c, u)$}
\State $d_v \gets d_v + g_{vc}$
\If{$d_c + m_j < u$}
\State $u \gets d_j + m_j$
\EndIf
\If{$d_v + g_{vc} + h_j < \min(d_c, u)$}
\State $d_c \gets d_v + g_{vc}$
\State $c.parent \gets v$
\If{$c \neq t$ and $c \notin K$}
\State $K.insert(c)$