Algorithm Design Methods. Some Methods Not Covered

Similar documents
6. Algorithm Design Techniques

Greedy Algorithms 1 {K(S) K(S) C} For large values of d, brute force search is not feasible because there are 2 d {1,..., d}.

Greedy Algorithms 1. For large values of d, brute force search is not feasible because there are 2 d

CMPSCI 311: Introduction to Algorithms Practice Final Exam

Theorem 2.9: nearest addition algorithm

Chapter 16. Greedy Algorithms

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

Design and Analysis of Algorithms

Algorithms for the Bin Packing Problem with Conflicts

Analysis of Algorithms - Greedy algorithms -

Algorithmic patterns

Approximation Algorithms

Chapter Design Techniques for Approximation Algorithms

Greedy algorithms is another useful way for solving optimization problems.

A Hybrid Recursive Multi-Way Number Partitioning Algorithm

CSC 373: Algorithm Design and Analysis Lecture 3

Conflict Graphs for Combinatorial Optimization Problems

Constructive and destructive algorithms

2. (a) Explain when the Quick sort is preferred to merge sort and vice-versa.

Applied Algorithm Design Lecture 3

Coping with the Limitations of Algorithm Power Exact Solution Strategies Backtracking Backtracking : A Scenario

COMP 355 Advanced Algorithms Approximation Algorithms: VC and TSP Chapter 11 (KT) Section (CLRS)

D.K.M.COLLEGE FOR WOMEN (AUTONOMOUS), VELLORE-1.

Search Algorithms. IE 496 Lecture 17

UNIT 3. Greedy Method. Design and Analysis of Algorithms GENERAL METHOD

Bulldozers/Sites A B C D

INTERNATIONAL INSTITUTE OF MANAGEMENT, ENGINEERING & TECHNOLOGY, JAIPUR (IIMET)

Sankalchand Patel College of Engineering - Visnagar Department of Computer Engineering and Information Technology. Assignment

CSC2420 Fall 2012: Algorithm Design, Analysis and Theory

5 (Monday, 08/14/2017)

February 19, Integer programming. Outline. Problem formulation. Branch-andbound

Department of Computer Applications. MCA 312: Design and Analysis of Algorithms. [Part I : Medium Answer Type Questions] UNIT I

4.1 Interval Scheduling

Decision Problems. Observation: Many polynomial algorithms. Questions: Can we solve all problems in polynomial time? Answer: No, absolutely not.

CMSC Introduction to Algorithms Spring 2012 Lecture 16

Backtracking. Chapter 5

DESIGN AND ANALYSIS OF ALGORITHMS GREEDY METHOD

We will go over the basic scenarios, in which it is appropriate to apply this technique, and a few concrete applications.

Approximation Algorithms

UNIT 4 Branch and Bound

R13 SET - 1. ''' '' ''' ' blog: anilkumarprathipati.wordpress.com. Code No: RT32054

CS6402 DESIGN AND ANALYSIS OF ALGORITHMS QUESTION BANK UNIT I

Parallel Computing in Combinatorial Optimization

Greedy Algorithms. T. M. Murali. January 28, Interval Scheduling Interval Partitioning Minimising Lateness

COMP Analysis of Algorithms & Data Structures

CMPSCI611: Approximating SET-COVER Lecture 21

15CS43: DESIGN AND ANALYSIS OF ALGORITHMS

Greedy Algorithms. Informal Definition A greedy algorithm makes its next step based only on the current state and simple calculations on the input.

CLASS: II YEAR / IV SEMESTER CSE CS 6402-DESIGN AND ANALYSIS OF ALGORITHM UNIT I INTRODUCTION

CS 350 Final Algorithms and Complexity. It is recommended that you read through the exam before you begin. Answer all questions in the space provided.

Greedy Algorithms CHAPTER 16

18 Spanning Tree Algorithms

Design and Analysis of Algorithms

3 No-Wait Job Shops with Variable Processing Times

Contents. 1 Introduction. 2 Searching and Traversal Techniques. Preface... (vii) Acknowledgements... (ix)

Fundamentals of Integer Programming

The Algorithm Design Manual

The Design of Approximation Algorithms

Greedy Algorithms CLRS Laura Toma, csci2200, Bowdoin College

Greedy Algorithms. Alexandra Stefan

Model Answer. Section A Q.1 - (20 1=10) B.Tech. (Fifth Semester) Examination Analysis and Design of Algorithm (IT3105N) (Information Technology)

Design and Analysis of Algorithms

Greedy Algorithms. Previous Examples: Huffman coding, Minimum Spanning Tree Algorithms

Graph Definitions. In a directed graph the edges have directions (ordered pairs). A weighted graph includes a weight function.

Storage Allocation Based on Client Preferences

Chapter 9. Greedy Technique. Copyright 2007 Pearson Addison-Wesley. All rights reserved.

General Methods and Search Algorithms

Problem Strategies. 320 Greedy Strategies 6

Notes for Lecture 24

Integer Programming. Xi Chen. Department of Management Science and Engineering International Business School Beijing Foreign Studies University

Chapter 16: Greedy Algorithm

Department of Computer Science and Engineering Analysis and Design of Algorithm (CS-4004) Subject Notes

Theorem: The greedy algorithm for RKP will always output the optimal solution under Selection Criterion 3. Proof sketch: Assume that the objects have

A surefire way to find the answer to a problem is to make a list of all candidate answers, examine each, and following the examination of all or some

Approximation Algorithms

Algorithm Design and Analysis

CSE541 Class 2. Jeremy Buhler. September 1, 2016

SOLVING LARGE CARPOOLING PROBLEMS USING GRAPH THEORETIC TOOLS

Lecture: Analysis of Algorithms (CS )

A surefire way to find the answer to a problem is to make a list of all candidate answers, examine each, and following the examination of all or some

CS 161 Fall 2015 Final Exam

NP-Hardness. We start by defining types of problem, and then move on to defining the polynomial-time reductions.

Homework 4 Solutions CSE 101 Summer 2017

Minimum-Cost Spanning Tree. Example

Example. Minimum-Cost Spanning Tree. Edge Selection Greedy Strategies. Edge Selection Greedy Strategies

CAD Algorithms. Categorizing Algorithms

CMSC 451: Lecture 22 Approximation Algorithms: Vertex Cover and TSP Tuesday, Dec 5, 2017

Approximation Basics

CS6402 Design and Analysis of Algorithm. 2 Marks Question & Answer UNIT I INTRODUCTION

Introduction to Combinatorial Algorithms

Cost Optimal Parallel Algorithm for 0-1 Knapsack Problem

Copyright 2000, Kevin Wayne 1

L.J. Institute of Engineering & Technology Semester: VIII (2016)

Outline of the talk. Local search meta-heuristics for combinatorial problems. Constraint Satisfaction Problems. The n-queens problem

Announcements. CSEP 521 Applied Algorithms. Announcements. Polynomial time efficiency. Definitions of efficiency 1/14/2013

Introduction to Optimization

CS 231: Algorithmic Problem Solving

Last topic: Summary; Heuristics and Approximation Algorithms Topics we studied so far:

5105 BHARATHIDASAN ENGINEERING COLLEGE

CS599: Convex and Combinatorial Optimization Fall 2013 Lecture 14: Combinatorial Problems as Linear Programs I. Instructor: Shaddin Dughmi

Transcription:

Algorithm Design Methods Greedy method. Divide and conquer. Dynamic Programming. Backtracking. Branch and bound. Some Methods Not Covered Linear Programming. Integer Programming. Simulated Annealing. Neural Networks. Genetic Algorithms. Tabu Search.

Optimization Problem A problem in which some function (called the optimization or objective function) is to be optimized (usually minimized or maximized) subject to some constraints. Machine Scheduling Find a schedule that minimizes the finish time. optimization function finish time constraints ƒ each job is scheduled continuously on a single machine for an amount of time equal to its processing requirement ƒ no machine processes more than one job at a time

Bin Packing Pack items into bins using the fewest number of bins. optimization function number of bins constraints ƒ each item is packed into a single bin ƒ the capacity of no bin is exceeded Min Cost Spanning Tree Find a spanning tree that has minimum cost. optimization function sum of edge costs constraints ƒ must select n-1edges of the given n vertex graph ƒ the selected edges must form a tree

Feasible And Optimal Solutions A feasible solution is a solution that satisfies the constraints. An optimal solution is a feasible solution that optimizes the objective/optimization function. Greedy Method Solve problem by making a sequence of decisions. Decisions are made one by one in some order. Each decision is made using a greedy criterion. A decision, once made, is (usually) not changed later.

Machine Scheduling LPT Scheduling. Schedule jobs one by one and in decreasing order of processing time. Each job is scheduled on the machine on which it finishes earliest. Scheduling decisions are made serially using a greedy criterion (minimize finish time of this job). LPT scheduling is an application of the greedy method. LPT Schedule LPT rule does not guarantee minimum finish time schedules. (LPT Finish Time)/(Minimum Finish Time) <= 4/3-1/(3m) where m is number of machines Minimum finish time scheduling is NP-hard. In this case, the greedy method does not work. The greedy method does, however, give us a good heuristic for machine scheduling.

Container Loading Ship has capacity c. m containers are available for loading. Weight of container i is w i. Each weight is a positive number. Sum of container weights > c. Load as many containers as is possible without sinking the ship. Greedy Solution Load containers in increasing order of weight until we get to a container that doesn t fit. Does this greedy algorithm always load the maximum number of containers? Yes. May be proved using a proof by induction (see text).

Container Loading With 2 Ships Can all containers be loaded into 2 ships whose capacity is c (each)? Same as bin packing with 2 bins. ƒ Are 2 bins sufficient for all items? Same as machine scheduling with 2 machines. ƒ Can all jobs be completed by 2 machines in c time units? NP-hard. 0/1 Knapsack Problem

0/1 Knapsack Problem Hiker wishes to take n items on a trip. The weight of item i is w i. The items are to be carried in a knapsack whose weight capacity is c. When sum of item weights <= c, all n items can be carried in the knapsack. When sum of item weights > c, some items must be left behind. Which items should be taken/left? 0/1 Knapsack Problem Hiker assigns a profit/value p i to item i. All weights and profits are positive numbers. Hiker wants to select a subset of the n items to take. ƒ The weight of the subset should not exceed the capacity of the knapsack. (constraint) ƒ Cannot select a fraction of an item. (constraint) ƒ The profit/value of the subset is the sum of the profits of the selected items. (optimization function) ƒ The profit/value of the selected subset should be maximum. (optimization criterion)

0/1 Knapsack Problem Let x i = 1 when item i is selected and let x i = 0 when item i is not selected. n maximize p i x i i = 1 n subject to w i x i <= c i = 1 and x i = 0 or 1 for all i Greedy Attempt 1 Be greedy on capacity utilization. ƒ Select items in increasing order of weight. n = 2, c = 7 w = [3, 6] p = [2, 10] only item 1 is selected profit (value) of selection is 2 not best selection!

Greedy Attempt 2 Be greedy on profit earned. ƒ Select items in decreasing order of profit. n = 3, c = 7 w = [7, 3, 2] p = [10, 8, 6] only item 1 is selected profit (value) of selection is 10 not best selection! Greedy Attempt 3 Be greedy on profit density (p/w). ƒ Select items in decreasing order of profit density. n = 2, c = 7 w = [1, 7] p = [10, 20] only item 1 is selected profit (value) of selection is 10 not best selection!

Greedy Attempt 3 Be greedy on profit density (p/w). ƒ Works when selecting a fraction of an item is permitted ƒ Select items in decreasing order of profit density, if next item doesn t fit take a fraction so as to fill knapsack. n = 2, c = 7 w = [1, 7] p = [10, 20] item 1 and 6/7 of item 2 are selected 0/1 Knapsack Greedy Heuristics Select a subset with <= k items. If the weight of this subset is > c, discard the subset. If the subset weight is <= c, fill as much of the remaining capacity as possible by being greedy on profit density. Try all subsets with <= k items and select the one that yields maximum profit.

0/1 Knapsack Greedy Heuristics (best value - greedy value)/(best value) <= 1/(k+1) k 0% 1% 5% 10% 25% 0 239 390 528 583 600 1 360 527 598 600 2 483 581 600 Number of solutions (out of 600) within x% of best. 0/1 Knapsack Greedy Heuristics First sort into decreasing order of profit density. There are O(n k ) subsets with at most k items. Trying a subset takes O(n) time. Total time is O(n k+1 ) when k > 0. (best value - greedy value)/(best value) <= 1/(k+1)