﻿1
00:00:00,650 --> 00:00:10,130
‫Finally, once your embassy simplification has given you your seat to the Star Global, why max global

2
00:00:10,130 --> 00:00:11,350
‫and why mean global?

3
00:00:12,020 --> 00:00:14,120
‫Now we can use them in the main file.

4
00:00:14,690 --> 00:00:20,120
‫So just like in section eight, here I compute my small f transposed.

5
00:00:20,690 --> 00:00:29,270
‫And now if my constraints, which equals one meaning that I'm considering my constraints, then here

6
00:00:29,480 --> 00:00:32,480
‫I create my CC matrix.

7
00:00:33,200 --> 00:00:40,430
‫It's this one here you see, see till their star Global Times C double bar.

8
00:00:41,060 --> 00:00:45,950
‫And then from that, I can create my g matrix that I need for my constraints.

9
00:00:46,580 --> 00:00:52,540
‫And I simply take this CC matrix and I concatenate them like this.

10
00:00:53,150 --> 00:00:58,820
‫And I have this minus sign here, because that's what you have in the G Matrix.

11
00:00:59,480 --> 00:01:05,780
‫And so this g matrix here that we had derived some videos ago, it's this one here.

12
00:01:06,410 --> 00:01:15,110
‫And now we also need to generate our H vector, which is this one here and this entire generation process.

13
00:01:15,470 --> 00:01:19,040
‫It happens here with these two lines.

14
00:01:19,700 --> 00:01:23,120
‫I multiply C Tilde Star Global Times.

15
00:01:23,450 --> 00:01:28,550
‫A double circle flex times the augmented presence state vector.

16
00:01:28,700 --> 00:01:30,200
‫So it's this term here.

17
00:01:30,860 --> 00:01:34,970
‫Then this h one, it's y max global minus.

18
00:01:35,600 --> 00:01:38,420
‫And then what you had received here.

19
00:01:39,050 --> 00:01:44,780
‫So this is essentially your h one and then your H two that you have here.

20
00:01:45,440 --> 00:01:53,450
‫It's minus y min global plus what you had here, what you had generated with these two lines.

21
00:01:54,110 --> 00:01:59,450
‫So this one here, the second element, that's your H.

22
00:02:00,440 --> 00:02:05,660
‫And remember this Y global star max and Y global star men.

23
00:02:05,930 --> 00:02:08,380
‫And then your c till the Star Global.

24
00:02:08,960 --> 00:02:12,200
‫They all came from your MPAC simplification function.

25
00:02:12,860 --> 00:02:14,360
‫They are these ones here.

26
00:02:14,960 --> 00:02:21,050
‫And once you have your H1 and H2, you can simply concatenate them like this.

27
00:02:21,680 --> 00:02:29,690
‫And so you have your H vector and then once you have it, you also need to transpose it because your

28
00:02:29,690 --> 00:02:33,920
‫kewpie solvers needs to have it as a role vector.

29
00:02:34,460 --> 00:02:41,140
‫So this entry here, it's your role vector, the same thing like your small f transposed.

30
00:02:41,150 --> 00:02:42,770
‫It's also your role vector.

31
00:02:43,340 --> 00:02:45,890
‫And that's how you find your Delta U Global.

32
00:02:46,520 --> 00:02:47,510
‫Is this one here?

33
00:02:47,510 --> 00:02:51,620
‫Delta U global superscript c and then all this.

34
00:02:52,340 --> 00:02:57,380
‫It's your solution that minimizes your cost function and respects all your constraints.

35
00:02:58,010 --> 00:03:05,810
‫You put here your age double bar that you got from your MBC simplification function, then small if

36
00:03:05,810 --> 00:03:15,710
‫transposed that you had calculated here and then your G matrix that you have from here and your h transposed

37
00:03:16,400 --> 00:03:17,390
‫that you have here.

38
00:03:17,990 --> 00:03:24,920
‫And then if you put here smaller equals CVS, except then it simply works better.

39
00:03:25,490 --> 00:03:31,040
‫And then just like in section eight, you only extract the first delta.

40
00:03:31,040 --> 00:03:39,170
‫You two, the first Delta you three and the first Delta you four and you discard everything else.

41
00:03:39,890 --> 00:03:48,620
‫These are your previous two Q3 and Q4 values, and these are your new Q2, Q3 and Q4 values.

42
00:03:49,250 --> 00:03:53,030
‫And then this block here, that's what you had in section eight.

43
00:03:53,210 --> 00:03:56,510
‫That's when you choose not to consider MVC constraints.

44
00:03:57,200 --> 00:04:06,170
‫Now you can see that here I have two brackets like this, and then here I only have one bracket.

45
00:04:06,800 --> 00:04:14,360
‫The reason for that is that if I use the solver in order to compute my delta, you'll global, then

46
00:04:14,360 --> 00:04:15,410
‫it's a roll vector.

47
00:04:16,010 --> 00:04:21,770
‫And then I extract the first elements from this dual variable like this with one bracket.

48
00:04:22,370 --> 00:04:29,900
‫But this role here, which we had in section eight, that's finding the solution using the gradient

49
00:04:29,900 --> 00:04:30,290
‫method.

50
00:04:30,860 --> 00:04:34,760
‫And this row here it gives me a column vector.

51
00:04:35,330 --> 00:04:41,330
‫And so when you want to extract the first elements from your column vector, then you need to have two

52
00:04:41,330 --> 00:04:42,080
‫brackets here.

53
00:04:42,650 --> 00:04:43,370
‫And that's it.

54
00:04:43,640 --> 00:04:47,450
‫Everything else in this code file is the same.

55
00:04:47,990 --> 00:04:55,210
‫You calculate your Omegas, you go inside your plant, you get your new states and then you start with

56
00:04:55,220 --> 00:04:55,880
‫a new loop.

57
00:04:56,240 --> 00:04:59,990
‫And then starting from here, the animation code starts.

58
00:05:00,500 --> 00:05:05,360
‫And there is also a course about how to create awesome animations in Python.

59
00:05:05,990 --> 00:05:09,150
‫And now let's take a look at some of the results.

60
00:05:09,830 --> 00:05:13,490
‫And let's see if our embassy constraints work.

61
00:05:14,060 --> 00:05:14,990
‫Thank you very much.

