﻿1
00:00:00,730 --> 00:00:08,950
‫But remember, x tilde global equals C double bar times, Delta, you global.

2
00:00:09,610 --> 00:00:13,780
‫Plus a double circle Flex Times X to the zero.

3
00:00:14,500 --> 00:00:20,920
‫That means that y global star, it equals C till the star.

4
00:00:20,950 --> 00:00:22,900
‫Global Times.

5
00:00:22,900 --> 00:00:29,050
‫X still the global or it equals C to the star.

6
00:00:29,060 --> 00:00:32,830
‫Global Times C Double Bar.

7
00:00:33,490 --> 00:00:33,940
‫Times.

8
00:00:33,940 --> 00:00:34,990
‫Delta you global.

9
00:00:35,110 --> 00:00:37,590
‫Plus C till Death Star.

10
00:00:37,600 --> 00:00:39,490
‫Global Times.

11
00:00:39,490 --> 00:00:42,100
‫A Double Circle Flex Times.

12
00:00:42,100 --> 00:00:43,150
‫It's still the zero.

13
00:00:43,780 --> 00:00:48,430
‫Remember that your C double bar and a double circle flex.

14
00:00:48,790 --> 00:00:54,190
‫These are these matrices here, c double bar and a double circle flex.

15
00:00:54,790 --> 00:00:57,610
‫And so what we have done here?

16
00:00:58,240 --> 00:01:02,140
‫We did the exact same thing in the previous car course.

17
00:01:02,800 --> 00:01:07,210
‫You see why global star equals and then all this.

18
00:01:07,840 --> 00:01:11,410
‫We took this c till the global star.

19
00:01:11,950 --> 00:01:14,950
‫We multiplied it by this vector here.

20
00:01:15,640 --> 00:01:22,930
‫That means that this red matrix it got distributed among these two terms here.

21
00:01:23,530 --> 00:01:25,630
‫This is your C double bar matrix.

22
00:01:26,290 --> 00:01:30,430
‫This is your a double circle flex from the previous car course.

23
00:01:31,090 --> 00:01:38,590
‫And then when you performed this multiplication, then you can see how these C2, the star matrices,

24
00:01:39,160 --> 00:01:43,120
‫how they were distributed inside these matrices here.

25
00:01:43,690 --> 00:01:50,290
‫And as you can see in the previous car course, we used the non simplified LP approach.

26
00:01:50,530 --> 00:01:56,740
‫That's why your C double bar and a double serve conflicts matrices are a bit different there.

27
00:01:57,280 --> 00:02:05,950
‫We had to do it that way because our horizon period in that course was considerably longer than in this

28
00:02:05,950 --> 00:02:06,460
‫course.

29
00:02:07,090 --> 00:02:20,080
‫And now, since our y star global vector contains the predicted U2 Q3 and you values one, two, three

30
00:02:20,080 --> 00:02:29,040
‫and four time steps into the future, what I can do now I can reformulate my constraints like that y

31
00:02:29,050 --> 00:02:34,870
‫global star, minimum y global star and y global star maximum.

32
00:02:35,470 --> 00:02:43,810
‫So this vector here, it simply contains all the minimal values that I can have here in this vector.

33
00:02:44,410 --> 00:02:53,230
‫And then this vector here, it contains all the maximum values that I can have here and both for minimum

34
00:02:53,230 --> 00:02:54,640
‫and maximum values.

35
00:02:55,210 --> 00:03:00,100
‫U2 zero, U2 one, U2 two and U2 three.

36
00:03:00,790 --> 00:03:01,930
‫They would be the same.

37
00:03:02,530 --> 00:03:04,420
‫Then you three zero U2.

38
00:03:04,420 --> 00:03:07,450
‫You want U3 two and you three three.

39
00:03:08,140 --> 00:03:11,380
‫They would have the same maximum and minimum value as well.

40
00:03:12,010 --> 00:03:17,200
‫And finally, you for zero, you for one, you for two and you for three.

41
00:03:17,830 --> 00:03:22,350
‫They will also have the same maximum and minimum of values.

42
00:03:23,050 --> 00:03:30,760
‫But now what I can do, I can still have my y global star minimum here, and then I can still have my

43
00:03:30,910 --> 00:03:32,920
‫y global star maximum here.

44
00:03:33,550 --> 00:03:40,390
‫But now, instead of this one here, I'm going to replace it with this one here.

45
00:03:40,990 --> 00:03:43,540
‫So I'm going to have C to the star.

46
00:03:43,540 --> 00:03:54,490
‫Global Times C Double Bar Times, Delta U Global Plus C to the Star Global Times A Double Circle Flex

47
00:03:55,150 --> 00:03:57,970
‫Times X2 still the zero next.

48
00:03:57,970 --> 00:04:04,330
‫I can take this second term here and I can put it on this side and on that side.

49
00:04:04,900 --> 00:04:19,330
‫And so I will have y global star minimum minus C till the Global Star Times, a double circle flex times

50
00:04:19,630 --> 00:04:29,350
‫till the zero, then all that is less than or equal to then I have here C till the star Global Times

51
00:04:29,530 --> 00:04:35,530
‫C Double Bar Times, Delta U Global, which is this one here.

52
00:04:36,160 --> 00:04:46,080
‫And then that is less than or equal to Y Global Max star and then minus C to the Star Global.

53
00:04:46,720 --> 00:04:50,110
‫A double circle flex and X tilde zero.

54
00:04:50,830 --> 00:04:52,480
‫And now it becomes interesting.

55
00:04:53,080 --> 00:04:57,970
‫Now I only have a term here that has Delta Global in it.

56
00:04:58,540 --> 00:04:59,920
‫What I can do now.

57
00:05:00,580 --> 00:05:02,410
‫I can separate them like this.

58
00:05:02,920 --> 00:05:04,840
‫So first of all, we take this one.

59
00:05:05,530 --> 00:05:07,540
‫Then we take this one here.

60
00:05:08,260 --> 00:05:09,880
‫This will be our second part.

61
00:05:10,390 --> 00:05:12,960
‫So I will have see to the star.

62
00:05:12,970 --> 00:05:14,590
‫Global Times.

63
00:05:14,590 --> 00:05:15,750
‫See Double Bar.

64
00:05:16,420 --> 00:05:16,840
‫Times.

65
00:05:16,840 --> 00:05:17,870
‫Delta, you global.

66
00:05:18,520 --> 00:05:23,800
‫And that's less than or equal to why Star Global Max minus.

67
00:05:24,400 --> 00:05:25,900
‫And then this term here.

68
00:05:26,530 --> 00:05:30,910
‫And then the second part here, it will be like this again.

69
00:05:31,240 --> 00:05:32,490
‫See till this star.

70
00:05:32,500 --> 00:05:34,180
‫Global Times.

71
00:05:34,180 --> 00:05:35,140
‫See Double Bar.

72
00:05:35,740 --> 00:05:36,770
‫Times Delta.

73
00:05:36,770 --> 00:05:38,020
‫You Global.

74
00:05:38,680 --> 00:05:40,600
‫It's greater than or equal to.

75
00:05:41,260 --> 00:05:44,620
‫And then you have all this that you have over here.

76
00:05:45,250 --> 00:05:48,580
‫But now remember all our inequality signs.

77
00:05:48,970 --> 00:05:50,620
‫They had to point to the left.

78
00:05:51,010 --> 00:05:55,510
‫So that means that I have to multiply this side by minus one.

79
00:05:56,140 --> 00:05:57,760
‫And this side by minus one.

80
00:05:58,390 --> 00:06:02,920
‫And if I do that, then this sign will become like this.

81
00:06:03,550 --> 00:06:09,040
‫In other words, I can simply write that I have a minus sign here.

82
00:06:09,700 --> 00:06:11,740
‫Then the inequality sign is like this.

83
00:06:12,340 --> 00:06:15,730
‫Then I'm going to put a minus sign here and here.

84
00:06:15,760 --> 00:06:17,020
‫I will have a plus sign.

85
00:06:17,620 --> 00:06:20,890
‫And now you can just formulate them like this.

86
00:06:21,400 --> 00:06:22,930
‫I have this matrix here.

87
00:06:23,590 --> 00:06:29,860
‫Times Delta, you global less than or equal to why global star max.

88
00:06:30,490 --> 00:06:34,870
‫And then all this and then minus y global star men.

89
00:06:35,500 --> 00:06:36,940
‫And then plus all this.

90
00:06:37,570 --> 00:06:38,560
‫And there you have it.

91
00:06:39,160 --> 00:06:43,240
‫You have your matrix and you have your h vector.

92
00:06:44,020 --> 00:06:50,560
‫And now all we have to do is to give this g matrix and each vector to the solver.

93
00:06:51,220 --> 00:06:59,890
‫Together with your cost function information, so don't you global that considers the constraints it

94
00:06:59,890 --> 00:07:00,550
‫equals?

95
00:07:01,180 --> 00:07:12,310
‫Solve underscore kewpie h double bar small if transposed g and then H transposed and then in addition,

96
00:07:12,970 --> 00:07:17,350
‫you will have your solver equals c accept.

97
00:07:18,010 --> 00:07:18,700
‫And that's it.

98
00:07:19,330 --> 00:07:26,050
‫That's how you find the solution that minimizes your cost function and respects your constraints.

99
00:07:26,050 --> 00:07:32,020
‫At the same time, from the solvers point of view, you constrained your delta use.

100
00:07:32,680 --> 00:07:38,860
‫But in reality, you know that our journey started with Omegas.

101
00:07:39,520 --> 00:07:42,610
‫You first had a minimum and maximum omega.

102
00:07:43,270 --> 00:07:47,590
‫That's what we started with, with minimum and maximum Omegas.

103
00:07:48,190 --> 00:07:53,270
‫Then from there, we went to minimum and maximum use.

104
00:07:53,890 --> 00:07:59,950
‫And once we had that, we were able to go from here till this form here.

105
00:08:00,550 --> 00:08:01,840
‫So that was the journey.

106
00:08:02,440 --> 00:08:07,360
‫And now I would like to talk about a problem that you face for sure.

107
00:08:07,960 --> 00:08:17,230
‫It can happen many times that when you work with constraints, then there simply are no solutions that

108
00:08:17,230 --> 00:08:24,400
‫minimize the cost function and respect all the constraints at the same time to give you good intuition

109
00:08:24,400 --> 00:08:25,570
‫about this problem.

110
00:08:26,110 --> 00:08:30,340
‫In the previous car course, I had a very good example for that.

111
00:08:30,940 --> 00:08:32,920
‫I will show it to you here as well.

112
00:08:33,490 --> 00:08:40,480
‫So if you have already covered the previous car course and I mean the second concourse, then you can

113
00:08:40,480 --> 00:08:42,220
‫skip the next two videos.

114
00:08:42,670 --> 00:08:45,910
‫But if not, then feel free to watch them here.

115
00:08:46,450 --> 00:08:52,630
‫So let's forget about the drone during two videos, and let's focus on this car example.

116
00:08:53,200 --> 00:08:57,310
‫Even though this problem can occur with any system.

117
00:08:58,300 --> 00:08:59,470
‫You can do it by hand.

118
00:08:59,950 --> 00:09:03,310
‫I'm going to give you a Matrix H double bar.

119
00:09:03,940 --> 00:09:04,930
‫It looks like this.

120
00:09:05,590 --> 00:09:10,960
‫Then I'm going to give you a small f transposed that looks like this.

121
00:09:11,650 --> 00:09:16,510
‫Then I'm going to give you a g matrix that looks like this.

122
00:09:17,140 --> 00:09:24,400
‫And then I'm going to give you the H Vector transposed that looks like this.

123
00:09:25,030 --> 00:09:26,530
‫So you have two questions.

124
00:09:27,160 --> 00:09:30,250
‫Question number one, do you have a solution?

125
00:09:30,850 --> 00:09:41,260
‫Delta you global that minimizes your cost function, j, and respects all your constraints.

126
00:09:41,830 --> 00:09:43,360
‫So that's the first question.

127
00:09:43,990 --> 00:09:46,770
‫And Question two is why.

128
00:09:47,320 --> 00:09:50,020
‫Whatever answer you have for your question one.

129
00:09:50,650 --> 00:09:52,060
‫Why is it like that?

130
00:09:52,630 --> 00:09:53,920
‫So give it some thought.

131
00:09:54,460 --> 00:09:56,560
‫Try doing it by yourself first.

132
00:09:57,130 --> 00:09:59,350
‫Don't watch the next video right away.

133
00:09:59,950 --> 00:10:03,760
‫And then when you have thought about it, then I'll see you in the next video.

134
00:10:03,910 --> 00:10:04,810
‫Thank you very much.

