up previous next
Up: 2 Branch & Bound Previous: 2.1 Starting Branch & Next: 3 The Great Deluge



2.2 The Branch & Bound Algorithm

Saying the algorithm doesn't check all valid solutions requieres an explanation of the algorithm.
We use a kind of treeprunning to cut off solution paths, that cannot lead to an better solution. Branch and Bound keeps track of all analysed paths using a sorted history list. The shortest paths can be found at the beginning.
In each step of the algorithm the first path (shortest) is expanded. This means that all edges that lead further and are not cyclic, or if cyclic are a solution, are sorted into the history.
If the first path already is a solution the algorithm ends because we assume that the length of each edge is positive.


For the more mathematical inclined:


Let:

Knot $ s \in K$ be the start of the round trip, where $ K$ is the set of all knots.

$ E(s) \subset E$ be a set of all edges leading away from $ s$, where $ E$ is a set of all edges.

An edge is an triple $ (k1, l, k2)$ where $ k1$ is the start knot, $ l \geq 0$ the length, $ k2$ the end knot.

$ P$ be the actual processed path.

$ H$ a sorted list of all visited paths, shortest path first.


A path is a list of edges $ P(0)$ to $ P(j)$ satisfying the following equations:

$\displaystyle P(0\ldots j) \epsilon E$     (1)
$\displaystyle \forall (0 \leq i < j)\;(P(i)\rightarrow k2 = P(i+1)\rightarrow k1)$     (2)

A path is cyclic if:

$\displaystyle \exists\:i\;P(i)\!\rightarrow\!k2 \in \{P(n)\!\rightarrow\!k1\:\backslash\:0 \leq n \leq j\}$ (3)

The length of a path is:

$\displaystyle \sum\limits_{i=0}^j P(i)\rightarrow l$ (4)



Our implementation is very straight forward:

  1. set start Knot $ s$, $ H = \{[e]\;\vert e \in E(s)\} $
  2. first element $ x$ in $ H$ is a solution $ \Rightarrow$ best solution

    $\displaystyle (x(0)\!\rightarrow\!k1 = x(j)\!\rightarrow\!k2) \wedge \{x(i)\!\rightarrow\!k2\;\vert \forall i\} = K$ (5)

    else set $ P = x$
  3. expand $ P$

    $\displaystyle M = \{[P, e]\;\vert e \in E(s) \}$ (6)

  4. check cycles

    $\displaystyle C$ $\displaystyle =$ $\displaystyle \{x \in M\;\vert x$    is cyclic$\displaystyle \}$ (7)
    $\displaystyle \overline{C}$ $\displaystyle =$ $\displaystyle M\:\backslash\:C$ (8)

  5. check solution

    $\displaystyle R = \{x \in C\;\vert x$    is solution (see [*])$\displaystyle \}$ (9)

  6. sort in

    $\displaystyle H = H \cup \overline{C} \cup R \:\backslash\:\{P\}$ (10)

  7. $ \Rightarrow$ 2.


up previous next
Up: 2 Branch & Bound Previous: 2.1 Starting Branch & Next: 3 The Great Deluge