# CSCE 310J Data Structures & Algorithms. Dynamic programming 0-1 Knapsack problem. Dynamic programming. Dynamic Programming. Knapsack problem (Review)

Save this PDF as:

Size: px
Start display at page:

Download "CSCE 310J Data Structures & Algorithms. Dynamic programming 0-1 Knapsack problem. Dynamic programming. Dynamic Programming. Knapsack problem (Review)"

## Transcription

1 CSCE J Data Structures & Algorithms Dynamic programming - Knapsac problem Dr. Steve Goddard CSCE J Data Structures & Algorithms Giving credit where credit is due:» Most of slides for this lecture are based on slides created by Dr. David Luebe, University of Virginia.» Some slides are based on lecture notes created by Dr. Chuc Cusac, UNL.» I have modified them and added new slides. Dynamic Programming Another strategy for designing algorithms is dynamic programming» A metatechnique, not an algorithm (lie divide & conquer)» The word programming is historical and predates computer programming Use when problem breas down into recurring small subproblems Dynamic programming It is used when the solution can be recursively described in terms of solutions to subproblems (optimal substructure). Algorithm finds solutions to subproblems and stores them in memory for later use. More efficient than brute-force methods, which solve the same subproblems over and over again. Summarizing the Concept of Dynamic Programming Basic idea:» Optimal substructure: optimal solution to problem consists of optimal solutions to subproblems» Overlapping subproblems: few subproblems in total, many recurring instances of each» Solve bottom-up, building a table of solved subproblems that are used to solve larger ones Variations:» Table could be -dimensional, triangular, a tree, etc. Knapsac problem (Review) Given some items, pac the napsac to get the maximum total value. Each item has some weight and some value. Total weight that we can carry is no more than some fixed number W. So we must consider weights of items as well as their value. Item # Weight Value 8 6 6

2 Knapsac problem There are two versions of the problem:. - napsac problem and. Fractional napsac problem. Items are indivisible; you either tae an item or not. Solved with dynamic programming. Items are divisible: you can tae any fraction of an item. Solved with a greedy algorithm. We have already seen this version - Knapsac problem Given a napsac with maximum capacity W, and a set S consisting of n items Each item i has some weight w i and benefit value b i (all w i, b i and W are integer values) Problem: How to pac the napsac to achieve maximum total value of paced items? 8 - Knapsac problem: a picture - Knapsac problem This is a napsac Max weight: W = W = Items Weight w i 9 Benefit value b i 8 Problem, in other words, is to find max i T b subject to i i T w W The problem is called a - problem, because each item must be entirely accepted or rejected. In the Fractional Knapsac Problem, we can tae fractions of items. i 9 - Knapsac problem: brute-force approach - Knapsac problem: brute-force approach Let s first solve this problem with a straightforward algorithm Since there are n items, there are n possible combinations of items. We go through all combinations and find the one with maximum value and with total weight less or equal to W Running time will be O( n ) Can we do better? Yes, with an algorithm based on dynamic programming We need to carefully identify the subproblems Let s try this: If items are labeled..n, then a subproblem would be to find an optimal solution for S = {items labeled,,.. }

3 Defining a Subproblem If items are labeled..n, then a subproblem would be to find an optimal solution for S = {items labeled,,.. } This is a reasonable subproblem definition. The question is: can we describe the final solution (S n ) in terms of subproblems (S )? Unfortunately, we can t do that. Defining a Subproblem w = b = w = b = w = b =8 w = Max weight: W = For S : Total weight: ; Maximum benefit: w = b = w = b = w = b =8 Weight Benefit Item # b = w i b i? w =9 b = For S : Total weight: Maximum benefit: 6 S S 9 8 Solution for S is not part of the solution for S!!! Defining a Subproblem (continued) Recursive Formula for subproblems As we have seen, the solution for S is not part of the solution for S So our definition of a subproblem is flawed and we need another one! Let s add another parameter: w, which will represent the exact weight for each subset of items The subproblem then will be to compute,w] Recursive formula for subproblems:, w] =, w] if w > w max{, w],, w w ] + b } It means, that the best subset of S that has total weight w is: ) the best subset of S - that has total weight w, or ) the best subset of S - that has total weight w-w plus the item 6 Recursive Formula, w] =, w] if w > w max{, w],, w w ] + b } The best subset of S that has the total weight w, either contains item or not. First case: w >w. Item can t be part of the solution, since if it was, the total weight would be > w, which is unacceptable. Second case: w w. Then the item can be in the solution, and we choose the case with greater value. - Knapsac Algorithm for w = to W,w] = for i = to n i,] = for i = to n for w = to W if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w 8

4 Running time for w = to W,w] = for i = to n i,] = for i = to n for w = to W < the rest of the code > O(W) Repeat n times O(W) What is the running time of this algorithm? O(n*W) Remember that the brute-force algorithm taes O( n ) 9 Example Let s run our algorithm on the following data: n = (# of elements) W = (max weight) Elements (weight, benefit): (,), (,), (,), (,6) Example () Example () i\w i\w for w = to W,w] = for i = to n i,] = Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i =- Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i =

5 Example (6) i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = 6 Example (8) i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = Example (9) i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i =- 8 Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i =- Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = 9

6 Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w-w i = Example () i\w : (,) : (,) : (,) i= : (,6) b i = w i = w=.. Example () i\w : (,) : (,) : (,) i= : (,6) b i = w i = w= w- w i = if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w Example (6) i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i = w i = w= w- w i = Example () i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i =6 w i = w=.. 6 6

7 Example (8) i\w if b i + i-,w-w i ] > i-,w] i,w] = b i + i-,w- w i ] i,w] = i-,w] i,w] = i-,w] // w i > w : (,) : (,) : (,) i= : (,6) b i =6 w i = w= w- w i = Comments This algorithm only finds the max possible value that can be carried in the napsac» I.e., the value in n,w] To now the items that mae this maximum value, an addition to this algorithm is necessary. 8 How to find actual Knapsac Items All of the information we need is in the table. n,w] is the maximal value of items that can be placed in the Knapsac. Let i=n and =W if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i // Assume the i th item is not in the napsac // Could it be in the optimally paced napsac? 9 i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items while i, > if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items () while i, > if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i i\w i= : (,) : (,) : (,) : (,6) = b i =6 w i = i,] = i,] = Finding the Items () while i, > if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i

8 Finding the Items () i\w i= while i, > if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i : (,) : (,) : (,) : (,6) = b i = w i = i,] = i,] = w i = Finding the Items () i\w i= while i, > if i,] i,] then mar the i th item as in the napsac i = i, = -w i i = i : (,) : (,) : (,) : (,6) = b i = w i = i,] = i,] = w i = Finding the Items (6) i\w while i, > if i,] i,] then mar the n th item as in the napsac i = i, = -w i i = i i= = : (,) : (,) : (,) : (,6) The optimal napsac should contain {, } Finding the Items () i\w while i, > if i,] i,] then mar the n th item as in the napsac i = i, = -w i i = i : (,) : (,) : (,) : (,6) The optimal napsac should contain {, } 6 Review: The Knapsac Problem And Optimal Substructure Solving The Knapsac Problem Both variations exhibit optimal substructure To show this for the - problem, consider the most valuable load weighing at most W pounds» If we remove item j from the load, what do we now about the remaining load?» A: remainder must be the most valuable load weighing at most W - w j that thief could tae, excluding item j The optimal solution to the fractional napsac problem can be found with a greedy algorithm» Do you recall how?» Greedy strategy: tae in order of dollars/pound The optimal solution to the - problem cannot be found with the same greedy strategy» Example: items weighing,, and pounds, napsac can hold pounds Suppose item is worth \$. Assign values to the other items so that the greedy strategy will fail 8 8

9 The Knapsac Problem: Greedy Vs. Dynamic Memoization The fractional problem can be solved greedily The - problem can be solved with a dynamic programming approach Memoization is another way to deal with overlapping subproblems in dynamic programming» After computing the solution to a subproblem, store it in a table» Subsequent calls just do a table looup With memoization, we implement the algorithm recursively:» If we encounter a subproblem we have seen, we loo up the answer» If not, compute the solution and add it to the list of subproblems we have seen. Must useful when the algorithm is easiest to implement recursively» Especially if we do not need solutions to all subproblems. 9 Conclusion Dynamic programming is a useful technique of solving certain ind of problems When the solution can be recursively described in terms of partial solutions, we can store these partial solutions and re-use them as necessary (memoization) Running time of dynamic programming algorithm vs. naïve algorithm:» - Knapsac problem: O(W*n) vs. O( n ) 9

### The Greedy Method. Fundamental Techniques. The Greedy Method. Fractional Knapsack Problem

Fundamental Techniques There are some algorithmic tools that are quite specialised. They are good for problems they are intended to solve, but they are not very versatile. There are also more fundamental

### Lecture 13: The Knapsack Problem

Lecture 13: The Knapsack Problem Outline of this Lecture Introduction of the 0-1 Knapsack Problem. A dynamic programming solution to this problem. 1 0-1 Knapsack Problem Informal Description: We have computed

### Analysis of Algorithms I: Optimal Binary Search Trees

Analysis of Algorithms I: Optimal Binary Search Trees Xi Chen Columbia University Given a set of n keys K = {k 1,..., k n } in sorted order: k 1 < k 2 < < k n we wish to build an optimal binary search

### Big Data & Scripting Part II Streaming Algorithms

Big Data & Scripting Part II Streaming Algorithms 1, 2, a note on sampling and filtering sampling: (randomly) choose a representative subset filtering: given some criterion (e.g. membership in a set),

### Memoization/Dynamic Programming. The String reconstruction problem. CS125 Lecture 5 Fall 2016

CS125 Lecture 5 Fall 2016 Memoization/Dynamic Programming Today s lecture discusses memoization, which is a method for speeding up algorithms based on recursion, by using additional memory to remember

### Near Optimal Solutions

Near Optimal Solutions Many important optimization problems are lacking efficient solutions. NP-Complete problems unlikely to have polynomial time solutions. Good heuristics important for such problems.

### Page 1. CSCE 310J Data Structures & Algorithms. CSCE 310J Data Structures & Algorithms. P, NP, and NP-Complete. Polynomial-Time Algorithms

CSCE 310J Data Structures & Algorithms P, NP, and NP-Complete Dr. Steve Goddard goddard@cse.unl.edu CSCE 310J Data Structures & Algorithms Giving credit where credit is due:» Most of the lecture notes

### Dynamic Programming. Lecture 11. 11.1 Overview. 11.2 Introduction

Lecture 11 Dynamic Programming 11.1 Overview Dynamic Programming is a powerful technique that allows one to solve many different types of problems in time O(n 2 ) or O(n 3 ) for which a naive approach

### The Selection Problem

The Selection Problem The selection problem: given an integer k and a list x 1,..., x n of n elements find the k-th smallest element in the list Example: the 3rd smallest element of the following list

### Lecture 7: NP-Complete Problems

IAS/PCMI Summer Session 2000 Clay Mathematics Undergraduate Program Basic Course on Computational Complexity Lecture 7: NP-Complete Problems David Mix Barrington and Alexis Maciel July 25, 2000 1. Circuit

### Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24

Introduction to Algorithms Review information for Prelim 1 CS 4820, Spring 2010 Distributed Wednesday, February 24 The final exam will cover seven topics. 1. greedy algorithms 2. divide-and-conquer algorithms

### COMP 250 Fall 2012 lecture 2 binary representations Sept. 11, 2012

Binary numbers The reason humans represent numbers using decimal (the ten digits from 0,1,... 9) is that we have ten fingers. There is no other reason than that. There is nothing special otherwise about

### Recurrence Relations

Recurrence Relations Introduction Determining the running time of a recursive algorithm often requires one to determine the big-o growth of a function T (n) that is defined in terms of a recurrence relation.

### Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that. a = bq + r and 0 r < b.

Theorem (The division theorem) Suppose that a and b are integers with b > 0. There exist unique integers q and r so that a = bq + r and 0 r < b. We re dividing a by b: q is the quotient and r is the remainder,

### Solutions to Homework 6

Solutions to Homework 6 Debasish Das EECS Department, Northwestern University ddas@northwestern.edu 1 Problem 5.24 We want to find light spanning trees with certain special properties. Given is one example

### Lecture 10: Regression Trees

Lecture 10: Regression Trees 36-350: Data Mining October 11, 2006 Reading: Textbook, sections 5.2 and 10.5. The next three lectures are going to be about a particular kind of nonlinear predictive model,

### Week 7: Divide and Conquer

Agenda: Divide and Conquer technique Multiplication of large integers Exponentiation Matrix multiplication 1 2- Divide and Conquer : To solve a problem we can break it into smaller subproblems, solve each

### Dynamic Programming Problem Set Partial Solution CMPSC 465

Dynamic Programming Problem Set Partial Solution CMPSC 465 I ve annotated this document with partial solutions to problems written more like a test solution. (I remind you again, though, that a formal

### Recall that in base 10, the digits of a number are just coefficients of powers of the base (10):

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### Divide And Conquer Algorithms

CSE341T/CSE549T 09/10/2014 Lecture 5 Divide And Conquer Algorithms Recall in last lecture, we looked at one way of parallelizing matrix multiplication. At the end of the lecture, we saw the reduce SUM

### Dynamic programming. Doctoral course Optimization on graphs - Lecture 4.1. Giovanni Righini. January 17 th, 2013

Dynamic programming Doctoral course Optimization on graphs - Lecture.1 Giovanni Righini January 1 th, 201 Implicit enumeration Combinatorial optimization problems are in general NP-hard and we usually

### Binary Number System. 16. Binary Numbers. Base 10 digits: 0 1 2 3 4 5 6 7 8 9. Base 2 digits: 0 1

Binary Number System 1 Base 10 digits: 0 1 2 3 4 5 6 7 8 9 Base 2 digits: 0 1 Recall that in base 10, the digits of a number are just coefficients of powers of the base (10): 417 = 4 * 10 2 + 1 * 10 1

### 1 Recursion and the divide-and-conquer approach

CS 7B - Spring 2014 - Assignment 4. 4/17/14 Write responses on paper and submit programs by email. 1 Recursion and the divide-and-conquer approach Many useful algorithms are recursive in structure: to

### Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li. Advised by: Dave Mount. May 22, 2014

Euclidean Minimum Spanning Trees Based on Well Separated Pair Decompositions Chaojun Li Advised by: Dave Mount May 22, 2014 1 INTRODUCTION In this report we consider the implementation of an efficient

### Divide and Conquer My T. UF

Introduction to Algorithms Divide and Conquer @ UF General Approach Divide the problem into a number of subproblems that are smaller instances of the same problem Conquer the subproblems by solving them

### Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay

Information Theory and Coding Prof. S. N. Merchant Department of Electrical Engineering Indian Institute of Technology, Bombay Lecture - 17 Shannon-Fano-Elias Coding and Introduction to Arithmetic Coding

### Data Mining Cluster Analysis: Basic Concepts and Algorithms. Lecture Notes for Chapter 8. Introduction to Data Mining

Data Mining Cluster Analysis: Basic Concepts and Algorithms Lecture Notes for Chapter 8 by Tan, Steinbach, Kumar 1 What is Cluster Analysis? Finding groups of objects such that the objects in a group will

### Data Structures and Algorithms Written Examination

Data Structures and Algorithms Written Examination 22 February 2013 FIRST NAME STUDENT NUMBER LAST NAME SIGNATURE Instructions for students: Write First Name, Last Name, Student Number and Signature where

### Computer Science 211 Data Structures Mount Holyoke College Fall Topic Notes: Recursion and Mathematical Induction

Computer Science 11 Data Structures Mount Holyoke College Fall 009 Topic Notes: Recursion and Mathematical Induction Recursion An important tool when trying to solve a problem is the ability to break the

### INTEGER PROGRAMMING. Integer Programming. Prototype example. BIP model. BIP models

Integer Programming INTEGER PROGRAMMING In many problems the decision variables must have integer values. Example: assign people, machines, and vehicles to activities in integer quantities. If this is

### MA 1125 Lecture 14 - Expected Values. Friday, February 28, 2014. Objectives: Introduce expected values.

MA 5 Lecture 4 - Expected Values Friday, February 2, 24. Objectives: Introduce expected values.. Means, Variances, and Standard Deviations of Probability Distributions Two classes ago, we computed the

### Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4

Intro. to the Divide-and-Conquer Strategy via Merge Sort CMPSC 465 CLRS Sections 2.3, Intro. to and various parts of Chapter 4 I. Algorithm Design and Divide-and-Conquer There are various strategies we

### Outline. NP-completeness. When is a problem easy? When is a problem hard? Today. Euler Circuits

Outline NP-completeness Examples of Easy vs. Hard problems Euler circuit vs. Hamiltonian circuit Shortest Path vs. Longest Path 2-pairs sum vs. general Subset Sum Reducing one problem to another Clique

### About the inverse football pool problem for 9 games 1

Seventh International Workshop on Optimal Codes and Related Topics September 6-1, 013, Albena, Bulgaria pp. 15-133 About the inverse football pool problem for 9 games 1 Emil Kolev Tsonka Baicheva Institute

### Computer Algorithms. NP-Complete Problems. CISC 4080 Yanjun Li

Computer Algorithms NP-Complete Problems NP-completeness The quest for efficient algorithms is about finding clever ways to bypass the process of exhaustive search, using clues from the input in order

### Recurrences (CLRS )

Recurrences (CLRS 4.1-4.2) Last time we discussed divide-and-conquer algorithms Divide and Conquer To Solve P: 1. Divide P into smaller problems P 1,P 2,P 3...P k. 2. Conquer by solving the (smaller) subproblems

### Faster deterministic integer factorisation

David Harvey (joint work with Edgar Costa, NYU) University of New South Wales 25th October 2011 The obvious mathematical breakthrough would be the development of an easy way to factor large prime numbers

### Lecture 12: Chain Matrix Multiplication

Lecture 12: Chain Matrix Multiplication CLRS Section 15.2 Outline of this Lecture Recalling matrix multiplication. The chain matrix multiplication problem. A dynamic programming algorithm for chain matrix

### Induction. Margaret M. Fleck. 10 October These notes cover mathematical induction and recursive definition

Induction Margaret M. Fleck 10 October 011 These notes cover mathematical induction and recursive definition 1 Introduction to induction At the start of the term, we saw the following formula for computing

### Final Exam, Spring 2007

10-701 Final Exam, Spring 2007 1. Personal info: Name: Andrew account: E-mail address: 2. There should be 16 numbered pages in this exam (including this cover sheet). 3. You can use any material you brought:

### Data Preprocessing. Week 2

Data Preprocessing Week 2 Topics Data Types Data Repositories Data Preprocessing Present homework assignment #1 Team Homework Assignment #2 Read pp. 227 240, pp. 250 250, and pp. 259 263 the text book.

### CS420/520 Algorithm Analysis Spring 2010 Lecture 04

CS420/520 Algorithm Analysis Spring 2010 Lecture 04 I. Chapter 4 Recurrences A. Introduction 1. Three steps applied at each level of a recursion a) Divide into a number of subproblems that are smaller

### Design and Analysis of Algorithms

Design and Analysis of Algorithms CSE 5311 Lecture 3 Divide-and-Conquer Junzhou Huang, Ph.D. Department of Computer Science and Engineering CSE5311 Design and Analysis of Algorithms 1 Reviewing: Θ-notation

### Lecture 21: Dynamic Programming III

Lecture 21: Dynamic Programming III Lecture Overview Subproblems for strings Parenthesization Edit distance (& longest common subseq.) Knapsack Pseudopolynomial Time Review: * 5 easy steps to dynamic programming

### Greedy algorithms. Solve the Fractional Knapsack Problem for this set of items, where the maximum total allowed weight is W max = 15.

Greedy algorithms 1. Consider the set of items S = {a, b, c, d, e, f, g, h} where the benefits and weights are given in the table below. Note that I have computed the value index of each item (benefit/weight)

### The Tower of Hanoi. Recursion Solution. Recursive Function. Time Complexity. Recursive Thinking. Why Recursion? n! = n* (n-1)!

The Tower of Hanoi Recursion Solution recursion recursion recursion Recursive Thinking: ignore everything but the bottom disk. 1 2 Recursive Function Time Complexity Hanoi (n, src, dest, temp): If (n >

### Notes on Excel Forecasting Tools. Data Table, Scenario Manager, Goal Seek, & Solver

Notes on Excel Forecasting Tools Data Table, Scenario Manager, Goal Seek, & Solver 2001-2002 1 Contents Overview...1 Data Table Scenario Manager Goal Seek Solver Examples Data Table...2 Scenario Manager...8

### Induction Problems. Tom Davis November 7, 2005

Induction Problems Tom Davis tomrdavis@earthlin.net http://www.geometer.org/mathcircles November 7, 2005 All of the following problems should be proved by mathematical induction. The problems are not necessarily

### 3.2 The Factor Theorem and The Remainder Theorem

3. The Factor Theorem and The Remainder Theorem 57 3. The Factor Theorem and The Remainder Theorem Suppose we wish to find the zeros of f(x) = x 3 + 4x 5x 4. Setting f(x) = 0 results in the polynomial

### Lecture 1: Course overview, circuits, and formulas

Lecture 1: Course overview, circuits, and formulas Topics in Complexity Theory and Pseudorandomness (Spring 2013) Rutgers University Swastik Kopparty Scribes: John Kim, Ben Lund 1 Course Information Swastik

### 8.1 Makespan Scheduling

600.469 / 600.669 Approximation Algorithms Lecturer: Michael Dinitz Topic: Dynamic Programing: Min-Makespan and Bin Packing Date: 2/19/15 Scribe: Gabriel Kaptchuk 8.1 Makespan Scheduling Consider an instance

### Binary Ant Colony Evolutionary Algorithm

Weiqing Xiong Liuyi Wang Chenyang Yan School of Information Science and Engineering Ningbo University, Ningbo 35 China Weiqing,xwqdds@tom.com, Liuyi,jameswang@hotmail.com School Information and Electrical

### Data Mining Classification: Decision Trees

Data Mining Classification: Decision Trees Classification Decision Trees: what they are and how they work Hunt s (TDIDT) algorithm How to select the best split How to handle Inconsistent data Continuous

### Merge Sort and Recurrences. COSC 581, Algorithms January 14, 2014

Merge Sort and Recurrences COSC 581, Algorithms January 14, 2014 Reading Assignments Today s class: Chapter 2, 4.0, 4.4 Reading assignment for next class: Chapter 4.2, 4.5 3 Common Algorithmic Techniques

### // Returns base ^ exponent. // Precondition: exponent >= 0 // base case; any number to 0th power is 1 // recursive case: x^n = x * x^(n-1)

Recursion continued Exercise solution // Returns base ^ exponent. // Precondition: exponent >= 0 public static int pow(int x, int n) { if (n == 0) { // base case; any number to 0th power is 1 return 1;

### Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation. Lecture Notes for Chapter 4. Introduction to Data Mining

Data Mining Classification: Basic Concepts, Decision Trees, and Model Evaluation Lecture Notes for Chapter 4 Introduction to Data Mining by Tan, Steinbach, Kumar Tan,Steinbach, Kumar Introduction to Data

### Useful Number Systems

Useful Number Systems Decimal Base = 10 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} Binary Base = 2 Digit Set = {0, 1} Octal Base = 8 = 2 3 Digit Set = {0, 1, 2, 3, 4, 5, 6, 7} Hexadecimal Base = 16 = 2

### Notes on Factoring. MA 206 Kurt Bryan

The General Approach Notes on Factoring MA 26 Kurt Bryan Suppose I hand you n, a 2 digit integer and tell you that n is composite, with smallest prime factor around 5 digits. Finding a nontrivial factor

### CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis. Linda Shapiro Winter 2015

CSE373: Data Structures and Algorithms Lecture 3: Math Review; Algorithm Analysis Linda Shapiro Today Registration should be done. Homework 1 due 11:59 pm next Wednesday, January 14 Review math essential

### Polynomials. Dr. philippe B. laval Kennesaw State University. April 3, 2005

Polynomials Dr. philippe B. laval Kennesaw State University April 3, 2005 Abstract Handout on polynomials. The following topics are covered: Polynomial Functions End behavior Extrema Polynomial Division

### CSC2420 Spring 2015: Lecture 3

CSC2420 Spring 2015: Lecture 3 Allan Borodin January 22, 2015 1 / 1 Announcements and todays agenda Assignment 1 due next Thursday. I may add one or two additional questions today or tomorrow. Todays agenda

### The Taxman Game. Robert K. Moniot September 5, 2003

The Taxman Game Robert K. Moniot September 5, 2003 1 Introduction Want to know how to beat the taxman? Legally, that is? Read on, and we will explore this cute little mathematical game. The taxman game

### Solving Mixed Integer Linear Programs Using Branch and Cut Algorithm

1 Solving Mixed Integer Linear Programs Using Branch and Cut Algorithm by Shon Albert A Project Submitted to the Graduate Faculty of North Carolina State University in Partial Fulfillment of the Requirements

### Approximation Algorithms

Approximation Algorithms or: How I Learned to Stop Worrying and Deal with NP-Completeness Ong Jit Sheng, Jonathan (A0073924B) March, 2012 Overview Key Results (I) General techniques: Greedy algorithms

### Discuss the size of the instance for the minimum spanning tree problem.

3.1 Algorithm complexity The algorithms A, B are given. The former has complexity O(n 2 ), the latter O(2 n ), where n is the size of the instance. Let n A 0 be the size of the largest instance that can

### 1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM)

Copyright c 2013 by Karl Sigman 1 Simulating Brownian motion (BM) and geometric Brownian motion (GBM) For an introduction to how one can construct BM, see the Appendix at the end of these notes A stochastic

### 24. The Branch and Bound Method

24. The Branch and Bound Method It has serious practical consequences if it is known that a combinatorial problem is NP-complete. Then one can conclude according to the present state of science that no

### PROJECT COST MANAGEMENT

7 PROJECT COST MANAGEMENT Project Cost Management includes the processes required to ensure that the project is completed within the approved budget. Figure 7 1 provides an overview of the following major

### Lecture Notes on Database Normalization

Lecture Notes on Database Normalization Chengkai Li Department of Computer Science and Engineering The University of Texas at Arlington April 15, 2012 I decided to write this document, because many students

### Stats for Strategy Exam 1 In-Class Practice Questions DIRECTIONS

Stats for Strategy Exam 1 In-Class Practice Questions DIRECTIONS Choose the single best answer for each question. Discuss questions with classmates, TAs and Professor Whitten. Raise your hand to check

### Data Mining with R. Decision Trees and Random Forests. Hugh Murrell

Data Mining with R Decision Trees and Random Forests Hugh Murrell reference books These slides are based on a book by Graham Williams: Data Mining with Rattle and R, The Art of Excavating Data for Knowledge

### CSI 333 Lecture 1 Number Systems

CSI 333 Lecture 1 Number Systems 1 1 / 23 Basics of Number Systems Ref: Appendix C of Deitel & Deitel. Weighted Positional Notation: 192 = 2 10 0 + 9 10 1 + 1 10 2 General: Digit sequence : d n 1 d n 2...

### Algorithm Design and Analysis

Algorithm Design and Analysis LECTURE 27 Approximation Algorithms Load Balancing Weighted Vertex Cover Reminder: Fill out SRTEs online Don t forget to click submit Sofya Raskhodnikova 12/6/2011 S. Raskhodnikova;

### 2 The Euclidean algorithm

2 The Euclidean algorithm Do you understand the number 5? 6? 7? At some point our level of comfort with individual numbers goes down as the numbers get large For some it may be at 43, for others, 4 In

### Less naive Bayes spam detection

Less naive Bayes spam detection Hongming Yang Eindhoven University of Technology Dept. EE, Rm PT 3.27, P.O.Box 53, 5600MB Eindhoven The Netherlands. E-mail:h.m.yang@tue.nl also CoSiNe Connectivity Systems

### Temperature Scales. The metric system that we are now using includes a unit that is specific for the representation of measured temperatures.

Temperature Scales INTRODUCTION The metric system that we are now using includes a unit that is specific for the representation of measured temperatures. The unit of temperature in the metric system is

### Medical Information Management & Mining. You Chen Jan,15, 2013 You.chen@vanderbilt.edu

Medical Information Management & Mining You Chen Jan,15, 2013 You.chen@vanderbilt.edu 1 Trees Building Materials Trees cannot be used to build a house directly. How can we transform trees to building materials?

### Annuities. Lecture: Weeks 9-11. Lecture: Weeks 9-11 (STT 455) Annuities Fall 2014 - Valdez 1 / 43

Annuities Lecture: Weeks 9-11 Lecture: Weeks 9-11 (STT 455) Annuities Fall 2014 - Valdez 1 / 43 What are annuities? What are annuities? An annuity is a series of payments that could vary according to:

### MapReduce and Distributed Data Analysis. Sergei Vassilvitskii Google Research

MapReduce and Distributed Data Analysis Google Research 1 Dealing With Massive Data 2 2 Dealing With Massive Data Polynomial Memory Sublinear RAM Sketches External Memory Property Testing 3 3 Dealing With

### Assignment Problems. Guoming Tang

Assignment Problems Guoming Tang A Practical Problem Workers: A, B, C, D Jobs: P, Q, R, S. Cost matrix: Job P Job Q Job R Job S Worker A 1 2 3 4 Worker B 2 4 6 8 Worker C 3 6 9 12 Worker D 4 8 12 16 Given:

### Divide and Conquer Examples. Top-down recursive mergesort. Gravitational N-body problem.

Divide and Conquer Divide the problem into several subproblems of equal size. Recursively solve each subproblem in parallel. Merge the solutions to the various subproblems into a solution for the original

### Computational Finance Options

1 Options 1 1 Options Computational Finance Options An option gives the holder of the option the right, but not the obligation to do something. Conversely, if you sell an option, you may be obliged to

### !"!!"#\$\$%&'()*+\$(,%!"#\$%\$&'()*""%(+,'-*&./#-\$&'(-&(0*".\$#-\$1"(2&."3\$'45"

!"!!"#\$\$%&'()*+\$(,%!"#\$%\$&'()*""%(+,'-*&./#-\$&'(-&(0*".\$#-\$1"(2&."3\$'45"!"#"\$%&#'()*+',\$\$-.&#',/"-0%.12'32./4'5,5'6/%&)\$).2&'7./&)8'5,5'9/2%.%3%&8':")08';:

### Exponential time algorithms for graph coloring

Exponential time algorithms for graph coloring Uriel Feige Lecture notes, March 14, 2011 1 Introduction Let [n] denote the set {1,..., k}. A k-labeling of vertices of a graph G(V, E) is a function V [k].

### Formal Languages and Automata Theory - Regular Expressions and Finite Automata -

Formal Languages and Automata Theory - Regular Expressions and Finite Automata - Samarjit Chakraborty Computer Engineering and Networks Laboratory Swiss Federal Institute of Technology (ETH) Zürich March

### Game Theory and Algorithms Lecture 10: Extensive Games: Critiques and Extensions

Game Theory and Algorithms Lecture 0: Extensive Games: Critiques and Extensions March 3, 0 Summary: We discuss a game called the centipede game, a simple extensive game where the prediction made by backwards

### CSC 373: Algorithm Design and Analysis Lecture 16

CSC 373: Algorithm Design and Analysis Lecture 16 Allan Borodin February 25, 2013 Some materials are from Stephen Cook s IIT talk and Keven Wayne s slides. 1 / 17 Announcements and Outline Announcements

### SOLUTIONS FOR PROBLEM SET 2

SOLUTIONS FOR PROBLEM SET 2 A: There exist primes p such that p+6k is also prime for k = 1,2 and 3. One such prime is p = 11. Another such prime is p = 41. Prove that there exists exactly one prime p such

### Chapter 4. Trees. 4.1 Basics

Chapter 4 Trees 4.1 Basics A tree is a connected graph with no cycles. A forest is a collection of trees. A vertex of degree one, particularly in a tree, is called a leaf. Trees arise in a variety of applications.

### Optimal Cheque Production: A Case Study

Blo UNIVERSITÀ DI SALERNO Dipartimento di Matematica e Informatica D.M.I. Via Ponte don Melillo 84084 Fisciano (SA) Italy Optimal Cheque Production: A Case Study Raffaele Cerulli, Renato De Leone, Monica

### Solutions of Linear Equations in One Variable

2. Solutions of Linear Equations in One Variable 2. OBJECTIVES. Identify a linear equation 2. Combine like terms to solve an equation We begin this chapter by considering one of the most important tools

### Language Modeling. Chapter 1. 1.1 Introduction

Chapter 1 Language Modeling (Course notes for NLP by Michael Collins, Columbia University) 1.1 Introduction In this chapter we will consider the the problem of constructing a language model from a set

### Supervised Learning (Big Data Analytics)

Supervised Learning (Big Data Analytics) Vibhav Gogate Department of Computer Science The University of Texas at Dallas Practical advice Goal of Big Data Analytics Uncover patterns in Data. Can be used

### IP Subnetting: Practical Subnet Design and Address Determination Example

IP Subnetting: Practical Subnet Design and Address Determination Example When educators ask students what they consider to be the most confusing aspect in learning about networking, many say that it is

### ! Solve problem to optimality. ! Solve problem in poly-time. ! Solve arbitrary instances of the problem. #-approximation algorithm.

Approximation Algorithms 11 Approximation Algorithms Q Suppose I need to solve an NP-hard problem What should I do? A Theory says you're unlikely to find a poly-time algorithm Must sacrifice one of three

### Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi

Project and Production Management Prof. Arun Kanda Department of Mechanical Engineering Indian Institute of Technology, Delhi Lecture - 9 Basic Scheduling with A-O-A Networks Today we are going to be talking

### Dimitris Chatzidimitriou. Corelab NTUA. June 28, 2013

AN EFFICIENT ALGORITHM FOR THE OPTIMAL STABLE MARRIAGE PROBLEM Dimitris Chatzidimitriou Corelab NTUA June 28, 2013 OUTLINE 1 BASIC CONCEPTS 2 DEFINITIONS 3 ROTATIONS 4 THE ALGORITHM DIMITRIS CHATZIDIMITRIOU

### Chapter 13: Binary and Mixed-Integer Programming

Chapter 3: Binary and Mixed-Integer Programming The general branch and bound approach described in the previous chapter can be customized for special situations. This chapter addresses two special situations: