0/1 knapsack problem knapsack problem

Size: px
Start display at page:

Download "0/1 knapsack problem knapsack problem"

Transcription

1 1 (1) 0/1 knapsack problem. A thief robbing a safe finds it filled with N types of items of varying size and value, but has only a small knapsack of capacity M to use to carry the goods. More precisely, the knapsack problem is to find the combination of items which the thief should choose for his knapsack in order to maximize the total value of all the items he takes. It is called 0/1 since the items only can be taken as whole not a fraction. For example, suppose that he has a knapsack of capacity 17 and the safe contains many items of each of the sizes and values shown in the figure below. (Here, we use single-letter names for the items in the example and integers in the program.) Then the thief can take five A s (but not six) for total of 20, or he can fill up his knapsack with a D and an E for a total of 24, or he can try many other combinations. But which will maximize his total take? There are clearly many commercial situations in which a solution to the knapsack problem could be important. For example, a shipping company might wish to know the best way to load a truck or cargo plane with items for shipment. In such applications, other variants to the problem might arise as well: for example, there might be a limited number of each kind of item available. Many such variants can be handled with the same approach that we are about to examine for solving the basic stated above. In a dynamic programming solution to the knapsack problem, we calculate the best combination for all knapsack size up to M. It turns out that we can perform this calculation very efficiently by doing things in an appropriate order, as in the following program: For j:=1 to N do Begin For i:=1 to M do If i-size[j]>=0 then If cost[i]<(cost[i-size[j]+val[j]) then Begin cost[i]:=cost[i-size[j]]+val[j]; best [i[:=j; End;

2 End; In this program, cost[i] is the highest value that can be achieved with a knapsack of capacity I and best[i] is the last item that was added to achieve that maximum (as described below, this is used to recover the contents of the knapsack). First, we calculate the best we can do for all knapsack size when only items of type A are taken, then we calculate the best that we can do when only A s and The actual contents of the optimal knapsack can be computed with the aid of the best array. By definition, best[m] is included, and the remaining contents are the same as for the optimal knapsack of size M-size[best[M]]. Therefore, best[m-size[best[m]] is included, and so forth. B s are taken, etc. The solution reduces to a simple calculation for cost[i]. Suppose an item j is chosen for the knapsack: then the best value that could be achieved for the total would be val[j] (for the item) plus cost[i-size[j]] (to fill up the rest of the knapsack). If this value exceeds the best value that can be achieved without an item j, then we update cost[i] and best[i]; otherwise we leave them alone. A simple induction proof shows that this strategy solves the problem. The figure above traces the computation for our example. The first pair of lines shows the best that can be done (the contents of the cost and best arrays) with only A s, the second pair of lines shows the best that can be done with only A s and B s, etc.. The highest value that can be achieved with a knapsack of size 17 is 24. In the course of computing this result, we also solved may smaller sub-problems. For example, the highest values that can be achieved with a knapsack of size 16 using A s and B s and C s is 22. The actual contents of the optimal knapsack can be computed with the aid of the best array. By definition, best[m] is included, and the remaining contents are the same as for the optimal knapsack of size M-size[best[M]]. Therefore, size[best[m-size[m]]] is included, and so forth. For our example, best[17]=c; then we find another type-c item at size 10, then a type-1 item at size 3. (2) Traveling salesperson problem Given a graph with nonnegative lengths attached to the edges, we are required to find the shortest possible circuit that begins and ends at the same node, after having gone exactly once through each of the other nodes.

3 Let G = <V, E> be a directed graph. As usual, we take N = {1, 2,, n}, an the lengths of the edges are denoted by Lij, with L[i, i] = 0, L[i, j] 0 if i j, and L[i, j]= if the edge (i, j) does not exist. Suppose without loss of generality that the circuit begins and ends at node 1. it therefore consists of an edge (I, j), j 1, followed by a path from j to 1 that passes exactly once through each node in S N {1, j}. If the circuit is optimal (as short as possible), then so is the path from j to 1: the principle of optimality holds. Consider a set of nodes S N {1} and a node i N S, with i=1 allowed only if S = N {1}. Define g( i, S) as the length of the shortest path from node I to node 1 that passes exactly once through each node in S. Using this definition g(1, N {1}) is the length of an optimal circuit. By the principle of optimality, we see that g(1, N {1}) = min( L + g( j, N {1, j}). 2 j n 1, j (*) More generally, if i 1, S Φ, S N {1}, and i S, g( i, S) = min( L + g( j, S { j})). i, j j S (**) Furthermore, g( i, Φ ) = L, i = 2,3,..., n. i,1 The value of g( i, S) are therefore known when S is empty. We can apply (**) to calculate the function g for all the sets S that contain exactly one node (other than 1); then we can apply (**) again to calculate f for all the set S that contain two nodes (other than 1), and so on. Once the value of g( j, N {1, j}) is known for all the nodes j except node 1, we can use (*) to calculate g( j, N {1}) and solve the problem. Example1: Let G is the complete graph on four nodes given in Figure below.

4 We initialize g(2, ) = 5, g(3, ) = 6, g(4, ) = 8 and g(2,{3}) = L + g(3, ) = g(2,{4}) = L + g(4, ) = 18 and 24 g(3,{2}) = 18, g(3,{4}) = 20 g(4,{2}) = 13, g(4,{4}) = 15 Next, we use (**) for sets of two nodes, we have Finally we apply (*) to obtain g(2,{3, 4}) = min( L + g(3,{4}), L + g(4,{3})) = min(29, 25) = g(3,{2, 4}) = min( L + g(2,{4}), L + g(4,{2})) = min(31, 25) = g(4,{2,3}) = min( L + g(2,{3}), L + g(3,{2})) = min(23, 27) = g(1,{2,3, 4}) = min( L + g(2,{3, 4}), L + g(3,{2, 4}), L + g(4,{2,3}) = min(25, 40,43) = The optimal circuit in Example1 has length 35. To known where this circuit goes, we need an extra function: J ( i, S) is the value of j chosen to minimize g at the moment when we apply (*) or (**) to calculate J ( i, S ). Example2 (Continuation of Example1) In this example find

5 J (2,{3, 4}) = 4 J (3,{2, 4}) = 4 J (4,{2,3}) = 2 J (1,{2,3, 4}) = 2 And the optimal circuit is 1 J (1,{2,3, 4}) = 2 J (2,{3, 4}) = 4 J (4,3) = Let X be a sequence of n real numbers. (1) Sort the n real numbers in increasing order by Heap sort or Merge sort methods. Denote this increasing sequence of n real numbers as Y. (O(nlogn)) (2)Compute the longest common subsequence of X and Y using dynamic programming.(o(n 2 )) 4 (a) algorithm: Change (n) { Quarters=0; Dimes=0;

6 Nickels=0; While n>=25 Do { Quarters++; n=n-25 ;} While n>=10 Do { Dimes++; n=n-10 ;} While n>=5 Do { Nickels++; N=n-5 ;} Pennies=n;} (b) To prove this greedy choice yields an optimal solution, we must show optimal substructure and the greedy choice property. 1. Proof of Optimal Substructure: Let {C1, C2,, Cm} be the coins comprising an optimal solution to the coin-changing problem, where Ci is either a penny, nickel, dime or quarter, and the Ci.S sum to n, the change to be made. Putting aside the first coin choice C1, the remaining coins {C2,, Cm} represent a solution to the n-d(c1) coin-changing problem, where d(c) is the denomination of coin C. If {C2,, Cm} were not an optimal solution to the n-d(c1) change problem, then there exists another solution {a2,, ak}, where k<m; thus taking fewer coins. But if such a solution exists for n-d(c1), then combing it with C1 would yields a better solution to the n change problem. Since we started with an optimal solution, this is a contradiction, {C2,, Cm} must be an optimal solution to the subproblem n-d(c1), and the coin-changing problem exhibits optimal substructure. 2. Proof of the greedy choice property: Assume we have an optimal solution to the n-change problem {C1, C2,, Cm}. First, we know that the coins Ci add up to n no matter what order they are chosen, therefore, we can make any coin choice Cj swap with the first choice C1 and still yield an optimal solution. We have only to prove that greedy choice must reside somewhere in an optimal solution. Assume it does not. Then, one of the highest denomination coins less than n is not in the solution. But, that means that lower denomination coins must be used to obtain the amount of cents of the higher-denomination coin. Since it takes at least two lower-denomination coins to equal to the cents of a higherdenomination coin, we could always replace these coins with the greedy coin and obtain a better solution (fewer coins). Therefore, the greedy coin must be in the optimal solution. Thus, a greedy choice for the first coin will lead to an optimal solution. (c) The set {1, 20, and 50} will be the set. (Consider 60 cents)

IEOR E4004: Introduction to OR: Deterministic Models

IEOR E4004: Introduction to OR: Deterministic Models IEOR E4004: Introduction to OR: Deterministic Models 1 Dynamic Programming Following is a summary of the problems we discussed in class. (We do not include the discussion on the container problem or the

More information

Slides credited from Hsu-Chun Hsiao

Slides credited from Hsu-Chun Hsiao Slides credited from Hsu-Chun Hsiao Greedy Algorithms Greedy #1: Activity-Selection / Interval Scheduling Greedy #2: Coin Changing Greedy #3: Fractional Knapsack Problem Greedy #4: Breakpoint Selection

More information

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class

Homework #4. CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class Homework #4 CMSC351 - Spring 2013 PRINT Name : Due: Thu Apr 16 th at the start of class o Grades depend on neatness and clarity. o Write your answers with enough detail about your approach and concepts

More information

useful than solving these yourself, writing up your solution and then either comparing your

useful than solving these yourself, writing up your solution and then either comparing your CSE 441T/541T: Advanced Algorithms Fall Semester, 2003 September 9, 2004 Practice Problems Solutions Here are the solutions for the practice problems. However, reading these is far less useful than solving

More information

CSE202: Algorithm Design and Analysis. Ragesh Jaiswal, CSE, UCSD

CSE202: Algorithm Design and Analysis. Ragesh Jaiswal, CSE, UCSD Fractional knapsack Problem Fractional knapsack: You are a thief and you have a sack of size W. There are n divisible items. Each item i has a volume W (i) and a total value V (i). Design an algorithm

More information

Handout 4: Deterministic Systems and the Shortest Path Problem

Handout 4: Deterministic Systems and the Shortest Path Problem SEEM 3470: Dynamic Optimization and Applications 2013 14 Second Term Handout 4: Deterministic Systems and the Shortest Path Problem Instructor: Shiqian Ma January 27, 2014 Suggested Reading: Bertsekas

More information

UNIT 2. Greedy Method GENERAL METHOD

UNIT 2. Greedy Method GENERAL METHOD UNIT 2 GENERAL METHOD Greedy Method Greedy is the most straight forward design technique. Most of the problems have n inputs and require us to obtain a subset that satisfies some constraints. Any subset

More information

What is Greedy Approach? Control abstraction for Greedy Method. Three important activities

What is Greedy Approach? Control abstraction for Greedy Method. Three important activities 0-0-07 What is Greedy Approach? Suppose that a problem can be solved by a sequence of decisions. The greedy method has that each decision is locally optimal. These locally optimal solutions will finally

More information

Chapter wise Question bank

Chapter wise Question bank GOVERNMENT ENGINEERING COLLEGE - MODASA Chapter wise Question bank Subject Name Analysis and Design of Algorithm Semester Department 5 th Term ODD 2015 Information Technology / Computer Engineering Chapter

More information

Essays on Some Combinatorial Optimization Problems with Interval Data

Essays on Some Combinatorial Optimization Problems with Interval Data Essays on Some Combinatorial Optimization Problems with Interval Data a thesis submitted to the department of industrial engineering and the institute of engineering and sciences of bilkent university

More information

2. This algorithm does not solve the problem of finding a maximum cardinality set of non-overlapping intervals. Consider the following intervals:

2. This algorithm does not solve the problem of finding a maximum cardinality set of non-overlapping intervals. Consider the following intervals: 1. No solution. 2. This algorithm does not solve the problem of finding a maximum cardinality set of non-overlapping intervals. Consider the following intervals: E A B C D Obviously, the optimal solution

More information

Problem Set 2: Answers

Problem Set 2: Answers Economics 623 J.R.Walker Page 1 Problem Set 2: Answers The problem set came from Michael A. Trick, Senior Associate Dean, Education and Professor Tepper School of Business, Carnegie Mellon University.

More information

Lecture 10: The knapsack problem

Lecture 10: The knapsack problem Optimization Methods in Finance (EPFL, Fall 2010) Lecture 10: The knapsack problem 24.11.2010 Lecturer: Prof. Friedrich Eisenbrand Scribe: Anu Harjula The knapsack problem The Knapsack problem is a problem

More information

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract

Tug of War Game. William Gasarch and Nick Sovich and Paul Zimand. October 6, Abstract Tug of War Game William Gasarch and ick Sovich and Paul Zimand October 6, 2009 To be written later Abstract Introduction Combinatorial games under auction play, introduced by Lazarus, Loeb, Propp, Stromquist,

More information

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS

CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS CMPSCI 311: Introduction to Algorithms Second Midterm Practice Exam SOLUTIONS November 17, 2016. Name: ID: Instructions: Answer the questions directly on the exam pages. Show all your work for each question.

More information

June 11, Dynamic Programming( Weighted Interval Scheduling)

June 11, Dynamic Programming( Weighted Interval Scheduling) Dynamic Programming( Weighted Interval Scheduling) June 11, 2014 Problem Statement: 1 We have a resource and many people request to use the resource for periods of time (an interval of time) 2 Each interval

More information

Deterministic Dynamic Programming

Deterministic Dynamic Programming Deterministic Dynamic Programming Dynamic programming is a technique that can be used to solve many optimization problems. In most applications, dynamic programming obtains solutions by working backward

More information

1) S = {s}; 2) for each u V {s} do 3) dist[u] = cost(s, u); 4) Insert u into a 2-3 tree Q with dist[u] as the key; 5) for i = 1 to n 1 do 6) Identify

1) S = {s}; 2) for each u V {s} do 3) dist[u] = cost(s, u); 4) Insert u into a 2-3 tree Q with dist[u] as the key; 5) for i = 1 to n 1 do 6) Identify CSE 3500 Algorithms and Complexity Fall 2016 Lecture 17: October 25, 2016 Dijkstra s Algorithm Dijkstra s algorithm for the SSSP problem generates the shortest paths in nondecreasing order of the shortest

More information

Chapter 15: Dynamic Programming

Chapter 15: Dynamic Programming Chapter 15: Dynamic Programming Dynamic programming is a general approach to making a sequence of interrelated decisions in an optimum way. While we can describe the general characteristics, the details

More information

An Optimal Algorithm for Calculating the Profit in the Coins in a Row Game

An Optimal Algorithm for Calculating the Profit in the Coins in a Row Game An Optimal Algorithm for Calculating the Profit in the Coins in a Row Game Tomasz Idziaszek University of Warsaw idziaszek@mimuw.edu.pl Abstract. On the table there is a row of n coins of various denominations.

More information

CSE 417 Dynamic Programming (pt 2) Look at the Last Element

CSE 417 Dynamic Programming (pt 2) Look at the Last Element CSE 417 Dynamic Programming (pt 2) Look at the Last Element Reminders > HW4 is due on Friday start early! if you run into problems loading data (date parsing), try running java with Duser.country=US Duser.language=en

More information

Dynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming

Dynamic Programming: An overview. 1 Preliminaries: The basic principle underlying dynamic programming Dynamic Programming: An overview These notes summarize some key properties of the Dynamic Programming principle to optimize a function or cost that depends on an interval or stages. This plays a key role

More information

CHAPTER 5: DYNAMIC PROGRAMMING

CHAPTER 5: DYNAMIC PROGRAMMING CHAPTER 5: DYNAMIC PROGRAMMING Overview This chapter discusses dynamic programming, a method to solve optimization problems that involve a dynamical process. This is in contrast to our previous discussions

More information

Maximum Contiguous Subsequences

Maximum Contiguous Subsequences Chapter 8 Maximum Contiguous Subsequences In this chapter, we consider a well-know problem and apply the algorithm-design techniques that we have learned thus far to this problem. While applying these

More information

Dynamic Programming cont. We repeat: The Dynamic Programming Template has three parts.

Dynamic Programming cont. We repeat: The Dynamic Programming Template has three parts. Page 1 Dynamic Programming cont. We repeat: The Dynamic Programming Template has three parts. Subproblems Sometimes this is enough if the algorithm and its complexity is obvious. Recursion Algorithm Must

More information

Yao s Minimax Principle

Yao s Minimax Principle Complexity of algorithms The complexity of an algorithm is usually measured with respect to the size of the input, where size may for example refer to the length of a binary word describing the input,

More information

CSCE 750, Fall 2009 Quizzes with Answers

CSCE 750, Fall 2009 Quizzes with Answers CSCE 750, Fall 009 Quizzes with Answers Stephen A. Fenner September 4, 011 1. Give an exact closed form for Simplify your answer as much as possible. k 3 k+1. We reduce the expression to a form we ve already

More information

Lecture 2: The Simple Story of 2-SAT

Lecture 2: The Simple Story of 2-SAT 0510-7410: Topics in Algorithms - Random Satisfiability March 04, 2014 Lecture 2: The Simple Story of 2-SAT Lecturer: Benny Applebaum Scribe(s): Mor Baruch 1 Lecture Outline In this talk we will show that

More information

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE 6.21 DYNAMIC PROGRAMMING LECTURE LECTURE OUTLINE Deterministic finite-state DP problems Backward shortest path algorithm Forward shortest path algorithm Shortest path examples Alternative shortest path

More information

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE

THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE THE TRAVELING SALESMAN PROBLEM FOR MOVING POINTS ON A LINE GÜNTER ROTE Abstract. A salesperson wants to visit each of n objects that move on a line at given constant speeds in the shortest possible time,

More information

Lecture l(x) 1. (1) x X

Lecture l(x) 1. (1) x X Lecture 14 Agenda for the lecture Kraft s inequality Shannon codes The relation H(X) L u (X) = L p (X) H(X) + 1 14.1 Kraft s inequality While the definition of prefix-free codes is intuitively clear, we

More information

Dynamic Programming (DP) Massimo Paolucci University of Genova

Dynamic Programming (DP) Massimo Paolucci University of Genova Dynamic Programming (DP) Massimo Paolucci University of Genova DP cannot be applied to each kind of problem In particular, it is a solution method for problems defined over stages For each stage a subproblem

More information

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam

Discrete Mathematics for CS Spring 2008 David Wagner Final Exam CS 70 Discrete Mathematics for CS Spring 2008 David Wagner Final Exam PRINT your name:, (last) SIGN your name: (first) PRINT your Unix account login: Your section time (e.g., Tue 3pm): Name of the person

More information

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem

Lecture 6. 1 Polynomial-time algorithms for the global min-cut problem ORIE 633 Network Flows September 20, 2007 Lecturer: David P. Williamson Lecture 6 Scribe: Animashree Anandkumar 1 Polynomial-time algorithms for the global min-cut problem 1.1 The global min-cut problem

More information

Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in

Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in Maximizing the Spread of Influence through a Social Network Problem/Motivation: Suppose we want to market a product or promote an idea or behavior in a society. In order to do so, we can target individuals,

More information

Fundamental Algorithms - Surprise Test

Fundamental Algorithms - Surprise Test Technische Universität München Fakultät für Informatik Lehrstuhl für Effiziente Algorithmen Dmytro Chibisov Sandeep Sadanandan Winter Semester 007/08 Sheet Model Test January 16, 008 Fundamental Algorithms

More information

On the Optimality of a Family of Binary Trees Techical Report TR

On the Optimality of a Family of Binary Trees Techical Report TR On the Optimality of a Family of Binary Trees Techical Report TR-011101-1 Dana Vrajitoru and William Knight Indiana University South Bend Department of Computer and Information Sciences Abstract In this

More information

Introduction to Greedy Algorithms: Huffman Codes

Introduction to Greedy Algorithms: Huffman Codes Introduction to Greedy Algorithms: Huffman Codes Yufei Tao ITEE University of Queensland In computer science, one interesting method to design algorithms is to go greedy, namely, keep doing the thing that

More information

1 Solutions to Tute09

1 Solutions to Tute09 s to Tute0 Questions 4. - 4. are straight forward. Q. 4.4 Show that in a binary tree of N nodes, there are N + NULL pointers. Every node has outgoing pointers. Therefore there are N pointers. Each node,

More information

Optimization Methods. Lecture 16: Dynamic Programming

Optimization Methods. Lecture 16: Dynamic Programming 15.093 Optimization Methods Lecture 16: Dynamic Programming 1 Outline 1. The knapsack problem Slide 1. The traveling salesman problem 3. The general DP framework 4. Bellman equation 5. Optimal inventory

More information

SET 1C Binary Trees. 2. (i) Define the height of a binary tree or subtree and also define a height balanced (AVL) tree. (2)

SET 1C Binary Trees. 2. (i) Define the height of a binary tree or subtree and also define a height balanced (AVL) tree. (2) SET 1C Binary Trees 1. Construct a binary tree whose preorder traversal is K L N M P R Q S T and inorder traversal is N L K P R M S Q T 2. (i) Define the height of a binary tree or subtree and also define

More information

Chapter 21. Dynamic Programming CONTENTS 21.1 A SHORTEST-ROUTE PROBLEM 21.2 DYNAMIC PROGRAMMING NOTATION

Chapter 21. Dynamic Programming CONTENTS 21.1 A SHORTEST-ROUTE PROBLEM 21.2 DYNAMIC PROGRAMMING NOTATION Chapter 21 Dynamic Programming CONTENTS 21.1 A SHORTEST-ROUTE PROBLEM 21.2 DYNAMIC PROGRAMMING NOTATION 21.3 THE KNAPSACK PROBLEM 21.4 A PRODUCTION AND INVENTORY CONTROL PROBLEM 23_ch21_ptg01_Web.indd

More information

Advanced Operations Research Prof. G. Srinivasan Dept of Management Studies Indian Institute of Technology, Madras

Advanced Operations Research Prof. G. Srinivasan Dept of Management Studies Indian Institute of Technology, Madras Advanced Operations Research Prof. G. Srinivasan Dept of Management Studies Indian Institute of Technology, Madras Lecture 23 Minimum Cost Flow Problem In this lecture, we will discuss the minimum cost

More information

1 Online Problem Examples

1 Online Problem Examples Comp 260: Advanced Algorithms Tufts University, Spring 2018 Prof. Lenore Cowen Scribe: Isaiah Mindich Lecture 9: Online Algorithms All of the algorithms we have studied so far operate on the assumption

More information

Fibonacci Heaps Y Y o o u u c c an an s s u u b b m miitt P P ro ro b blle e m m S S et et 3 3 iin n t t h h e e b b o o x x u u p p fro fro n n tt..

Fibonacci Heaps Y Y o o u u c c an an s s u u b b m miitt P P ro ro b blle e m m S S et et 3 3 iin n t t h h e e b b o o x x u u p p fro fro n n tt.. Fibonacci Heaps You You can can submit submit Problem Problem Set Set 3 in in the the box box up up front. front. Outline for Today Review from Last Time Quick refresher on binomial heaps and lazy binomial

More information

Programming for Engineers in Python

Programming for Engineers in Python Programming for Engineers in Python Lecture 12: Dynamic Programming Autumn 2011-12 1 Lecture 11: Highlights GUI (Based on slides from the course Software1, CS, TAU) GUI in Python (Based on Chapter 19 from

More information

Chapter 6. Percents and their Applications

Chapter 6. Percents and their Applications Chapter 6 Percents and their Applications What is a percent? A percent is 1 one hundredth of a number. For instance, a penny is 1/100 of a dollar. Each one hundredth is 1% A nickel is 5/100 of a dollar

More information

Notes on Natural Logic

Notes on Natural Logic Notes on Natural Logic Notes for PHIL370 Eric Pacuit November 16, 2012 1 Preliminaries: Trees A tree is a structure T = (T, E), where T is a nonempty set whose elements are called nodes and E is a relation

More information

Optimal Satisficing Tree Searches

Optimal Satisficing Tree Searches Optimal Satisficing Tree Searches Dan Geiger and Jeffrey A. Barnett Northrop Research and Technology Center One Research Park Palos Verdes, CA 90274 Abstract We provide an algorithm that finds optimal

More information

Q1. [?? pts] Search Traces

Q1. [?? pts] Search Traces CS 188 Spring 2010 Introduction to Artificial Intelligence Midterm Exam Solutions Q1. [?? pts] Search Traces Each of the trees (G1 through G5) was generated by searching the graph (below, left) with a

More information

Outline for this Week

Outline for this Week Binomial Heaps Outline for this Week Binomial Heaps (Today) A simple, flexible, and versatile priority queue. Lazy Binomial Heaps (Today) A powerful building block for designing advanced data structures.

More information

Binary and Binomial Heaps. Disclaimer: these slides were adapted from the ones by Kevin Wayne

Binary and Binomial Heaps. Disclaimer: these slides were adapted from the ones by Kevin Wayne Binary and Binomial Heaps Disclaimer: these slides were adapted from the ones by Kevin Wayne Priority Queues Supports the following operations. Insert element x. Return min element. Return and delete minimum

More information

ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games

ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games University of Illinois Fall 2018 ECE 586GT: Problem Set 1: Problems and Solutions Analysis of static games Due: Tuesday, Sept. 11, at beginning of class Reading: Course notes, Sections 1.1-1.4 1. [A random

More information

A relation on 132-avoiding permutation patterns

A relation on 132-avoiding permutation patterns Discrete Mathematics and Theoretical Computer Science DMTCS vol. VOL, 205, 285 302 A relation on 32-avoiding permutation patterns Natalie Aisbett School of Mathematics and Statistics, University of Sydney,

More information

Matching Markets and Google s Sponsored Search

Matching Markets and Google s Sponsored Search Matching Markets and Google s Sponsored Search Part III: Dynamics Episode 9 Baochun Li Department of Electrical and Computer Engineering University of Toronto Matching Markets (Required reading: Chapter

More information

Microeconomics of Banking: Lecture 5

Microeconomics of Banking: Lecture 5 Microeconomics of Banking: Lecture 5 Prof. Ronaldo CARPIO Oct. 23, 2015 Administrative Stuff Homework 2 is due next week. Due to the change in material covered, I have decided to change the grading system

More information

Structural Induction

Structural Induction Structural Induction Jason Filippou CMSC250 @ UMCP 07-05-2016 Jason Filippou (CMSC250 @ UMCP) Structural Induction 07-05-2016 1 / 26 Outline 1 Recursively defined structures 2 Proofs Binary Trees Jason

More information

Enhanced Shell Sorting Algorithm

Enhanced Shell Sorting Algorithm Enhanced ing Algorithm Basit Shahzad, and Muhammad Tanvir Afzal Abstract Many algorithms are available for sorting the unordered elements. Most important of them are Bubble sort, Heap sort, Insertion sort

More information

CSV 886 Social Economic and Information Networks. Lecture 5: Matching Markets, Sponsored Search. R Ravi

CSV 886 Social Economic and Information Networks. Lecture 5: Matching Markets, Sponsored Search. R Ravi CSV 886 Social Economic and Information Networks Lecture 5: Matching Markets, Sponsored Search R Ravi ravi+iitd@andrew.cmu.edu Simple Models of Trade Decentralized Buyers and sellers have to find each

More information

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE

6.231 DYNAMIC PROGRAMMING LECTURE 3 LECTURE OUTLINE 6.21 DYNAMIC PROGRAMMING LECTURE LECTURE OUTLINE Deterministic finite-state DP problems Backward shortest path algorithm Forward shortest path algorithm Shortest path examples Alternative shortest path

More information

is a path in the graph from node i to node i k provided that each of(i i), (i i) through (i k; i k )isan arc in the graph. This path has k ; arcs in i

is a path in the graph from node i to node i k provided that each of(i i), (i i) through (i k; i k )isan arc in the graph. This path has k ; arcs in i ENG Engineering Applications of OR Fall 998 Handout The shortest path problem Consider the following problem. You are given a map of the city in which you live, and you wish to gure out the fastest route

More information

Handout 8: Introduction to Stochastic Dynamic Programming. 2 Examples of Stochastic Dynamic Programming Problems

Handout 8: Introduction to Stochastic Dynamic Programming. 2 Examples of Stochastic Dynamic Programming Problems SEEM 3470: Dynamic Optimization and Applications 2013 14 Second Term Handout 8: Introduction to Stochastic Dynamic Programming Instructor: Shiqian Ma March 10, 2014 Suggested Reading: Chapter 1 of Bertsekas,

More information

Lecture 4: Divide and Conquer

Lecture 4: Divide and Conquer Lecture 4: Divide and Conquer Divide and Conquer Merge sort is an example of a divide-and-conquer algorithm Recall the three steps (at each level to solve a divideand-conquer problem recursively Divide

More information

CSE 100: TREAPS AND RANDOMIZED SEARCH TREES

CSE 100: TREAPS AND RANDOMIZED SEARCH TREES CSE 100: TREAPS AND RANDOMIZED SEARCH TREES Midterm Review Practice Midterm covered during Sunday discussion Today Run time analysis of building the Huffman tree AVL rotations and treaps Huffman s algorithm

More information

15-451/651: Design & Analysis of Algorithms November 9 & 11, 2015 Lecture #19 & #20 last changed: November 10, 2015

15-451/651: Design & Analysis of Algorithms November 9 & 11, 2015 Lecture #19 & #20 last changed: November 10, 2015 15-451/651: Design & Analysis of Algorithms November 9 & 11, 2015 Lecture #19 & #20 last changed: November 10, 2015 Last time we looked at algorithms for finding approximately-optimal solutions for NP-hard

More information

The Probabilistic Method - Probabilistic Techniques. Lecture 7: Martingales

The Probabilistic Method - Probabilistic Techniques. Lecture 7: Martingales The Probabilistic Method - Probabilistic Techniques Lecture 7: Martingales Sotiris Nikoletseas Associate Professor Computer Engineering and Informatics Department 2015-2016 Sotiris Nikoletseas, Associate

More information

15-451/651: Design & Analysis of Algorithms October 23, 2018 Lecture #16: Online Algorithms last changed: October 22, 2018

15-451/651: Design & Analysis of Algorithms October 23, 2018 Lecture #16: Online Algorithms last changed: October 22, 2018 15-451/651: Design & Analysis of Algorithms October 23, 2018 Lecture #16: Online Algorithms last changed: October 22, 2018 Today we ll be looking at finding approximately-optimal solutions for problems

More information

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions

CSE 21 Winter 2016 Homework 6 Due: Wednesday, May 11, 2016 at 11:59pm. Instructions CSE 1 Winter 016 Homework 6 Due: Wednesday, May 11, 016 at 11:59pm Instructions Homework should be done in groups of one to three people. You are free to change group members at any time throughout the

More information

Production Cost Analysis with Circulating Metal Commodity Metal Prices. United States Mint Department of the Treasury

Production Cost Analysis with Circulating Metal Commodity Metal Prices. United States Mint Department of the Treasury Production Cost Analysis with Circulating Metal Commodity Metal Prices United States Mint Department of the Treasury December 2014 As America s sole manufacturer of legal tender coinage, the efficient

More information

Homework Assignment #3. 1 Demonstrate how mergesort works when sorting the following list of numbers:

Homework Assignment #3. 1 Demonstrate how mergesort works when sorting the following list of numbers: CISC 5835 Algorithms for Big Data Fall, 2018 Homework Assignment #3 1 Demonstrate how mergesort works when sorting the following list of numbers: 6 1 4 2 3 8 7 5 2 Given the following array (list), follows

More information

Bioinformatics - Lecture 7

Bioinformatics - Lecture 7 Bioinformatics - Lecture 7 Louis Wehenkel Department of Electrical Engineering and Computer Science University of Liège Montefiore - Liège - November 20, 2007 Find slides: http://montefiore.ulg.ac.be/

More information

Design and Analysis of Algorithms 演算法設計與分析. Lecture 8 November 16, 2016 洪國寶

Design and Analysis of Algorithms 演算法設計與分析. Lecture 8 November 16, 2016 洪國寶 Design and Analysis of Algorithms 演算法設計與分析 Lecture 8 November 6, 206 洪國寶 Outline Review Amortized analysis Advanced data structures Binary heaps Binomial heaps Fibonacci heaps Data structures for disjoint

More information

Introduction to Dynamic Programming

Introduction to Dynamic Programming Introduction to Dynamic Programming http://bicmr.pku.edu.cn/~wenzw/bigdata2018.html Acknowledgement: this slides is based on Prof. Mengdi Wang s and Prof. Dimitri Bertsekas lecture notes Outline 2/65 1

More information

Another Variant of 3sat. 3sat. 3sat Is NP-Complete. The Proof (concluded)

Another Variant of 3sat. 3sat. 3sat Is NP-Complete. The Proof (concluded) 3sat k-sat, where k Z +, is the special case of sat. The formula is in CNF and all clauses have exactly k literals (repetition of literals is allowed). For example, (x 1 x 2 x 3 ) (x 1 x 1 x 2 ) (x 1 x

More information

Networks: Fall 2010 Homework 3 David Easley and Jon Kleinberg Due in Class September 29, 2010

Networks: Fall 2010 Homework 3 David Easley and Jon Kleinberg Due in Class September 29, 2010 Networks: Fall 00 Homework David Easley and Jon Kleinberg Due in Class September 9, 00 As noted on the course home page, homework solutions must be submitted by upload to the CMS site, at https://cms.csuglab.cornell.edu/.

More information

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras

Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras Advanced Operations Research Prof. G. Srinivasan Department of Management Studies Indian Institute of Technology, Madras Lecture 21 Successive Shortest Path Problem In this lecture, we continue our discussion

More information

Outline for Today. Quick refresher on binomial heaps and lazy binomial heaps. An important operation in many graph algorithms.

Outline for Today. Quick refresher on binomial heaps and lazy binomial heaps. An important operation in many graph algorithms. Fibonacci Heaps Outline for Today Review from Last Time Quick refresher on binomial heaps and lazy binomial heaps. The Need for decrease-key An important operation in many graph algorithms. Fibonacci Heaps

More information

Outline for this Week

Outline for this Week Binomial Heaps Outline for this Week Binomial Heaps (Today) A simple, fexible, and versatile priority queue. Lazy Binomial Heaps (Today) A powerful building block for designing advanced data structures.

More information

Initializing A Max Heap. Initializing A Max Heap

Initializing A Max Heap. Initializing A Max Heap Initializing A Max Heap 3 4 5 6 7 8 70 8 input array = [-,,, 3, 4, 5, 6, 7, 8,, 0, ] Initializing A Max Heap 3 4 5 6 7 8 70 8 Start at rightmost array position that has a child. Index is n/. Initializing

More information

Reinforcement learning and Markov Decision Processes (MDPs) (B) Avrim Blum

Reinforcement learning and Markov Decision Processes (MDPs) (B) Avrim Blum Reinforcement learning and Markov Decision Processes (MDPs) 15-859(B) Avrim Blum RL and MDPs General scenario: We are an agent in some state. Have observations, perform actions, get rewards. (See lights,

More information

COS 445 Final. Due online Monday, May 21st at 11:59 pm. Please upload each problem as a separate file via MTA.

COS 445 Final. Due online Monday, May 21st at 11:59 pm. Please upload each problem as a separate file via MTA. COS 445 Final Due online Monday, May 21st at 11:59 pm All problems on this final are no collaboration problems. You may not discuss any aspect of any problems with anyone except for the course staff. You

More information

PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES

PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES PARELLIZATION OF DIJKSTRA S ALGORITHM: COMPARISON OF VARIOUS PRIORITY QUEUES WIKTOR JAKUBIUK, KESHAV PURANMALKA 1. Introduction Dijkstra s algorithm solves the single-sourced shorest path problem on a

More information

CS360 Homework 14 Solution

CS360 Homework 14 Solution CS360 Homework 14 Solution Markov Decision Processes 1) Invent a simple Markov decision process (MDP) with the following properties: a) it has a goal state, b) its immediate action costs are all positive,

More information

Homework solutions, Chapter 8

Homework solutions, Chapter 8 Homework solutions, Chapter 8 NOTE: We might think of 8.1 as being a section devoted to setting up the networks and 8.2 as solving them, but only 8.2 has a homework section. Section 8.2 2. Use Dijkstra

More information

So we turn now to many-to-one matching with money, which is generally seen as a model of firms hiring workers

So we turn now to many-to-one matching with money, which is generally seen as a model of firms hiring workers Econ 805 Advanced Micro Theory I Dan Quint Fall 2009 Lecture 20 November 13 2008 So far, we ve considered matching markets in settings where there is no money you can t necessarily pay someone to marry

More information

Another Variant of 3sat

Another Variant of 3sat Another Variant of 3sat Proposition 32 3sat is NP-complete for expressions in which each variable is restricted to appear at most three times, and each literal at most twice. (3sat here requires only that

More information

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 6: Prior-Free Single-Parameter Mechanism Design (Continued)

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 6: Prior-Free Single-Parameter Mechanism Design (Continued) CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 6: Prior-Free Single-Parameter Mechanism Design (Continued) Instructor: Shaddin Dughmi Administrivia Homework 1 due today. Homework 2 out

More information

LEC 13 : Introduction to Dynamic Programming

LEC 13 : Introduction to Dynamic Programming CE 191: Civl and Environmental Engineering Systems Analysis LEC 13 : Introduction to Dynamic Programming Professor Scott Moura Civl & Environmental Engineering University of California, Berkeley Fall 2013

More information

A Branch-and-Price method for the Multiple-depot Vehicle and Crew Scheduling Problem

A Branch-and-Price method for the Multiple-depot Vehicle and Crew Scheduling Problem A Branch-and-Price method for the Multiple-depot Vehicle and Crew Scheduling Problem SCIP Workshop 2018, Aachen Markó Horváth Tamás Kis Institute for Computer Science and Control Hungarian Academy of Sciences

More information

Outline Introduction Game Representations Reductions Solution Concepts. Game Theory. Enrico Franchi. May 19, 2010

Outline Introduction Game Representations Reductions Solution Concepts. Game Theory. Enrico Franchi. May 19, 2010 May 19, 2010 1 Introduction Scope of Agent preferences Utility Functions 2 Game Representations Example: Game-1 Extended Form Strategic Form Equivalences 3 Reductions Best Response Domination 4 Solution

More information

Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks

Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks Analysis of Link Reversal Routing Algorithms for Mobile Ad Hoc Networks Costas Busch Rensselaer Polytechnic Inst. Troy, NY 12180 buschc@cs.rpi.edu Srikanth Surapaneni Rensselaer Polytechnic Inst. Troy,

More information

Optimizing Portfolios

Optimizing Portfolios Optimizing Portfolios An Undergraduate Introduction to Financial Mathematics J. Robert Buchanan 2010 Introduction Investors may wish to adjust the allocation of financial resources including a mixture

More information

arxiv: v1 [q-fin.rm] 1 Jan 2017

arxiv: v1 [q-fin.rm] 1 Jan 2017 Net Stable Funding Ratio: Impact on Funding Value Adjustment Medya Siadat 1 and Ola Hammarlid 2 arxiv:1701.00540v1 [q-fin.rm] 1 Jan 2017 1 SEB, Stockholm, Sweden medya.siadat@seb.se 2 Swedbank, Stockholm,

More information

Optimization Methods in Management Science

Optimization Methods in Management Science Problem Set Rules: Optimization Methods in Management Science MIT 15.053, Spring 2013 Problem Set 6, Due: Thursday April 11th, 2013 1. Each student should hand in an individual problem set. 2. Discussing

More information

Lecture outline W.B.Powell 1

Lecture outline W.B.Powell 1 Lecture outline What is a policy? Policy function approximations (PFAs) Cost function approximations (CFAs) alue function approximations (FAs) Lookahead policies Finding good policies Optimizing continuous

More information

Integer Programming Models

Integer Programming Models Integer Programming Models Fabio Furini December 10, 2014 Integer Programming Models 1 Outline 1 Combinatorial Auctions 2 The Lockbox Problem 3 Constructing an Index Fund Integer Programming Models 2 Integer

More information

OPPA European Social Fund Prague & EU: We invest in your future.

OPPA European Social Fund Prague & EU: We invest in your future. OPPA European Social Fund Prague & EU: We invest in your future. Cooperative Game Theory Michal Jakob and Michal Pěchouček Agent Technology Center, Dept. of Computer Science and Engineering, FEE, Czech

More information

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 4: Prior-Free Single-Parameter Mechanism Design. Instructor: Shaddin Dughmi

CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 4: Prior-Free Single-Parameter Mechanism Design. Instructor: Shaddin Dughmi CS599: Algorithm Design in Strategic Settings Fall 2012 Lecture 4: Prior-Free Single-Parameter Mechanism Design Instructor: Shaddin Dughmi Administrivia HW out, due Friday 10/5 Very hard (I think) Discuss

More information

The potential function φ for the amortized analysis of an operation on Fibonacci heap at time (iteration) i is given by the following equation:

The potential function φ for the amortized analysis of an operation on Fibonacci heap at time (iteration) i is given by the following equation: 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 01 Advanced Data Structures

More information

Finding optimal arbitrage opportunities using a quantum annealer

Finding optimal arbitrage opportunities using a quantum annealer Finding optimal arbitrage opportunities using a quantum annealer White Paper Finding optimal arbitrage opportunities using a quantum annealer Gili Rosenberg Abstract We present two formulations for finding

More information