Exhaustion, Branch and Bound, Divide and Conquer.

Slides:



Advertisements
Similar presentations
Dynamic Programming 25-Mar-17.
Advertisements

Problem solving with graph search
Algorithm Design Methods Spring 2007 CSE, POSTECH.
Back to Sorting – More efficient sorting algorithms.
 Review: The Greedy Method
Dynamic Programming.
Traveling Salesperson Problem
O(N 1.5 ) divide-and-conquer technique for Minimum Spanning Tree problem Step 1: Divide the graph into  N sub-graph by clustering. Step 2: Solve each.
Comments We consider in this topic a large class of related problems that deal with proximity of points in the plane. We will: 1.Define some proximity.
Counting the bits Analysis of Algorithms Will it run on a larger problem? When will it fail?
Types of Algorithms.
Lecture 24 Coping with NPC and Unsolvable problems. When a problem is unsolvable, that's generally very bad news: it means there is no general algorithm.
Anany Levitin ACM SIGCSE 1999SIG. Outline Introduction Four General Design Techniques A Test of Generality Further Refinements Conclusion.
Algorithms + L. Grewe.
What is divide and conquer? Divide and conquer is a problem solving technique. It does not imply any specific computing problems. The idea is to divide.
EE 553 Integer Programming
Lecture 12: Revision Lecture Dr John Levine Algorithms and Complexity March 27th 2006.
S. J. Shyu Chap. 1 Introduction 1 The Design and Analysis of Algorithms Chapter 1 Introduction S. J. Shyu.
Lecture 4 Divide and Conquer for Nearest Neighbor Problem
September 12, Algorithms and Data Structures Lecture III Simonas Šaltenis Nykredit Center for Database Research Aalborg University
The Divide-and-Conquer Strategy
15-May-15 Dynamic Programming. 2 Algorithm types Algorithm types we will consider include: Simple recursive algorithms Backtracking algorithms Divide.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. Divide and Conquer.
CS223 Advanced Data Structures and Algorithms 1 Divide and Conquer Neil Tang 4/15/2010.
Search by partial solutions. Where are we? Optimization methods Complete solutions Partial solutions Exhaustive search Hill climbing Random restart General.
Divide and Conquer. Recall Complexity Analysis – Comparison of algorithm – Big O Simplification From source code – Recursive.
Algorithms Recurrences. Definition – a recurrence is an equation or inequality that describes a function in terms of its value on smaller inputs Example.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Algorithm Strategies Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Recursion and Exhaustion Hong Kong Olympiad in Informatics 2009 Hackson Leung
Games with Chance Other Search Algorithms CPSC 315 – Programming Studio Spring 2008 Project 2, Lecture 3 Adapted from slides of Yoonsuck Choe.
5 - 1 § 5 The Divide-and-Conquer Strategy e.g. find the maximum of a set S of n numbers.
Polynomial time approximation scheme Lecture 17: Mar 13.
Lecture 6 Divide and Conquer for Nearest Neighbor Problem Shang-Hua Teng.
Backtracking.
Nattee Niparnan. Recall  Complexity Analysis  Comparison of Two Algos  Big O  Simplification  From source code  Recursive.
Fundamentals of Algorithms MCS - 2 Lecture # 7
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
Algorithm Paradigms High Level Approach To solving a Class of Problems.
CP Summer School Modelling for Constraint Programming Barbara Smith 2. Implied Constraints, Optimization, Dominance Rules.
INTRODUCTION. What is an algorithm? What is a Problem?
Gary Sham HKOI 2010 Greedy, Divide and Conquer. Greedy Algorithm Solve the problem by the “BEST” choice. To find the global optimal through local optimal.
CSE 589 Part VI. Reading Skiena, Sections 5.5 and 6.8 CLR, chapter 37.
CSE 421 Algorithms Lecture 15 Closest Pair, Multiplication.
Types of Algorithms. 2 Algorithm classification Algorithms that use a similar problem-solving approach can be grouped together We’ll talk about a classification.
Divide and Conquer Andreas Klappenecker [based on slides by Prof. Welch]
Optimization Problems
Lecture 5 Today, how to solve recurrences We learned “guess and proved by induction” We also learned “substitution” method Today, we learn the “master.
Dynamic Programming.  Decomposes a problem into a series of sub- problems  Builds up correct solutions to larger and larger sub- problems  Examples.
1 CSC 421: Algorithm Design & Analysis Spring 2014 Complexity & lower bounds  brute force  decision trees  adversary arguments  problem reduction.
Sorting Lower Bounds n Beating Them. Recap Divide and Conquer –Know how to break a problem into smaller problems, such that –Given a solution to the smaller.
G5AIAI Introduction to AI Graham Kendall Heuristic Searches.
Common Intersection of Half-Planes in R 2 2 PROBLEM (Common Intersection of half- planes in R 2 ) Given n half-planes H 1, H 2,..., H n in R 2 compute.
CMPT 238 Data Structures More on Sorting: Merge Sort and Quicksort.
CMPT 463. What will be covered A* search Local search Game tree Constraint satisfaction problems (CSP)
Traveling Salesperson Problem
Algorithm Design Methods
Unit 1. Sorting and Divide and Conquer
Lecture 4 Divide-and-Conquer
Divide and Conquer.
Types of Algorithms.
CSCE 411 Design and Analysis of Algorithms
Types of Algorithms.
Exam 2 LZW not on syllabus. 73% / 75%.
Algorithm Design Methods
Types of Algorithms.
Algorithm Design Methods
Major Design Strategies
Major Design Strategies
Algorithm Design Methods
Presentation transcript:

Exhaustion, Branch and Bound, Divide and Conquer

Bin packing Maximum Consecutive Sum Fast Exponentiation Closest Pair

窮舉 / 窮尋 / 暴力法 Also called Brute Force Anyway it is not about violence...

Why Exhaustion Sometimes it’s the only way out. Case Study 1 Irreversible Transform Given a transform H, you can calculate y = H(x) But given y, you cannot easily calculate x such that y = H(x), we call H is irreversible Given y, tell me how many x can be transformed to y

Why Exhaustion Simple Less Error Prone … But that may take a LONG TIME.

Not that simple The way you exhaust matters Case Study 2 Narrow Range Broadband Given all clients’ positions as well as the profits that can be made from each of them You can only setup one server station with limited transmission distance Give the best possible position and the profit for the company

Case Study 2 Give the best possible position and the profit for the company Any definite answer, first? The more the clients it covers, the better? Map size: at most 100 x 100 (w x h) Number of clients: at most 1000 (n) Maximum distance: 200 (d) Manhatten Distance:

Case Study 2 Give the best possible position and the profit for the company Solution 1 Each position can be the best For each position Find from its reachable distance Add profit if that position is a client Complexity?

Case Study 2 Give the best possible position and the profit for the company Solution 1 Complexity? Can we be faster?

Case Study 2 Give the best possible position and the profit for the company Solution 2 A client is served if a server can reach it within d units Similarly, if a client can reach the server d units, it is served By exploiting the fact that distance is symmetric, one can achieve an algorithm Any faster algorithm?

Summary If you cannot figure out fast way to solve a given problem (may or may not exist), try brute force For small case (usually 30%~50%), they are designed for brute force purposes Exhaust in a smart way

Tricks Pre-process Memorization MRV (Minimum Remaining Values) –Aka. MCV (Most Constrained Variables) LCV (Least Constraining Value)

Branch and Bound Basically like exhaustion Try to be faster –Prune sub-optimal searching early

Branch and Bound Idea: “Estimate” the best solution of the current Search Tree with a heuristic function If the estimation says this search tree will not produce better result, give up on it… Well… is it possible that we miss the optimal solution if we give up on some search tree?

Branch and Bound An admissible heuristic function is a heuristic function that never over- estimates It can be proved that if a admissible heuristic function is used, the result is always optimal

Examples Bin Packing

Divide and Conquer Three steps – Divide, Conquer, and Combine –Divide: Breaks the problem into some sub-problems –Conquer: Solve individual sub-problems –Combine: Use solutions to sub-problems to construct a solution to the original problem Question: How are sub-problems solved?

Examples (D&C) Finding Max and Min in a list of numbers Merge Sort Quick Sort L-Block

Mergesort

Maximum Consecutive Sum Given a sequence of numbers, find a consecutive subsequence, such that its total sum is largest.

Fast Exponentiation

Given a plane of points, find the distance of the closest pair Closest Pair

Closet Pair

Appendix Complexity: Master Theorem