1 / 14

Exhaustive Search

Exhaustive Search. Brute Force Methods. guarantee best fitness value is found feasible for ‘small’ data sets only. SAT satisfiability problem. set of propositions prop[n] fitness function logical expression based on propositions boolean fitness(prop)

booth
Download Presentation

Exhaustive Search

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Exhaustive Search

  2. Brute Force Methods • guarantee best fitness value is found • feasible for ‘small’ data sets only

  3. SAT satisfiability problem • set of propositions prop[n] • fitness function • logical expression based on propositions boolean fitness(prop) • try all 2n combinations of T/F for propositions

  4. boolean fitness(boolean b[]) //fitness function boolean [] prop = new boolean[n]; boolean satisfied = sat(n-1); boolean sat (int index) // find a solution { if (index==0) //base case { prop[0] = true; if fitness(prop) return true; prop[0] = false; return fitness(prop); } prop[index] = true; // recursive if (sat(index-1)) return true; prop[index] = false; return sat(index-1); } ... ... 2 1 0 ..T ..F .TT .FT .TF .FF TTT FTT TFT FFT TTF FTF TFF FFF

  5. efficiency without risk • pruning the tree: • suppose fitness(prop) is (p0 \/ ~p1) /\ (~p2) partial evaluation ... ... nodes can be ignored: fitness can not be true 2 1 0 ..T ..F .TT .FT .TF .FF TTT FTT TFT FFT TTF FTF TFF FFF

  6. TSP travelling salesman • directed edges, complete graph: exhaustive search is the permutation problem enumerate all n! permutations of n distinct items (cities) {0,2,3,…,n-1} rank in path array D[i][j] 0 1 2 3 1 0 3 1 4 2 3 2

  7. TSP travelling salesman O(nn) input(V) // number of cities (Vertices) int[V] rIP // rankInPath, initialized to 0==not ranked visit(1) // generate visiting sequences void visit(int rank) { for (city = 0 to V-1) if (rIP[city] == 0) // not yet visited { rIP[city] = rank; if (rank == V) fitness(rIP) else visit(rank+1) rIP[city] = 0 } } fitness(int[] p) calculate pathlength from D[i][j] if bestpath, save p

  8. efficiency without risk • fix first city  O((n-1)n-1) • use sets instead of searching array  O((n-1)!) • keep partial fitness values • reduce cost of fitness evaluation • apply branch and bound BUT… still O(en)

  9. Variations on TSP • undirected edges: D[i][j] == D[j][i] • incomplete graph: some D[i][j] = null • Euclidean distances (on a plane) • cities are located on plane at (xi,yi) • D[i][j] is computed from coordinates: D[i][j] = D[j][i] = sqrt((xi-xj)2 + (yi-yj)2)  other data structures, efficiencies

  10. Continuousproblem spaces Where is height of land? 1. what scale to sample? x[0,1], y[0,1] interval length: 0.1: 100 data points 0.01: 10,000 0.001: 1,000,000 --- y  --- x 

  11. Continuousproblem spaces Where is height of land? 1. what scale to sample? x[0,1], y[0,1] interval length: 0.1: 100 data points 0.01: 10,000 0.001: 1,000,000 --- y  --- x 

  12. Continuousproblem spaces Where is height of land? 2. constraints – ignore water fewer data points but constraints must be tested --- y  --- x 

  13. Continuousproblem spaces Where is height of land? 3. where to locate sample --- y  --- x 

  14. Continuousproblem spaces - NLP Non-Linear Programming problems Typical problems are functions of multiple variables over domains of each Maximize f(x1,x2,x3,…,xn) for x1  D1, x2  D2, x3  D3,…, xn  Dn NLP problems are NP complete *Linear Programming problems are polynomial solvable O(nk)

More Related