next up previous contents index
Next: Example Up: Alternative: Reducing IP to Previous: Correctness

Subsections

Optimal Solution for SGP

   In this section, we present an algorithm that gives an optimal solution for SGP and - because of the reduction M presented in the previous section - also to IP. The only change to Kernighan's algorithm has to reflect the slightly different calculation of a fragment's weight.

The approach taken by the algorithm SGP-opt  is similar to the one taken for IP-opt. It is based on dynamic programming: the graph is scanned, beginning with v1 and proceeding one vertex in each step. In step i, i.e. having reached vertex vi, the algorithm knows an optimal partition for each of the subgraphs containing respectively. It then seeks the vertex vj prior to vi that minimises the partial costs c(vi) for if the graph ended at vi and the previous breakpoint had been vj. The minimising vj is stored as  . Finally, when reaching vn, the optimal partition for the entire graph can be found in .

The following data structures and functions are used by the algorithm in addition to the ones already introduced in the context of SGP:

The algorithm is shown in figure 5.10. It adopts a similar structure to the one used for IP-opt in figure 5.5. This is intended to emphasise the similarities between IP and SGP. For a proof of correctness the reader might refer to [Kernighan, 1971].



Algorithm SGP-opt


The algorithm SGP-opt for computing an optimal partition for an instance of SGP.

 


next up previous contents index
Next: Example Up: Alternative: Reducing IP to Previous: Correctness

Thomas Zurek