Presentation is loading. Please wait.

Presentation is loading. Please wait.

CS 189 today Open-ended project option… A few more problems…… and one more algorithm! Jotto game finale?! Rest of the term No meeting on Tuesday, November.

Similar presentations


Presentation on theme: "CS 189 today Open-ended project option… A few more problems…… and one more algorithm! Jotto game finale?! Rest of the term No meeting on Tuesday, November."— Presentation transcript:

1 CS 189 today Open-ended project option… A few more problems…… and one more algorithm! Jotto game finale?! Rest of the term No meeting on Tuesday, November 4 th Riverside contest on Saturday, November 9 th Final meeting of CS 189 on Tuesday, Nov. 12 th - quick review of the contest - project proposals due (optional…) - remember: problems can be submitted to term's end: 12/23 I'll meet with our teams…

2 Jotto! JRsSRs other diner 1 This term's first class to guess another's word earns 1 problem... diner 1diner 2 This term's last class to have its word guessed earns 1 problem... Sophs diner 1 POM-CMC- SCR-PTZ diner 1 about 3about 0about 1 yearn 2yearn 0yearn 1yearn 2 jotto 2jotto 0jotto 1jotto 0jotto 1 syrup 1 syrup 2syrup 1

3 Projects? Alums: What do you feel you didn't get @ HMC CS? Paul Scott Josh Klontz Josh Ehrlich Moira Tagle Karen Gragg Will Scott

4 Answers… Alums: What do you feel you didn't get @ HMC CS? Paul Scott Josh Klontz Josh Ehrlich Moira Tagle Will Scott web technologies (at least for terminology...) cmake and build systems the code check-in process web things parallelizing/distributing large computations web frameworks don't try to teach web stuff Karen Gragg

5 Optional open-ended project worth up to +12 problems ~ also, an opportunity… … to try out / get familiar with / learn about a technology, domain, library, or project that might be one of your answers to the question, What do you feel you didn't learn @ HMC?

6 Optional open-ended project that might be one of your answers to the question, What do you feel you didn't learn @ HMC? (0) decide what you'd like to learn… (1) find a reasonable resource for it… (2) create a project and a write-up… (3) time expectation: 3 hours per week Plan: worth up to +12 problems ~ also, an opportunity… … to try out / get familiar with / learn about a technology, domain, library, or project

7 Optional open-ended project that might be one of your answers to the question, What do you feel you didn't learn @ HMC? OpenCV Qt other UI library game dev. library console library? hardware project requiring programming something you've wanted to do but you wouldn't otherwise get to web basics: HTML/CSS/Jav ascript/JQuery "Minecraft" technology? framework, e.g., web framework (Django et al.) en.wikipedia.org/wiki/ Comparison_of_web_ application_frameworks worth up to +12 problems ~ also, an opportunity… … to try out / get familiar with / learn about a technology, domain, library, or project

8 Drawbacks? specific technologies should be avoided in the CS curriculum I agree. Yet this one-unit course is too small to shift that balance... there's not enough support to make it work True! I'm no expert at what you're working on, but here the goal's not expertise, but the "working on" … too much time is required…! 3 good-faith hours per week + write-up == 12 problems

9 Drawbacks?Benefits? it never hurts to have an on-line portfolio of one or more of your projects... helps the limitations of DWIC letters, because it's unique + personalized curricular support vs. expertise support sometimes the benefits don't outweigh the drawbacks one unit! John Grasel, Cris Cecka "did well in class" specific technologies should be avoided in the CS curriculum I agree. Yet this one-unit course is too small to shift that balance... there's not enough support to make it work True! I'm no expert at what you're working on, but here the goal's not expertise, but the "working on" … too much time is required…! 3 good-faith hours per week + write-up == 12 problems

10 Interested? To do by 11/12: project proposal due 2-3 paragraphs: (0) Use the CS wiki or some similar site… (1) Describe your overall project idea(s) (2) Describe your plan/resources online tutorial or course? do you have a "Hello, World!" version? (3) Document your time-spent (4) Check-in with me on 11/12 (or before…) grading ~ worth up to 12 problems…

11 PHP's WAT! php > $x = "209"; php > $x++; php > print( $x ); print( "\n" ); 210 php –a

12 PHP's WAT! php > $x = "209"; php > $x++; php > print( $x ); print( "\n" ); 210 php > $x = "may"; php > $x++; php > print( $x ); print ( "\n" ); maz php > $x++; php > print( $x ); print ( "\n" ); mba php –a $x = "2d9"; Now, let's try it with…

13 Ford-Fulkerson algorithm What's the maximum flow possible, from src to sink? s B E D C 13 t 16 104 9 12 14 7 20 4 source capacity Max Flow ! sink or target

14 s B E D C 13 s B C D E FROM sBCDE t -1613-- --1012- -4--14 --9-- ---7- - - - 20 4 ------ t t 16 104 9 12 14 7 20 4 TO Capacity Graph source sink (Step #1) Use depth- or breadth-first search to find any path from s to t. Max Flow What's left ?

15 s B E D C 13 s B C D E sBCDE t -1613-- --1012- -4--14 --9-- ---7- - - - 20 4 ------ t t 4/16 104 9 0/12 14 7 8/20 4 source sink (Step #2) Compute RESIDUAL graph Max Flow What's left… s B C D E sBCDE -413-- 12-100- -4--14 -129-- ---7- - - - 8 4 --- -- t t Residual capacities. and the red edges? Backwards capacities! 12

16 s B E D C 13 s B C D E sBCDE t -1613-- --1012- -4--14 --9-- ---7- - - - 20 4 ------ t t 4 104 9 0 14 7 8 4 source sink (Step #3) Repeat until no path exists… Max Flow s B C D E sBCDE -413-- 12-100- -4--14 -129-- ---7- - - - 8 4 --- -- t t Residual capacities. Backwards capacities.

17 B E D C 12/13 11/16 0/101/4 0/9 12/12 11/14 7/7 19/20 4/4 max flow: 23 Max Flow s source t sink (Step #3) Repeat until no path exists… (Step #2) Compute RESIDUAL graph (Step #1) Use depth- or breadth-first search to find any path from s to t.

18 Python… if __name__ == "__main__": # make a capacity graph # node A B C D E F C = [ [ 00, 16, 13, 00, 00, 00 ], # A [ 00, 00, 10, 12, 00, 00 ], # B [ 00, 04, 00, 00, 14, 00 ], # C [ 00, 00, 9, 00, 00, 20 ], # D [ 00, 00, 00, 7, 00, 4 ], # E [ 00, 00, 00, 00, 00, 00 ] ] # F print "C is", C source = 0 # A sink = 5 # F max_flow_value = max_flow( C, source, sink ) print "max_flow_value is", max_flow_value Linked at the ACM website by the slides…

19 def max_flow(C, source, sink): n = len(C) # C is the capacity matrix F = [[0] * n for i in range(n)] # F is the flow matrix # residual capacity from u to v is C[u][v] - F[u][v] while True: path = BFS(C, F, source, sink) if not path: break # no path - we're done! # find the path's flow, that is, the "bottleneck" edges = [C[u][v]-F[u][v] for u,v in path] path_flow = min( edges ) print "Augmenting by", path_flow for u,v in path: # traverse path to update flow F[u][v] += path_flow # forward edge up F[v][u] -= path_flow # backward edge down return sum([F[source][i] for i in range(n)]) # out from source edmonds_karp algorithm Python…

20 def BFS(C, F, source, sink): queue = [source] # the BFS queue paths = {source: []} # stores 1 path per graph node while queue: u = queue.pop(0) # next node to explore (expand) for v in range(len(C)): # for each possible next node # path from u to v? and not yet at v? if C[u][v] - F[u][v] > 0 and v not in paths: paths[v] = paths[u] + [(u,v)] if v == sink: return paths[v] queue.append(v) # go from v in the future return None Python…

21 Is maxflow good for anything else? that is, beyond solving maximum-flow problems...

22 we have four bridesand six grooms and some acceptable possibilities... a bipartite graph Matching!

23 we have four bridesand six grooms and some acceptable possibilities... a maximal matching == no more matchings without rearrangement Matching!

24 we have four bridesand six grooms Matching! and some acceptable possibilities... a maximum matching == no rearrangements will yield more matchings

25 Maximum matching is max flow... s source connect a source to the left side... all 1s

26 Maximum matching is max flow... s source connect a source to the left side... make all capacities = 1 1 1 1 1 1 1 all 1s

27 Maximum matching is max flow... s source t sink connect a source to the left side... put a sink on the right make all capacities = 1 1 1 1 1 1 1 all 1s what do the source and sink constraints ensure?

28 Max flow thought experiment... s source t sink 1 1 1 1 1 1 all 1s Suppose this is the flow so far (3 units): Draw what happens in the next step of the max-flow algorithm! how to get from maximal matching to maximum matching…

29 Max flow thought experiment... s source t sink 1 1 1 1 1 1 all 1s... the path it finds... What's going on here?

30 Max flow thought experiment... s source t sink 1 1 1 1 1 1 all 1s Done! Maximum matching == 4

31 This week's problems… dinner dining hardware muddy feeding all can be done with maxflow…

32 The challenge: is often setting up the graph

33 Tools 4 42 189 10 1000 50 1 3 20 1 3 8 2 3 1 4 Tasks How do we use the results? What is flowing? There are four tools available ~ at these costs hammer phone coffee laptop There are four tasks available ~ with these rewards hammer phone coffee PC 4 tools & 4 tasks each task requires some tools E4 PHP coding sleep coding hardware

34 Tools 4 42 189 10 1000 50 1 3 20 1 3 8 2 3 1 4 source Tasks sink 42 189 10 1000 costs rewards 50 20 8 3 How do we use the results? What is flowing? There are four tools available ~ at these costs hammer phone coffee laptop There are four tasks available ~ with these rewards 4 tools & 4 tasks each task requires some tools hammer phone coffee PC E4 PHP coding sleep coding hardware

35 Tools 4 42 189 10 1000 50 1 3 20 1 3 8 2 3 1 4 source Tasks sink 42 189 10 1000 costs rewards 50 20 8 3 How do we use the results? What is flowing? hardware There are four tools available ~ at these costs hammer phone coffee laptop There are four tasks available ~ with these rewards 4 tools & 4 tasks each task requires some tools hammer phone coffee PC E4 PHP coding sleep Netflix      

36 4 5 4 5 3 5 3 5 2 6 4 4 5 4 5 3 5 3 5 2 6 3 0 number of teams Input Output number of tables # of people in each team can an assignment be made without putting teammates together? 1010 capacity of each table again… end… 3 5 2 6 4 tables with capacities teams with sizes 5 3 4 5 seating assignments! no teammates dinner

37 s source t sink How does maxflow help? Team Table 4 3 6 5 2 5 5 3 4 fully connected with edge weights of 1 How do these edge weights reflect the problem constraints? dinner

38 Try max flow!

39 JRsSRs other diner 1 diner 2 Sophs diner 1 POM-CMC- SCR-PTZ diner 1 about 3about 0about 1 yearn 2yearn 0yearn 1yearn 2 jotto 2jotto 0jotto 1jotto 0jotto 1 syrup 1syrup 2syrup 1syrup 2syrup 1 chimp 0chimp 3chimp 1 chimp 2 today 3today 0today 2today 1today 2 flags 1 flags 0flags 3flags 0 ships 0ships 4ships 1ships 2ships 1 phish 0phish 5phish 1phish 2phish 1 This term's first class to guess another's word earns 1 problem... This term's last class to have its word guessed earns 1 problem... gapes 1-----gapes 0gapes 4gapes 1 JRs +1.5 POMs +1 aorta 5-----aorta 2aorta 1 ---------sepal 0sepal 5sepal 1

40 Jotto! JRsSRs other diner 1 This term's first class to guess another's word earns 1 problem... diner 1diner 2 This term's last class to have its word guessed earns 1 problem... Sophs diner 1 POM-CMC- SCR-PTZ diner 1 about 3about 0about 1 yearn 2yearn 0yearn 1yearn 2 jotto 2jotto 0jotto 1jotto 0jotto 1 syrup 1 syrup 2syrup 1

41 Jotto…

42 This code only looks obfuscated!

43 No ideas? Default projects... goal: to get familiar with a variety of web technologies Project #1: build a web jotto-player and advisor demo 1: use HTML, CSS, and CGI forms with Python to choose a random hidden word and score guesses against that hidden word demo 2: use an SQL database to help analyze the comparative effectiveness of guessing a particular word next, without scoring them all final demo: use javascript and AJAX (and/or HTML 5 canvas) features to make the interface more slick, as befits the noble game of Jotto! See https://www.cs.hmc.edu/twiki/bin/view/CS5/WebCS5DevelopmentPage for some (rough) guidance and sample applications on HMC's webserver...

44 No ideas? Default projects... goal: to get familiar with a variety of web technologies Project #1: build a web jotto-player and advisor demo 1: use HTML, CSS, and CGI forms with Python to choose a random hidden word and score guesses against that hidden word demo 2: use an SQL database to help analyze the comparative effectiveness of guessing a particular word next, without scoring them all final demo: use javascript and AJAX (and/or HTML 5 canvas) features to make the interface more slick, as befits the noble game of Jotto! Project #2: build a web-based Python autograder alternative final demo: allow a user to submit a program and get "immediate" feedback as to whether it passed a series of tests or not (time out as necessary to avoid uncomputability...) impossible final demo: show off your Hyper-Turing quantum computer, since, after all, the autograder problem is uncomputable

45 http://www.amirrorclear.net/academic/papers/many-forms.pdfhttp://www.cs.virginia.edu/~robins/The_Limits_of_Quantum_Computers.pdf HyperTuring computation is easy – just add coffee to your TM! Hyper-Turing? Quantum computers are not considered likely to extend what's computable – only how efficiently computations can be done.

46 Hyper-turing computation? HyperTuring computation is easy – just add coffee to your TM!

47 Hyper-turing computation? HyperTuring computation is easy – just add coffee to your TM!

48 Survey JRsSRsElderly a word-guessing game similar to mastermind… diner ? This term's first class to guess another's word earns 1 point... diner ? This term's last class to have its word guessed earns 1 point... Sophs diner ? Pomona? diner ? Other points may be possible... Get together with same-year classmates... (1) Choose a jotto word with/for your class... and jotto, part 1 (2) Have you built software on your own with technologies not typically part of Mudd's curriculum? If not, no problem! If so, great! - please mention a detail or two: (3) Do you already have a plan (or an idea) for a CS189 project you might want to pursue? If so, what are you considering? (0) Name: ____________________________

49

50 Scores... JRsSRsOthers diner 3 This term's first class to guess another's word earns 1 point... diner 1diner 3 This term's last class to have its word guessed earns 1 point... Sophs diner 0 Other points may be possible... Ideas!... and jotto: squid 2squid 1 squid 0 neigh 3neigh 0neigh 2neigh 1 No idea: 8 Web App: 12 iPad/iOS: 3 OpenCV: 5 baseball: 1 Android: 2 Audio analysis: 3 57623195761128 2111076279323 36213142103

51


Download ppt "CS 189 today Open-ended project option… A few more problems…… and one more algorithm! Jotto game finale?! Rest of the term No meeting on Tuesday, November."

Similar presentations


Ads by Google