CS 312: Algorithm Design & Analysis Lecture #24: Optimality, Gene Sequence Alignment This work is licensed under a Creative Commons Attribution-Share Alike.

Slides:



Advertisements
Similar presentations
Dynamic Programming In this handout A shortest path example
Advertisements

Algorithms + L. Grewe.
Optimization of thermal processes2007/2008 Optimization of thermal processes Maciej Marek Czestochowa University of Technology Institute of Thermal Machinery.
CS Section 600 CS Section 002 Dr. Angela Guercio Spring 2010.
4-step Model – Trip Assignment 1CVEN672 Lecture 13-1.
KNAPSACK PROBLEM A dynamic approach. Knapsack Problem  Given a sack, able to hold K kg  Given a list of objects  Each has a weight and a value  Try.
Today’s quiz on 8.2 B Graphing Worksheet 2 will be given at the end of class. You will have 12 minutes to complete this quiz, which will consist of one.
CS 312: Algorithm Analysis Lecture #16: Strongly Connected Components This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
David Luebke 1 8/23/2015 CS 332: Algorithms Greedy Algorithms.
Instructor: Dr. Sahar Shabanah Fall Lectures ST, 9:30 pm-11:00 pm Text book: M. T. Goodrich and R. Tamassia, “Data Structures and Algorithms in.
Nattee Niparnan Dept. of Computer Engineering, Chulalongkorn University.
CS223 Algorithms D-Term 2013 Instructor: Mohamed Eltabakh WPI, CS Introduction Slide 1.
CS 312: Algorithm Analysis Lecture #3: Algorithms for Modular Arithmetic, Modular Exponentiation This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis
CS 312: Algorithm Design & Analysis Lecture #34: Branch and Bound Design Options for Solving the TSP: Tight Bounds This work is licensed under a Creative.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CS 312: Algorithm Design & Analysis Lecture #17: Connectedness in Graphs This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
Dynamic Programming. Well known algorithm design techniques:. –Divide-and-conquer algorithms Another strategy for designing algorithms is dynamic programming.
Fundamentals of Algorithms MCS - 2 Lecture # 7
Dr. Naveed Ahmad Assistant Professor Department of Computer Science University of Peshawar.
CS 312: Algorithm Analysis Lecture #8: Non-Homogeneous Recurrence Relations This work is licensed under a Creative Commons Attribution-Share Alike 3.0.
1 Summary: Design Methods for Algorithms Andreas Klappenecker.
CS 312: Algorithm Analysis Lecture #32: Intro. to State-Space Search This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Design & Analysis Lecture #23: Making Optimal Change with Dynamic Programming Slides by: Eric Ringger, with contributions from Mike Jones,
CS 312: Algorithm Design & Analysis Lecture #12: Average Case Analysis of Quicksort This work is licensed under a Creative Commons Attribution-Share Alike.
CS 312: Algorithm Analysis Lecture #1: Algorithms and Efficiency This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CSC 413/513: Intro to Algorithms Greedy Algorithms.
+ Review CS302 Spring 2013 David Kauchak. + Admin Final posted on the course web page on Monday due Sunday at 11:59pm time-boxed (3-4 hours) You may use:
Honors Track: Competitive Programming & Problem Solving Optimization Problems Kevin Verbeek.
CS 312: Algorithm Design & Analysis Lecture #2: Asymptotic Notation This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Please CLOSE YOUR LAPTOPS, and turn off and put away your cell phones, and get out your note- taking materials.
MA/CSSE 473 Day 28 Dynamic Programming Binomial Coefficients Warshall's algorithm Student questions?
CS 312: Algorithm Design & Analysis Lecture #35: Branch and Bound Design Options: State Spaces Slides by: Eric Ringger, with contributions from Mike Jones,
Greedy Algorithms. What is “Greedy Algorithm” Optimization problem usually goes through a sequence of steps A greedy algorithm makes the choice looks.
CS 312: Algorithm Analysis Lecture #1: Algorithms and Efficiency This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CS 312: Algorithm Design & Analysis Lecture #37: A* (cont.); Admissible Heuristics Credit: adapted from slides by Stuart Russell of UC Berkeley. This work.
Tuesday, April 30 Dynamic Programming – Recursion – Principle of Optimality Handouts: Lecture Notes.
Lecture #9: Introduction to Markov Chain Monte Carlo, part 3
Slides by: Eric Ringger, adapted from slides by Stuart Russell of UC Berkeley. CS 312: Algorithm Design & Analysis Lecture #36: Best-first State- space.
1 Dynamic Programming Topic 07 Asst. Prof. Dr. Bunyarit Uyyanonvara IT Program, Image and Vision Computing Lab. School of Information and Computer Technology.
Computer Sciences Department1.  Property 1: each node can have up to two successor nodes (children)  The predecessor node of a node is called its.
CS 312: Algorithm Analysis Lecture #7: Recurrence Relations a.k.a. Difference Equations Slides by: Eric Ringger, with contributions from Mike Jones, Eric.
CS 312: Algorithm Analysis Lecture #8: Non-Homogeneous Recurrence Relations This work is licensed under a Creative Commons Attribution-Share Alike 3.0.
CS 312: Algorithm Analysis Lecture #33: Branch and Bound, Job Assignment This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS38 Introduction to Algorithms Lecture 10 May 1, 2014.
CS 312: Algorithm Analysis
CS 312: Algorithm Analysis Lecture #31: Linear Programming: the Simplex Algorithm, part 2 This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis Lecture #35: Branch and Bound Design Options - State Spaces Slides by: Eric Ringger, with contributions from Mike Jones, Eric.
CS 312: Algorithm Analysis Lecture #31: Linear Programming: the Simplex Algorithm, part 2 This work is licensed under a Creative Commons Attribution-Share.
CS 312: Algorithm Analysis Lecture #4: Primality Testing, GCD This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Fundamental Data Structures and Algorithms Ananda Guna March 18, 2003 Dynamic Programming Part 1.
CS 312: Algorithm Analysis Lecture #9: Recurrence Relations - Change of Variable Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer,
1 Algorithms CSCI 235, Fall 2015 Lecture 29 Greedy Algorithms.
CS 312: Algorithm Design & Analysis Lecture #26: 0/1 Knapsack This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
CS 312: Algorithm Design & Analysis Lecture #29: Network Flow and Cuts This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported.
CS 312: Algorithm Analysis Lecture #30: Linear Programming: Intro. to the Simplex Algorithm This work is licensed under a Creative Commons Attribution-Share.
9/27/10 A. Smith; based on slides by E. Demaine, C. Leiserson, S. Raskhodnikova, K. Wayne Adam Smith Algorithm Design and Analysis L ECTURE 16 Dynamic.
CS 312: Algorithm Analysis Lecture #27: Network Flow This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative.
Greedy Algorithms Many of the slides are from Prof. Plaisted’s resources at University of North Carolina at Chapel Hill.
Data Structures Lab Algorithm Animation.
Dynamic Programming Sequence of decisions. Problem state.
Lecture 5 Dynamic Programming
CS 3343: Analysis of Algorithms
Lecture 5 Dynamic Programming
CS 3343: Analysis of Algorithms
Advanced Analysis of Algorithms
CSE 326: Data Structures Lecture #24 The Algorhythmics
Bioinformatics Algorithms and Data Structures
Presentation transcript:

CS 312: Algorithm Design & Analysis Lecture #24: Optimality, Gene Sequence Alignment This work is licensed under a Creative Commons Attribution-Share Alike 3.0 Unported License.Creative Commons Attribution-Share Alike 3.0 Unported License Slides by: Eric Ringger, with contributions from Mike Jones, Eric Mercer, Sean Warnick

Announcements  Homework #15 due now  Project #5: Gene Sequence Alignment  Kick-off: today  Read directions now  Whiteboard experience: due Monday  Early: Monday after mid-term exam  Due: Wednesday after mid-term exam  Mid-term Exam  Start preparing your one page of notes  Must be prepared by you. No cutting and pasting.

Objectives  Revisit the main ideas behind Dynamic Programming  Define the optimality property for DP  Develop the algorithm for gene sequence alignment (or at least begin)  Prepare for Project #5

Dynamic Programming The six steps: 1.Ask: am I solving an optimization problem? 2.Devise a minimal description (address) for any problem instance and sub-problem 3.Divide problems into sub-problems: define the recurrence to specify the relationship of problems to sub-problems 4.Check that the optimality property holds: An optimal solution to a problem is built from optimal solutions to sub- problems. 5.Store results – typically in a table – and re-use the solutions to sub-problems in the table as you build up to the overall solution. 6.Back-trace / analyze the table to extract the composition of the final solution.

Optimality Property An optimal solution to a problem is built from optimal solutions to sub-problems.  The optimality property is a necessary condition for solving an optimization problem by DP!  It allows us to store and re-use optimal results to sub-problems.

Optimality A BC EFG HI D JK

Shortest Path American Fork Orem Provo Sundance Geneva Goal: the shortest path from AF to Provo. Does this problem exhibit the optimality property? Pair up. Discuss

Shortest Path American Fork Orem Provo Sundance Geneva Goal: the shortest path from AF to Provo. Does this problem exhibit the optimality property? Pair up. Discuss

Questions  Q. In general, do you know which sub-problem solutions to use in advance?  A. No. So a very greedy algorithm is not an option. (But Dijkstra’s is.)  Q: How does having a table of intermediate shortest path results help find the shortest path from AF to Provo?  A: Reuse those results for intermediate destinations as you try different routes.  Q. Do you have to reconsider alternative sub-optimal solutions for the intermediate destinations?  A. No  Thus,, the Optimality Property holds  Therefore, the shortest path problem can be solved by DP. American Fork Orem Provo Sundance Geneva

Optimality in Driving The shortest route from American Fork to Provo passes through Orem. Assume we have found this route. Then what can we say about the shortest route from AF to Orem? It follows that optimal route from AF to Provo. Could it be otherwise?

A related problem Now suppose you drive from AF to Orem as fast as you can on your way to Provo, But you are limited by the gas in your tank.

Does the Optimality Property Hold? AFOremProvo Goal: get to Provo in as little time as possible. No refueling. Does this problem (formulation) satisfy the optimality property or not? Why? 5/9 10/5 20/1 5/9 10/5 20/1 “takes 20 minutes using 1 gallon of gas” Start with 10 gallons

Problem Solving Advice  Start by asking: which sub-problems should be solved?  If you know how to choose in advance using local information only, then  greedy might work.  Else if sub-problems don’t overlap, then  divide and conquer would be a good choice.  Else if the optimality property holds, then  DP is a good choice.  Else the optimality property does NOT hold, so  apply another strategy. (Stay tuned for more guidance) Important!

x=ACGCTGA y=ACTGT Gene Sequence Alignment

Virtually Identical Problems  Edit Distance  aka Levenshtein Distance  Sequence Alignment  E.g., Gene Sequence Alignment  Fundamentally the same thing!  We’re focusing on gene sequence alignment.

Edit Distance / Sequence Alignment Problem Contrast the 2 perspectives.

Edit Distance / Sequence Alignment Problem x: ACGCT-C y: A--CTGT Alignment Example: The ‘-’ is a “gap”

Edit Distance / Sequence Alignment Problem x: ACGCT-C y: A--CTGT Divide into Pairs

Edit Distance / Sequence Alignment Problem x: ACGCT-C y: A--CTGT Each Pair has a type and a cost

x: ACGCT-C y: A--CTGT Edit Distance / Sequence Alignment Problem

x: ACGCT-C y: A--CTGT Edit Distance / Sequence Alignment Problem

x: ACGCT-C y: A--CTGT

Edit Distance / Sequence Alignment Problem x: ACGCT-C y: A--CTGT

Edit Distance / Sequence Alignment Problem x: ACGCT-C y: A--CTGT How would you solve this problem?

Solution Ideas  Enumerate all and score  Pro: Easy to code  Pro: Optimal  Con: exponential  Greedy: work from left to right, gobbling up matches and inserting gaps or allowing substitutions as necessary  Pro: Easy  Pro: Linear = fast / efficient  Con: not optimal  DP  Pre-req: optimality property  Pre-req: define addressable sub-problems  Pre-req: determine relationship between problem and sub-problems  Pro: Optimal  Con: ?  Divide and Conquer?

Designing the DP Algorithm for Gene Sequence Alignment

DP?

Example: Sub-problems x=ACGCTGA y=ACTGT

Example: Sub-problems x=ACGCTGA y=ACTGT

Example: Sub-problems x=ACGCTGA y=ACTGT

 To be continued in Lecture #25

Assignment  HW #16  Read Section 6.3, if you haven’t done so already.  Thursday: Screencast & Quiz