1 00:00:00,090 --> 00:00:01,800 The following content is provided 2 00:00:01,800 --> 00:00:04,030 under a Creative Commons license. 3 00:00:04,030 --> 00:00:06,880 Your support will help MIT OpenCourseWare continue 4 00:00:06,880 --> 00:00:10,740 to offer high quality educational resources for free. 5 00:00:10,740 --> 00:00:13,350 To make a donation, or view additional materials 6 00:00:13,350 --> 00:00:17,256 from hundreds of MIT courses, visit MIT OpenCourseWare 7 00:00:17,256 --> 00:00:17,881 at ocw.mit.edu. 8 00:00:27,000 --> 00:00:28,980 PROFESSOR: So we're going to do a problem that 9 00:00:28,980 --> 00:00:30,330 looks like the guitar problem. 10 00:00:30,330 --> 00:00:31,912 But it's a bit cooler. 11 00:00:31,912 --> 00:00:33,620 At the same time, there are fewer states, 12 00:00:33,620 --> 00:00:35,370 so I think it's easier to manage. 13 00:00:35,370 --> 00:00:38,286 How many people know how to play DDR? 14 00:00:38,286 --> 00:00:39,190 AUDIENCE: Well. 15 00:00:39,190 --> 00:00:40,480 PROFESSOR: Yeah. 16 00:00:40,480 --> 00:00:40,980 OK. 17 00:00:40,980 --> 00:00:43,832 How many people know the rules of playing DDR? 18 00:00:43,832 --> 00:00:46,040 Because otherwise I won't be able to lift my hand up. 19 00:00:46,040 --> 00:00:47,970 OK. 20 00:00:47,970 --> 00:00:51,640 OK, so let's go through an algorithmic model. 21 00:00:51,640 --> 00:00:58,510 So, you have a board that basically looks like this. 22 00:00:58,510 --> 00:01:03,090 And you have four touch sensitive pads. 23 00:01:03,090 --> 00:01:05,140 Up, down, left, right. 24 00:01:05,140 --> 00:01:08,230 And then you have a center position. 25 00:01:08,230 --> 00:01:13,340 You also have a sheet of notes that looks something like this. 26 00:01:13,340 --> 00:01:23,700 Say, up, up down, down, up down, up, up down, left right, 27 00:01:23,700 --> 00:01:27,039 left, left right, right. 28 00:01:27,039 --> 00:01:27,830 So on and so forth. 29 00:01:31,120 --> 00:01:34,760 So when you see an arrow of up, that's 30 00:01:34,760 --> 00:01:37,130 a constraint that says one of your feet 31 00:01:37,130 --> 00:01:40,310 has to be on the up arrow. 32 00:01:40,310 --> 00:01:43,410 Has to tap the up arrow, actually. 33 00:01:43,410 --> 00:01:45,470 There's no constraint for the other foot. 34 00:01:45,470 --> 00:01:47,770 So your other foot can be anywhere else on the board. 35 00:01:47,770 --> 00:01:49,340 It doesn't matter. 36 00:01:49,340 --> 00:01:52,980 You are also allowed to tap the board some extra times. 37 00:01:52,980 --> 00:01:57,130 So if you don't have a note showing up, 38 00:01:57,130 --> 00:01:58,780 you can still hit the board. 39 00:01:58,780 --> 00:02:00,340 And there's no penalty. 40 00:02:00,340 --> 00:02:02,340 So you can hop around as many times as you want, 41 00:02:02,340 --> 00:02:06,260 or as many times as you can, until you run out of breath. 42 00:02:06,260 --> 00:02:09,550 So up basically means, it's actually one foot has to be up. 43 00:02:09,550 --> 00:02:11,100 The other one center. 44 00:02:11,100 --> 00:02:13,589 Also, of course, because of the design of the board, 45 00:02:13,589 --> 00:02:15,130 it doesn't matter what foot is where. 46 00:02:18,180 --> 00:02:22,251 So what are possible goals for this game? 47 00:02:22,251 --> 00:02:25,000 AUDIENCE: Not to get an F. 48 00:02:25,000 --> 00:02:27,240 PROFESSOR: OK. 49 00:02:27,240 --> 00:02:29,711 AUDIENCE: Hit all the arrows when 50 00:02:29,711 --> 00:02:32,637 they line up with the top row. 51 00:02:32,637 --> 00:02:33,220 PROFESSOR: OK. 52 00:02:33,220 --> 00:02:36,680 So there are two different ways of doing it. 53 00:02:36,680 --> 00:02:38,660 One, you said, "not to get an F." 54 00:02:38,660 --> 00:02:44,020 So I would say, given some limited set of skills. 55 00:02:44,020 --> 00:02:49,220 So given a set of skills, or your skill level 56 00:02:49,220 --> 00:02:50,980 maximizes your score. right? 57 00:02:50,980 --> 00:02:51,606 AUDIENCE: Yeah. 58 00:02:51,606 --> 00:02:53,230 PROFESSOR: This is dynamic programming, 59 00:02:53,230 --> 00:02:55,115 so we always want to maximize something. 60 00:02:58,550 --> 00:03:02,160 Now, if you're really good, then another possible goal 61 00:03:02,160 --> 00:03:10,740 is hit all the notes with a minimum amount of effort. 62 00:03:13,495 --> 00:03:15,120 If you're going to be in a competition, 63 00:03:15,120 --> 00:03:16,703 and you're going to be doing 10 songs, 64 00:03:16,703 --> 00:03:19,890 you don't want to die after the first song, right? 65 00:03:19,890 --> 00:03:22,370 So, assuming you can do everything reasonably well, 66 00:03:22,370 --> 00:03:25,830 this is another possible goal. 67 00:03:25,830 --> 00:03:28,804 Any other goals? 68 00:03:28,804 --> 00:03:29,970 So we're brainstorming here. 69 00:03:29,970 --> 00:03:32,210 This isn't set in stone. 70 00:03:32,210 --> 00:03:36,150 We've already seen the formal solution for this problem. 71 00:03:36,150 --> 00:03:38,430 So I want to play with it for a little bit, right? 72 00:03:38,430 --> 00:03:42,910 We brought a DDR pad, so I want to play with it. 73 00:03:42,910 --> 00:03:45,990 What else could you hope to maximize or minimize 74 00:03:45,990 --> 00:03:47,205 for with dynamic programming? 75 00:03:51,262 --> 00:03:54,590 AUDIENCE: Not look ridiculous. 76 00:03:54,590 --> 00:03:56,470 PROFESSOR: OK. 77 00:03:56,470 --> 00:03:59,961 AUDIENCE: I guess we're looking at the cost of each move, 78 00:03:59,961 --> 00:04:00,460 right? 79 00:04:00,460 --> 00:04:02,180 PROFESSOR: So, hit all the notes. 80 00:04:02,180 --> 00:04:09,685 Minimum effort, or otherwise say best appearance. 81 00:04:13,530 --> 00:04:18,230 So every move looks somewhat good or somewhat bad. 82 00:04:18,230 --> 00:04:21,269 And you want to do the moves that look as good as possible. 83 00:04:21,269 --> 00:04:23,410 So this maximizes entertainment, right? 84 00:04:28,640 --> 00:04:32,830 if you're on TV, you probably want this. 85 00:04:32,830 --> 00:04:34,590 Now suppose you are in a competition 86 00:04:34,590 --> 00:04:36,640 and you only have one track to play. 87 00:04:41,920 --> 00:04:45,254 AUDIENCE: Well, you know where all the notes are. 88 00:04:45,254 --> 00:04:45,920 PROFESSOR: Sure. 89 00:04:45,920 --> 00:04:47,919 Like, we assume that we know this ahead of time. 90 00:04:47,919 --> 00:04:49,032 So you've memorized this. 91 00:04:49,032 --> 00:04:50,990 And you're trying to compute the best strategy, 92 00:04:50,990 --> 00:04:52,031 so you can memorize that. 93 00:04:52,031 --> 00:04:53,980 Then when you go and play, you dominate. 94 00:04:53,980 --> 00:04:55,220 AUDIENCE: Yeah. 95 00:04:55,220 --> 00:04:56,769 PROFESSOR: So, if you have one track, 96 00:04:56,769 --> 00:04:58,560 then I would say that what you'd want to do 97 00:04:58,560 --> 00:05:00,950 is minimize your probability of failure. 98 00:05:00,950 --> 00:05:01,450 Right? 99 00:05:01,450 --> 00:05:05,459 So given the probability of failure for each possible move. 100 00:05:05,459 --> 00:05:07,750 You want to minimize the overall probability of failure 101 00:05:07,750 --> 00:05:10,170 so your teammates won't hate you. 102 00:05:10,170 --> 00:05:14,386 So, hit all the notes and minimize. 103 00:05:24,037 --> 00:05:26,370 So this one's a little bit different from the other ones 104 00:05:26,370 --> 00:05:27,953 because all the other ones are already 105 00:05:27,953 --> 00:05:30,390 set up as a nice problem where you add up things. 106 00:05:30,390 --> 00:05:31,880 So you can solve them with graphs 107 00:05:31,880 --> 00:05:33,770 or with dynamic programming. 108 00:05:33,770 --> 00:05:36,580 If you want to minimize the probability of failure, 109 00:05:36,580 --> 00:05:39,320 then you want to maximize the probability of success. 110 00:05:39,320 --> 00:05:41,840 The probability of succeeding on all your moves 111 00:05:41,840 --> 00:05:44,550 is the product of the probability 112 00:05:44,550 --> 00:05:46,321 of succeeding on each move. 113 00:05:46,321 --> 00:05:46,820 All right? 114 00:05:46,820 --> 00:05:48,110 So if you have five moves, then you 115 00:05:48,110 --> 00:05:49,590 have five individual probabilities. 116 00:05:49,590 --> 00:05:50,540 You multiply them up. 117 00:05:50,540 --> 00:05:53,820 And that's the probability that you execute the whole sequence 118 00:05:53,820 --> 00:05:55,930 correctly, and not stumble. 119 00:05:55,930 --> 00:05:57,430 So we have products instead of sums. 120 00:05:57,430 --> 00:05:57,760 Yes? 121 00:05:57,760 --> 00:06:00,093 AUDIENCE: Isn't it related to the maximizing score goal? 122 00:06:04,580 --> 00:06:07,240 PROFESSOR: You can. 123 00:06:07,240 --> 00:06:09,210 Well, not necessarily because this one 124 00:06:09,210 --> 00:06:12,520 says that you only have some possible moves. 125 00:06:12,520 --> 00:06:15,450 I think in the end, all of them, except for this last one, 126 00:06:15,450 --> 00:06:17,840 can be solved using the recursion depth we have for it. 127 00:06:17,840 --> 00:06:19,840 The last one, you have to do a bit of massaging. 128 00:06:19,840 --> 00:06:21,339 And we're going over that right now. 129 00:06:24,430 --> 00:06:29,610 So, you have products instead of sums. 130 00:06:29,610 --> 00:06:31,695 How do you turn products into sums? 131 00:06:31,695 --> 00:06:32,910 AUDIENCE: Logs? 132 00:06:32,910 --> 00:06:33,850 PROFESSOR: Yep. 133 00:06:33,850 --> 00:06:38,220 So, for this one, I would want to use logs, 134 00:06:38,220 --> 00:06:40,450 so that I can say that I want to maximize 135 00:06:40,450 --> 00:06:42,200 the log probability of success. 136 00:06:42,200 --> 00:06:45,660 Which is just the sum of the log probabilities for each move. 137 00:06:45,660 --> 00:06:49,580 And then it looks like dynamic programming, as usual. 138 00:06:49,580 --> 00:06:51,550 Now, if I wouldn't want to use logs, 139 00:06:51,550 --> 00:06:56,920 if I'm using the DP formulation, where I'm doing recursion, 140 00:06:56,920 --> 00:06:58,790 I can incorporate products there. 141 00:06:58,790 --> 00:07:00,290 But it turns out, I didn't practice. 142 00:07:00,290 --> 00:07:02,331 If you have a lot of numbers that are close to 1, 143 00:07:02,331 --> 00:07:05,070 or that are close to 0, so all the easy moves 144 00:07:05,070 --> 00:07:07,920 are going to be really close to 1, for example. 145 00:07:07,920 --> 00:07:10,310 If you have a lot of numbers that are close to 1 or close 146 00:07:10,310 --> 00:07:12,460 to 0, if you multiply them up, you 147 00:07:12,460 --> 00:07:13,830 get numerical instabilities. 148 00:07:13,830 --> 00:07:18,000 So we get the number that's really close to 1. 149 00:07:18,000 --> 00:07:23,100 So for example, if I'm choosing whether to do, say I'm here, 150 00:07:23,100 --> 00:07:26,230 and I'm thinking, do I want to move like this? 151 00:07:26,230 --> 00:07:31,260 Or do I want to move like this, and then like this? 152 00:07:31,260 --> 00:07:32,970 These are both pretty easy moves. 153 00:07:32,970 --> 00:07:35,785 So, in both cases, we're looking at probabilities 154 00:07:35,785 --> 00:07:38,560 of success of 99.991%. 155 00:07:38,560 --> 00:07:42,010 And maybe 99.992%. 156 00:07:42,010 --> 00:07:44,445 So if you have numbers with probabilities 157 00:07:44,445 --> 00:07:46,820 that are really close to 1, and if you have a lot of them 158 00:07:46,820 --> 00:07:48,960 and you try to multiply them, you're 159 00:07:48,960 --> 00:07:50,990 going to get a bad result. 160 00:07:50,990 --> 00:07:54,440 So all the products are going to start looking the same. 161 00:07:54,440 --> 00:07:56,140 So we're going to get a random solution, 162 00:07:56,140 --> 00:07:57,530 instead of what you want. 163 00:07:57,530 --> 00:07:58,640 This is a practical thing. 164 00:07:58,640 --> 00:08:00,100 It's called numerical instability. 165 00:08:00,100 --> 00:08:02,310 And it's a practical reason why you'd 166 00:08:02,310 --> 00:08:06,789 want to use logs, instead of multiplying things up. 167 00:08:06,789 --> 00:08:08,330 So it's not just a theoretical thing. 168 00:08:08,330 --> 00:08:12,200 It also makes life nice in practice. 169 00:08:12,200 --> 00:08:12,700 OK. 170 00:08:12,700 --> 00:08:15,270 So we have a goal that looks like this. 171 00:08:15,270 --> 00:08:16,630 Say, let's go for this one. 172 00:08:16,630 --> 00:08:18,820 Hit all the notes, minimize the effort. 173 00:08:18,820 --> 00:08:23,480 And all the other ones can be reduced to this one. 174 00:08:23,480 --> 00:08:25,490 We need to define effort, right? 175 00:08:25,490 --> 00:08:29,300 Let's say that we have a function called delta, that 176 00:08:29,300 --> 00:08:33,280 takes two foot locations-- so, where both of my feet 177 00:08:33,280 --> 00:08:38,500 are-- from and to. 178 00:08:38,500 --> 00:08:48,470 And it gives me a number from 0 to 1, where 0 is really easy. 179 00:08:48,470 --> 00:08:49,980 And 1 is really hard. 180 00:08:54,190 --> 00:08:58,480 So from would look something like, my left foot is up. 181 00:08:58,480 --> 00:09:00,230 My right foot is centered. 182 00:09:00,230 --> 00:09:04,230 To would look something like, my left foot is centered 183 00:09:04,230 --> 00:09:05,550 and my right foot is up. 184 00:09:05,550 --> 00:09:10,730 So basically going from here to here. 185 00:09:10,730 --> 00:09:12,427 So from left foot up. 186 00:09:12,427 --> 00:09:13,330 Right foot center. 187 00:09:13,330 --> 00:09:13,960 To here. 188 00:09:16,432 --> 00:09:18,140 So there is some difficulty there, right? 189 00:09:18,140 --> 00:09:19,830 We have to jump, so it's not 0. 190 00:09:19,830 --> 00:09:23,230 I'm burning some calories here. 191 00:09:23,230 --> 00:09:25,530 So any move that I make has some difficulty. 192 00:09:25,530 --> 00:09:28,300 And I want to solve the game so that overall I 193 00:09:28,300 --> 00:09:32,450 have a reasonably small total difficulty. 194 00:09:37,290 --> 00:09:41,130 OK, are we understanding the problem? 195 00:09:41,130 --> 00:09:43,610 So we have three possible avenues here. 196 00:09:43,610 --> 00:09:47,040 We can start solving it using dynamic programming. 197 00:09:47,040 --> 00:09:49,550 We can start solving it using graphs. 198 00:09:49,550 --> 00:09:52,670 Or we can have someone else play the DDR again so that we 199 00:09:52,670 --> 00:09:54,120 can get more hands on experience, 200 00:09:54,120 --> 00:09:57,860 and look at what a good strategy or a bad strategy looks like. 201 00:09:57,860 --> 00:09:58,860 So you guys get to vote. 202 00:09:58,860 --> 00:10:01,790 Who wants to solve this using the dynamic programming? 203 00:10:04,490 --> 00:10:08,550 Who wants to solve this using graphs? 204 00:10:08,550 --> 00:10:10,380 Who wants to get more hands on experience? 205 00:10:13,020 --> 00:10:15,160 Damn. 206 00:10:15,160 --> 00:10:17,280 I was hoping that DDR would win. 207 00:10:17,280 --> 00:10:19,620 You guys are boring. 208 00:10:19,620 --> 00:10:20,832 So, graphs, right? 209 00:10:20,832 --> 00:10:21,915 We're going to have notes. 210 00:10:26,360 --> 00:10:27,820 Notes represent states, right? 211 00:10:27,820 --> 00:10:31,300 So a state is where you are at some point in the game. 212 00:10:31,300 --> 00:10:34,510 And we'll have to define what where you are means. 213 00:10:34,510 --> 00:10:37,550 And then, when you jump, you make a move. 214 00:10:37,550 --> 00:10:40,150 So moves go between states. 215 00:10:40,150 --> 00:10:42,370 So in any game, you have states and moves. 216 00:10:42,370 --> 00:10:43,980 A state is very hard to put in time. 217 00:10:43,980 --> 00:10:45,021 And then you make a move. 218 00:10:45,021 --> 00:10:45,620 Like in chess. 219 00:10:45,620 --> 00:10:47,270 Your state is your board position. 220 00:10:47,270 --> 00:10:49,200 And whether you're moving, or your opponent 221 00:10:49,200 --> 00:10:50,865 is the next to move. 222 00:10:50,865 --> 00:10:53,490 And the move is when you take a piece and put it from one place 223 00:10:53,490 --> 00:10:53,989 to another. 224 00:10:58,160 --> 00:10:59,710 So your vertices are states. 225 00:10:59,710 --> 00:11:03,270 And your edges are moves. 226 00:11:05,900 --> 00:11:10,110 So what's in a state? 227 00:11:10,110 --> 00:11:12,050 This is our problem. 228 00:11:12,050 --> 00:11:13,740 Whether we're solving it with graphs 229 00:11:13,740 --> 00:11:16,140 or with dynamic programming, this 230 00:11:16,140 --> 00:11:17,937 is what everything comes down to. 231 00:11:17,937 --> 00:11:18,770 What's in the state? 232 00:11:29,190 --> 00:11:31,440 AUDIENCE: So your current state is how much difficulty 233 00:11:31,440 --> 00:11:33,920 have you-- what is the problem? 234 00:11:33,920 --> 00:11:36,672 Are those representing the probabilities, 235 00:11:36,672 --> 00:11:37,380 the difficulties? 236 00:11:37,380 --> 00:11:38,400 Or. 237 00:11:38,400 --> 00:11:41,460 PROFESSOR: So this is the difficulty for one move. 238 00:11:41,460 --> 00:11:44,000 Does it depend on previous moves? 239 00:11:44,000 --> 00:11:44,797 AUDIENCE: No, but. 240 00:11:44,797 --> 00:11:45,380 PROFESSOR: No. 241 00:11:45,380 --> 00:11:47,530 So it's a nice thing to note that the difficulties 242 00:11:47,530 --> 00:11:48,779 for each move are independent. 243 00:11:58,746 --> 00:12:01,216 AUDIENCE: Would it be dependent in real life? 244 00:12:01,216 --> 00:12:02,698 You'll get tired at the end. 245 00:12:02,698 --> 00:12:05,168 And he's able to have less energy. 246 00:12:07,545 --> 00:12:08,170 PROFESSOR: Yep. 247 00:12:08,170 --> 00:12:12,060 So, in real life, we might want to say that this actually 248 00:12:12,060 --> 00:12:15,870 depends on how much energy you've expended so far. 249 00:12:15,870 --> 00:12:18,740 And if we have time, let's solve that problem. 250 00:12:25,180 --> 00:12:26,680 So the nice thing about this problem 251 00:12:26,680 --> 00:12:29,950 is there are many directions in which we can take it. 252 00:12:29,950 --> 00:12:30,920 This is one of them. 253 00:12:30,920 --> 00:12:32,000 I'm fine. 254 00:12:32,000 --> 00:12:34,780 And I think we'll learn a lot by doing that. 255 00:12:34,780 --> 00:12:37,340 So back to the original problem. 256 00:12:37,340 --> 00:12:40,100 Suppose that it doesn't matter how tired you are. 257 00:12:40,100 --> 00:12:41,720 You're pretty good, so you're not 258 00:12:41,720 --> 00:12:43,413 going to be tired enough to go [GASP]. 259 00:12:46,520 --> 00:12:50,020 So, mostly independent difficulties for each move. 260 00:12:50,020 --> 00:12:53,240 What's in a state? 261 00:12:53,240 --> 00:12:56,417 AUDIENCE: The sum of the difficulties up to that point. 262 00:12:56,417 --> 00:12:57,000 PROFESSOR: OK. 263 00:12:57,000 --> 00:12:57,500 So. 264 00:13:09,666 --> 00:13:11,765 AUDIENCE: Your appearance factor, 265 00:13:11,765 --> 00:13:12,885 if we're including that. 266 00:13:12,885 --> 00:13:13,610 Or are we only doing-- 267 00:13:13,610 --> 00:13:14,901 PROFESSOR: So we're doing this. 268 00:13:16,760 --> 00:13:17,801 AUDIENCE: Oh, I was just. 269 00:13:17,801 --> 00:13:18,763 Oh, effort. 270 00:13:18,763 --> 00:13:19,930 OK, we're minimizing effort. 271 00:13:19,930 --> 00:13:21,804 PROFESSOR: So the way I like to think of this 272 00:13:21,804 --> 00:13:23,590 is, what is does a solution look like? 273 00:13:23,590 --> 00:13:25,458 It's made up of decisions, right? 274 00:13:25,458 --> 00:13:26,416 What are the decisions? 275 00:13:29,090 --> 00:13:33,500 AUDIENCE: To make that move or don't make that move? 276 00:13:33,500 --> 00:13:34,470 PROFESSOR: We'll see. 277 00:13:34,470 --> 00:13:36,040 But once you know what the decisions are, 278 00:13:36,040 --> 00:13:38,456 then you have to think, what do I need to make a decision? 279 00:13:41,680 --> 00:13:43,650 AUDIENCE: The note. 280 00:13:43,650 --> 00:13:51,840 PROFESSOR: So, a note is one of these. 281 00:13:51,840 --> 00:13:54,000 For some reason, they're called notes. 282 00:13:58,717 --> 00:14:00,300 AUDIENCE: So you know that somehow you 283 00:14:00,300 --> 00:14:01,950 have to hit all of them? 284 00:14:01,950 --> 00:14:05,116 Like, you can have steps in between. 285 00:14:05,116 --> 00:14:05,740 PROFESSOR: Yep. 286 00:14:05,740 --> 00:14:06,864 AUDIENCE: Moves in between. 287 00:14:06,864 --> 00:14:08,480 You have to hit all of them. 288 00:14:08,480 --> 00:14:10,420 PROFESSOR: OK, so I like this. 289 00:14:10,420 --> 00:14:15,640 So, every one of these is going to have to generate a move. 290 00:14:15,640 --> 00:14:17,430 And there might be some moves in between. 291 00:14:24,650 --> 00:14:26,950 Well, each move is going to map to some edge. 292 00:14:26,950 --> 00:14:29,160 And I'm going to need vertices. 293 00:14:29,160 --> 00:14:33,510 So, as an algorithms program where when I hear that, oh. 294 00:14:33,510 --> 00:14:36,040 I can have some moves in between, I get really uneasy. 295 00:14:36,040 --> 00:14:37,424 Like, what is this? 296 00:14:37,424 --> 00:14:38,840 How many moves am I going to have? 297 00:14:38,840 --> 00:14:40,340 Is this going to become really huge? 298 00:14:40,340 --> 00:14:43,950 And am I not going to be able to run any algorithm on it? 299 00:14:43,950 --> 00:14:45,200 So let's think about that. 300 00:14:45,200 --> 00:14:46,910 How many moves would I have in between? 301 00:14:46,910 --> 00:14:48,409 And, what would I achieve with them? 302 00:14:52,520 --> 00:14:55,760 AUDIENCE: I guess you'd have a max of, like, four, right? 303 00:14:55,760 --> 00:14:58,584 I mean, you can put your right leg someplace, 304 00:14:58,584 --> 00:15:00,250 and you can put your left leg someplace. 305 00:15:00,250 --> 00:15:02,870 That's like a max of two. 306 00:15:02,870 --> 00:15:03,370 Right? 307 00:15:03,370 --> 00:15:04,350 Or no? 308 00:15:04,350 --> 00:15:07,350 PROFESSOR: So, let's think of an example. 309 00:15:07,350 --> 00:15:10,670 You want to go, say, I want to go, what? 310 00:15:10,670 --> 00:15:12,930 From here to here, right? 311 00:15:12,930 --> 00:15:13,980 AUDIENCE: Um-hmm. 312 00:15:13,980 --> 00:15:17,110 PROFESSOR: And you're thinking what? 313 00:15:17,110 --> 00:15:19,750 They can do this, oh sorry. 314 00:15:19,750 --> 00:15:21,430 So I can do this as one move. 315 00:15:21,430 --> 00:15:22,420 And this is one move. 316 00:15:22,420 --> 00:15:22,548 AUDIENCE: Yeah. 317 00:15:22,548 --> 00:15:24,236 Or you can just do one jump, right? 318 00:15:24,236 --> 00:15:25,645 So it's-- oh, yeah. 319 00:15:25,645 --> 00:15:27,570 I guess that's more than one. 320 00:15:27,570 --> 00:15:29,090 PROFESSOR: OK. 321 00:15:29,090 --> 00:15:31,660 So looking at this, if I'm considering 322 00:15:31,660 --> 00:15:35,240 whether to go from here to here. 323 00:15:35,240 --> 00:15:41,387 If I want to go either this way, or if I want to go this way. 324 00:15:41,387 --> 00:15:42,970 So let's write this down on the board. 325 00:15:46,150 --> 00:15:54,050 So I'm going from up down to left right. 326 00:15:54,050 --> 00:15:56,120 And I'm considering, do I want to go directly 327 00:15:56,120 --> 00:16:01,690 or do I want to go up right first. 328 00:16:01,690 --> 00:16:04,980 And then left right. 329 00:16:04,980 --> 00:16:07,980 Let's not do these arrows because they're confusing. 330 00:16:07,980 --> 00:16:10,060 So, do I want to transition like this? 331 00:16:10,060 --> 00:16:12,990 Or do I want to transition like this? 332 00:16:12,990 --> 00:16:19,700 Well, I claim that, since my moves are independent, 333 00:16:19,700 --> 00:16:23,990 going from here to here, if it's beneficial to go 334 00:16:23,990 --> 00:16:25,990 this way instead of this way, I would 335 00:16:25,990 --> 00:16:28,070 want to go this way all the time. 336 00:16:28,070 --> 00:16:30,330 So I would just say that, look. 337 00:16:30,330 --> 00:16:32,372 Inside my delta here, I would say that, actually, 338 00:16:32,372 --> 00:16:34,371 if you know what you're doing, whenever you have 339 00:16:34,371 --> 00:16:36,780 to go from here to here, you're going to go like this. 340 00:16:36,780 --> 00:16:39,650 And the delta is going to report to the total delta for this. 341 00:16:43,700 --> 00:16:49,150 So, if the problem is that they have one note, 342 00:16:49,150 --> 00:16:52,550 and then I have my next note like this, between these two 343 00:16:52,550 --> 00:16:55,610 notes, I can always go in one move. 344 00:16:58,544 --> 00:16:59,960 AUDIENCE: So you're saying 1 would 345 00:16:59,960 --> 00:17:03,550 like, including in our difficulty function, 346 00:17:03,550 --> 00:17:06,150 it'll also tell us, like, what move 347 00:17:06,150 --> 00:17:07,900 we should make to get there? 348 00:17:07,900 --> 00:17:09,300 PROFESSOR: How to get there. 349 00:17:09,300 --> 00:17:11,270 The best way to get from one state to another. 350 00:17:11,270 --> 00:17:12,770 Well, like when you're learning DDR, 351 00:17:12,770 --> 00:17:14,990 these are the basic steps, right? 352 00:17:14,990 --> 00:17:17,680 Like, you practice until you know how to get from one place 353 00:17:17,680 --> 00:17:19,410 to another. 354 00:17:19,410 --> 00:17:21,960 There is something else where you need intermediate steps. 355 00:17:26,218 --> 00:17:27,634 AUDIENCE: Or if you're holding one 356 00:17:27,634 --> 00:17:30,685 and then you've got to move to another. 357 00:17:30,685 --> 00:17:31,185 Right? 358 00:17:35,019 --> 00:17:36,810 PROFESSOR: So, let's not worry about holds. 359 00:17:36,810 --> 00:17:38,393 Let's say that we would just represent 360 00:17:38,393 --> 00:17:43,390 holds as-- so if you have a hold in a game, then 361 00:17:43,390 --> 00:17:45,370 we're just going to represent it like this. 362 00:17:45,370 --> 00:17:46,244 We're going to cheat. 363 00:17:49,290 --> 00:17:50,946 So we don't have to deal with it. 364 00:17:50,946 --> 00:17:52,820 In real life, you would have to deal with it. 365 00:17:52,820 --> 00:17:55,361 Like if you're actually writing a program that trains people. 366 00:17:55,361 --> 00:17:59,970 AUDIENCE: What happens if you have, like, right, left, up 367 00:17:59,970 --> 00:18:00,780 or something. 368 00:18:00,780 --> 00:18:04,200 So let's say you start off hitting your right foot 369 00:18:04,200 --> 00:18:10,836 on the top, and then you have to hit the right one again. 370 00:18:10,836 --> 00:18:12,420 And then you have to hit up again 371 00:18:12,420 --> 00:18:13,670 and then you have to transfer. 372 00:18:13,670 --> 00:18:17,700 So I guess anytime you have to through the middle. 373 00:18:17,700 --> 00:18:19,700 You have move your foot. 374 00:18:19,700 --> 00:18:23,540 PROFESSOR: So I like the idea of going through the middle. 375 00:18:23,540 --> 00:18:27,954 Why or how do you, why would you go through the middle? 376 00:18:27,954 --> 00:18:32,099 AUDIENCE: To avoid crossing your leg over or something. 377 00:18:32,099 --> 00:18:34,265 PROFESSOR: Well, what if I have something like this? 378 00:18:37,791 --> 00:18:40,540 If there are DDR experts, I know this isn't the right way 379 00:18:40,540 --> 00:18:41,040 to do it. 380 00:18:41,040 --> 00:18:49,595 But one way of doing it is left, right, left, right, left, 381 00:18:49,595 --> 00:18:51,640 right. 382 00:18:51,640 --> 00:18:53,950 So then, I have some states that account for the fact 383 00:18:53,950 --> 00:18:54,741 that I'm centering. 384 00:18:57,420 --> 00:18:59,080 So, some people like to do this, right? 385 00:18:59,080 --> 00:19:02,070 Some people like to go to the center as much as possible, 386 00:19:02,070 --> 00:19:04,500 if they have time between the moves. 387 00:19:04,500 --> 00:19:07,060 So then, I would need at least one state 388 00:19:07,060 --> 00:19:11,167 in between where I'm allowed to center, right? 389 00:19:11,167 --> 00:19:13,000 In order to represent what I just did there, 390 00:19:13,000 --> 00:19:14,570 I need one move. 391 00:19:21,490 --> 00:19:24,610 So, one way I could meet this is I have left center. 392 00:19:24,610 --> 00:19:26,980 And then left right. 393 00:19:26,980 --> 00:19:30,729 And then left right, left right, left right. 394 00:19:30,729 --> 00:19:31,520 So on and so forth. 395 00:19:31,520 --> 00:19:35,160 But this would mean that instead of doing this, which 396 00:19:35,160 --> 00:19:38,091 is reasonably easy, I would have to do this. 397 00:19:38,091 --> 00:19:38,590 This. 398 00:19:38,590 --> 00:19:40,940 And then jump, jump, jump, jump every time. 399 00:19:40,940 --> 00:19:41,900 Harder. 400 00:19:41,900 --> 00:19:42,930 Not good. 401 00:19:42,930 --> 00:19:43,870 Not good for my knees. 402 00:19:43,870 --> 00:19:45,196 Not good for my score. 403 00:19:45,196 --> 00:19:46,320 So I don't want to do this. 404 00:19:46,320 --> 00:19:50,200 I want to have an intermediate state so I can say, 405 00:19:50,200 --> 00:19:53,340 I start here and then I get back here. 406 00:19:53,340 --> 00:19:55,540 Then I do this. 407 00:19:55,540 --> 00:19:56,610 Then I get back here. 408 00:19:56,610 --> 00:19:59,690 Then I go here. 409 00:19:59,690 --> 00:20:02,630 And then I go back here. 410 00:20:02,630 --> 00:20:03,510 And then go back. 411 00:20:03,510 --> 00:20:06,131 Do guys see how this works? 412 00:20:06,131 --> 00:20:07,964 AUDIENCE: You could also rock back and forth 413 00:20:07,964 --> 00:20:10,882 to because they don't require both feet to be on the ground 414 00:20:10,882 --> 00:20:12,269 the entire time. 415 00:20:12,269 --> 00:20:13,560 PROFESSOR: Rock back and forth. 416 00:20:13,560 --> 00:20:14,309 Hold that thought. 417 00:20:17,169 --> 00:20:18,210 That might come in handy. 418 00:20:18,210 --> 00:20:20,270 Assuming we have enough time. 419 00:20:20,270 --> 00:20:23,550 So, if we only do one move every time we see a note, 420 00:20:23,550 --> 00:20:25,720 we're stuck with this. 421 00:20:25,720 --> 00:20:28,180 In our to allow re-centering, we have 422 00:20:28,180 --> 00:20:32,550 to add states between the notes. 423 00:20:32,550 --> 00:20:35,210 We need to add an intermediary state. 424 00:20:35,210 --> 00:20:39,530 And you can either think about it, or take my word for it, 425 00:20:39,530 --> 00:20:43,570 but if you represent the notes using the trick that I said 426 00:20:43,570 --> 00:20:47,460 above, and you want to represent centering, then all you need 427 00:20:47,460 --> 00:20:49,070 is one extra state. 428 00:20:49,070 --> 00:20:50,960 So one extra move between every two states. 429 00:20:56,340 --> 00:20:57,210 Between two notes. 430 00:21:00,320 --> 00:21:01,070 And that's enough. 431 00:21:01,070 --> 00:21:03,270 Because that one extra state allows you to center. 432 00:21:03,270 --> 00:21:06,610 And it allows you to do pretty much everything a beginner 433 00:21:06,610 --> 00:21:10,170 like me would know how to do. 434 00:21:10,170 --> 00:21:13,876 AUDIENCE: So you only need one extra state between each note? 435 00:21:13,876 --> 00:21:14,500 PROFESSOR: Yep. 436 00:21:14,500 --> 00:21:16,690 That is the inside. 437 00:21:16,690 --> 00:21:18,840 That is where I'm thinking, right? 438 00:21:18,840 --> 00:21:22,490 So I have to do both this trick, to see 439 00:21:22,490 --> 00:21:25,300 that I don't need an infinite number of steps. 440 00:21:25,300 --> 00:21:28,320 And come up with the need for centering 441 00:21:28,320 --> 00:21:30,291 to see why I need one intermediate step. 442 00:21:33,492 --> 00:21:34,950 By the way, does anyone know what's 443 00:21:34,950 --> 00:21:36,594 the right way of doing that? 444 00:21:36,594 --> 00:21:38,260 What's the right way of doing this move? 445 00:21:41,510 --> 00:21:42,780 You said, rock back and forth. 446 00:21:42,780 --> 00:21:44,860 So I wouldn't rock back and forth in this case, right? 447 00:21:44,860 --> 00:21:45,940 Because that wouldn't be helpful. 448 00:21:45,940 --> 00:21:46,648 How would I rock? 449 00:21:46,648 --> 00:21:48,156 AUDIENCE: Well, you hold down one 450 00:21:48,156 --> 00:21:49,530 and then you go to the other one. 451 00:21:49,530 --> 00:21:51,730 PROFESSOR: Yeah, so rock left and right. 452 00:21:51,730 --> 00:21:52,338 OK. 453 00:21:52,338 --> 00:21:54,530 AUDIENCE: I said back and forth, I meant rocking-- 454 00:21:54,530 --> 00:21:55,238 PROFESSOR: Sorry. 455 00:21:55,238 --> 00:21:57,170 I thought back, forth. 456 00:21:57,170 --> 00:21:59,090 So, the optimal way of doing this 457 00:21:59,090 --> 00:22:04,690 is left, right, left, right, left, right. 458 00:22:04,690 --> 00:22:06,497 So what am I doing? 459 00:22:06,497 --> 00:22:07,830 AUDIENCE: You have another move. 460 00:22:11,281 --> 00:22:15,460 You have, like, one state for your foot where 461 00:22:15,460 --> 00:22:17,400 it's not touching the ground. 462 00:22:17,400 --> 00:22:18,110 PROFESSOR: OK. 463 00:22:18,110 --> 00:22:20,160 It's an interesting, and important, distinction. 464 00:22:20,160 --> 00:22:22,160 So if I wanted to hit both of them, if I'm here, 465 00:22:22,160 --> 00:22:25,200 and I need to hit both of them, I need to hit them. 466 00:22:25,200 --> 00:22:27,770 If I only need to hit one of them, if I'm here, 467 00:22:27,770 --> 00:22:29,430 I can hit it like this. 468 00:22:29,430 --> 00:22:31,180 If I'm here, though, and I want to hit it, 469 00:22:31,180 --> 00:22:34,659 I have to lift myself up. 470 00:22:34,659 --> 00:22:36,450 So the difference is whether I'm like this. 471 00:22:36,450 --> 00:22:37,409 Or like this. 472 00:22:37,409 --> 00:22:38,200 Where is my weight? 473 00:22:42,690 --> 00:22:44,860 So if I want to allow for these moves, 474 00:22:44,860 --> 00:22:47,800 if I want to go past the stage of very beginner, 475 00:22:47,800 --> 00:22:50,190 aside from keeping track of where my feet are, 476 00:22:50,190 --> 00:22:52,750 I have to keep track of whether my weight is on my left foot 477 00:22:52,750 --> 00:22:54,920 or on my right foot. 478 00:22:54,920 --> 00:22:58,570 So, I would actually have l, r, and W, 479 00:22:58,570 --> 00:23:01,210 where W is either l or r. 480 00:23:07,138 --> 00:23:11,265 AUDIENCE: So your state now has what you're currently 481 00:23:11,265 --> 00:23:13,810 putting more weight on. 482 00:23:13,810 --> 00:23:15,770 PROFESSOR: And where each of the feet are. 483 00:23:15,770 --> 00:23:16,660 AUDIENCE: Yeah. 484 00:23:16,660 --> 00:23:18,890 Where your two feet are. 485 00:23:18,890 --> 00:23:22,146 And then also, the song difficulty. 486 00:23:22,146 --> 00:23:24,070 So it's everything in your state, right? 487 00:23:24,070 --> 00:23:25,470 PROFESSOR: Ah, yes. 488 00:23:25,470 --> 00:23:26,470 I didn't think about it. 489 00:23:26,470 --> 00:23:28,159 I was just talking about foot position. 490 00:23:28,159 --> 00:23:29,950 But we need to get back to the state thing. 491 00:23:29,950 --> 00:23:31,270 So that's a good point. 492 00:23:31,270 --> 00:23:35,360 So before we get to that, how many feet positions do we have? 493 00:23:35,360 --> 00:23:39,610 If we don't include where do I have my weight, 494 00:23:39,610 --> 00:23:42,230 how many possible positions for both of my feet do I have? 495 00:23:47,350 --> 00:23:48,370 So I have two feet. 496 00:23:48,370 --> 00:23:51,910 Each of them can be in any of these five squares, right? 497 00:23:51,910 --> 00:23:54,043 So how many total positions? 498 00:23:54,043 --> 00:23:57,256 AUDIENCE: 5 choose 2. 499 00:23:57,256 --> 00:23:58,620 Using 2. 500 00:23:58,620 --> 00:24:00,358 PROFESSOR: So I can do this. 501 00:24:00,358 --> 00:24:00,983 AUDIENCE: Sure. 502 00:24:00,983 --> 00:24:02,340 Why not? 503 00:24:02,340 --> 00:24:04,616 PROFESSOR: Well, if I have 5 choose 2, then you-- 504 00:24:04,616 --> 00:24:05,430 AUDIENCE: Oh, then that doesn't quite work. 505 00:24:05,430 --> 00:24:06,096 PROFESSOR: Yeah. 506 00:24:06,096 --> 00:24:07,820 AUDIENCE: Yeah, no. 507 00:24:07,820 --> 00:24:12,978 PROFESSOR: So flip. 508 00:24:12,978 --> 00:24:13,734 AUDIENCE: Times 2. 509 00:24:13,734 --> 00:24:14,400 PROFESSOR: Yeah. 510 00:24:14,400 --> 00:24:15,980 So you have two feet. 511 00:24:15,980 --> 00:24:17,260 Each foot, five possibilities. 512 00:24:21,520 --> 00:24:23,110 Now, what if we have weight? 513 00:24:23,110 --> 00:24:25,670 If we are tracking on where I keep my weight. 514 00:24:25,670 --> 00:24:27,275 How many possible positions? 515 00:24:31,006 --> 00:24:31,970 AUDIENCE: [INAUDIBLE]? 516 00:24:31,970 --> 00:24:34,480 Oh no, because there's only two. 517 00:24:34,480 --> 00:24:36,700 PROFESSOR: So, for each of these, 518 00:24:36,700 --> 00:24:38,470 there's two possibilities now. 519 00:24:38,470 --> 00:24:39,370 So 50. 520 00:24:39,370 --> 00:24:41,170 AUDIENCE: You also have to be so your weight is like this. 521 00:24:41,170 --> 00:24:41,880 PROFESSOR: In the middle? 522 00:24:41,880 --> 00:24:42,820 AUDIENCE: Yeah. 523 00:24:42,820 --> 00:24:44,287 PROFESSOR: You can. 524 00:24:44,287 --> 00:24:46,620 Based on that what I've been reading, you never want to. 525 00:24:46,620 --> 00:24:48,370 Because if you're weight is in the middle, 526 00:24:48,370 --> 00:24:53,229 then you're extending a lot of effort to move either foot. 527 00:24:53,229 --> 00:24:55,270 So you always want to have your weight somewhere. 528 00:24:55,270 --> 00:24:56,895 So that, at least for one of your feet, 529 00:24:56,895 --> 00:24:58,849 it's easy to move it. 530 00:24:58,849 --> 00:25:00,582 AUDIENCE: Could it be the back? 531 00:25:00,582 --> 00:25:02,290 PROFESSOR: If that's not true, then yeah. 532 00:25:02,290 --> 00:25:04,569 We'd need to have a center. 533 00:25:04,569 --> 00:25:06,610 Oh, so, like, whether I'm like this or like this? 534 00:25:06,610 --> 00:25:06,852 AUDIENCE: Yeah. 535 00:25:06,852 --> 00:25:08,554 If you were, like, doing the same thing. 536 00:25:08,554 --> 00:25:09,530 Rocking back and forth. 537 00:25:09,530 --> 00:25:10,946 PROFESSOR: So, if I have two feet, 538 00:25:10,946 --> 00:25:13,100 then this says my weight is on my left foot. 539 00:25:13,100 --> 00:25:15,070 My weight is on my right foot. 540 00:25:15,070 --> 00:25:20,070 So l and r is which foot, not where on the board. 541 00:25:20,070 --> 00:25:22,900 AUDIENCE: So, did you not do center because it was optimal? 542 00:25:22,900 --> 00:25:25,250 PROFESSOR: Because I claim that, in an optimal strategy, 543 00:25:25,250 --> 00:25:26,240 you wouldn't have it. 544 00:25:26,240 --> 00:25:28,060 But you don't have to take my word for it. 545 00:25:28,060 --> 00:25:30,060 If you don't believe me, then you add center. 546 00:25:30,060 --> 00:25:32,110 And you just have more possibilities. 547 00:25:32,110 --> 00:25:34,220 And if it happens to not be an optimal thing, 548 00:25:34,220 --> 00:25:37,260 then the dynamic programming will ignore it. 549 00:25:37,260 --> 00:25:40,860 So how many positions do I have if I add center? 550 00:25:40,860 --> 00:25:44,099 So if I have left, center, right for each position. 551 00:25:44,099 --> 00:25:44,640 AUDIENCE: 75. 552 00:25:47,140 --> 00:25:47,806 PROFESSOR: Cool. 553 00:25:50,640 --> 00:25:51,395 Yes. 554 00:25:51,395 --> 00:25:53,453 AUDIENCE: So why is it 25? 555 00:25:53,453 --> 00:25:56,945 You wouldn't actually have both of your feet on the right. 556 00:25:56,945 --> 00:25:57,570 PROFESSOR: Why? 557 00:26:00,430 --> 00:26:03,720 Maybe, well especially, for maximizing this one actually. 558 00:26:03,720 --> 00:26:06,800 Especially for maximizing entertainment. 559 00:26:06,800 --> 00:26:10,515 Then it's way cooler to do this, right? 560 00:26:10,515 --> 00:26:12,830 [LAUGHTER] 561 00:26:12,830 --> 00:26:13,580 You get the point. 562 00:26:13,580 --> 00:26:14,746 AUDIENCE: --possible weight. 563 00:26:14,746 --> 00:26:16,757 Like combinations for like, where is 564 00:26:16,757 --> 00:26:18,340 you should have your feet at one time. 565 00:26:18,340 --> 00:26:20,764 Like, not necessarily what the game is asking you to do. 566 00:26:20,764 --> 00:26:21,430 PROFESSOR: Yeah. 567 00:26:21,430 --> 00:26:25,040 So this is where my feet are. 568 00:26:25,040 --> 00:26:26,964 The game will always ask something like this. 569 00:26:26,964 --> 00:26:29,130 So the game won't always care about both of my feet. 570 00:26:29,130 --> 00:26:30,930 Sometimes it'll only care about one foot. 571 00:26:33,241 --> 00:26:33,740 So, yeah. 572 00:26:33,740 --> 00:26:35,406 There are two different concepts, right? 573 00:26:35,406 --> 00:26:37,900 There's the position of my feet. 574 00:26:37,900 --> 00:26:40,479 And then there's the note on the screen. 575 00:26:40,479 --> 00:26:42,520 And my feet have to match the note on the screen. 576 00:26:42,520 --> 00:26:45,500 And we'll have to capture that somehow. 577 00:26:45,500 --> 00:26:48,370 So what's in a state? 578 00:26:48,370 --> 00:26:50,169 What are my decisions? 579 00:26:50,169 --> 00:26:50,710 Come on, now. 580 00:26:50,710 --> 00:26:53,780 We should be in a good shape to know what my decisions are. 581 00:26:53,780 --> 00:26:54,990 What do I decide every time? 582 00:26:57,906 --> 00:27:00,034 AUDIENCE: What move to make? 583 00:27:00,034 --> 00:27:00,700 PROFESSOR: Yeah. 584 00:27:00,700 --> 00:27:01,950 How am I going to jump, right? 585 00:27:01,950 --> 00:27:05,510 Where my feet are going to be in the new position. 586 00:27:05,510 --> 00:27:12,570 So every time, I'm deciding what's the new foot position. 587 00:27:12,570 --> 00:27:14,810 AUDIENCE: Aren't you also deciding weight position, 588 00:27:14,810 --> 00:27:17,157 where you're going to hold to, right? 589 00:27:17,157 --> 00:27:17,740 PROFESSOR: OK. 590 00:27:17,740 --> 00:27:21,240 So when I say foot position, it's a cheat for everything. 591 00:27:24,380 --> 00:27:24,880 So yeah. 592 00:27:24,880 --> 00:27:27,650 Good observation. 593 00:27:27,650 --> 00:27:29,560 OK. 594 00:27:29,560 --> 00:27:33,680 What do I need to know, in order to make this decision? 595 00:27:38,030 --> 00:27:39,450 OK. 596 00:27:39,450 --> 00:27:41,450 I would need to know where I was before 597 00:27:41,450 --> 00:27:43,620 if I want to compute the difficulties. 598 00:27:43,620 --> 00:27:45,750 But aside from that-- what? 599 00:27:45,750 --> 00:27:48,540 AUDIENCE: Sir, it came up with this polynomial. 600 00:27:48,540 --> 00:27:50,450 PROFESSOR: All right. 601 00:27:50,450 --> 00:27:53,899 AUDIENCE: Is that a hint to what the run time of this will be? 602 00:27:53,899 --> 00:27:55,190 PROFESSOR: It's not on purpose. 603 00:27:55,190 --> 00:27:57,600 But yes. 604 00:27:57,600 --> 00:27:58,950 So, yeah. 605 00:27:58,950 --> 00:27:59,730 That makes sense. 606 00:27:59,730 --> 00:28:00,220 Probably not good. 607 00:28:00,220 --> 00:28:02,303 I should probably not have my screen up without me 608 00:28:02,303 --> 00:28:04,570 looking at it. 609 00:28:04,570 --> 00:28:05,510 OK, so. 610 00:28:05,510 --> 00:28:07,720 Back to decisions. 611 00:28:07,720 --> 00:28:10,530 I think I want to know what's going to be on the screen 612 00:28:10,530 --> 00:28:11,350 when I land, right? 613 00:28:11,350 --> 00:28:15,120 Because if the screen says, yo, you need to go up and down. 614 00:28:15,120 --> 00:28:17,872 Then maybe I shouldn't do this, right? 615 00:28:17,872 --> 00:28:18,830 That would not be good. 616 00:28:21,620 --> 00:28:24,460 So I need to know what the note is going to be when I land. 617 00:28:27,131 --> 00:28:27,630 Note. 618 00:28:31,318 --> 00:28:33,725 AUDIENCE: Is that the same as the next? 619 00:28:33,725 --> 00:28:34,350 PROFESSOR: Yep. 620 00:28:34,350 --> 00:28:35,360 Next note. 621 00:28:35,360 --> 00:28:36,480 Yes. 622 00:28:36,480 --> 00:28:39,050 So the next note here on the screen. 623 00:28:39,050 --> 00:28:42,880 So, my position in this list, basically. 624 00:28:42,880 --> 00:28:45,296 AUDIENCE: So it's kind of like the knapsack problem, where 625 00:28:45,296 --> 00:28:48,005 it's like which thing we're considering picking up. 626 00:28:48,005 --> 00:28:51,470 But in this case, it's coming [INAUDIBLE]. 627 00:28:51,470 --> 00:28:53,720 PROFESSOR: So it's close to knapsack. 628 00:28:53,720 --> 00:28:56,970 But the difference is, in knapsack, I 629 00:28:56,970 --> 00:29:02,680 have to decide, do I choose this or do I ignore it. 630 00:29:02,680 --> 00:29:11,779 So, if I'd be like, if I can only do a few things 631 00:29:11,779 --> 00:29:13,320 and I want to maximize my score, then 632 00:29:13,320 --> 00:29:14,870 maybe I would choose, all right. 633 00:29:14,870 --> 00:29:15,450 This is easy. 634 00:29:15,450 --> 00:29:16,241 I'm going to do it. 635 00:29:16,241 --> 00:29:16,870 This is hard. 636 00:29:16,870 --> 00:29:17,370 Screw it. 637 00:29:17,370 --> 00:29:17,860 This is easy. 638 00:29:17,860 --> 00:29:18,651 I'm going to do it. 639 00:29:18,651 --> 00:29:20,780 So then my decisions are 0, 1. 640 00:29:20,780 --> 00:29:22,610 Pick or not pick. 641 00:29:22,610 --> 00:29:24,520 In this case, every time my decision 642 00:29:24,520 --> 00:29:25,870 is a new state of my feet. 643 00:29:25,870 --> 00:29:27,046 So it's not 0, 1. 644 00:29:27,046 --> 00:29:27,860 AUDIENCE: OK. 645 00:29:27,860 --> 00:29:29,260 PROFESSOR: That's the difference. 646 00:29:29,260 --> 00:29:31,310 And then, because of that, the state 647 00:29:31,310 --> 00:29:32,570 is going to look different. 648 00:29:32,570 --> 00:29:34,520 And the recursion's will look a bit different. 649 00:29:40,740 --> 00:29:41,240 OK. 650 00:29:41,240 --> 00:29:43,710 So I want to know the note that I'm landing at. 651 00:29:43,710 --> 00:29:46,845 I want to know the sum of-- well, 652 00:29:46,845 --> 00:29:48,970 we'll see if I want to know the sum of difficulties 653 00:29:48,970 --> 00:29:50,230 up to this point. 654 00:29:50,230 --> 00:29:53,730 And I want to know one more thing, so. 655 00:29:53,730 --> 00:29:56,310 If this is going to be my new state, 656 00:29:56,310 --> 00:30:00,900 and I know what note I'm landing at, I'm making a decision. 657 00:30:00,900 --> 00:30:04,240 The decision tells me where my feet are going to be. 658 00:30:07,320 --> 00:30:07,820 Right? 659 00:30:07,820 --> 00:30:10,390 The move decides where my feet are going to be. 660 00:30:10,390 --> 00:30:12,640 What do I need to do? 661 00:30:12,640 --> 00:30:16,672 What else do I need to know for my total solution? 662 00:30:16,672 --> 00:30:19,005 So what do I need to know to consider between decisions? 663 00:30:24,500 --> 00:30:31,290 So say I'm considering the state of-- I'm at note two. 664 00:30:31,290 --> 00:30:35,750 Note two says, left right. 665 00:30:35,750 --> 00:30:38,790 And I'm considering of coming here 666 00:30:38,790 --> 00:30:44,700 from note one, where my foot position was up down. 667 00:30:44,700 --> 00:30:48,510 Or come here from note one, where 668 00:30:48,510 --> 00:30:52,270 my foot position was left right. 669 00:30:57,671 --> 00:30:59,420 I need to know where my foot position was, 670 00:30:59,420 --> 00:31:01,650 to choose between these, right? 671 00:31:01,650 --> 00:31:03,795 If I don't know that, then I can't choose. 672 00:31:03,795 --> 00:31:06,170 AUDIENCE: That's not from your state, though? 673 00:31:06,170 --> 00:31:07,115 PROFESSOR: Not yet. 674 00:31:07,115 --> 00:31:09,010 It's not here, so it's not part of my state. 675 00:31:09,010 --> 00:31:11,570 We've been talking about it a lot, but we didn't put it here. 676 00:31:11,570 --> 00:31:13,070 So let's say that the state is going 677 00:31:13,070 --> 00:31:14,640 to have the note that I'm landing at. 678 00:31:14,640 --> 00:31:18,550 And my foot position after landing. 679 00:31:28,130 --> 00:31:33,100 So, if I know that I'm going to land like this, 680 00:31:33,100 --> 00:31:35,530 then I know where I was here. l r. 681 00:31:35,530 --> 00:31:37,920 Say, l r. 682 00:31:37,920 --> 00:31:39,650 I can compute the costs here, right? 683 00:31:39,650 --> 00:31:47,010 This is delta of going from this to this. 684 00:31:47,010 --> 00:31:53,641 And this is the delta for going from this to this. 685 00:31:53,641 --> 00:31:54,540 Can you see? 686 00:31:54,540 --> 00:31:55,290 Is that too small? 687 00:31:59,600 --> 00:32:02,210 Delta wants to know where my feet were before. 688 00:32:02,210 --> 00:32:03,910 And where they're going to be now. 689 00:32:03,910 --> 00:32:06,290 So when I call it, I need to know where I was before. 690 00:32:06,290 --> 00:32:08,165 And I need to know where I'm going to be now. 691 00:32:08,165 --> 00:32:11,360 So this should be part of my state. 692 00:32:11,360 --> 00:32:15,140 So our decision says, what's my new position going to be? 693 00:32:15,140 --> 00:32:18,610 So when I make a move, I influence my new foot position. 694 00:32:18,610 --> 00:32:20,450 They're going to be in someplace. 695 00:32:20,450 --> 00:32:25,242 And independently of that, the note-- the position here-- 696 00:32:25,242 --> 00:32:27,575 the position of the note, increases all the time, right? 697 00:32:27,575 --> 00:32:28,991 Because time can only go forwards. 698 00:32:32,910 --> 00:32:35,010 How are we going to account for these extra moves? 699 00:32:38,689 --> 00:32:40,824 AUDIENCE: [INAUDIBLE]. 700 00:32:40,824 --> 00:32:42,990 PROFESSOR: So, we said that between every two notes, 701 00:32:42,990 --> 00:32:45,200 we might want to make one extra move. 702 00:32:50,840 --> 00:32:53,092 AUDIENCE: Like, a potential new note 703 00:32:53,092 --> 00:32:56,610 in between your destination note? 704 00:32:56,610 --> 00:32:57,442 PROFESSOR: Yep. 705 00:32:57,442 --> 00:33:00,385 AUDIENCE: And then just fill in the difficulties for that 706 00:33:00,385 --> 00:33:01,350 and see which ones-- 707 00:33:01,350 --> 00:33:03,850 PROFESSOR: So, if I want to use the algorithm that I already 708 00:33:03,850 --> 00:33:07,090 have, that compares my landing position to my note, 709 00:33:07,090 --> 00:33:10,470 to see whether I can go there or not, what note would 710 00:33:10,470 --> 00:33:14,670 I want to put in that intermediate note? 711 00:33:14,670 --> 00:33:18,750 So, you're basically saying that between every two notes, 712 00:33:18,750 --> 00:33:20,560 I'm going to have one more note. 713 00:33:20,560 --> 00:33:24,903 And my feet can be wherever here. 714 00:33:24,903 --> 00:33:25,444 AUDIENCE: Oh. 715 00:33:25,444 --> 00:33:28,228 I mean, you'll also have the edge originally 716 00:33:28,228 --> 00:33:30,550 connecting them. 717 00:33:30,550 --> 00:33:32,820 So, you'd have it going to the intermediate note, 718 00:33:32,820 --> 00:33:34,070 but also from the destination. 719 00:33:34,070 --> 00:33:35,763 Yeah, like that. 720 00:33:35,763 --> 00:33:38,070 You'd have to-- 721 00:33:38,070 --> 00:33:42,630 PROFESSOR: So, what note would I have here? 722 00:33:42,630 --> 00:33:44,556 AUDIENCE: It makes you go to the center. 723 00:33:44,556 --> 00:33:46,000 PROFESSOR: Do I have to be at the center? 724 00:33:46,000 --> 00:33:47,370 AUDIENCE: Well, you can be anywhere. 725 00:33:47,370 --> 00:33:48,036 PROFESSOR: Yeah. 726 00:33:48,036 --> 00:33:50,900 So I'm going to invent the blank note. 727 00:33:50,900 --> 00:33:53,360 That's a big O. That means you can do whatever you want. 728 00:33:53,360 --> 00:33:54,820 There are no constraints. 729 00:33:54,820 --> 00:33:56,800 So that is just an intermediary state. 730 00:33:56,800 --> 00:34:00,790 So then I'm going to take this input, 731 00:34:00,790 --> 00:34:03,710 and I'm going to add these blank notes here. 732 00:34:03,710 --> 00:34:05,690 And these map to adding notes in the graph. 733 00:34:11,026 --> 00:34:12,484 AUDIENCE: Well, then, when you just 734 00:34:12,484 --> 00:34:16,320 run through your difficulty function between each two notes 735 00:34:16,320 --> 00:34:20,854 and see if, for all the potential moves, which 736 00:34:20,854 --> 00:34:23,656 one minimizes that path. 737 00:34:23,656 --> 00:34:25,060 PROFESSOR: Yep. 738 00:34:25,060 --> 00:34:27,190 So basically, I'm assuming I don't need this. 739 00:34:27,190 --> 00:34:30,065 I'm assuming that. 740 00:34:30,065 --> 00:34:31,440 This is going to be where there's 741 00:34:31,440 --> 00:34:33,989 at least one choice where this is going 742 00:34:33,989 --> 00:34:37,377 to have the same cost as a direct note. 743 00:34:37,377 --> 00:34:38,960 And then I'm going to say that instead 744 00:34:38,960 --> 00:34:42,260 of having more complex shapes in the graph, 745 00:34:42,260 --> 00:34:46,138 I'm going to insert extra moves here. 746 00:34:46,138 --> 00:34:46,679 AUDIENCE: OK. 747 00:34:46,679 --> 00:34:49,053 I would think that, if you have an intermediate move that 748 00:34:49,053 --> 00:34:52,570 might be less expensive, you should, like, just 749 00:34:52,570 --> 00:34:54,411 hop to that new position than to have 750 00:34:54,411 --> 00:34:56,374 an intermediate move, right? 751 00:34:56,374 --> 00:34:57,040 PROFESSOR: Yeah. 752 00:34:57,040 --> 00:35:00,375 And I'm going to assume that either that's not the case, 753 00:35:00,375 --> 00:35:02,500 or that I can always find an intermediate move that 754 00:35:02,500 --> 00:35:05,290 makes my life better. 755 00:35:05,290 --> 00:35:06,564 AUDIENCE: Every case? 756 00:35:06,564 --> 00:35:07,230 PROFESSOR: Yeah. 757 00:35:12,786 --> 00:35:14,255 PROFESSOR: These results do work. 758 00:35:14,255 --> 00:35:16,380 You'll have to take my word for it that this works. 759 00:35:16,380 --> 00:35:18,860 And this makes your dynamic programming easy. 760 00:35:18,860 --> 00:35:21,500 And it makes your graph building easy. 761 00:35:21,500 --> 00:35:24,370 So the advantage of this is you're changing the input. 762 00:35:24,370 --> 00:35:26,160 And then, when you're building your graph 763 00:35:26,160 --> 00:35:28,000 or when you're doing the DP, you only 764 00:35:28,000 --> 00:35:30,430 worry about an input that looks like this. 765 00:35:30,430 --> 00:35:32,720 You don't care about any intermediate stuff. 766 00:35:32,720 --> 00:35:35,270 You have notes, and you have to transition between the notes. 767 00:35:35,270 --> 00:35:36,240 Period. 768 00:35:36,240 --> 00:35:39,365 So we reduce the complexity of the problem. 769 00:35:39,365 --> 00:35:41,740 So whenever you can get away with that, it's really nice. 770 00:35:41,740 --> 00:35:43,970 We can do that for centering. 771 00:35:43,970 --> 00:35:46,530 We might not be able to do it for other more complicated 772 00:35:46,530 --> 00:35:47,029 stuff. 773 00:35:50,360 --> 00:35:52,990 OK. 774 00:35:52,990 --> 00:35:57,730 So, we sort of know what we want in a state. 775 00:35:57,730 --> 00:36:00,950 Now we want to build a graph, so that the path 776 00:36:00,950 --> 00:36:05,140 from some source to some destination 777 00:36:05,140 --> 00:36:10,970 has a cost that's equivalent to the sum of these difficulties. 778 00:36:10,970 --> 00:36:11,470 Right? 779 00:36:11,470 --> 00:36:13,220 Because then I can run the shortest path. 780 00:36:13,220 --> 00:36:17,330 And my solution will be right there. 781 00:36:17,330 --> 00:36:17,830 I know. 782 00:36:17,830 --> 00:36:18,950 You guys seem awfully sad. 783 00:36:18,950 --> 00:36:21,970 Do you want to take a break and play for a little bit more? 784 00:36:21,970 --> 00:36:24,790 Yes? 785 00:36:24,790 --> 00:36:28,797 How many people want to play, instead of. 786 00:36:28,797 --> 00:36:30,130 You don't have to play yourself. 787 00:36:30,130 --> 00:36:32,720 You can just rest for these two or three minutes. 788 00:36:32,720 --> 00:36:34,220 And you can watch someone else play. 789 00:36:34,220 --> 00:36:37,311 And get more intuition about how you're supposed to play. 790 00:36:39,741 --> 00:36:40,240 OK. 791 00:36:40,240 --> 00:36:41,820 So one person wants to take a break. 792 00:36:41,820 --> 00:36:43,110 Everyone else wants to keep going? 793 00:36:43,110 --> 00:36:44,440 Or are you guys passed out already? 794 00:36:44,440 --> 00:36:45,731 AUDIENCE: Can we get out early? 795 00:36:48,370 --> 00:36:49,920 PROFESSOR: Sort of. 796 00:36:49,920 --> 00:36:50,420 Yeah. 797 00:36:50,420 --> 00:36:51,878 You'll get out three minutes early, 798 00:36:51,878 --> 00:36:55,410 if we don't do another round. 799 00:36:55,410 --> 00:36:57,933 So who wants to keep going? 800 00:36:57,933 --> 00:36:58,474 AUDIENCE: No. 801 00:36:58,474 --> 00:37:01,057 Let's play. 802 00:37:01,057 --> 00:37:01,640 PROFESSOR: OK. 803 00:37:01,640 --> 00:37:02,765 So who wants to keep going? 804 00:37:02,765 --> 00:37:04,241 You can only vote on one thing. 805 00:37:04,241 --> 00:37:04,990 Who wants to play? 806 00:37:08,297 --> 00:37:08,838 AUDIENCE: OK. 807 00:37:08,838 --> 00:37:09,463 AUDIENCE: Five. 808 00:37:09,463 --> 00:37:10,960 AUDIENCE: Four. 809 00:37:10,960 --> 00:37:12,100 AUDIENCE: Victor, go. 810 00:37:12,100 --> 00:37:13,050 PROFESSOR: OK. 811 00:37:13,050 --> 00:37:15,680 Who wants to go? 812 00:37:15,680 --> 00:37:18,330 So we decided what we're going to have in notes. 813 00:37:18,330 --> 00:37:20,730 And we're going to build a graph, where 814 00:37:20,730 --> 00:37:22,200 the notes are the states. 815 00:37:22,200 --> 00:37:23,830 And the edges are the moves. 816 00:37:23,830 --> 00:37:25,630 Right? 817 00:37:25,630 --> 00:37:29,300 So a note tells me, just like there, what note I'm at. 818 00:37:29,300 --> 00:37:31,440 Say I'm at note two. 819 00:37:31,440 --> 00:37:34,440 And where my feet are on. 820 00:37:34,440 --> 00:37:35,320 So, left foot left. 821 00:37:35,320 --> 00:37:36,290 Right foot right. 822 00:37:38,820 --> 00:37:42,270 So, given a state, what outgoing edges do I build? 823 00:37:42,270 --> 00:37:43,950 Where can I go to? 824 00:37:43,950 --> 00:37:47,480 So let's say I have a state that says I'm at note n 825 00:37:47,480 --> 00:37:49,320 and my left foot is in some position. 826 00:37:49,320 --> 00:37:53,000 My right foot is in some position. 827 00:37:53,000 --> 00:37:55,656 What are my outgoing edges from here? 828 00:37:55,656 --> 00:37:58,340 AUDIENCE: Is there an outgoing edge to every move? 829 00:37:58,340 --> 00:37:59,497 Because there's a point. 830 00:37:59,497 --> 00:38:00,080 PROFESSOR: OK. 831 00:38:03,869 --> 00:38:05,660 Well, actually, the blank is a note, right? 832 00:38:05,660 --> 00:38:09,750 So if the next note, if note three's a blank, 833 00:38:09,750 --> 00:38:11,610 then the note is a blank. 834 00:38:11,610 --> 00:38:13,464 And then I can have. 835 00:38:13,464 --> 00:38:16,470 AUDIENCE: I guess, isn't the difficulty 836 00:38:16,470 --> 00:38:21,585 of the move dependent on what note that blank actually is? 837 00:38:21,585 --> 00:38:23,960 PROFESSOR: So, it doesn't depend on what the screen says. 838 00:38:23,960 --> 00:38:27,232 It depends on where my feet are. 839 00:38:27,232 --> 00:38:27,940 AUDIENCE: Oh, OK. 840 00:38:27,940 --> 00:38:28,464 I see. 841 00:38:28,464 --> 00:38:29,880 PROFESSOR: So I have a number that 842 00:38:29,880 --> 00:38:31,690 tells me what's on my screen. 843 00:38:31,690 --> 00:38:33,980 This number is enough for me to know 844 00:38:33,980 --> 00:38:36,610 what's going to be on my screen from now on until forever. 845 00:38:36,610 --> 00:38:39,080 Because I have the list ahead of time. 846 00:38:39,080 --> 00:38:41,010 And then I have the position of my feet. 847 00:38:41,010 --> 00:38:43,300 So these are both part of the state. 848 00:38:43,300 --> 00:38:45,310 So I have notes for all the notes. 849 00:38:45,310 --> 00:38:47,470 And all the positions of the feet. 850 00:38:47,470 --> 00:38:49,270 AUDIENCE: Right. 851 00:38:49,270 --> 00:38:55,240 But the blank note is just one position of feet? 852 00:38:55,240 --> 00:38:56,010 PROFESSOR: No. 853 00:38:56,010 --> 00:38:57,120 AUDIENCE: Or, it's all positions. 854 00:38:57,120 --> 00:38:57,320 PROFESSOR: Yeah. 855 00:38:57,320 --> 00:38:59,124 AUDIENCE: Isn't the difficulty dependent 856 00:38:59,124 --> 00:39:01,014 on what position your feet end up? 857 00:39:01,014 --> 00:39:01,680 PROFESSOR: Yeah. 858 00:39:01,680 --> 00:39:03,690 So it's from where I start to where I land. 859 00:39:03,690 --> 00:39:14,030 So, if I decide to start from here, and go here, 860 00:39:14,030 --> 00:39:18,080 the difficulty of this move is-- so it doesn't depend on 861 00:39:18,080 --> 00:39:20,520 whether I have a blank there. 862 00:39:20,520 --> 00:39:21,450 And this was OK. 863 00:39:21,450 --> 00:39:24,320 Or, if I had an up down, then I just missed the note. 864 00:39:24,320 --> 00:39:27,120 But the difficulty, the effort I'm expending, is the same. 865 00:39:27,120 --> 00:39:28,120 AUDIENCE: OK. 866 00:39:28,120 --> 00:39:31,120 But if you start from that other move and go to a different 867 00:39:31,120 --> 00:39:32,150 position, that's-- 868 00:39:32,150 --> 00:39:34,060 PROFESSOR: If I go from this to this, 869 00:39:34,060 --> 00:39:35,747 then that's a different difficulty. 870 00:39:35,747 --> 00:39:38,609 AUDIENCE: But it still could be a blank note? 871 00:39:38,609 --> 00:39:39,570 PROFESSOR: Yeah. 872 00:39:39,570 --> 00:39:42,025 So, a blank note will let me go wherever I want. 873 00:39:42,025 --> 00:39:43,630 AUDIENCE: I see. 874 00:39:43,630 --> 00:39:49,098 But there are different kinds of blank notes, with different-- 875 00:39:49,098 --> 00:39:50,717 I guess I'm confused as to what-- 876 00:39:50,717 --> 00:39:51,300 PROFESSOR: OK. 877 00:39:51,300 --> 00:39:52,591 So let's go through them again. 878 00:39:52,591 --> 00:39:55,200 AUDIENCE: Is it kind of like it's, like, spreading, 879 00:39:55,200 --> 00:39:58,860 so really when you have your source note, 880 00:39:58,860 --> 00:40:02,660 it's actually connecting to every possible move. 881 00:40:02,660 --> 00:40:05,080 And every possible move is connecting to your next-- 882 00:40:05,080 --> 00:40:06,913 so it's kind of like a diamond shaped thing? 883 00:40:08,685 --> 00:40:09,560 PROFESSOR: Not quite. 884 00:40:09,560 --> 00:40:10,430 Not quite. 885 00:40:10,430 --> 00:40:12,220 So, let's go through the notes again. 886 00:40:12,220 --> 00:40:13,730 And then let's go through that. 887 00:40:13,730 --> 00:40:16,030 So the source move will be connected to some notes. 888 00:40:16,030 --> 00:40:18,280 And then those notes will be connected to other notes. 889 00:40:18,280 --> 00:40:21,490 And it looks more like you have a big, outgoing degree. 890 00:40:21,490 --> 00:40:22,836 Then you have a big network. 891 00:40:22,836 --> 00:40:24,085 Then the big, incoming degree. 892 00:40:24,085 --> 00:40:27,082 It looks like a messed up sorting network. 893 00:40:27,082 --> 00:40:28,165 So, notes are constraints. 894 00:40:31,050 --> 00:40:34,230 This accepts any possible feet combination, right? 895 00:40:34,230 --> 00:40:38,830 So this accepts this. 896 00:40:38,830 --> 00:40:40,312 AUDIENCE: Is the first combination 897 00:40:40,312 --> 00:40:42,782 contained in that note? 898 00:40:42,782 --> 00:40:43,607 In that blank note? 899 00:40:43,607 --> 00:40:44,190 PROFESSOR: No. 900 00:40:44,190 --> 00:40:45,273 The blank is a constraint. 901 00:40:47,600 --> 00:40:51,170 So, if I have a note that looks like this, then 902 00:40:51,170 --> 00:40:54,590 if one of my feet is here and the other one is in the center, 903 00:40:54,590 --> 00:40:55,750 then that's fine. 904 00:40:55,750 --> 00:40:57,517 The constraint is met. 905 00:40:57,517 --> 00:40:59,600 If one of my feet is up and the other one is down, 906 00:40:59,600 --> 00:41:02,110 then the constraint is met. 907 00:41:02,110 --> 00:41:04,652 AUDIENCE: But the edge running into that blank note, 908 00:41:04,652 --> 00:41:09,976 depending on how your feet land, is different difficulty. 909 00:41:09,976 --> 00:41:10,944 Is that right? 910 00:41:10,944 --> 00:41:12,410 PROFESSOR: Yep. 911 00:41:12,410 --> 00:41:13,980 But when I compute the edge width, 912 00:41:13,980 --> 00:41:16,590 I need to know where I'm landing exactly. 913 00:41:16,590 --> 00:41:18,770 Not just where the note is because the note might 914 00:41:18,770 --> 00:41:20,250 admit multiple positions. 915 00:41:20,250 --> 00:41:21,077 AUDIENCE: I see. 916 00:41:21,077 --> 00:41:22,910 PROFESSOR: So this guy admits all positions. 917 00:41:22,910 --> 00:41:23,940 AUDIENCE: OK. 918 00:41:23,940 --> 00:41:26,050 PROFESSOR: This guy admits some positions, right? 919 00:41:26,050 --> 00:41:28,140 These are l r, l r. 920 00:41:28,140 --> 00:41:33,150 If I have up down, how many feet positions does it admit? 921 00:41:33,150 --> 00:41:34,115 AUDIENCE: Just one. 922 00:41:34,115 --> 00:41:34,990 PROFESSOR: Not great. 923 00:41:34,990 --> 00:41:36,830 AUDIENCE: No. 924 00:41:36,830 --> 00:41:38,910 PROFESSOR: How many? 925 00:41:38,910 --> 00:41:41,444 AUDIENCE: As an intermediate? 926 00:41:41,444 --> 00:41:43,610 PROFESSOR: If it's up down, then it's on the screen. 927 00:41:43,610 --> 00:41:44,901 My intermediates are all blank. 928 00:41:44,901 --> 00:41:45,654 AUDIENCE: Oh, oh. 929 00:41:45,654 --> 00:41:47,844 I thought you were saying start with that. 930 00:41:47,844 --> 00:41:48,760 PROFESSOR: So up down. 931 00:41:48,760 --> 00:41:50,135 If you see up down on the screen, 932 00:41:50,135 --> 00:41:51,360 how many feet positions? 933 00:41:51,360 --> 00:41:52,640 AUDIENCE: Left to right what it could have. 934 00:41:52,640 --> 00:41:53,420 PROFESSOR: Yep. 935 00:41:53,420 --> 00:41:56,210 So, if the screen says up down, the only two ways 936 00:41:56,210 --> 00:41:58,740 I can do that is this. 937 00:41:58,740 --> 00:41:59,440 Or this. 938 00:41:59,440 --> 00:41:59,940 Right? 939 00:41:59,940 --> 00:42:00,555 So, two positions. 940 00:42:00,555 --> 00:42:01,346 AUDIENCE: I see. 941 00:42:01,346 --> 00:42:03,637 AUDIENCE: Well, I mean, but you could have intermediate 942 00:42:03,637 --> 00:42:05,850 where you step in the first one, then back. 943 00:42:05,850 --> 00:42:07,890 PROFESSOR: But I don't care because I've 944 00:42:07,890 --> 00:42:09,120 added these blank notes. 945 00:42:09,120 --> 00:42:11,200 And they take care of my intermediates for me. 946 00:42:11,200 --> 00:42:12,700 AUDIENCE: But so, we're saying where 947 00:42:12,700 --> 00:42:17,804 the feet land aren't part of the note. 948 00:42:17,804 --> 00:42:18,470 PROFESSOR: Nope. 949 00:42:18,470 --> 00:42:19,640 They're just states. 950 00:42:19,640 --> 00:42:22,290 So they're a decision I'm making. 951 00:42:22,290 --> 00:42:24,816 AUDIENCE: So, do we have the multiple-- no, 952 00:42:24,816 --> 00:42:28,500 we don't because they're not part of the-- 953 00:42:34,760 --> 00:42:37,620 PROFESSOR: For each note position here, 954 00:42:37,620 --> 00:42:40,960 for every position in the screen thing, 955 00:42:40,960 --> 00:42:45,540 I have multiple feet positions that I could be in. 956 00:42:45,540 --> 00:42:46,363 AUDIENCE: Right. 957 00:42:46,363 --> 00:42:46,863 Right. 958 00:42:46,863 --> 00:42:50,895 But then, are there multiple moves to get to those? 959 00:42:50,895 --> 00:42:51,520 PROFESSOR: Yep. 960 00:42:51,520 --> 00:42:52,061 AUDIENCE: OK. 961 00:42:52,061 --> 00:42:54,640 So there's multiple moves connecting each. 962 00:42:54,640 --> 00:42:55,950 PROFESSOR: Yeah. 963 00:42:55,950 --> 00:43:04,230 So for example, if I want to get to l r, up down here, 964 00:43:04,230 --> 00:43:09,360 I can go from l r, up down in the blank. 965 00:43:09,360 --> 00:43:12,760 Or, I could have l r be like this. 966 00:43:12,760 --> 00:43:16,040 And then transition. 967 00:43:16,040 --> 00:43:20,450 So I can have a lot of possible foot positions 968 00:43:20,450 --> 00:43:24,970 that I'm transitioning from in order to get here. 969 00:43:24,970 --> 00:43:27,640 AUDIENCE: But those aren't actually 970 00:43:27,640 --> 00:43:29,837 separate notes on the graph. 971 00:43:29,837 --> 00:43:30,670 PROFESSOR: They are. 972 00:43:30,670 --> 00:43:33,620 They have to be. 973 00:43:33,620 --> 00:43:36,260 So these all have to be separate notes. 974 00:43:36,260 --> 00:43:38,600 Because the edges are going to have separate weights. 975 00:43:38,600 --> 00:43:39,100 Right? 976 00:43:39,100 --> 00:43:40,680 This edge is going to have one weight. 977 00:43:40,680 --> 00:43:42,160 This edge is going to have another weight. 978 00:43:42,160 --> 00:43:42,820 AUDIENCE: OK. 979 00:43:42,820 --> 00:43:43,736 That's what I thought. 980 00:43:43,736 --> 00:43:45,680 But then you said there was only one blank. 981 00:43:51,999 --> 00:43:54,912 Don't there have to be multiple blank notes for every foot 982 00:43:54,912 --> 00:43:55,610 thing. 983 00:43:55,610 --> 00:43:57,485 If you're approaching a note from different-- 984 00:44:00,110 --> 00:44:04,840 PROFESSOR: So, I'm not sure what you're asking. 985 00:44:04,840 --> 00:44:06,796 So, if you want to care about centering, 986 00:44:06,796 --> 00:44:08,420 if you want to have intermediate moves, 987 00:44:08,420 --> 00:44:12,060 you need one blank note between every real note. 988 00:44:12,060 --> 00:44:16,122 So that you're allowed to make one intermediate move between. 989 00:44:16,122 --> 00:44:16,788 AUDIENCE: Right. 990 00:44:16,788 --> 00:44:21,184 I get that that's talking about the on the screen. 991 00:44:21,184 --> 00:44:21,850 PROFESSOR: Yeah. 992 00:44:21,850 --> 00:44:22,520 That's the screen. 993 00:44:22,520 --> 00:44:23,180 AUDIENCE: That's the screen. 994 00:44:23,180 --> 00:44:23,805 PROFESSOR: Yep. 995 00:44:23,805 --> 00:44:24,430 AUDIENCE: OK. 996 00:44:24,430 --> 00:44:26,350 So, that's not the graph, though. 997 00:44:26,350 --> 00:44:28,760 Here, we're talking about the screen on the graph. 998 00:44:28,760 --> 00:44:30,780 PROFESSOR: Here, we're talking about the graph. 999 00:44:30,780 --> 00:44:34,540 So two tells me that the screen is at note two. 1000 00:44:34,540 --> 00:44:36,370 Whatever that happens to be. 1001 00:44:36,370 --> 00:44:37,760 And my feet are in this position. 1002 00:44:40,200 --> 00:44:40,700 OK. 1003 00:44:40,700 --> 00:44:42,450 So that's very important. 1004 00:44:42,450 --> 00:44:44,560 Thanks for asking because that's very important. 1005 00:44:44,560 --> 00:44:47,350 So, a state has the note that I'm landing at. 1006 00:44:47,350 --> 00:44:48,650 So, where the screen is. 1007 00:44:48,650 --> 00:44:50,185 And where my feet are. 1008 00:44:50,185 --> 00:44:51,497 AUDIENCE: OK. 1009 00:44:51,497 --> 00:44:52,080 PROFESSOR: OK. 1010 00:44:52,080 --> 00:44:54,270 AUDIENCE: The state corresponds to the nodes that you're on. 1011 00:44:54,270 --> 00:44:55,020 PROFESSOR: A note. 1012 00:44:55,020 --> 00:44:56,940 A note is a state. 1013 00:44:56,940 --> 00:44:58,230 So, a note is a state. 1014 00:44:58,230 --> 00:45:01,071 And a move goes between two states. 1015 00:45:01,071 --> 00:45:03,070 This is how we represent all the graph problems. 1016 00:45:05,880 --> 00:45:08,050 OK. 1017 00:45:08,050 --> 00:45:10,834 AUDIENCE: So, you need multiple blank. 1018 00:45:10,834 --> 00:45:11,500 PROFESSOR: Yeah. 1019 00:45:11,500 --> 00:45:13,390 So here, I'm just drawing one example. 1020 00:45:13,390 --> 00:45:14,010 Yeah. 1021 00:45:14,010 --> 00:45:14,240 Yeah. 1022 00:45:14,240 --> 00:45:16,000 So for example, here I would need-- sorry. 1023 00:45:16,000 --> 00:45:16,589 Oh, OK. 1024 00:45:16,589 --> 00:45:17,630 I get your confusion now. 1025 00:45:17,630 --> 00:45:18,129 So, yeah. 1026 00:45:18,129 --> 00:45:20,930 This would be one move. 1027 00:45:20,930 --> 00:45:24,210 This would be another move. 1028 00:45:24,210 --> 00:45:26,796 AUDIENCE: That's all for a single thing on the screen. 1029 00:45:26,796 --> 00:45:27,420 PROFESSOR: Yep. 1030 00:45:27,420 --> 00:45:28,286 AUDIENCE: OK. 1031 00:45:28,286 --> 00:45:28,785 OK. 1032 00:45:28,785 --> 00:45:29,695 That makes sense. 1033 00:45:29,695 --> 00:45:32,028 AUDIENCE: So the next note would have a really large end 1034 00:45:32,028 --> 00:45:32,840 degree, right? 1035 00:45:32,840 --> 00:45:33,540 I guess they always have-- 1036 00:45:33,540 --> 00:45:34,100 AUDIENCE: Well, no. 1037 00:45:34,100 --> 00:45:34,800 It'd have lots of-- 1038 00:45:34,800 --> 00:45:36,385 PROFESSOR: So, this note has a huge out degree. 1039 00:45:36,385 --> 00:45:37,010 AUDIENCE: Yeah. 1040 00:45:37,010 --> 00:45:40,237 But I'm saying the ones that all those intermediates connect to. 1041 00:45:40,237 --> 00:45:40,903 PROFESSOR: Yeah. 1042 00:45:40,903 --> 00:45:42,030 AUDIENCE: So, then, they would connect 1043 00:45:42,030 --> 00:45:43,801 with some note that have, like, really large degree. 1044 00:45:43,801 --> 00:45:44,284 PROFESSOR: Yep. 1045 00:45:44,284 --> 00:45:46,450 AUDIENCE: But there's two of them after that, right? 1046 00:45:46,450 --> 00:45:48,295 Because there would be two different-- 1047 00:45:48,295 --> 00:45:49,420 PROFESSOR: So, what's next? 1048 00:45:49,420 --> 00:45:52,830 Next, is position, hmm. 1049 00:45:52,830 --> 00:45:54,210 How did U number them? 1050 00:45:54,210 --> 00:45:57,452 I guess, crap. 1051 00:46:03,111 --> 00:46:03,610 No. 1052 00:46:03,610 --> 00:46:05,080 It's not going to match that, so. 1053 00:46:05,080 --> 00:46:08,450 Whatever we do, it's not going to match that. 1054 00:46:08,450 --> 00:46:13,370 Say the next note, 4, is just an up. 1055 00:46:18,930 --> 00:46:19,890 4 is up down. 1056 00:46:19,890 --> 00:46:21,880 And then I have two notes for it, right? 1057 00:46:21,880 --> 00:46:22,800 Wild One note, l r. 1058 00:46:26,130 --> 00:46:27,830 So this is note 4. 1059 00:46:27,830 --> 00:46:29,060 That happens to be up down. 1060 00:46:29,060 --> 00:46:32,270 And then I have this. 1061 00:46:32,270 --> 00:46:40,767 And every one of these connects to every one of these. 1062 00:46:40,767 --> 00:46:42,350 AUDIENCE: If the next move is up down, 1063 00:46:42,350 --> 00:46:43,561 how can notes have down up? 1064 00:46:43,561 --> 00:46:45,060 Oh, because you can switch the feet. 1065 00:46:45,060 --> 00:46:45,556 PROFESSOR: Yep. 1066 00:46:45,556 --> 00:46:46,097 AUDIENCE: Oh. 1067 00:46:48,524 --> 00:46:49,190 PROFESSOR: Yeah. 1068 00:46:49,190 --> 00:46:51,773 So, I aimed to ask you guys, how am I going to draw the edges? 1069 00:46:51,773 --> 00:46:54,490 But you guys made me do it with questions. 1070 00:46:54,490 --> 00:46:57,040 So, suppose I met note n, l, r. 1071 00:46:57,040 --> 00:46:59,760 What edges do I draw going out of it? 1072 00:46:59,760 --> 00:47:01,914 So, note n, left foot at some position. 1073 00:47:01,914 --> 00:47:03,080 Right foot at some position. 1074 00:47:03,080 --> 00:47:04,420 What are my outgoing edges? 1075 00:47:07,476 --> 00:47:09,100 AUDIENCE: This is a note on the screen. 1076 00:47:09,100 --> 00:47:09,620 Or-- 1077 00:47:09,620 --> 00:47:09,860 PROFESSOR: In the graph. 1078 00:47:09,860 --> 00:47:11,693 AUDIENCE: --the new one or intermediate one? 1079 00:47:11,693 --> 00:47:12,850 PROFESSOR: Doesn't matter. 1080 00:47:12,850 --> 00:47:15,106 So, intermediate notes have a note blank. 1081 00:47:15,106 --> 00:47:16,480 AUDIENCE: That's just everything. 1082 00:47:16,480 --> 00:47:17,688 PROFESSOR: It doesn't matter. 1083 00:47:17,688 --> 00:47:20,720 Yeah, we're looking at all of them at the same time. 1084 00:47:20,720 --> 00:47:23,170 AUDIENCE: Wait, so you're asking what are-- 1085 00:47:23,170 --> 00:47:26,320 PROFESSOR: So, given this note, who am I connecting it to? 1086 00:47:26,320 --> 00:47:28,510 Let's draw the outgoing edges. 1087 00:47:28,510 --> 00:47:30,960 So, if you're solving this as a graph problem, 1088 00:47:30,960 --> 00:47:31,860 you build the notes. 1089 00:47:31,860 --> 00:47:32,990 You draw the edges. 1090 00:47:32,990 --> 00:47:34,471 You're on some algorithm. 1091 00:47:34,471 --> 00:47:35,470 So let's draw the edges. 1092 00:47:38,023 --> 00:47:40,481 AUDIENCE: I think it depends if you're an intermediate note 1093 00:47:40,481 --> 00:47:41,780 or not. 1094 00:47:41,780 --> 00:47:42,600 PROFESSOR: Nope. 1095 00:47:42,600 --> 00:47:45,190 So the note tells you what your constraints are. 1096 00:47:45,190 --> 00:47:48,830 And that covers intermediate notes. 1097 00:47:48,830 --> 00:47:52,099 If you're note is a blank, then, well, there's no constraints. 1098 00:47:52,099 --> 00:47:54,390 If the note is not a blank, then there are constraints. 1099 00:47:54,390 --> 00:47:54,639 AUDIENCE: Oh, note. 1100 00:47:54,639 --> 00:47:56,830 I thought that was referring to the note, not the-- 1101 00:47:56,830 --> 00:47:57,413 PROFESSOR: No. 1102 00:47:57,413 --> 00:47:58,860 So this is a note. 1103 00:47:58,860 --> 00:48:00,400 Maybe n is not good. 1104 00:48:00,400 --> 00:48:03,702 Let's use i, instead, then. 1105 00:48:03,702 --> 00:48:04,890 If n is hard. 1106 00:48:04,890 --> 00:48:08,647 So, i is the position here, in this guy. 1107 00:48:08,647 --> 00:48:09,146 Right? 1108 00:48:12,340 --> 00:48:14,015 Say for example, i equals 1 here. 1109 00:48:14,015 --> 00:48:15,090 I equals 2 here. 1110 00:48:15,090 --> 00:48:15,760 I equals 3 here. 1111 00:48:15,760 --> 00:48:17,270 So and so forth. 1112 00:48:17,270 --> 00:48:19,673 And that doesn't match this, so. 1113 00:48:19,673 --> 00:48:21,172 AUDIENCE: We're talking about note-- 1114 00:48:21,172 --> 00:48:21,797 PROFESSOR: Yep. 1115 00:48:21,797 --> 00:48:23,570 AUDIENCE: --not-- 1116 00:48:23,570 --> 00:48:25,260 PROFESSOR: If one note is represented 1117 00:48:25,260 --> 00:48:26,510 by these three numbers, right? 1118 00:48:26,510 --> 00:48:27,825 Each note has this tuple in it. 1119 00:48:27,825 --> 00:48:29,495 AUDIENCE: Then i is the note. 1120 00:48:29,495 --> 00:48:30,120 PROFESSOR: Yep. 1121 00:48:30,120 --> 00:48:32,028 AUDIENCE: So i connects to i plus 1. 1122 00:48:32,028 --> 00:48:34,097 And then all possibilities known. 1123 00:48:34,097 --> 00:48:34,680 PROFESSOR: OK. 1124 00:48:34,680 --> 00:48:36,610 So this connects to i plus 1. 1125 00:48:36,610 --> 00:48:40,880 And then all possible destinations, right? 1126 00:48:40,880 --> 00:48:44,380 So I'm going to say left. 1127 00:48:44,380 --> 00:48:45,360 This is after the jump. 1128 00:48:45,360 --> 00:48:48,630 So, left after the jump, and right after the jump. 1129 00:48:48,630 --> 00:48:54,340 And this is for all possible left after a jump, 1130 00:48:54,340 --> 00:48:55,710 right after the jump. 1131 00:48:55,710 --> 00:49:02,780 And lost a weight on this edge. 1132 00:49:02,780 --> 00:49:05,940 AUDIENCE: The way that it's from-- 1133 00:49:05,940 --> 00:49:06,728 AUDIENCE: l r to 1134 00:49:06,728 --> 00:49:08,997 AUDIENCE: --l r to l r. 1135 00:49:08,997 --> 00:49:10,080 AUDIENCE: l j-- l sub j r. 1136 00:49:10,080 --> 00:49:11,770 AUDIENCE: l r. 1137 00:49:11,770 --> 00:49:16,850 PROFESSOR: So you want to say from l r to l j, r j. 1138 00:49:16,850 --> 00:49:18,855 But what? 1139 00:49:18,855 --> 00:49:19,980 AUDIENCE: Difficulty level? 1140 00:49:19,980 --> 00:49:20,646 PROFESSOR: Yeah. 1141 00:49:20,646 --> 00:49:21,922 Where is that? 1142 00:49:21,922 --> 00:49:23,380 AUDIENCE: Your difficulty function. 1143 00:49:23,380 --> 00:49:24,424 PROFESSOR: Which is? 1144 00:49:24,424 --> 00:49:25,090 AUDIENCE: Delta. 1145 00:49:25,090 --> 00:49:27,350 PROFESSOR: Delta. 1146 00:49:27,350 --> 00:49:27,850 So, yeah. 1147 00:49:27,850 --> 00:49:29,710 The weight is delta. 1148 00:49:29,710 --> 00:49:31,220 I drew d. 1149 00:49:31,220 --> 00:49:36,880 Delta of these two foot positions. 1150 00:49:36,880 --> 00:49:37,660 Almost. 1151 00:49:37,660 --> 00:49:42,260 If I want to minimize the difficulty, then this is right. 1152 00:49:42,260 --> 00:49:44,040 If I want to maximize a score, then I 1153 00:49:44,040 --> 00:49:47,404 would have to add a minus sign. 1154 00:49:47,404 --> 00:49:49,070 But if you're minimizing the difficulty, 1155 00:49:49,070 --> 00:49:51,520 this is exactly the way because it maps the shortest path. 1156 00:49:51,520 --> 00:49:55,302 Usually, in dynamic programming, things are maximized. 1157 00:49:55,302 --> 00:49:57,586 AUDIENCE: Wait, why would you add a minus if it's-- 1158 00:49:57,586 --> 00:49:59,460 PROFESSOR: So, if we're maximizing something, 1159 00:49:59,460 --> 00:50:02,165 we have to flip-- we have to add a minus to the edge costs 1160 00:50:02,165 --> 00:50:02,665 because-- 1161 00:50:02,665 --> 00:50:03,520 AUDIENCE: Right. 1162 00:50:03,520 --> 00:50:03,700 PROFESSOR: Yeah. 1163 00:50:03,700 --> 00:50:05,590 But this time we're minimizing something. 1164 00:50:05,590 --> 00:50:05,802 AUDIENCE: Oh. 1165 00:50:05,802 --> 00:50:06,580 Right, right, right. 1166 00:50:06,580 --> 00:50:08,260 PROFESSOR: I promised you that we'll maximize something 1167 00:50:08,260 --> 00:50:08,730 all the time. 1168 00:50:08,730 --> 00:50:09,630 Well, I guess I lied. 1169 00:50:09,630 --> 00:50:10,084 AUDIENCE: OK. 1170 00:50:10,084 --> 00:50:10,538 Right, right, right. 1171 00:50:10,538 --> 00:50:12,162 AUDIENCE: You don't want to maximize d. 1172 00:50:12,162 --> 00:50:13,720 Then you're dead. 1173 00:50:13,720 --> 00:50:14,439 PROFESSOR: No. 1174 00:50:14,439 --> 00:50:15,730 You want to maximize show offs. 1175 00:50:15,730 --> 00:50:17,090 So if we have the entertainment thing, 1176 00:50:17,090 --> 00:50:18,210 then that would be maximized. 1177 00:50:18,210 --> 00:50:19,290 And then you'd have minus. 1178 00:50:19,290 --> 00:50:20,136 AUDIENCE: Then you'd have everything you need. 1179 00:50:20,136 --> 00:50:20,761 PROFESSOR: Yep. 1180 00:50:20,761 --> 00:50:21,611 AUDIENCE: OK. 1181 00:50:21,611 --> 00:50:23,110 PROFESSOR: OK, so we're almost good. 1182 00:50:23,110 --> 00:50:26,630 Source notes and destination notes. 1183 00:50:26,630 --> 00:50:28,046 AUDIENCE: Well, I guess source, we 1184 00:50:28,046 --> 00:50:30,142 know that means start in the middle. 1185 00:50:30,142 --> 00:50:30,642 Right? 1186 00:50:30,642 --> 00:50:33,720 Like, you would start off with-- 1187 00:50:33,720 --> 00:50:35,329 PROFESSOR: What's the source? 1188 00:50:35,329 --> 00:50:37,120 You want to start at the first note, right? 1189 00:50:37,120 --> 00:50:38,510 AUDIENCE: Yeah. 1190 00:50:38,510 --> 00:50:40,581 PROFESSOR: But in which position? 1191 00:50:40,581 --> 00:50:42,265 AUDIENCE: Well, in the center, right? 1192 00:50:42,265 --> 00:50:43,988 I mean, the [INAUDIBLE] start. 1193 00:50:43,988 --> 00:50:45,196 Or, I guess you could start-- 1194 00:50:45,196 --> 00:50:47,699 AUDIENCE: Wherever you want. 1195 00:50:47,699 --> 00:50:49,240 AUDIENCE: Could you add a source note 1196 00:50:49,240 --> 00:50:51,060 going to a bunch of intermediate notes? 1197 00:50:51,060 --> 00:50:52,180 PROFESSOR: Yeah. 1198 00:50:52,180 --> 00:50:52,680 Yeah. 1199 00:50:52,680 --> 00:50:56,510 So what I'm going to do is I'm going to say there is a note 0. 1200 00:50:56,510 --> 00:50:59,475 That let's me choose how I'm going to start. 1201 00:50:59,475 --> 00:51:01,100 AUDIENCE: Oh, it could be any position. 1202 00:51:01,100 --> 00:51:02,890 It's like an intermediate note itself. 1203 00:51:02,890 --> 00:51:03,515 PROFESSOR: Yep. 1204 00:51:06,180 --> 00:51:09,690 So I'm going to have a note 0, with all possible foot 1205 00:51:09,690 --> 00:51:11,760 positions. 1206 00:51:11,760 --> 00:51:15,540 And then this is going to be connected to a source, 1207 00:51:15,540 --> 00:51:18,087 by edges of weight 0. 1208 00:51:18,087 --> 00:51:20,670 So the intuition is that I get to choose my starting position, 1209 00:51:20,670 --> 00:51:21,710 right? 1210 00:51:21,710 --> 00:51:23,360 Starting position. 1211 00:51:23,360 --> 00:51:24,440 I see the first note. 1212 00:51:24,440 --> 00:51:26,020 I make a move. 1213 00:51:26,020 --> 00:51:28,280 So I want to be able to choose the starting position. 1214 00:51:28,280 --> 00:51:29,820 That's why I have all those notes. 1215 00:51:29,820 --> 00:51:32,370 And then make a move to touch the first note. 1216 00:51:35,842 --> 00:51:38,322 AUDIENCE: The starting position is also a note. 1217 00:51:38,322 --> 00:51:39,820 PROFESSOR: Yep. 1218 00:51:39,820 --> 00:51:43,490 Because, if the first note is here, 1219 00:51:43,490 --> 00:51:45,500 I don't necessarily want to start like this 1220 00:51:45,500 --> 00:51:47,820 because maybe this is harder than this. 1221 00:51:52,295 --> 00:51:52,795 All right. 1222 00:51:52,795 --> 00:51:53,753 What's the destination? 1223 00:51:56,898 --> 00:51:58,400 AUDIENCE: The last note. 1224 00:51:58,400 --> 00:51:59,930 PROFESSOR: OK. 1225 00:51:59,930 --> 00:52:04,790 So, all the notes that are at note n, and have any position, 1226 00:52:04,790 --> 00:52:06,720 would be connected to a destination note, 1227 00:52:06,720 --> 00:52:09,660 using an edge of weight 0. 1228 00:52:09,660 --> 00:52:11,510 Or I can consider them as destinations. 1229 00:52:11,510 --> 00:52:16,340 And then choose the destination that has the shortest path. 1230 00:52:16,340 --> 00:52:18,580 AUDIENCE: Oh, I see. 1231 00:52:18,580 --> 00:52:23,320 The final destination is going to be, like, two notes. 1232 00:52:23,320 --> 00:52:23,820 Right? 1233 00:52:23,820 --> 00:52:25,242 It's going to be that last position, and then-- 1234 00:52:25,242 --> 00:52:26,866 PROFESSOR: Or it might be more than two 1235 00:52:26,866 --> 00:52:29,900 if the note is just a simple note. 1236 00:52:29,900 --> 00:52:32,030 Because that wouldn't constrain my feet too much. 1237 00:52:32,030 --> 00:52:32,530 OK. 1238 00:52:32,530 --> 00:52:34,770 And last, last question. 1239 00:52:34,770 --> 00:52:36,382 Dijkstra or Bellman-Ford? 1240 00:52:36,382 --> 00:52:37,840 AUDIENCE: Bellman-Ford, because you 1241 00:52:37,840 --> 00:52:41,235 have negative edges, negative weight, 1242 00:52:41,235 --> 00:52:45,130 as if you were going to maximize to death. 1243 00:52:45,130 --> 00:52:48,060 PROFESSOR: So, this is always going to be from 0 to 1. 1244 00:52:48,060 --> 00:52:50,490 So I could possibly use Dijkstra. 1245 00:52:50,490 --> 00:52:51,550 The answer is neither. 1246 00:52:51,550 --> 00:52:54,175 The answer is, we're building a DAG, so. 1247 00:52:54,175 --> 00:52:54,966 AUDIENCE: Dijkstra. 1248 00:52:54,966 --> 00:52:56,730 AUDIENCE: We don't use that. 1249 00:52:56,730 --> 00:52:57,980 PROFESSOR: DAG, shortest path. 1250 00:52:57,980 --> 00:53:00,350 Every time we have dynamic programming, DAG, 1251 00:53:00,350 --> 00:53:02,820 shortest path. 1252 00:53:02,820 --> 00:53:03,320 OK? 1253 00:53:03,320 --> 00:53:04,240 AUDIENCE: Question. 1254 00:53:04,240 --> 00:53:05,160 PROFESSOR: Yeah. 1255 00:53:05,160 --> 00:53:06,360 Come on, last question. 1256 00:53:06,360 --> 00:53:08,000 You can't get away that easily. 1257 00:53:08,000 --> 00:53:08,550 OK, so. 1258 00:53:08,550 --> 00:53:10,400 Who wants to play?