(tree searching technique) (Boolean formulas) satisfying assignment: (X 1, X 2 )

Size: px
Start display at page:

Download "(tree searching technique) (Boolean formulas) satisfying assignment: (X 1, X 2 )"

Transcription

1 Algorithms Chapter 5: The Tree Searching Strategy - Examples 1 / 11 Chapter 5: The Tree Searching Strategy 1. Ex 5.1Determine the satisfiability of the following Boolean formulas by depth-first search tree searching technique. (depth-first search) (tree searching technique) (Boolean formulas) (satisfiability) (a) ( X1 X 2 X ) ( X1 X ) ( X 2 ) (b) ( X1 X 2 X ) ( X1 X 2 ) ( X 2 X ) ( X ) (c) ( X1 X 2 X ) ( X1 X 2 X ) (d) ( X1 X 2 ) ( X 2 X ) ( X ) We apply the depth-first search. (a) satisfiable (b) unsatisfiable satisfying assignment: (X 1, X 2 ) X 1 =T X 1 =F X 2 =T X 2 =F X 2 =T X 2 =F X =T X =F X =T X =F X =T X =F X =T X =F (4) (c) satisfiable () (4) (1) (4) () (4) (2)

2 Algorithms Chapter 5: The Tree Searching Strategy - Examples 2 / 11 satisfying assignment: (X 1, X 2, -X ) (d) satisfiable satisfying assignment: (X 1, -X 2, -X ) 2. Ex 5.2Consider the following graph. Find a Hamiltonian cycle by some kind of tree searching technique. (tree searching technique) (Hamiltonian cycle) The searching tree with respect to the graph, starting from node 1 is as follows. It can be seen from the searching tree that there are two Hamiltonian cycles for this graph. One is and the other is They are exactly the same.

3 Algorithms Chapter 5: The Tree Searching Strategy - Examples / 11. Ex 5.Solve the following sum of subset problem. S = {7, 1, 4, 6, 14, 25, 5, 8} and M = 18. Find a sum whose elements add up to M by using the depth-first search strategy. We adopt the depth-first search in the branch-and-bound strategy. The searching tree is as follows. A branch is valid only when the accumulated sum of the selected elements is less than or equal to 18. This accumulated sum is annotated inside each node. We find a subset of S, that is, {7, 1, 4, 6}, whose sum is exactly 18 so that the searching stops. 4. Ex 5.4 Solve the 8-puzzle problem which tests with the following initial state.

4 Algorithms Chapter 5: The Tree Searching Strategy - Examples 4 / Note that our final goal is Note that (1) the evaluation function f(n) be defined as f(n) = w(n), where w(n) is the number of misplaced tiles in node n, and (2) you must expand at least 4 levels. Let the evaluation function f(n) be defined as f(n) = w(n), where w(n) is the number of misplaced tiles in node n. We apply the hill climbing method to expand the searching tree. The partially expanded searching tree is shown in the following. Note that the value of f(n) is annotated beside node n (5) (4) 8 1 (6) () 8 4 (4) (4)

5 Algorithms Chapter 5: The Tree Searching Strategy - Examples 5 / Ex 5.5Find the shortest path from v 0 to v 8 in the following graph by the branch-and-bound strategy. (branch-and-bound strategy) v 0 v 8 (shortest path) v v 1 v 2 v v 5 v v 8 v 4 v 7 We apply the depth-first search in the branch-and-bound strategy and we illustrate the searching tree as follows. We indicate the branching sequence of each node at its left side. It is seen that at the th branching node we obtain a path from v 0 to v 8 with weight 6 based upon which branching nodes 4, 6, 7, 8, and 10 can be bounded. Since all branches have been expanded or bounded we have a shortest path from v 0 to v 8 with weight >6 bound v 5 v 6 v 5 v 7 v 7 2 v 8 goal weight=6 v 0 v 1 v 2 v >6 bound 1 >6 bound >6 bound 4 v 4 >6 bound 6. Ex 5.6Given the following distance (cost) matrix, please solve the traveling salesperson problem on it by the branch-and-bound strategy. (You must expand at least 2 levels) a b c d a 9 7

6 Algorithms Chapter 5: The Tree Searching Strategy - Examples 6 / 11 b 6 5 c d The represented directed graph: 9 a 7 d b 6 c 6 The reduced cost matrix: (cost matrix 1 0) a b c d a 9 7 b 6 5 c d a b c d a 0 6 b 0 1 c d 5 0 lower bound = (++5+4)+1 = 16 ( cost, i.e., solution 16) 1st row C 12 or -1: C 12 reduced cost matrix cost matrix: a b c d a 6 b 0 1 c 0 1 0

7 Algorithms Chapter 5: The Tree Searching Strategy - Examples 7 / 11 d a b c d a 0 b 0 1 c d lower bound = 16+(+1) = 20 ( cost, i.e., solution 20) -2: C 12 edge (2, 1) Hamiltonian cycle C 21 = 1 2 reduced cost matrix cost matrix: a c d b 1 1 c 0 0 d 5 0 a c d b 2 0 c 0 0 d 5 0 lower bound = 16+(1) = 17 ( cost, i.e., solution 17) binary decision tree(branch-and-bound strategy) (OPT) binary decision tree:

8 Algorithms Chapter 5: The Tree Searching Strategy - Examples 8 / 11 solutions LB = 17 C 12 LB = 20 C 12 LB = 17 C 24 C 24 LB = 19 LB = 17 C 4 C 4 No solution LB = 17 C 1 No solution C 1 (1) Branch = LB nodeexpanding (2) An upper bound 17 is obtained. (optimal solution ) () nodelb (17) expand( optimal) (4) optimal solution = 17: a b d c a 7. Ex 5.7The following is an instance of 0/1 Knapsack problem, where p i is the profit when putting object i into knapsack, w i is the weight of object i, and M = 15 is the capacity of knapsack for 1 i 4. Please use the branch-and-bound strategy to solve this problem. i p i w i We first transfer the original problem to the following: minimize 1 i 4 p i x i, subject to 1 i 4 w i x i M for x i = 0 or 1. Initially, a lower bound and an upper bound are found. -1: lower bound (LB, optimal solution ) use the greedy strategy to find it (see Sec..7) i p i /w i x i /9 A lower bound = (p 1 +p 2 +p +/9*p 4 ) = (2+6) = 8-2: upper bound (UB, solution> optimal) use the greedy strategy to find it s = 0; for i = 1 to 4 do if s+w i M = 15 then

9 Algorithms Chapter 5: The Tree Searching Strategy - Examples 9 / 11 s = s+w i ; x i = 1; else x i = 0; By the above procedure, we obtain a feasible solution (x 1, x 2, x, x 4 ) = (1, 1, 1, 0). Then, an upper bound (p 1 +p 2 +p ) = ( ) = 2 is obtained. Branch-and-bound strategy: Branch strategy: the best LB ( ) and then the lowest UB ( ) of node is expanded. UB = 2 LB = 8 UB = 2 0 LB = 8 x 1 =1 x 1 =0 UB = 2 UB: (x 1 2 1, x 2, x, x 4 ) = (0, 1, 1, 0) = 22 LB = 8 LB: (x 1, x 2, x, x 4 ) = (0, 1, 1, 5/9) = 2 x 2 =1 x 2 =0 LB > node 7 UB = 2 UB: (x 1, x 2, x, x 4 ) = (1, 0, 1, 0) = 2 4 UB, LB = 8 LB: (x 1, x 2, x, x 4 ) = (1, 0, 1, 7/9) = 6 x =1 x =0 expand UB: (x 1, x 2, x, x 4 ) = (1, 1, 0, 1) = LB: (x 1, x 2, x, x 4 ) = (1, 1, 0, 1) = 8 x 4 =1 x 4 =0 UB = 8 UB: (x 1, x 2, x, x 4 ) = (1, 1, 0, 0) = 20 LB = LB: (x 1, x 2, x, x 4 ) = (1, 1, 0, 0) = 20 The optimal solution is 8, where (x 1, x 2, x, x 4 ) = (1, 1, 0, 1). Then, the original solution is 8.

10 Algorithms Chapter 5: The Tree Searching Strategy - Examples 10 / 11 Chapter 6: The Prune-and-Search Strategy 1. Ex 6.1Given a set S of n elements and an integer k, the selection problem is to find the k-th smallest element of S. Please design an O(n) time algorithm to solve the selection problem. Note that you must design an algorithm and then analyze its time complexity. (a) The algorithm Prune-and-Search Algorithm Input: A set S of n elements. Output: The k-th smallest element of S. Method. Step 1: Divide S into n/5 subsets. Each subset contains five elements. Add some dummy elements to the last subset if n is not a net multiple of S. Step 2: Sort each subset of elements. Step : Find the element p which is the median of the medians of the n/5 subsets. Step 4: Partition S into S 1, S 2 and S, which contain the elements less than, equal to, and greater than p, respectively. Step 5: If S 1 k, then discard S 2 and S and solve the problem that selects the k-th smallest element from S 1 during the next iteration; else if S 1 + S 2 k, then p is the k-th smallest element of S; otherwise, let k = k S 1 S 2, solve the problem that selects the k -th smallest element from S during the next iteration. (b) The analysis of the algorithm We first show that S 1 n/4 and S n/4 by the following figure: At least 1/4 of S known to be less than or equal to p. Each 5-element subset is sorted in non-decreasing sequence. p M At least 1/4 of S known to be greater than or equal to p. Then, at least n/4 elements are pruned away during each iteration. The problem remaining in Step 5 contains at most n/4 elements. Let T(n) be the time complexity of the algorithm. Then, Step takes T(n/5) time, Step 5 takes T(n/4), and the remaining

11 Algorithms Chapter 5: The Tree Searching Strategy - Examples 11 / 11 steps take O(n) time. Thus, we obtain the following recurrence. T(n) = T(n/4) + T(n/5) + O(n) (1) To solve the above recurrence, we set T(n) = a 0 + a 1 n + a 2 n , where a 1 0. Then, T(n/4) = a 0 + (/4)a 1 n + (9/16)a 2 n (2) T(n/5) = a 0 + (1/5)a 1 n + (1/25)a 2 n () T((n/4)+(n/5)) = T(19n/20) = a 0 + (19/20)a 1 n + (61/400) a 2 n +... (4) By Equations (2) (4), we obtain T(n/4)+T(n/5) a 0 + T(19n/20) and hence, T(n) = T(n/4) + T(n/5) + O(n) T(19n/20) +cn cn + (19/20)cn + T((19/20) 2 n)... cn + (19/20)cn + (19/20) 2 cn (19/20) p cn + T((19/20) p+1 n) (note: (19/20) p+1 n 1 (19/20) p n) 19 p+ 1 1 ( ) 20 = cn + b 20cn + b = O(n).

maxz = 3x 1 +4x 2 2x 1 +x 2 6 2x 1 +3x 2 9 x 1,x 2

maxz = 3x 1 +4x 2 2x 1 +x 2 6 2x 1 +3x 2 9 x 1,x 2 ex-5.-5. Foundations of Operations Research Prof. E. Amaldi 5. Branch-and-Bound Given the integer linear program maxz = x +x x +x 6 x +x 9 x,x integer solve it via the Branch-and-Bound method (solving

More information

min3x 1 + 4x 2 + 5x 3 2x 1 + 2x 2 + x 3 6 x 1 + 2x 2 + 3x 3 5 x 1, x 2, x 3 0.

min3x 1 + 4x 2 + 5x 3 2x 1 + 2x 2 + x 3 6 x 1 + 2x 2 + 3x 3 5 x 1, x 2, x 3 0. ex-.-. Foundations of Operations Research Prof. E. Amaldi. Dual simplex algorithm Given the linear program minx + x + x x + x + x 6 x + x + x x, x, x. solve it via the dual simplex algorithm. Describe

More information

Algorithm Design Strategies V

Algorithm Design Strategies V Algorithm Design Strategies V Joaquim Madeira Version 0.0 October 2016 U. Aveiro, October 2016 1 Overview The 0-1 Knapsack Problem Revisited The Fractional Knapsack Problem Greedy Algorithms Example Coin

More information

Multi-objective branch-and-cut algorithm and multi-modal traveling salesman problem

Multi-objective branch-and-cut algorithm and multi-modal traveling salesman problem Multi-objective branch-and-cut algorithm and multi-modal traveling salesman problem Nicolas Jozefowiez 1, Gilbert Laporte 2, Frédéric Semet 3 1. LAAS-CNRS, INSA, Université de Toulouse, Toulouse, France,

More information

Unit 1A: Computational Complexity

Unit 1A: Computational Complexity Unit 1A: Computational Complexity Course contents: Computational complexity NP-completeness Algorithmic Paradigms Readings Chapters 3, 4, and 5 Unit 1A 1 O: Upper Bounding Function Def: f(n)= O(g(n)) if

More information

where X is the feasible region, i.e., the set of the feasible solutions.

where X is the feasible region, i.e., the set of the feasible solutions. 3.5 Branch and Bound Consider a generic Discrete Optimization problem (P) z = max{c(x) : x X }, where X is the feasible region, i.e., the set of the feasible solutions. Branch and Bound is a general semi-enumerative

More information

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University

Algorithms. NP -Complete Problems. Dong Kyue Kim Hanyang University Algorithms NP -Complete Problems Dong Kyue Kim Hanyang University dqkim@hanyang.ac.kr The Class P Definition 13.2 Polynomially bounded An algorithm is said to be polynomially bounded if its worst-case

More information

CS Analysis of Recursive Algorithms and Brute Force

CS Analysis of Recursive Algorithms and Brute Force CS483-05 Analysis of Recursive Algorithms and Brute Force Instructor: Fei Li Room 443 ST II Office hours: Tue. & Thur. 4:30pm - 5:30pm or by appointments lifei@cs.gmu.edu with subject: CS483 http://www.cs.gmu.edu/

More information

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35.

NP-Completeness. f(n) \ n n sec sec sec. n sec 24.3 sec 5.2 mins. 2 n sec 17.9 mins 35. NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9

Computational Complexity and Intractability: An Introduction to the Theory of NP. Chapter 9 1 Computational Complexity and Intractability: An Introduction to the Theory of NP Chapter 9 2 Objectives Classify problems as tractable or intractable Define decision problems Define the class P Define

More information

CS Algorithms and Complexity

CS Algorithms and Complexity CS 50 - Algorithms and Complexity Linear Programming, the Simplex Method, and Hard Problems Sean Anderson 2/15/18 Portland State University Table of contents 1. The Simplex Method 2. The Graph Problem

More information

Question Paper Code :

Question Paper Code : www.vidyarthiplus.com Reg. No. : B.E./B.Tech. DEGREE EXAMINATION, NOVEMBER/DECEMBER 2011. Time : Three hours Fourth Semester Computer Science and Engineering CS 2251 DESIGN AND ANALYSIS OF ALGORITHMS (Regulation

More information

Introduction to Mathematical Programming IE406. Lecture 21. Dr. Ted Ralphs

Introduction to Mathematical Programming IE406. Lecture 21. Dr. Ted Ralphs Introduction to Mathematical Programming IE406 Lecture 21 Dr. Ted Ralphs IE406 Lecture 21 1 Reading for This Lecture Bertsimas Sections 10.2, 10.3, 11.1, 11.2 IE406 Lecture 21 2 Branch and Bound Branch

More information

Integer Linear Programming

Integer Linear Programming Integer Linear Programming Solution : cutting planes and Branch and Bound Hugues Talbot Laboratoire CVN April 13, 2018 IP Resolution Gomory s cutting planes Solution branch-and-bound General method Resolution

More information

8.5 Sequencing Problems

8.5 Sequencing Problems 8.5 Sequencing Problems Basic genres. Packing problems: SET-PACKING, INDEPENDENT SET. Covering problems: SET-COVER, VERTEX-COVER. Constraint satisfaction problems: SAT, 3-SAT. Sequencing problems: HAMILTONIAN-CYCLE,

More information

MVE165/MMG630, Applied Optimization Lecture 6 Integer linear programming: models and applications; complexity. Ann-Brith Strömberg

MVE165/MMG630, Applied Optimization Lecture 6 Integer linear programming: models and applications; complexity. Ann-Brith Strömberg MVE165/MMG630, Integer linear programming: models and applications; complexity Ann-Brith Strömberg 2011 04 01 Modelling with integer variables (Ch. 13.1) Variables Linear programming (LP) uses continuous

More information

More on NP and Reductions

More on NP and Reductions Indian Institute of Information Technology Design and Manufacturing, Kancheepuram Chennai 600 127, India An Autonomous Institute under MHRD, Govt of India http://www.iiitdm.ac.in COM 501 Advanced Data

More information

Optimisation and Operations Research

Optimisation and Operations Research Optimisation and Operations Research Lecture 15: The Greedy Heuristic Matthew Roughan http://www.maths.adelaide.edu.au/matthew.roughan/ Lecture_notes/OORII/ School of

More information

NP-Completeness. NP-Completeness 1

NP-Completeness. NP-Completeness 1 NP-Completeness Reference: Computers and Intractability: A Guide to the Theory of NP-Completeness by Garey and Johnson, W.H. Freeman and Company, 1979. NP-Completeness 1 General Problems, Input Size and

More information

CS325: Analysis of Algorithms, Fall Final Exam

CS325: Analysis of Algorithms, Fall Final Exam CS: Analysis of Algorithms, Fall 0 Final Exam I don t know policy: you may write I don t know and nothing else to answer a question and receive percent of the total points for that problem whereas a completely

More information

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2)

Algorithms and Theory of Computation. Lecture 22: NP-Completeness (2) Algorithms and Theory of Computation Lecture 22: NP-Completeness (2) Xiaohui Bei MAS 714 November 8, 2018 Nanyang Technological University MAS 714 November 8, 2018 1 / 20 Set Cover Set Cover Input: a set

More information

CS6901: review of Theory of Computation and Algorithms

CS6901: review of Theory of Computation and Algorithms CS6901: review of Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational

More information

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 0, Winter 08 Design and Analysis of Algorithms Lecture 8: Consolidation # (DP, Greed, NP-C, Flow) Class URL: http://vlsicad.ucsd.edu/courses/cse0-w8/ Followup on IGO, Annealing Iterative Global Optimization

More information

This observation leads to the following algorithm.

This observation leads to the following algorithm. 126 Andreas Jakoby A Bounding-Function for the Knapsack Problem Finding a useful bounding-function is for most problems a difficult task. Let us consider the Knapsack Problem: Let us consider the version

More information

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P

Easy Problems vs. Hard Problems. CSE 421 Introduction to Algorithms Winter Is P a good definition of efficient? The class P Easy Problems vs. Hard Problems CSE 421 Introduction to Algorithms Winter 2000 NP-Completeness (Chapter 11) Easy - problems whose worst case running time is bounded by some polynomial in the size of the

More information

Lecture 23 Branch-and-Bound Algorithm. November 3, 2009

Lecture 23 Branch-and-Bound Algorithm. November 3, 2009 Branch-and-Bound Algorithm November 3, 2009 Outline Lecture 23 Modeling aspect: Either-Or requirement Special ILPs: Totally unimodular matrices Branch-and-Bound Algorithm Underlying idea Terminology Formal

More information

3.4 Relaxations and bounds

3.4 Relaxations and bounds 3.4 Relaxations and bounds Consider a generic Discrete Optimization problem z = min{c(x) : x X} with an optimal solution x X. In general, the algorithms generate not only a decreasing sequence of upper

More information

Chapter 8 Dynamic Programming

Chapter 8 Dynamic Programming Chapter 8 Dynamic Programming Copyright 2007 Pearson Addison-Wesley. All rights reserved. Dynamic Programming Dynamic Programming is a general algorithm design technique for solving problems defined by

More information

Intractable Problems Part Two

Intractable Problems Part Two Intractable Problems Part Two Announcements Problem Set Five graded; will be returned at the end of lecture. Extra office hours today after lecture from 4PM 6PM in Clark S250. Reminder: Final project goes

More information

CSC 8301 Design & Analysis of Algorithms: Lower Bounds

CSC 8301 Design & Analysis of Algorithms: Lower Bounds CSC 8301 Design & Analysis of Algorithms: Lower Bounds Professor Henry Carter Fall 2016 Recap Iterative improvement algorithms take a feasible solution and iteratively improve it until optimized Simplex

More information

Dynamic Programming. Cormen et. al. IV 15

Dynamic Programming. Cormen et. al. IV 15 Dynamic Programming Cormen et. al. IV 5 Dynamic Programming Applications Areas. Bioinformatics. Control theory. Operations research. Some famous dynamic programming algorithms. Unix diff for comparing

More information

Advanced Analysis of Algorithms - Midterm (Solutions)

Advanced Analysis of Algorithms - Midterm (Solutions) Advanced Analysis of Algorithms - Midterm (Solutions) K. Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@csee.wvu.edu} 1 Problems 1. Solve the following recurrence using substitution:

More information

Note that M i,j depends on two entries in row (i 1). If we proceed in a row major order, these two entries will be available when we are ready to comp

Note that M i,j depends on two entries in row (i 1). If we proceed in a row major order, these two entries will be available when we are ready to comp CSE 3500 Algorithms and Complexity Fall 2016 Lecture 18: October 27, 2016 Dynamic Programming Steps involved in a typical dynamic programming algorithm are: 1. Identify a function such that the solution

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity CS 350 Algorithms and Complexity Winter 2019 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm

Outline. 1 NP-Completeness Theory. 2 Limitation of Computation. 3 Examples. 4 Decision Problems. 5 Verification Algorithm Outline 1 NP-Completeness Theory 2 Limitation of Computation 3 Examples 4 Decision Problems 5 Verification Algorithm 6 Non-Deterministic Algorithm 7 NP-Complete Problems c Hu Ding (Michigan State University)

More information

0-1 Knapsack Problem in parallel Progetto del corso di Calcolo Parallelo AA

0-1 Knapsack Problem in parallel Progetto del corso di Calcolo Parallelo AA 0-1 Knapsack Problem in parallel Progetto del corso di Calcolo Parallelo AA 2008-09 Salvatore Orlando 1 0-1 Knapsack problem N objects, j=1,..,n Each kind of item j has a value p j and a weight w j (single

More information

CS 350 Algorithms and Complexity

CS 350 Algorithms and Complexity 1 CS 350 Algorithms and Complexity Fall 2015 Lecture 15: Limitations of Algorithmic Power Introduction to complexity theory Andrew P. Black Department of Computer Science Portland State University Lower

More information

Decision Trees. Lewis Fishgold. (Material in these slides adapted from Ray Mooney's slides on Decision Trees)

Decision Trees. Lewis Fishgold. (Material in these slides adapted from Ray Mooney's slides on Decision Trees) Decision Trees Lewis Fishgold (Material in these slides adapted from Ray Mooney's slides on Decision Trees) Classification using Decision Trees Nodes test features, there is one branch for each value of

More information

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved.

Chapter 4. Greedy Algorithms. Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. Chapter 4 Greedy Algorithms Slides by Kevin Wayne. Copyright 2005 Pearson-Addison Wesley. All rights reserved. 1 4.1 Interval Scheduling Interval Scheduling Interval scheduling. Job j starts at s j and

More information

Limitations of Algorithm Power

Limitations of Algorithm Power Limitations of Algorithm Power Objectives We now move into the third and final major theme for this course. 1. Tools for analyzing algorithms. 2. Design strategies for designing algorithms. 3. Identifying

More information

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502)

Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik. Combinatorial Optimization (MA 4502) Technische Universität München, Zentrum Mathematik Lehrstuhl für Angewandte Geometrie und Diskrete Mathematik Combinatorial Optimization (MA 4502) Dr. Michael Ritter Problem Sheet 1 Homework Problems Exercise

More information

Network Flows. 6. Lagrangian Relaxation. Programming. Fall 2010 Instructor: Dr. Masoud Yaghini

Network Flows. 6. Lagrangian Relaxation. Programming. Fall 2010 Instructor: Dr. Masoud Yaghini In the name of God Network Flows 6. Lagrangian Relaxation 6.3 Lagrangian Relaxation and Integer Programming Fall 2010 Instructor: Dr. Masoud Yaghini Integer Programming Outline Branch-and-Bound Technique

More information

Combinatorial optimization problems

Combinatorial optimization problems Combinatorial optimization problems Heuristic Algorithms Giovanni Righini University of Milan Department of Computer Science (Crema) Optimization In general an optimization problem can be formulated as:

More information

This means that we can assume each list ) is

This means that we can assume each list ) is This means that we can assume each list ) is of the form ),, ( )with < and Since the sizes of the items are integers, there are at most +1pairs in each list Furthermore, if we let = be the maximum possible

More information

VIII. NP-completeness

VIII. NP-completeness VIII. NP-completeness 1 / 15 NP-Completeness Overview 1. Introduction 2. P and NP 3. NP-complete (NPC): formal definition 4. How to prove a problem is NPC 5. How to solve a NPC problem: approximate algorithms

More information

D1 Discrete Mathematics The Travelling Salesperson problem. The Nearest Neighbour Algorithm The Lower Bound Algorithm The Tour Improvement Algorithm

D1 Discrete Mathematics The Travelling Salesperson problem. The Nearest Neighbour Algorithm The Lower Bound Algorithm The Tour Improvement Algorithm 1 iscrete Mathematics The Travelling Salesperson problem The Nearest Neighbour lgorithm The Lower ound lgorithm The Tour Improvement lgorithm The Travelling Salesperson: Typically a travelling salesperson

More information

CPS 616 DIVIDE-AND-CONQUER 6-1

CPS 616 DIVIDE-AND-CONQUER 6-1 CPS 616 DIVIDE-AND-CONQUER 6-1 DIVIDE-AND-CONQUER Approach 1. Divide instance of problem into two or more smaller instances 2. Solve smaller instances recursively 3. Obtain solution to original (larger)

More information

the tree till a class assignment is reached

the tree till a class assignment is reached Decision Trees Decision Tree for Playing Tennis Prediction is done by sending the example down Prediction is done by sending the example down the tree till a class assignment is reached Definitions Internal

More information

ECS122A Handout on NP-Completeness March 12, 2018

ECS122A Handout on NP-Completeness March 12, 2018 ECS122A Handout on NP-Completeness March 12, 2018 Contents: I. Introduction II. P and NP III. NP-complete IV. How to prove a problem is NP-complete V. How to solve a NP-complete problem: approximate algorithms

More information

Optimisation and Operations Research

Optimisation and Operations Research Optimisation and Operations Research Lecture 11: Integer Programming Matthew Roughan http://www.maths.adelaide.edu.au/matthew.roughan/ Lecture_notes/OORII/ School of Mathematical

More information

NP and Computational Intractability

NP and Computational Intractability NP and Computational Intractability 1 Polynomial-Time Reduction Desiderata'. Suppose we could solve X in polynomial-time. What else could we solve in polynomial time? don't confuse with reduces from Reduction.

More information

Introduction to integer programming II

Introduction to integer programming II Introduction to integer programming II Martin Branda Charles University in Prague Faculty of Mathematics and Physics Department of Probability and Mathematical Statistics Computational Aspects of Optimization

More information

1. Introduction Recap

1. Introduction Recap 1. Introduction Recap 1. Tractable and intractable problems polynomial-boundness: O(n k ) 2. NP-complete problems informal definition 3. Examples of P vs. NP difference may appear only slightly 4. Optimization

More information

Column Generation. i = 1,, 255;

Column Generation. i = 1,, 255; Column Generation The idea of the column generation can be motivated by the trim-loss problem: We receive an order to cut 50 pieces of.5-meter (pipe) segments, 250 pieces of 2-meter segments, and 200 pieces

More information

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005

CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 CSCE 750 Final Exam Answer Key Wednesday December 7, 2005 Do all problems. Put your answers on blank paper or in a test booklet. There are 00 points total in the exam. You have 80 minutes. Please note

More information

Quiz 3 Reminder and Midterm Results

Quiz 3 Reminder and Midterm Results Quiz 3 Reminder and Midterm Results Reminder: Quiz 3 will be in the first 15 minutes of Monday s class. You can use any resources you have during the quiz. It covers all four sections of Unit 3. It has

More information

EXACT ALGORITHMS FOR THE ATSP

EXACT ALGORITHMS FOR THE ATSP EXACT ALGORITHMS FOR THE ATSP Branch-and-Bound Algorithms: Little-Murty-Sweeney-Karel (Operations Research, ); Bellmore-Malone (Operations Research, ); Garfinkel (Operations Research, ); Smith-Srinivasan-Thompson

More information

Introduction. An Introduction to Algorithms and Data Structures

Introduction. An Introduction to Algorithms and Data Structures Introduction An Introduction to Algorithms and Data Structures Overview Aims This course is an introduction to the design, analysis and wide variety of algorithms (a topic often called Algorithmics ).

More information

Part III: Traveling salesman problems

Part III: Traveling salesman problems Transportation Logistics Part III: Traveling salesman problems c R.F. Hartl, S.N. Parragh 1/282 Motivation Motivation Why do we study the TSP? c R.F. Hartl, S.N. Parragh 2/282 Motivation Motivation Why

More information

Synthesis of 2-level Logic Exact and Heuristic Methods. Two Approaches

Synthesis of 2-level Logic Exact and Heuristic Methods. Two Approaches Synthesis of 2-level Logic Exact and Heuristic Methods Lecture 7: Branch & Bound Exact Two Approaches Find all primes Find a complete sum Find a minimum cover (covering problem) Heuristic Take an initial

More information

CS3719 Theory of Computation and Algorithms

CS3719 Theory of Computation and Algorithms CS3719 Theory of Computation and Algorithms Any mechanically (automatically) discretely computation of problem solving contains at least three components: - problem description - computational tool - analysis

More information

P,NP, NP-Hard and NP-Complete

P,NP, NP-Hard and NP-Complete P,NP, NP-Hard and NP-Complete We can categorize the problem space into two parts Solvable Problems Unsolvable problems 7/11/2011 1 Halting Problem Given a description of a program and a finite input, decide

More information

Mat 3770 Bin Packing or

Mat 3770 Bin Packing or Basic Algithm Spring 2014 Used when a problem can be partitioned into non independent sub problems Basic Algithm Solve each sub problem once; solution is saved f use in other sub problems Combine solutions

More information

Fundamentals of optimization problems

Fundamentals of optimization problems Fundamentals of optimization problems Dmitriy Serdyuk Ferienakademie in Sarntal 2012 FAU Erlangen-Nürnberg, TU München, Uni Stuttgart September 2012 Overview 1 Introduction Optimization problems PO and

More information

The P versus NP Problem. Ker-I Ko. Stony Brook, New York

The P versus NP Problem. Ker-I Ko. Stony Brook, New York The P versus NP Problem Ker-I Ko Stony Brook, New York ? P = NP One of the seven Millenium Problems The youngest one A folklore question? Has hundreds of equivalent forms Informal Definitions P : Computational

More information

Examination paper for TDT4120 Algorithms and Data Structures

Examination paper for TDT4120 Algorithms and Data Structures Examination paper for TDT4120 Algorithms and Data Structures Academic contact during examination Magnus Lie Hetland Phone 91851949 Examination date December 7, 2013 Examination time (from to) 0900 1300

More information

Decision Tree Learning

Decision Tree Learning Decision Tree Learning Berlin Chen Department of Computer Science & Information Engineering National Taiwan Normal University References: 1. Machine Learning, Chapter 3 2. Data Mining: Concepts, Models,

More information

CSE 202 Homework 4 Matthias Springer, A

CSE 202 Homework 4 Matthias Springer, A CSE 202 Homework 4 Matthias Springer, A99500782 1 Problem 2 Basic Idea PERFECT ASSEMBLY N P: a permutation P of s i S is a certificate that can be checked in polynomial time by ensuring that P = S, and

More information

Data Structures and Algorithms

Data Structures and Algorithms Data Structures and Algorithms Spring 2017-2018 Outline 1 Sorting Algorithms (contd.) Outline Sorting Algorithms (contd.) 1 Sorting Algorithms (contd.) Analysis of Quicksort Time to sort array of length

More information

Introduction to Bin Packing Problems

Introduction to Bin Packing Problems Introduction to Bin Packing Problems Fabio Furini March 13, 2015 Outline Origins and applications Applications: Definition: Bin Packing Problem (BPP) Solution techniques for the BPP Heuristic Algorithms

More information

with Binary Decision Diagrams Integer Programming J. N. Hooker Tarik Hadzic IT University of Copenhagen Carnegie Mellon University ICS 2007, January

with Binary Decision Diagrams Integer Programming J. N. Hooker Tarik Hadzic IT University of Copenhagen Carnegie Mellon University ICS 2007, January Integer Programming with Binary Decision Diagrams Tarik Hadzic IT University of Copenhagen J. N. Hooker Carnegie Mellon University ICS 2007, January Integer Programming with BDDs Goal: Use binary decision

More information

Complexity, P and NP

Complexity, P and NP Complexity, P and NP EECS 477 Lecture 21, 11/26/2002 Last week Lower bound arguments Information theoretic (12.2) Decision trees (sorting) Adversary arguments (12.3) Maximum of an array Graph connectivity

More information

Lecture 3: Decision Trees

Lecture 3: Decision Trees Lecture 3: Decision Trees Cognitive Systems II - Machine Learning SS 2005 Part I: Basic Approaches of Concept Learning ID3, Information Gain, Overfitting, Pruning Lecture 3: Decision Trees p. Decision

More information

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD

CSE101: Design and Analysis of Algorithms. Ragesh Jaiswal, CSE, UCSD Greedy s Greedy s Shortest path Claim 2: Let S be a subset of vertices containing s such that we know the shortest path length l(s, u) from s to any vertex in u S. Let e = (u, v) be an edge such that 1

More information

0-1 Knapsack Problem

0-1 Knapsack Problem KP-0 0-1 Knapsack Problem Define object o i with profit p i > 0 and weight w i > 0, for 1 i n. Given n objects and a knapsack capacity C > 0, the problem is to select a subset of objects with largest total

More information

DAA Unit- II Greedy and Dynamic Programming. By Mrs. B.A. Khivsara Asst. Professor Department of Computer Engineering SNJB s KBJ COE, Chandwad

DAA Unit- II Greedy and Dynamic Programming. By Mrs. B.A. Khivsara Asst. Professor Department of Computer Engineering SNJB s KBJ COE, Chandwad DAA Unit- II Greedy and Dynamic Programming By Mrs. B.A. Khivsara Asst. Professor Department of Computer Engineering SNJB s KBJ COE, Chandwad 1 Greedy Method 2 Greedy Method Greedy Principal: are typically

More information

Section Notes 9. Midterm 2 Review. Applied Math / Engineering Sciences 121. Week of December 3, 2018

Section Notes 9. Midterm 2 Review. Applied Math / Engineering Sciences 121. Week of December 3, 2018 Section Notes 9 Midterm 2 Review Applied Math / Engineering Sciences 121 Week of December 3, 2018 The following list of topics is an overview of the material that was covered in the lectures and sections

More information

Travelling Salesman Problem

Travelling Salesman Problem Travelling Salesman Problem Fabio Furini November 10th, 2014 Travelling Salesman Problem 1 Outline 1 Traveling Salesman Problem Separation Travelling Salesman Problem 2 (Asymmetric) Traveling Salesman

More information

What is an integer program? Modelling with Integer Variables. Mixed Integer Program. Let us start with a linear program: max cx s.t.

What is an integer program? Modelling with Integer Variables. Mixed Integer Program. Let us start with a linear program: max cx s.t. Modelling with Integer Variables jesla@mandtudk Department of Management Engineering Technical University of Denmark What is an integer program? Let us start with a linear program: st Ax b x 0 where A

More information

1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)).

1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)). Code No: R05220502 Set No. 1 1. (a) Explain the asymptotic notations used in algorithm analysis. (b) Prove that f(n)=0(h(n)) where f(n)=0(g(n)) and g(n)=0(h(n)). 2. (a) List some of the relative advantages

More information

6. DYNAMIC PROGRAMMING I

6. DYNAMIC PROGRAMMING I 6. DYNAMIC PROGRAMMING I weighted interval scheduling segmented least squares knapsack problem RNA secondary structure Lecture slides by Kevin Wayne Copyright 2005 Pearson-Addison Wesley Copyright 2013

More information

Greedy vs Dynamic Programming Approach

Greedy vs Dynamic Programming Approach Greedy vs Dynamic Programming Approach Outline Compare the methods Knapsack problem Greedy algorithms for 0/1 knapsack An approximation algorithm for 0/1 knapsack Optimal greedy algorithm for knapsack

More information

Introduction to optimization and operations research

Introduction to optimization and operations research Introduction to optimization and operations research David Pisinger, Fall 2002 1 Smoked ham (Chvatal 1.6, adapted from Greene et al. (1957)) A meat packing plant produces 480 hams, 400 pork bellies, and

More information

4 Sequencing problem with heads and tails

4 Sequencing problem with heads and tails 4 Sequencing problem with heads and tails In what follows, we take a step towards multiple stage problems Therefore, we consider a single stage where a scheduling sequence has to be determined but each

More information

CS360 Homework 12 Solution

CS360 Homework 12 Solution CS360 Homework 12 Solution Constraint Satisfaction 1) Consider the following constraint satisfaction problem with variables x, y and z, each with domain {1, 2, 3}, and constraints C 1 and C 2, defined

More information

Answer the following questions: Q1: ( 15 points) : A) Choose the correct answer of the following questions: نموذج اإلجابة

Answer the following questions: Q1: ( 15 points) : A) Choose the correct answer of the following questions: نموذج اإلجابة Benha University Final Exam Class: 3 rd Year Students Subject: Design and analysis of Algorithms Faculty of Computers & Informatics Date: 10/1/2017 Time: 3 hours Examiner: Dr. El-Sayed Badr Answer the

More information

4. How to prove a problem is NPC

4. How to prove a problem is NPC The reducibility relation T is transitive, i.e, A T B and B T C imply A T C Therefore, to prove that a problem A is NPC: (1) show that A NP (2) choose some known NPC problem B define a polynomial transformation

More information

BBM402-Lecture 11: The Class NP

BBM402-Lecture 11: The Class NP BBM402-Lecture 11: The Class NP Lecturer: Lale Özkahya Resources for the presentation: http://ocw.mit.edu/courses/electrical-engineering-andcomputer-science/6-045j-automata-computability-andcomplexity-spring-2011/syllabus/

More information

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016

University of Toronto Department of Electrical and Computer Engineering. Final Examination. ECE 345 Algorithms and Data Structures Fall 2016 University of Toronto Department of Electrical and Computer Engineering Final Examination ECE 345 Algorithms and Data Structures Fall 2016 Print your first name, last name, UTORid, and student number neatly

More information

1 The Knapsack Problem

1 The Knapsack Problem Comp 260: Advanced Algorithms Prof. Lenore Cowen Tufts University, Spring 2018 Scribe: Tom Magerlein 1 Lecture 4: The Knapsack Problem 1 The Knapsack Problem Suppose we are trying to burgle someone s house.

More information

Data Structures and Algorithms (CSCI 340)

Data Structures and Algorithms (CSCI 340) University of Wisconsin Parkside Fall Semester 2008 Department of Computer Science Prof. Dr. F. Seutter Data Structures and Algorithms (CSCI 340) Homework Assignments The numbering of the problems refers

More information

Cutting Planes in SCIP

Cutting Planes in SCIP Cutting Planes in SCIP Kati Wolter Zuse-Institute Berlin Department Optimization Berlin, 6th June 2007 Outline 1 Cutting Planes in SCIP 2 Cutting Planes for the 0-1 Knapsack Problem 2.1 Cover Cuts 2.2

More information

NP-Completeness Theory

NP-Completeness Theory NP-Completeness Theory The topics we discussed so far are positive results: Given a problem, how to design efficient algorithms for solving it. NP-Completeness (NPC for sort) Theory is negative results.

More information

Analysis of Algorithms - Midterm (Solutions)

Analysis of Algorithms - Midterm (Solutions) Analysis of Algorithms - Midterm (Solutions) K Subramani LCSEE, West Virginia University, Morgantown, WV {ksmani@cseewvuedu} 1 Problems 1 Recurrences: Solve the following recurrences exactly or asymototically

More information

Knapsack. Bag/knapsack of integer capacity B n items item i has size s i and profit/weight w i

Knapsack. Bag/knapsack of integer capacity B n items item i has size s i and profit/weight w i Knapsack Bag/knapsack of integer capacity B n items item i has size s i and profit/weight w i Goal: find a subset of items of maximum profit such that the item subset fits in the bag Knapsack X: item set

More information

Greedy Algorithms My T. UF

Greedy Algorithms My T. UF Introduction to Algorithms Greedy Algorithms @ UF Overview A greedy algorithm always makes the choice that looks best at the moment Make a locally optimal choice in hope of getting a globally optimal solution

More information

AI Programming CS S-06 Heuristic Search

AI Programming CS S-06 Heuristic Search AI Programming CS662-2013S-06 Heuristic Search David Galles Department of Computer Science University of San Francisco 06-0: Overview Heuristic Search - exploiting knowledge about the problem Heuristic

More information

CS320 The knapsack problem

CS320 The knapsack problem CS320 The knapsack problem 1 Search and Discrete Optimization Discrete Optimization Problem (S,f) S: space of feasible solutions (satisfying some constraints) f : S R function that maps all feasible solutions

More information

Multivalued Decision Diagrams. Postoptimality Analysis Using. J. N. Hooker. Tarik Hadzic. Cork Constraint Computation Centre

Multivalued Decision Diagrams. Postoptimality Analysis Using. J. N. Hooker. Tarik Hadzic. Cork Constraint Computation Centre Postoptimality Analysis Using Multivalued Decision Diagrams Tarik Hadzic Cork Constraint Computation Centre J. N. Hooker Carnegie Mellon University London School of Economics June 2008 Postoptimality Analysis

More information