Computer Algorithms II Lecture Notes

16 October 2007 • Exhaustive Search


Outline

Some Files

$ du -sh *
170K    dj_Mitzura_-_If_you_really_want_to_rock_the_funky_beats.jpg
140M    dj_Mitzura_-_If_you_really_want_to_rock_the_funky_beats.mp3
74M     djspooky_ghostworldmix.m4a
8.0K    djspooky_ghostworldmix.txt
245M    fast-flux.mp3
2.0K    fast-flux.txt
109M    Green_Cheese_-_Green_Cheese_Vol_39_Reality_Adjustment.mp3
4.0K    Green_Cheese_-_Green_Cheese_Vol_39_Reality_Adjustment.txt
333M    Kper_-_Attention_Deficit_Disorder.mp3
6.0K    Kper_-_Attention_Deficit_Disorder.txt
336K    Tea_Time_at_Brian_Enos_House.jpg
110M    Tea_Time_at_Brian_Enos_House.mp3
4.0K    Tea_Time_at_Brian_Enos_House.txt

$ du -h
1.0G   .

$

A Problem

Some Solutions

Non-Solutions

Example

Exhaustive Search

answer solve(p)
  candidates = generate-all-candidates(p)

  for each candidate in candidates
    if solution(p, candidate)
      return candidate

  return none

Example

Applicability

Advantages

Disadvantages

Example

Exponential Order

Pallatives

Remember This?

The Algorithm

max-sum-path(triangle)

  all-paths = all-paths(triangle)
  max-path = pick(all-paths)
  max-sum = path-sum(triangle, max-path)

  for each path in all-paths
    sum = path-sum(triangle, path)
    if sum > max-sum
      max-sum = sum
      max-path = path

  return [ max-sum, max-path ]

Generating All Paths

Subset Generation

Exhaustive Sorting

sort(a[])
  candidates = generate-all-candidates(a)

  for each candidate in candidates
    if sorted(candidate)
      return candidate

  return none

Generating Candiate Sorts

Factorial Order

Route Planning

Finding Routes

Generating Routes

Implementation Details

Algorithm Outline

Decision Problem Solutions

Optimization Problem Solutions

Generating Candidates

Generating Subsets

Generating Permutations

One Last Problem

Candidate Set Size

A Revised Outline

A Revised Hierarchy

Intractable Problems


This page last modified on 23 October 2007.

This work's CC license.