🏠 Home · ← Prev: MMDP — Implementation
This document describes the Cutwidth Problem and the design of the algorithm used to solve it. The implementation details are covered in the CWP implementation notes.
Given an undirected graph with n vertices and e edges, the Cutwidth Problem
(CWP) consists of finding a linear ordering (a permutation) of the vertices that
minimizes the maximum number of edges cut between any two consecutive positions of
the ordering.
- Solution structure: a permutation of all
nvertices of the graph. - Constraints: the solution must be a permutation — every vertex appears exactly once.
- Objective function: for every position
iin the ordering, the cut atiis the number of edges connecting a vertex at a position≤ ito a vertex at a position> i. The objective value of a solution is the maximum cut over all positions (a minimax objective). - Optimization sense: minimization — the lower the maximum cut, the better the solution.
Letting
Here
A single instance set is used, the Harwell-Boeing collection (CW_hb). The
file format is:
- A first line with the number of vertices (given twice) and the number of edges.
- One line per edge, described by the two (0-based) vertex indices it connects.
32 32 90
17 25
17 15
17 21
17 6
17 18
...
The CWP is solved with a multi-start local search: a random solution is built and (optionally) improved with a local search, and this is repeated many times within a time budget, keeping the best solution found across all restarts. Four configurations are compared experimentally, differing in how each restart is improved.
The constructive method builds a feasible solution as a random permutation of all the vertices of the graph (its node list is shuffled). No objective information is used.
The local search explores a swap neighborhood: a move exchanges the positions of two vertices in the ordering. Each candidate move is evaluated by recomputing the objective (the maximum cut) of the resulting ordering; a move is improving when it decreases that value.
Two classic neighborhood-exploration strategies are compared:
- Best improvement: the whole neighborhood is built and the move that improves the solution the most is applied. This repeats from the resulting solution until no improving move exists.
- First improvement: the first move found that improves the current solution is applied immediately, without examining the rest of the neighborhood. This repeats until no improving move exists.
For first improvement, the order in which candidates are visited matters. If the order is always lexicographical (smaller indices first), the search explores more exhaustively the region around low-index vertices and is unlikely to reach other regions that might contain the optimum. For this reason the candidate order is often randomized so that all regions of the search space are visited with similar probability. Both a lexicographical and a random candidate order are compared.
Four configurations are run and compared:
| Configuration | Construction | Improvement |
|---|---|---|
| Random | random ordering | none |
| First improvement (random) | random ordering | first improvement, random candidate order |
| First improvement (lexicographical) | random ordering | first improvement, lexicographical candidate order |
| Best improvement | random ordering | best improvement |
The multi-start driver builds and improves solutions until a restart budget or a time limit is reached, keeping the best (here, "better" means a smaller maximum cut, because the CWP is a minimization problem):
Best improvement applies, at each step, the move with the largest improvement:
First improvement applies the first improving move found over the ordered candidates: