Bic Easy Hard
Bic Easy Hard
Bic Easy Hard
Computing: Optimisation
Examples
n 2 3 4 5 6 10 20 50 100
(exp)
1.1n 1.21 1.33 1.46 1.61 1.77 2.59 6.73 117 13,780
(poly)
n1.1 2.14 3.35 4.59 5.87 7.18 12.6 27.0 73.9 159
polynomial
Increasing n
Example: Minimum Spanning
Tree Problems
This is a case of an easy problem, but not as obvious
as our first easy example.
6 14
7 9 3
5
8
6
12
14
7 3
With cost = 36
Here’s a cheaper one
6
7 3
With cost 20 …
The problem find the minimal cost spanning tree
(aka the `MST’) is easy in the technical sense.
12
4
14
6
7 9 3
5
8
6
Several fast algorithms are known which solve this in polynomial time;
Here is the classic one: Prim’s algorithm:
Start with empty tree (no edges)
Repeat: choose cheapest edge which feasibly extends the tree
Until: n — 1 edges have been chosen.
Prim’s step 1:
12
4
14
6
7 9 3
5
8
6
Prim’s step 2:
12
4
14
6
7 9 3
5
8
6
Prim’s step 3:
12
4
14
6
7 9 3
5
8
6
Prim’s step 4:
12
4
14
6
7 9 3
5
8
6
Prim’s step 4:
6
3
5
These:
• deliver solutions in reasonable time
Time
So …
• Most real world problems that we need to
solve are hard problems
• We can’t expect truly optimal solutions for
these, so we use approximate algorithms
and do as well as we can.
• EAs (and other BIC methods we will see)
are very successful approximate algorithms