Algorthms Arlne Schedulng Arlne Schedulng Desgn and Analyss of Algorthms Andre Bulatov
Algorthms Arlne Schedulng 11-2 The Problem An arlne carrer wants to serve certan set of flghts Example: Boston (6 am) - Washngton DC (7 am), San Francsco (2:15pm) - Seattle (3:15pm) Phladelpha (7 am) - Pttsburg (8 am), Las Vegas (5 pm) - Seattle (6 pm) Washngton DC (8 am) Los Angeles (11 am) Phladelpha (11 am) - San Francsco (2 pm) The same plane can be used for flght and for flght j f - the destnaton of s the same as orgn of j and there s enough tme for mantenance (say, 1 hour) - a flght can be added n between that gets the plane from the destnaton of to the orgn of j wth adequate tme n between
Algorthms Arlne Schedulng 11-3 Formalsm Boston (6 am) - Washngton DC (7 am), Phladelpha (11 am) - San Francsco (2 pm) Phladelpha (7 am) - Pttsburg (8 am), San Francsco (2:15pm) - Seattle (3:15pm) Washngton DC (8 am) Los Angeles (11 am), Las Vegas (5 pm) - Seattle (6 pm) BOS 6 DC 7 DC 8 LAX 11 LAS 5 SEA 6 PHL 7 PIT 8 PHL 11 SFO 2 SFO 2:15 SEA 3:15 Flght j s reachable from flght f t s possble to use the same plane for flght, and then later for flght j as well. (or we can use a dfferent set of rules, t does not matter)
Algorthms Arlne Schedulng 11-4 The Problem The Arlne Schedulng Problem Instance: A set of flghts to serve, and a set of pars of reachable flghts, the allowed number k of planes Objectve: Is t possble to serve the requred flghts wth k planes
Algorthms Arlne Schedulng 11-5 The Idea Each arplane s represented by a unt of flow The requred flghts (arcs) have lower bound 1, and capacty 1 If ( u, v ) and ( u j, v j ) are arcs representng requred flghts and j, and j s reachable from, then there s an arc connectng v to u j ; we assgn ths arc capacty 1 Extend the network by addng an external source and snk BOS 6 DC 7 DC 8 LAX 11 LAS 5 SEA 6 PHL 7 PIT 8 PHL 11 SFO 2 SFO 2:15 SEA 3:15
Algorthms Arlne Schedulng 11-6 Constructon - For each requred flght, the graph G has two nodes and - G also has a dstnct source s and a snk t - For each, there s an arc ( u, v ) wth a lower bound 1 and capacty 1 - For each and j such that flght j s reachable from flght, there s an arc ( v, u j ) wth a lower bound 0 and a capacty 1 - For each there s an arc ( s, u ) wth a lower bound 0 and a capacty 1 - For each there s an arc ( v, t) wth a lower bound 0 and a capacty 1 - There s an arc (s,t) wth lower bound 0 and capacty k - The node s has demand -k, and node t has demand k u v
Algorthms Arlne Schedulng 11-7 The Problem Theorem There s a way to perform all flghts usng at most k planes f and only f there s a feasble crculaton n the network G. Proof DIY
Algorthms Image Segmentaton 15-8 Image Segmentaton Desgn and Analyss of Algorthms Andre Bulatov
Algorthms Image Segmentaton 15-9 Image Segmentaton The general problem s to separate objects on a dgtal mage We have pxels and have to decde, whch object each pxel belongs to The problem we solve: decde whether a pxel belongs to the background or foreground The decson, where a gven pxel belongs to s made takng nto account ts neghbors Usually, pxels are arranged n a grd But our model wll allow any other confguraton
Algorthms Image Segmentaton 15-10 Image Segmentaton: Framework We construct an undrected graph G = (V,E) where V s the set of pxels, and E s the neghborhood relaton For every pxel there are assocated lkelhood a that t belongs to the foreground, and lkelhood that t belongs to the background The lkelhoods can be any non-negatve numbers b For a pxel we tend to label t as a foreground pxel f a > b and as a background pxel otherwse However, the label also depends on labels of ts neghbors It s regulated by a separaton penalty p j 0 for one of and j n the foreground, and the other n the background
Algorthms Image Segmentaton 15-11 The Problem The Image Segmentaton Problem Instance: A set of pxels wth lkelhoods and separaton penaltes Objectve: Fnd an optmal labelng, that s, a partton of the set of pxels nto sets A and B (foreground and background) so as to maxmze q( A, B) = A a + B b p j (, j) A E {, j} = 1
Algorthms Image Segmentaton 15-12 Algorthm Ideas Observe that the problem s smlar to fndng a mnmal cut Dffcultes: (1) Need to maxmze, rather than mnmze (2) No source and snk (3) Have to deal wth values assgned to vertces (4) The graph s undrected
Algorthms Image Segmentaton 15-13 Algorthm Ideas (cntd) (1) Need to maxmze, rather than mnmze Let Then So Thus nstead of maxmzng q(a,b) we can mnmze = + a b Q ) ( = + B A B A a b Q b a = = 1 }, { ), ( ), ( j A E j j B A p a b Q B A q = + + = 1 }, { ), ( ), '( j A E j j B A p a b B A q
Algorthms Image Segmentaton 15-14 Algorthm Ideas (cntd) (2) No source and snk Add an external source, s, and snk, t (3) Have to deal wth values assgned to vertces We use the external source and snk Assgn capacty to edges (s,), b a and capacty to edges (,t)
Algorthms Image Segmentaton 15-15 Algorthm Ideas (cntd) (4) The graph s undrected Replace each undrected edge wth two drected arcs p j and assgn capacty to both
Algorthms Image Segmentaton 15-16 Cuts vs. Segmentaton A cut ( A {s}, B {t} ) corresponds to partton (A,B) of the orgnal graph The capacty c(a,b) s contrbuted by - edges (s,j), where j B; ths edge contrbutes - edges (,t), where A; ths edge contrbutes - edges (,j), where A and j B; ths edge contrbutes p j a b
Algorthms Image Segmentaton 15-17 The Result Theorem The soluton to the Segmentaton Problem can be obtaned by a mnmum-cut algorthm n the graph G constructed above. For a mnmum cut (A,B ), the partton (A,B) obtaned by deletng s and t maxmzes the segmentaton value q(a,b)