CS 331 DESIGN AND ANALYSIS OF ALGORITHMS DYNAMIC PROGRAMMING. Dr. Daisy Tang

Size: px
Start display at page:

Download "CS 331 DESIGN AND ANALYSIS OF ALGORITHMS DYNAMIC PROGRAMMING. Dr. Daisy Tang"

Transcription

1 CS DESIGN ND NLYSIS OF LGORITHMS DYNMIC PROGRMMING Dr. Dasy Tang

2 Dynamc Programmng Idea: Problems can be dvded nto stages Soluton s a sequence o decsons and the decson at the current stage s based on the results o the prevous stage

3 Example: Fbonacc Numbers F() F() F( n) F( n ) F( n ) n ssume n = 5 F(5) F () F() F () F () F () F() F () F () F () F () F() F() F() F()

4 I We Use Dvde-and-Conquer Dvde the problem nto subproblems. Solve each subproblem ndependently and then combne the solutons. For example F() s rst calculated n the let subtree and t wll be calculated agan n the rght subtree Subproblems are solved ndependently

5 But Dynamc Programmng 5 Works on phases Based on the results n prevous phase we can calculate result or the current phase Can be solved n a or-loop F[] = F[] = For to n F[] = F[-] + F[-];

6 Greedy vs. Dynamc Programmng 6 Consder shortest path problem Suppose we wsh to nd a shortest path rom vertex to vertex j. Let be the vertces adjacent rom vertex. Whch o the vertces n should be the second vertex on the path? There s no way to make a decson at ths tme and guarantee that uture decsons leadng to an optmal sequence can be made. I on the other hand we wsh to nd a shortest path rom vertex to all other vertces n G then at each step a correct decson can be made based on the prncple o optmalty.

7 Greedy vs. Dynamc Programmng 7 Greedy: For problems that an optmal soluton can be ound by makng the decsons one at a tme and never makng an erroneous decson [e.g. Knapsack] Consder only decson sequence Dynamc programmng: For problems that t s not possble to make stepwse decsons based only on local normaton Consder many decson sequences Try all possbltes but elmnates mpossble cases based on the prncple o optmalty

8 Prncple o Optmalty 8 Prncple o optmalty: n optmal sequence o decsons has the property that whatever the ntal decson s the remanng decsons must consttute an optmal decson sequence wth regard to the state resultng rom the rst decson elmnates not optmal subsequences

9 Examples 9 The shortest path problem satses the Prncple o Optmalty Subpath o a shortest path s also a shortest path The longest path problem does not satsy the Prncple o Optmalty Consder a rng graph The subpath o a longest path mght not be a longest path

10 . Multstage Sngle-Source Sngle- Destnaton Shortest Path Problem The Problem: Gven: m columns (or stages) o n nodes each a source node a destnaton node. ssume edges only exst between stages. Goal: to nd the shortest path rom source ( ) to the destnaton (m- ) Stage number Node number o that stage

11 Straghtorward vs. Dynamc Programmng Straghtorward way: Try all possble paths Complexty: O( n m ) Dynamc programmng: Let M( j) = length o the shortest path rom the source () to ( j) c( k j) = dstance rom ( k) to (+ j) want to nd M(m- ) Dene unctonal equaton: n M ( j) mn k M () M ( k) c( Shortest path rom source () to destnaton (m-) Dene the relaton between current stage and the result o prevous stage k j)

12 Example 5 5 Source 5 Destnaton

13 M () mn M () mn M () mn 5 Remember the prevous node o ths shortest path M () mn 5 7 M () mn 5 5 M () mn M ( ) mn7 5 7 Can be used or constructng the shortest path at the end The shortest path s: ( ) () () () ()

14 M: node( j) \ stage( ) lgorthm: assgn ntally M()= M() = M() = M()=; or = to (m ) // stages or j = to n // nodes M ( j) mn k calculate and return M(m ); n M ( k) c( k j)

15 Tme Complexty 5 There are O(mn) M( j) s to compute each M( j) takes O(n) computaton. So total complexty s O(mn ). total # o nodes n the graph Let N = m n nodes max # o stages max # o nodes n each stage mn = mn n = N n Note: use the Djkstra s algorthm the complexty s O(N )

16 Revst Dynamc Programmng 6 The problem can be dvded nto stages. Need to make decsons at each stage. The decson or the current stage (based on the results o the prevous stage) s ndependent rom that o the prevous stages. e.g. node o the multstage shortest path problem t s calculated rom m() m() and m() but t s ndependent rom how node ( or ) makes ts decson. Note that we nd shortest paths rom the source to all three nodes and and but some o them may not be used on the shortest path at all. But every decson must be optmal so that the overall result s optmal. Ths s called Prncple o Optmalty.

17 Problem : ll Pars Shortest Paths 7 The problem: Gven G = (V E) a drected graph wth n nodes Cost a cost adjacency matrx or G: Cost = Cost j = cost o <j> <j> E(G) otherwse Goal: to determne a matrx s.t. j = the length o the shortest path rom to j j n

18 Use Djkstra s algorthm call t or n tmes: Tme complexty s O(n ) The Dynamc Programmng way: Let jk = the length o the shortest path rom to j gong through no vertex o ndex greater than k Want to nd j n Observe that j = Cost Dene unctonal equaton: jk = mn { j k- k k- + kj k- } 8

19 9 Example: v v v mn mn mn 6 mn mn mn 7 6

20 mn mn mn 5 mn 6 mn mn mn mn mn 6 mn 6 mn mn

21 lgorthm: procedure llpars (n Cost ) // n Cost are nput s output { or to n do or j to n do (j) Cost(j); or k to n do or to n do or j to n do (j) mn {(j) (k)+ (kj)}; } There are O(n) k s to compute each takes O(n ) computaton total complexty o llpar s O(n ).

22 In order to prnt shortest paths or all pars o vertces we mody the algorthm: procedure llpaths (n Cost P) // n Cost are nput and P are output // P(j) contans the ntermedate node rom to j { or = to n do or j = to n do (j) = Cost(j); P(j) = j; or k = to n do or = to n do or j = to n do ((j) > (k)+ (kj) ) then P(j) = k; (j) = (k)+ (kj) ; or = to n do or j = to n do prnt(); Call PrntOut(P j); } procedure PrntOut (P j) { P(j) = j } then prnt(j); else let k = P(j); call PrntOut(P k); call PrntOut(P k j);

23 In-Class Exercse # Solve the all pars shortest path problem or the graph wth the ollowng weght matrx. Fnd and P and shortest paths or all pars o vertces. Show steps. = 5 5

24 Problem : Chaned Matrx Multplcaton The problem: Gven M M... M r (r matrces) [d d ] [d d ] [d r- d r ] Goal: nd the mnmum cost o multplyng r matrces

25 5 The dea: Dene C( j) = mnmum cost o computng M M +... M j C( ) = C ( ) d d d Want to nd C(r) Consder matrces rom to j : k = M M M (the total # o elementary multplcatons ) M j M j k: dvde-pont k j We can dvde the sequence o matrces rom to j nto two parts wth dvdng pont k where k j. j

26 6 We dvde t nto two parts wth dvde-pont k j k d k d ] [ j k d d Dene the unctonal equaton: B j k j k d d d j k C k C j C ) ( ) ( mn ) ( Cost o multplyng and B k k k d d d d M M M... j j k k j k d d d d M M...

27 7 Example: M M M M sze C ) ( sze 5 () () 8 8 () C C C

28 sze C() mn ( C() C() 8 5)( C() C() 5 k 78 Smallest C() mn( C() C() 8 )( C() C() 8 5 k Smallest ( C() C() 8 ) sze C() mn ( C() C() ) k ( () () 5 C C 8 It has the smallest cost when k =. Remember ths k-value and t can be used or obtanng the optmal soluton. The optmal multplcaton sequence or ths nstance s (M M ) (M M ).

29 9 lgorthm: procedure MnMult (r D P) // r D are nputs P s output { or to r do C( ) = or d to (r ) do or to (r d) do P C( r); } ; ) ( ) ( ) ( ) ( ) ( mn ) ( ; j D k D D j k C k C j C d j j k

30 nalyss: Matrx product o # o C(j) s wth ths sze Cost o computng C(j) sze.e. j = + r sze.e. j = + r sze r j = + (r ) r Total complexty s O(r ) Total # o C( j) s to compute s O(r ) each C( j) takes O(r) tme n the worst case

31 Problem : / Knapsack The problem: Gven n objects p p p n prot w w w n weght M = the capacty o the knapsack Goal: nd x x x n s.t. n p s maxmzed subject to x where x = or n w x M

32 The straght orward way: Try all possbltes. The complexty s O( n ). Example: 6 5 M w w w p p p n x x x x w p x soluton

33 Does Greedy work? Ths problem can t be solved by Greedy (P / W order) Counterexample: M = 6 P = 5 W = Greedy X = () total prot = 5. Optmal Y = () total prot = 6. The Dynamc Programmng way: Let (X ) = max prot generated rom subject to the capacty X want to nd n (M) Dene unctonal equaton: ( X ) max ( X ) p ( X ) ( X W x x x x... ) x

34 Example: n = 6 p p p p p5 p6 w w w w w5 w6 5 7 M 65 To nd 6 (65) : 6 (65) max 5 (65) max (65) max (65) max (65) max (65) max (5) max (5) max (6 ) max (65 ) (65 ) (65 ) (65 ) (65 ) (65) (5) (5 ) (6 ) 5 (6 ) max{6 6} 6 (58) 7 max{6 57} 6 (55 ) max{5 6} 6 (5) max{5 } 5 (5) 5 max{5} 5 (65) (5) (95) 5 max{ 5} (55 ) 7 max{657} 6

35 The result: x x x x x x Thereore the complexty o / Knapsack s O( n ) 5

36 M+ n+ j-w j M - - (j-w ) - (j) n +p (j) (M+)(n+) entres and constant tme each O(Mn) 6

37 Example: M = 6 Object Object Object Object p 8 5 w Max prot s By tracng whch entres lead to ths max-prot soluton we can obtan the optmal soluton - Object and (or and ).

38 Problem 5: Travelng Salesman Problem (TSP) 8 The problem: Gven a drected graph G = (V E) wth edge cost tour (or Hamltonan Crcut) o G s dened as drected cycle rom a vertex to tsel that passes through every other vertces exactly once. Goal: nd a tour wth mnmum cost

39 Example: G: C Tour : [ ] Cost = = 9 Tour : [ ] Cost = = 6 9

40 The straghtorward way: Ths s a permutaton problem. There are (n-)*(n-)* * combnatons o tours so the complexty s O(n!). The Dynamc Programmng way: ssume startng vertex s wthout loss o generalty. Let g(s) = length o the shortest path startng at vertex gong through all the vertces n S and termnatng at vertex Want to nd g(v {}) Dene unctonal equaton: g(s) = C S = g(s) = C S + C S S = g(s) = mn{ C k + g(k S {k}) } ks S

41 Use the above example: g g g g mnc g( ) C g C g k mn k mn C g C g k mn k mn C g C g k mn k mn C g C g k mn k Tour: Cost: There are O(n n ) g(s) s to compute each takes O(n) computaton. Thereore the complexty o TSP by dynamc programmng s O(n n ).

42 lgorthm: procedure TSP (C mnlength); //assume startng vertex s { or to n do g() = C(); or k to (n-) or all subsets S V {} contanng k vertces or ( such that and S) g(s) = mn ( C(j)+g(jS {j}) ); js path(s) = value o j that gave the mnmum; } g(v {}) mn ( C(j)+g(jV {j}) ); jn path(v {}) value o j that gave the mnmum; mnlength g(v {});

Problem Set 9 Solutions

Problem Set 9 Solutions Desgn and Analyss of Algorthms May 4, 2015 Massachusetts Insttute of Technology 6.046J/18.410J Profs. Erk Demane, Srn Devadas, and Nancy Lynch Problem Set 9 Solutons Problem Set 9 Solutons Ths problem

More information

Dynamic Programming. Preview. Dynamic Programming. Dynamic Programming. Dynamic Programming (Example: Fibonacci Sequence)

Dynamic Programming. Preview. Dynamic Programming. Dynamic Programming. Dynamic Programming (Example: Fibonacci Sequence) /24/27 Prevew Fbonacc Sequence Longest Common Subsequence Dynamc programmng s a method for solvng complex problems by breakng them down nto smpler sub-problems. It s applcable to problems exhbtng the propertes

More information

Outline and Reading. Dynamic Programming. Dynamic Programming revealed. Computing Fibonacci. The General Dynamic Programming Technique

Outline and Reading. Dynamic Programming. Dynamic Programming revealed. Computing Fibonacci. The General Dynamic Programming Technique Outlne and Readng Dynamc Programmng The General Technque ( 5.3.2) -1 Knapsac Problem ( 5.3.3) Matrx Chan-Product ( 5.3.1) Dynamc Programmng verson 1.4 1 Dynamc Programmng verson 1.4 2 Dynamc Programmng

More information

Calculation of time complexity (3%)

Calculation of time complexity (3%) Problem 1. (30%) Calculaton of tme complexty (3%) Gven n ctes, usng exhaust search to see every result takes O(n!). Calculaton of tme needed to solve the problem (2%) 40 ctes:40! dfferent tours 40 add

More information

Dynamic Programming! CSE 417: Algorithms and Computational Complexity!

Dynamic Programming! CSE 417: Algorithms and Computational Complexity! Dynamc Programmng CSE 417: Algorthms and Computatonal Complexty Wnter 2009 W. L. Ruzzo Dynamc Programmng, I:" Fbonacc & Stamps Outlne: General Prncples Easy Examples Fbonacc, Lckng Stamps Meater examples

More information

Design and Analysis of Algorithms

Design and Analysis of Algorithms Desgn and Analyss of Algorthms CSE 53 Lecture 4 Dynamc Programmng Junzhou Huang, Ph.D. Department of Computer Scence and Engneerng CSE53 Desgn and Analyss of Algorthms The General Dynamc Programmng Technque

More information

Math Review. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University

Math Review. CptS 223 Advanced Data Structures. Larry Holder School of Electrical Engineering and Computer Science Washington State University Math Revew CptS 223 dvanced Data Structures Larry Holder School of Electrcal Engneerng and Computer Scence Washngton State Unversty 1 Why do we need math n a data structures course? nalyzng data structures

More information

Dynamic Programming. Lecture 13 (5/31/2017)

Dynamic Programming. Lecture 13 (5/31/2017) Dynamc Programmng Lecture 13 (5/31/2017) - A Forest Thnnng Example - Projected yeld (m3/ha) at age 20 as functon of acton taken at age 10 Age 10 Begnnng Volume Resdual Ten-year Volume volume thnned volume

More information

Example: (13320, 22140) =? Solution #1: The divisors of are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41,

Example: (13320, 22140) =? Solution #1: The divisors of are 1, 2, 3, 4, 5, 6, 9, 10, 12, 15, 18, 20, 27, 30, 36, 41, The greatest common dvsor of two ntegers a and b (not both zero) s the largest nteger whch s a common factor of both a and b. We denote ths number by gcd(a, b), or smply (a, b) when there s no confuson

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J LECTURE 6 Shortest Paths III All-pars shortest paths Matrx-multplcaton algorthm Floyd-Warshall algorthm Johnson s algorthm Prof. Charles E. Leserson Shortest paths

More information

A 2D Bounded Linear Program (H,c) 2D Linear Programming

A 2D Bounded Linear Program (H,c) 2D Linear Programming A 2D Bounded Lnear Program (H,c) h 3 v h 8 h 5 c h 4 h h 6 h 7 h 2 2D Lnear Programmng C s a polygonal regon, the ntersecton of n halfplanes. (H, c) s nfeasble, as C s empty. Feasble regon C s unbounded

More information

Introduction to Algorithms

Introduction to Algorithms Introducton to Algorthms 6.046J/8.40J/SMA5503 Lecture 9 Prof. Erk Demane Shortest paths Sngle-source shortest paths Nonnegate edge weghts Djkstra s algorthm: OE + V lg V General Bellman-Ford: OVE DAG One

More information

Chapter 3 Differentiation and Integration

Chapter 3 Differentiation and Integration MEE07 Computer Modelng Technques n Engneerng Chapter Derentaton and Integraton Reerence: An Introducton to Numercal Computatons, nd edton, S. yakowtz and F. zdarovsky, Mawell/Macmllan, 990. Derentaton

More information

U.C. Berkeley CS294: Beyond Worst-Case Analysis Luca Trevisan September 5, 2017

U.C. Berkeley CS294: Beyond Worst-Case Analysis Luca Trevisan September 5, 2017 U.C. Berkeley CS94: Beyond Worst-Case Analyss Handout 4s Luca Trevsan September 5, 07 Summary of Lecture 4 In whch we ntroduce semdefnte programmng and apply t to Max Cut. Semdefnte Programmng Recall that

More information

Finite Difference Method

Finite Difference Method 7/0/07 Instructor r. Ramond Rump (9) 747 698 rcrump@utep.edu EE 337 Computatonal Electromagnetcs (CEM) Lecture #0 Fnte erence Method Lecture 0 These notes ma contan coprghted materal obtaned under ar use

More information

Computational Biology Lecture 8: Substitution matrices Saad Mneimneh

Computational Biology Lecture 8: Substitution matrices Saad Mneimneh Computatonal Bology Lecture 8: Substtuton matrces Saad Mnemneh As we have ntroduced last tme, smple scorng schemes lke + or a match, - or a msmatch and -2 or a gap are not justable bologcally, especally

More information

Lecture 2 Solution of Nonlinear Equations ( Root Finding Problems )

Lecture 2 Solution of Nonlinear Equations ( Root Finding Problems ) Lecture Soluton o Nonlnear Equatons Root Fndng Problems Dentons Classcaton o Methods Analytcal Solutons Graphcal Methods Numercal Methods Bracketng Methods Open Methods Convergence Notatons Root Fndng

More information

HMMT February 2016 February 20, 2016

HMMT February 2016 February 20, 2016 HMMT February 016 February 0, 016 Combnatorcs 1. For postve ntegers n, let S n be the set of ntegers x such that n dstnct lnes, no three concurrent, can dvde a plane nto x regons (for example, S = {3,

More information

Exercises. 18 Algorithms

Exercises. 18 Algorithms 18 Algorthms Exercses 0.1. In each of the followng stuatons, ndcate whether f = O(g), or f = Ω(g), or both (n whch case f = Θ(g)). f(n) g(n) (a) n 100 n 200 (b) n 1/2 n 2/3 (c) 100n + log n n + (log n)

More information

EEL 6266 Power System Operation and Control. Chapter 3 Economic Dispatch Using Dynamic Programming

EEL 6266 Power System Operation and Control. Chapter 3 Economic Dispatch Using Dynamic Programming EEL 6266 Power System Operaton and Control Chapter 3 Economc Dspatch Usng Dynamc Programmng Pecewse Lnear Cost Functons Common practce many utltes prefer to represent ther generator cost functons as sngle-

More information

College of Computer & Information Science Fall 2009 Northeastern University 20 October 2009

College of Computer & Information Science Fall 2009 Northeastern University 20 October 2009 College of Computer & Informaton Scence Fall 2009 Northeastern Unversty 20 October 2009 CS7880: Algorthmc Power Tools Scrbe: Jan Wen and Laura Poplawsk Lecture Outlne: Prmal-dual schema Network Desgn:

More information

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix

Lectures - Week 4 Matrix norms, Conditioning, Vector Spaces, Linear Independence, Spanning sets and Basis, Null space and Range of a Matrix Lectures - Week 4 Matrx norms, Condtonng, Vector Spaces, Lnear Independence, Spannng sets and Bass, Null space and Range of a Matrx Matrx Norms Now we turn to assocatng a number to each matrx. We could

More information

2.3 Nilpotent endomorphisms

2.3 Nilpotent endomorphisms s a block dagonal matrx, wth A Mat dm U (C) In fact, we can assume that B = B 1 B k, wth B an ordered bass of U, and that A = [f U ] B, where f U : U U s the restrcton of f to U 40 23 Nlpotent endomorphsms

More information

Lecture Notes Introduction to Cluster Algebra

Lecture Notes Introduction to Cluster Algebra Lecture Notes Introducton to Cluster Algebra Ivan C.H. Ip Updated: Ma 7, 2017 3 Defnton and Examples of Cluster algebra 3.1 Quvers We frst revst the noton of a quver. Defnton 3.1. A quver s a fnte orented

More information

5 The Rational Canonical Form

5 The Rational Canonical Form 5 The Ratonal Canoncal Form Here p s a monc rreducble factor of the mnmum polynomal m T and s not necessarly of degree one Let F p denote the feld constructed earler n the course, consstng of all matrces

More information

Finding Dense Subgraphs in G(n, 1/2)

Finding Dense Subgraphs in G(n, 1/2) Fndng Dense Subgraphs n Gn, 1/ Atsh Das Sarma 1, Amt Deshpande, and Rav Kannan 1 Georga Insttute of Technology,atsh@cc.gatech.edu Mcrosoft Research-Bangalore,amtdesh,annan@mcrosoft.com Abstract. Fndng

More information

: Numerical Analysis Topic 2: Solution of Nonlinear Equations Lectures 5-11:

: Numerical Analysis Topic 2: Solution of Nonlinear Equations Lectures 5-11: 764: Numercal Analyss Topc : Soluton o Nonlnear Equatons Lectures 5-: UIN Malang Read Chapters 5 and 6 o the tetbook 764_Topc Lecture 5 Soluton o Nonlnear Equatons Root Fndng Problems Dentons Classcaton

More information

8.4 COMPLEX VECTOR SPACES AND INNER PRODUCTS

8.4 COMPLEX VECTOR SPACES AND INNER PRODUCTS SECTION 8.4 COMPLEX VECTOR SPACES AND INNER PRODUCTS 493 8.4 COMPLEX VECTOR SPACES AND INNER PRODUCTS All the vector spaces you have studed thus far n the text are real vector spaces because the scalars

More information

NP-Completeness : Proofs

NP-Completeness : Proofs NP-Completeness : Proofs Proof Methods A method to show a decson problem Π NP-complete s as follows. (1) Show Π NP. (2) Choose an NP-complete problem Π. (3) Show Π Π. A method to show an optmzaton problem

More information

Physics 2A Chapter 3 HW Solutions

Physics 2A Chapter 3 HW Solutions Phscs A Chapter 3 HW Solutons Chapter 3 Conceptual Queston: 4, 6, 8, Problems: 5,, 8, 7, 3, 44, 46, 69, 70, 73 Q3.4. Reason: (a) C = A+ B onl A and B are n the same drecton. Sze does not matter. (b) C

More information

Structure and Drive Paul A. Jensen Copyright July 20, 2003

Structure and Drive Paul A. Jensen Copyright July 20, 2003 Structure and Drve Paul A. Jensen Copyrght July 20, 2003 A system s made up of several operatons wth flow passng between them. The structure of the system descrbes the flow paths from nputs to outputs.

More information

Outline. Communication. Bellman Ford Algorithm. Bellman Ford Example. Bellman Ford Shortest Path [1]

Outline. Communication. Bellman Ford Algorithm. Bellman Ford Example. Bellman Ford Shortest Path [1] DYNAMIC SHORTEST PATH SEARCH AND SYNCHRONIZED TASK SWITCHING Jay Wagenpfel, Adran Trachte 2 Outlne Shortest Communcaton Path Searchng Bellmann Ford algorthm Algorthm for dynamc case Modfcatons to our algorthm

More information

OPTIMISATION. Introduction Single Variable Unconstrained Optimisation Multivariable Unconstrained Optimisation Linear Programming

OPTIMISATION. Introduction Single Variable Unconstrained Optimisation Multivariable Unconstrained Optimisation Linear Programming OPTIMIATION Introducton ngle Varable Unconstraned Optmsaton Multvarable Unconstraned Optmsaton Lnear Programmng Chapter Optmsaton /. Introducton In an engneerng analss, sometmes etremtes, ether mnmum or

More information

Errors for Linear Systems

Errors for Linear Systems Errors for Lnear Systems When we solve a lnear system Ax b we often do not know A and b exactly, but have only approxmatons  and ˆb avalable. Then the best thng we can do s to solve ˆx ˆb exactly whch

More information

A Simple Research of Divisor Graphs

A Simple Research of Divisor Graphs The 29th Workshop on Combnatoral Mathematcs and Computaton Theory A Smple Research o Dvsor Graphs Yu-png Tsao General Educaton Center Chna Unversty o Technology Tape Tawan yp-tsao@cuteedutw Tape Tawan

More information

Combining Constraint Programming and Integer Programming

Combining Constraint Programming and Integer Programming Combnng Constrant Programmng and Integer Programmng GLOBAL CONSTRAINT OPTIMIZATION COMPONENT Specal Purpose Algorthm mn c T x +(x- 0 ) x( + ()) =1 x( - ()) =1 FILTERING ALGORITHM COST-BASED FILTERING ALGORITHM

More information

Chapter Newton s Method

Chapter Newton s Method Chapter 9. Newton s Method After readng ths chapter, you should be able to:. Understand how Newton s method s dfferent from the Golden Secton Search method. Understand how Newton s method works 3. Solve

More information

Single-Facility Scheduling over Long Time Horizons by Logic-based Benders Decomposition

Single-Facility Scheduling over Long Time Horizons by Logic-based Benders Decomposition Sngle-Faclty Schedulng over Long Tme Horzons by Logc-based Benders Decomposton Elvn Coban and J. N. Hooker Tepper School of Busness, Carnege Mellon Unversty ecoban@andrew.cmu.edu, john@hooker.tepper.cmu.edu

More information

Complete subgraphs in multipartite graphs

Complete subgraphs in multipartite graphs Complete subgraphs n multpartte graphs FLORIAN PFENDER Unverstät Rostock, Insttut für Mathematk D-18057 Rostock, Germany Floran.Pfender@un-rostock.de Abstract Turán s Theorem states that every graph G

More information

International Mathematical Olympiad. Preliminary Selection Contest 2012 Hong Kong. Outline of Solutions

International Mathematical Olympiad. Preliminary Selection Contest 2012 Hong Kong. Outline of Solutions Internatonal Mathematcal Olympad Prelmnary Selecton ontest Hong Kong Outlne of Solutons nswers: 7 4 7 4 6 5 9 6 99 7 6 6 9 5544 49 5 7 4 6765 5 6 6 7 6 944 9 Solutons: Snce n s a two-dgt number, we have

More information

For now, let us focus on a specific model of neurons. These are simplified from reality but can achieve remarkable results.

For now, let us focus on a specific model of neurons. These are simplified from reality but can achieve remarkable results. Neural Networks : Dervaton compled by Alvn Wan from Professor Jtendra Malk s lecture Ths type of computaton s called deep learnng and s the most popular method for many problems, such as computer vson

More information

Single Variable Optimization

Single Variable Optimization 8/4/07 Course Instructor Dr. Raymond C. Rump Oce: A 337 Phone: (95) 747 6958 E Mal: rcrump@utep.edu Topc 8b Sngle Varable Optmzaton EE 4386/530 Computatonal Methods n EE Outlne Mathematcal Prelmnares Sngle

More information

Problem Do any of the following determine homomorphisms from GL n (C) to GL n (C)?

Problem Do any of the following determine homomorphisms from GL n (C) to GL n (C)? Homework 8 solutons. Problem 16.1. Whch of the followng defne homomomorphsms from C\{0} to C\{0}? Answer. a) f 1 : z z Yes, f 1 s a homomorphsm. We have that z s the complex conjugate of z. If z 1,z 2

More information

Absorbing Markov Chain Models to Determine Optimum Process Target Levels in Production Systems with Rework and Scrapping

Absorbing Markov Chain Models to Determine Optimum Process Target Levels in Production Systems with Rework and Scrapping Archve o SID Journal o Industral Engneerng 6(00) -6 Absorbng Markov Chan Models to Determne Optmum Process Target evels n Producton Systems wth Rework and Scrappng Mohammad Saber Fallah Nezhad a, Seyed

More information

MAE140 - Linear Circuits - Fall 10 Midterm, October 28

MAE140 - Linear Circuits - Fall 10 Midterm, October 28 M140 - Lnear rcuts - Fall 10 Mdterm, October 28 nstructons () Ths exam s open book. You may use whatever wrtten materals you choose, ncludng your class notes and textbook. You may use a hand calculator

More information

APPENDIX A Some Linear Algebra

APPENDIX A Some Linear Algebra APPENDIX A Some Lnear Algebra The collecton of m, n matrces A.1 Matrces a 1,1,..., a 1,n A = a m,1,..., a m,n wth real elements a,j s denoted by R m,n. If n = 1 then A s called a column vector. Smlarly,

More information

Min Cut, Fast Cut, Polynomial Identities

Min Cut, Fast Cut, Polynomial Identities Randomzed Algorthms, Summer 016 Mn Cut, Fast Cut, Polynomal Identtes Instructor: Thomas Kesselhem and Kurt Mehlhorn 1 Mn Cuts n Graphs Lecture (5 pages) Throughout ths secton, G = (V, E) s a mult-graph.

More information

The Second Anti-Mathima on Game Theory

The Second Anti-Mathima on Game Theory The Second Ant-Mathma on Game Theory Ath. Kehagas December 1 2006 1 Introducton In ths note we wll examne the noton of game equlbrum for three types of games 1. 2-player 2-acton zero-sum games 2. 2-player

More information

Grover s Algorithm + Quantum Zeno Effect + Vaidman

Grover s Algorithm + Quantum Zeno Effect + Vaidman Grover s Algorthm + Quantum Zeno Effect + Vadman CS 294-2 Bomb 10/12/04 Fall 2004 Lecture 11 Grover s algorthm Recall that Grover s algorthm for searchng over a space of sze wors as follows: consder the

More information

Problem Set 6: Trees Spring 2018

Problem Set 6: Trees Spring 2018 Problem Set 6: Trees 1-29 Sprng 2018 A Average dstance Gven a tree, calculate the average dstance between two vertces n the tree. For example, the average dstance between two vertces n the followng tree

More information

8.6 The Complex Number System

8.6 The Complex Number System 8.6 The Complex Number System Earler n the chapter, we mentoned that we cannot have a negatve under a square root, snce the square of any postve or negatve number s always postve. In ths secton we want

More information

= = = (a) Use the MATLAB command rref to solve the system. (b) Let A be the coefficient matrix and B be the right-hand side of the system.

= = = (a) Use the MATLAB command rref to solve the system. (b) Let A be the coefficient matrix and B be the right-hand side of the system. Chapter Matlab Exercses Chapter Matlab Exercses. Consder the lnear system of Example n Secton.. x x x y z y y z (a) Use the MATLAB command rref to solve the system. (b) Let A be the coeffcent matrx and

More information

CS 770G - Parallel Algorithms in Scientific Computing

CS 770G - Parallel Algorithms in Scientific Computing References CS 770G - Parallel Algorthms n Scentfc Computng Parallel Sortng Introducton to Parallel Computng Kumar, Grama, Gupta, Karyps, Benjamn Cummngs. A porton of the notes comes from Prof. J. Demmel

More information

Aggregation of Social Networks by Divisive Clustering Method

Aggregation of Social Networks by Divisive Clustering Method ggregaton of Socal Networks by Dvsve Clusterng Method mne Louat and Yves Lechaveller INRI Pars-Rocquencourt Rocquencourt, France {lzennyr.da_slva, Yves.Lechevaller, Fabrce.Ross}@nra.fr HCSD Beng October

More information

CISE301: Numerical Methods Topic 2: Solution of Nonlinear Equations

CISE301: Numerical Methods Topic 2: Solution of Nonlinear Equations CISE3: Numercal Methods Topc : Soluton o Nonlnear Equatons Dr. Amar Khoukh Term Read Chapters 5 and 6 o the tetbook CISE3_Topc c Khoukh_ Lecture 5 Soluton o Nonlnear Equatons Root ndng Problems Dentons

More information

Math 261 Exercise sheet 2

Math 261 Exercise sheet 2 Math 261 Exercse sheet 2 http://staff.aub.edu.lb/~nm116/teachng/2017/math261/ndex.html Verson: September 25, 2017 Answers are due for Monday 25 September, 11AM. The use of calculators s allowed. Exercse

More information

arxiv: v2 [cs.ds] 1 Feb 2017

arxiv: v2 [cs.ds] 1 Feb 2017 Polynomal-tme Algorthms for the Subset Feedback Vertex Set Problem on Interval Graphs and Permutaton Graphs Chars Papadopoulos Spyrdon Tzmas arxv:170104634v2 [csds] 1 Feb 2017 Abstract Gven a vertex-weghted

More information

Lecture 4: Constant Time SVD Approximation

Lecture 4: Constant Time SVD Approximation Spectral Algorthms and Representatons eb. 17, Mar. 3 and 8, 005 Lecture 4: Constant Tme SVD Approxmaton Lecturer: Santosh Vempala Scrbe: Jangzhuo Chen Ths topc conssts of three lectures 0/17, 03/03, 03/08),

More information

Every planar graph is 4-colourable a proof without computer

Every planar graph is 4-colourable a proof without computer Peter Dörre Department of Informatcs and Natural Scences Fachhochschule Südwestfalen (Unversty of Appled Scences) Frauenstuhlweg 31, D-58644 Iserlohn, Germany Emal: doerre(at)fh-swf.de Mathematcs Subject

More information

Annexes. EC.1. Cycle-base move illustration. EC.2. Problem Instances

Annexes. EC.1. Cycle-base move illustration. EC.2. Problem Instances ec Annexes Ths Annex frst llustrates a cycle-based move n the dynamc-block generaton tabu search. It then dsplays the characterstcs of the nstance sets, followed by detaled results of the parametercalbraton

More information

Module 9. Lecture 6. Duality in Assignment Problems

Module 9. Lecture 6. Duality in Assignment Problems Module 9 1 Lecture 6 Dualty n Assgnment Problems In ths lecture we attempt to answer few other mportant questons posed n earler lecture for (AP) and see how some of them can be explaned through the concept

More information

Lecture 4: November 17, Part 1 Single Buffer Management

Lecture 4: November 17, Part 1 Single Buffer Management Lecturer: Ad Rosén Algorthms for the anagement of Networs Fall 2003-2004 Lecture 4: November 7, 2003 Scrbe: Guy Grebla Part Sngle Buffer anagement In the prevous lecture we taled about the Combned Input

More information

p 1 c 2 + p 2 c 2 + p 3 c p m c 2

p 1 c 2 + p 2 c 2 + p 3 c p m c 2 Where to put a faclty? Gven locatons p 1,..., p m n R n of m houses, want to choose a locaton c n R n for the fre staton. Want c to be as close as possble to all the house. We know how to measure dstance

More information

Graph Reconstruction by Permutations

Graph Reconstruction by Permutations Graph Reconstructon by Permutatons Perre Ille and Wllam Kocay* Insttut de Mathémathques de Lumny CNRS UMR 6206 163 avenue de Lumny, Case 907 13288 Marselle Cedex 9, France e-mal: lle@ml.unv-mrs.fr Computer

More information

Complex Numbers. x = B B 2 4AC 2A. or x = x = 2 ± 4 4 (1) (5) 2 (1)

Complex Numbers. x = B B 2 4AC 2A. or x = x = 2 ± 4 4 (1) (5) 2 (1) Complex Numbers If you have not yet encountered complex numbers, you wll soon do so n the process of solvng quadratc equatons. The general quadratc equaton Ax + Bx + C 0 has solutons x B + B 4AC A For

More information

The Minimum Universal Cost Flow in an Infeasible Flow Network

The Minimum Universal Cost Flow in an Infeasible Flow Network Journal of Scences, Islamc Republc of Iran 17(2): 175-180 (2006) Unversty of Tehran, ISSN 1016-1104 http://jscencesutacr The Mnmum Unversal Cost Flow n an Infeasble Flow Network H Saleh Fathabad * M Bagheran

More information

MAE140 - Linear Circuits - Winter 16 Midterm, February 5

MAE140 - Linear Circuits - Winter 16 Midterm, February 5 Instructons ME140 - Lnear Crcuts - Wnter 16 Mdterm, February 5 () Ths exam s open book. You may use whatever wrtten materals you choose, ncludng your class notes and textbook. You may use a hand calculator

More information

Maximum likelihood. Fredrik Ronquist. September 28, 2005

Maximum likelihood. Fredrik Ronquist. September 28, 2005 Maxmum lkelhood Fredrk Ronqust September 28, 2005 Introducton Now that we have explored a number of evolutonary models, rangng from smple to complex, let us examne how we can use them n statstcal nference.

More information

Compilers. Spring term. Alfonso Ortega: Enrique Alfonseca: Chapter 4: Syntactic analysis

Compilers. Spring term. Alfonso Ortega: Enrique Alfonseca: Chapter 4: Syntactic analysis Complers Sprng term Alfonso Ortega: alfonso.ortega@uam.es nrque Alfonseca: enrque.alfonseca@uam.es Chapter : Syntactc analyss. Introducton. Bottom-up Analyss Syntax Analyser Concepts It analyses the context-ndependent

More information

Stanford University CS359G: Graph Partitioning and Expanders Handout 4 Luca Trevisan January 13, 2011

Stanford University CS359G: Graph Partitioning and Expanders Handout 4 Luca Trevisan January 13, 2011 Stanford Unversty CS359G: Graph Parttonng and Expanders Handout 4 Luca Trevsan January 3, 0 Lecture 4 In whch we prove the dffcult drecton of Cheeger s nequalty. As n the past lectures, consder an undrected

More information

Curve Fitting with the Least Square Method

Curve Fitting with the Least Square Method WIKI Document Number 5 Interpolaton wth Least Squares Curve Fttng wth the Least Square Method Mattheu Bultelle Department of Bo-Engneerng Imperal College, London Context We wsh to model the postve feedback

More information

Homework 9 Solutions. 1. (Exercises from the book, 6 th edition, 6.6, 1-3.) Determine the number of distinct orderings of the letters given:

Homework 9 Solutions. 1. (Exercises from the book, 6 th edition, 6.6, 1-3.) Determine the number of distinct orderings of the letters given: Homework 9 Solutons PROBLEM ONE 1 (Exercses from the book, th edton,, 1-) Determne the number of dstnct orderngs of the letters gven: (a) GUIDE Soluton: 5! (b) SCHOOL Soluton:! (c) SALESPERSONS Soluton:

More information

Dynamic Programming 4/5/12. Dynamic programming. Fibonacci numbers. Fibonacci: a first attempt. David Kauchak cs302 Spring 2012

Dynamic Programming 4/5/12. Dynamic programming. Fibonacci numbers. Fibonacci: a first attempt. David Kauchak cs302 Spring 2012 Dynamc Programmng Davd Kauchak cs32 Sprng 212 Dynamc programmng l One of the most mportant algorthm tools! l Very common ntervew queston l Method for solvng problems where optmal solutons can be defned

More information

O-line Temporary Tasks Assignment. Abstract. In this paper we consider the temporary tasks assignment

O-line Temporary Tasks Assignment. Abstract. In this paper we consider the temporary tasks assignment O-lne Temporary Tasks Assgnment Yoss Azar and Oded Regev Dept. of Computer Scence, Tel-Avv Unversty, Tel-Avv, 69978, Israel. azar@math.tau.ac.l??? Dept. of Computer Scence, Tel-Avv Unversty, Tel-Avv, 69978,

More information

Formulas for the Determinant

Formulas for the Determinant page 224 224 CHAPTER 3 Determnants e t te t e 2t 38 A = e t 2te t e 2t e t te t 2e 2t 39 If 123 A = 345, 456 compute the matrx product A adj(a) What can you conclude about det(a)? For Problems 40 43, use

More information

COS 511: Theoretical Machine Learning. Lecturer: Rob Schapire Lecture # 15 Scribe: Jieming Mao April 1, 2013

COS 511: Theoretical Machine Learning. Lecturer: Rob Schapire Lecture # 15 Scribe: Jieming Mao April 1, 2013 COS 511: heoretcal Machne Learnng Lecturer: Rob Schapre Lecture # 15 Scrbe: Jemng Mao Aprl 1, 013 1 Bref revew 1.1 Learnng wth expert advce Last tme, we started to talk about learnng wth expert advce.

More information

Linear Feature Engineering 11

Linear Feature Engineering 11 Lnear Feature Engneerng 11 2 Least-Squares 2.1 Smple least-squares Consder the followng dataset. We have a bunch of nputs x and correspondng outputs y. The partcular values n ths dataset are x y 0.23 0.19

More information

Lecture 10: May 6, 2013

Lecture 10: May 6, 2013 TTIC/CMSC 31150 Mathematcal Toolkt Sprng 013 Madhur Tulsan Lecture 10: May 6, 013 Scrbe: Wenje Luo In today s lecture, we manly talked about random walk on graphs and ntroduce the concept of graph expander,

More information

Statistical Mechanics and Combinatorics : Lecture III

Statistical Mechanics and Combinatorics : Lecture III Statstcal Mechancs and Combnatorcs : Lecture III Dmer Model Dmer defntons Defnton A dmer coverng (perfect matchng) of a fnte graph s a set of edges whch covers every vertex exactly once, e every vertex

More information

Transfer Functions. Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: ( ) system

Transfer Functions. Convenient representation of a linear, dynamic model. A transfer function (TF) relates one input and one output: ( ) system Transfer Functons Convenent representaton of a lnear, dynamc model. A transfer functon (TF) relates one nput and one output: x t X s y t system Y s The followng termnology s used: x y nput output forcng

More information

Difference Equations

Difference Equations Dfference Equatons c Jan Vrbk 1 Bascs Suppose a sequence of numbers, say a 0,a 1,a,a 3,... s defned by a certan general relatonshp between, say, three consecutve values of the sequence, e.g. a + +3a +1

More information

An Integrated OR/CP Method for Planning and Scheduling

An Integrated OR/CP Method for Planning and Scheduling An Integrated OR/CP Method for Plannng and Schedulng John Hooer Carnege Mellon Unversty IT Unversty of Copenhagen June 2005 The Problem Allocate tass to facltes. Schedule tass assgned to each faclty. Subect

More information

Tracking with Kalman Filter

Tracking with Kalman Filter Trackng wth Kalman Flter Scott T. Acton Vrgna Image and Vdeo Analyss (VIVA), Charles L. Brown Department of Electrcal and Computer Engneerng Department of Bomedcal Engneerng Unversty of Vrgna, Charlottesvlle,

More information

U.C. Berkeley CS294: Spectral Methods and Expanders Handout 8 Luca Trevisan February 17, 2016

U.C. Berkeley CS294: Spectral Methods and Expanders Handout 8 Luca Trevisan February 17, 2016 U.C. Berkeley CS94: Spectral Methods and Expanders Handout 8 Luca Trevsan February 7, 06 Lecture 8: Spectral Algorthms Wrap-up In whch we talk about even more generalzatons of Cheeger s nequaltes, and

More information

Assortment Optimization under MNL

Assortment Optimization under MNL Assortment Optmzaton under MNL Haotan Song Aprl 30, 2017 1 Introducton The assortment optmzaton problem ams to fnd the revenue-maxmzng assortment of products to offer when the prces of products are fxed.

More information

Complex Variables. Chapter 18 Integration in the Complex Plane. March 12, 2013 Lecturer: Shih-Yuan Chen

Complex Variables. Chapter 18 Integration in the Complex Plane. March 12, 2013 Lecturer: Shih-Yuan Chen omplex Varables hapter 8 Integraton n the omplex Plane March, Lecturer: Shh-Yuan hen Except where otherwse noted, content s lcensed under a BY-N-SA. TW Lcense. ontents ontour ntegrals auchy-goursat theorem

More information

find (x): given element x, return the canonical element of the set containing x;

find (x): given element x, return the canonical element of the set containing x; COS 43 Sprng, 009 Dsjont Set Unon Problem: Mantan a collecton of dsjont sets. Two operatons: fnd the set contanng a gven element; unte two sets nto one (destructvely). Approach: Canoncal element method:

More information

Complex Numbers Alpha, Round 1 Test #123

Complex Numbers Alpha, Round 1 Test #123 Complex Numbers Alpha, Round Test #3. Wrte your 6-dgt ID# n the I.D. NUMBER grd, left-justfed, and bubble. Check that each column has only one number darkened.. In the EXAM NO. grd, wrte the 3-dgt Test

More information

Common loop optimizations. Example to improve locality. Why Dependence Analysis. Data Dependence in Loops. Goal is to find best schedule:

Common loop optimizations. Example to improve locality. Why Dependence Analysis. Data Dependence in Loops. Goal is to find best schedule: 15-745 Lecture 6 Data Dependence n Loops Copyrght Seth Goldsten, 2008 Based on sldes from Allen&Kennedy Lecture 6 15-745 2005-8 1 Common loop optmzatons Hostng of loop-nvarant computatons pre-compute before

More information

a b a In case b 0, a being divisible by b is the same as to say that

a b a In case b 0, a being divisible by b is the same as to say that Secton 6.2 Dvsblty among the ntegers An nteger a ε s dvsble by b ε f there s an nteger c ε such that a = bc. Note that s dvsble by any nteger b, snce = b. On the other hand, a s dvsble by only f a = :

More information

Modeling motion with VPython Every program that models the motion of physical objects has two main parts:

Modeling motion with VPython Every program that models the motion of physical objects has two main parts: 1 Modelng moton wth VPython Eery program that models the moton o physcal objects has two man parts: 1. Beore the loop: The rst part o the program tells the computer to: a. Create numercal alues or constants

More information

CHAPTER 17 Amortized Analysis

CHAPTER 17 Amortized Analysis CHAPTER 7 Amortzed Analyss In an amortzed analyss, the tme requred to perform a sequence of data structure operatons s averaged over all the operatons performed. It can be used to show that the average

More information

ORDINARY DIFFERENTIAL EQUATIONS EULER S METHOD

ORDINARY DIFFERENTIAL EQUATIONS EULER S METHOD Numercal Analss or Engneers German Jordanan Unverst ORDINARY DIFFERENTIAL EQUATIONS We wll eplore several metods o solvng rst order ordnar derental equatons (ODEs and we wll sow ow tese metods can be appled

More information

Lecture 4. Instructor: Haipeng Luo

Lecture 4. Instructor: Haipeng Luo Lecture 4 Instructor: Hapeng Luo In the followng lectures, we focus on the expert problem and study more adaptve algorthms. Although Hedge s proven to be worst-case optmal, one may wonder how well t would

More information

On the Multicriteria Integer Network Flow Problem

On the Multicriteria Integer Network Flow Problem BULGARIAN ACADEMY OF SCIENCES CYBERNETICS AND INFORMATION TECHNOLOGIES Volume 5, No 2 Sofa 2005 On the Multcrtera Integer Network Flow Problem Vassl Vasslev, Marana Nkolova, Maryana Vassleva Insttute of

More information

form, and they present results of tests comparng the new algorthms wth other methods. Recently, Olschowka & Neumaer [7] ntroduced another dea for choo

form, and they present results of tests comparng the new algorthms wth other methods. Recently, Olschowka & Neumaer [7] ntroduced another dea for choo Scalng and structural condton numbers Arnold Neumaer Insttut fur Mathematk, Unverstat Wen Strudlhofgasse 4, A-1090 Wen, Austra emal: neum@cma.unve.ac.at revsed, August 1996 Abstract. We ntroduce structural

More information

Norms, Condition Numbers, Eigenvalues and Eigenvectors

Norms, Condition Numbers, Eigenvalues and Eigenvectors Norms, Condton Numbers, Egenvalues and Egenvectors 1 Norms A norm s a measure of the sze of a matrx or a vector For vectors the common norms are: N a 2 = ( x 2 1/2 the Eucldean Norm (1a b 1 = =1 N x (1b

More information

The L(2, 1)-Labeling on -Product of Graphs

The L(2, 1)-Labeling on -Product of Graphs Annals of Pure and Appled Mathematcs Vol 0, No, 05, 9-39 ISSN: 79-087X (P, 79-0888(onlne Publshed on 7 Aprl 05 wwwresearchmathscorg Annals of The L(, -Labelng on -Product of Graphs P Pradhan and Kamesh

More information

G = G 1 + G 2 + G 3 G 2 +G 3 G1 G2 G3. Network (a) Network (b) Network (c) Network (d)

G = G 1 + G 2 + G 3 G 2 +G 3 G1 G2 G3. Network (a) Network (b) Network (c) Network (d) Massachusetts Insttute of Technology Department of Electrcal Engneerng and Computer Scence 6.002 í Electronc Crcuts Homework 2 Soluton Handout F98023 Exercse 21: Determne the conductance of each network

More information

= s j Ui U j. i, j, then s F(U) with s Ui F(U) G(U) F(V ) G(V )

= s j Ui U j. i, j, then s F(U) with s Ui F(U) G(U) F(V ) G(V ) 1 Lecture 2 Recap Last tme we talked about presheaves and sheaves. Preshea: F on a topologcal space X, wth groups (resp. rngs, sets, etc.) F(U) or each open set U X, wth restrcton homs ρ UV : F(U) F(V

More information