1 00:00:00,650 --> 00:00:05,410 OK, this example is the famous transportation problem. 2 00:00:05,630 --> 00:00:09,470 Suppose we have our factories on the left hand side. 3 00:00:10,530 --> 00:00:19,220 As one to a three and we have Jay demand points, let's call them, do you want to do, for example? 4 00:00:20,130 --> 00:00:28,260 And the question is how much we can, uh, produce from each factory in order to minimize the objective 5 00:00:28,260 --> 00:00:28,800 cost? 6 00:00:29,160 --> 00:00:38,190 And also, um, knowing that the capacity of each factory is limited, the capacity of each route is 7 00:00:38,190 --> 00:00:43,130 limited, and also the demand should be satisfied. 8 00:01:07,120 --> 00:01:13,930 OK, this is a famous transportation problem, and we have some factories on the left hand side and 9 00:01:13,930 --> 00:01:19,510 we have these are the factories, these are the demand points and we know the demand of each point and 10 00:01:19,510 --> 00:01:24,250 the capacity of each factory and the cost of production and the cost of transportation. 11 00:01:24,550 --> 00:01:31,600 So the question is, in order to satisfy the demand on the right hand side, how much each factory should 12 00:01:31,750 --> 00:01:40,900 produce and from which route we should transport these products from the factories to the demand in 13 00:01:40,900 --> 00:01:43,120 order to satisfy all the constraints. 14 00:01:43,150 --> 00:01:48,260 So there are two sections in the objective function. 15 00:01:48,550 --> 00:01:56,020 So first of all, is telling us that transportation costs depends on the distance between the nodes 16 00:01:56,260 --> 00:02:01,330 and also how much good are being transported from I to J. 17 00:03:01,820 --> 00:03:04,220 Hi, this is the transportation problem. 18 00:03:05,540 --> 00:03:15,110 And in this example, we want to know and if we have some factories and let's call them I and they are 19 00:03:15,110 --> 00:03:18,260 running from as to history and there are some demand points. 20 00:03:18,260 --> 00:03:19,320 Do you want to die for? 21 00:03:19,700 --> 00:03:23,060 And the question is how much each factory should produce. 22 00:03:23,630 --> 00:03:30,050 And in order to minimize the objective function, which is the summation of their production costs and 23 00:03:30,050 --> 00:03:31,340 the transportation costs. 24 00:03:31,880 --> 00:03:35,030 This is the transportation costs and this is the production cost. 25 00:03:35,480 --> 00:03:44,450 And also there is another thing that should be satisfied that is that and the capacity of the factories 26 00:03:44,450 --> 00:03:52,430 are limited and they should produce between some specific ranges and also the demand as each point should 27 00:03:52,430 --> 00:03:53,990 be satisfied. 28 00:03:54,020 --> 00:04:03,420 OK, so let me talk about the, um, promo codes for solving this problem. 29 00:04:03,440 --> 00:04:13,250 So first of all, as usual, we have to import the required packages and then, um, define the required 30 00:04:13,250 --> 00:04:13,820 sets. 31 00:04:14,450 --> 00:04:17,110 And they are two different sets. 32 00:04:17,600 --> 00:04:18,830 It's an abstract model. 33 00:04:19,300 --> 00:04:27,080 Um, we have a demand which is defined over J p mean P max and costs are the parameters. 34 00:04:28,690 --> 00:04:35,950 So and also the distance between, um, different nodes are, uh, defined as a parameter. 35 00:04:36,890 --> 00:04:45,650 There's a variable X and telling us how much good is moving from eye to to, uh, from factory eye to 36 00:04:45,650 --> 00:04:46,830 the demand point J. 37 00:04:47,330 --> 00:04:53,960 And it is defined, um, as a real number, could be defined as a positive, real. 38 00:04:54,620 --> 00:04:59,690 And also, uh, it has about between zero and three hundred, for example. 39 00:05:00,590 --> 00:05:04,430 And there are some bounds for the generation side or the production side. 40 00:05:04,940 --> 00:05:06,860 You can say that P. 41 00:05:07,280 --> 00:05:07,780 Mm. 42 00:05:07,880 --> 00:05:08,450 Is the final. 43 00:05:08,450 --> 00:05:11,100 The AI is always within this pound. 44 00:05:11,450 --> 00:05:11,720 Mm hmm. 45 00:05:12,230 --> 00:05:13,740 And also, um. 46 00:05:15,370 --> 00:05:25,360 How much you are producing is calculated this way, some version of, um, I NJ Automation of Model 47 00:05:25,360 --> 00:05:31,000 X, uh, model X IJA for J in Model J. 48 00:05:31,930 --> 00:05:33,100 Maybe we can improve it. 49 00:05:33,100 --> 00:05:33,910 What we will see. 50 00:05:34,420 --> 00:05:35,950 And also, um. 51 00:05:36,910 --> 00:05:45,310 Um, this is this constraint is on the production side and also this side is ensuring that the demand 52 00:05:45,310 --> 00:05:46,120 is satisfied. 53 00:05:46,150 --> 00:05:53,410 I intentionally put it a bigger than equal to demand because it's easier for me to solve it, but it 54 00:05:53,410 --> 00:05:57,040 will not produce more than what is needed. 55 00:05:57,070 --> 00:06:04,390 OK, so this term is the production cost and this term is the, uh, transportation cost. 56 00:06:06,550 --> 00:06:07,960 So, um. 57 00:06:09,570 --> 00:06:16,740 Everything is fine here and also, um, the objective function, um, is this. 58 00:06:18,990 --> 00:06:25,170 And we want to minimize that the saw the model, as you can see, it's a linear programming one and 59 00:06:25,170 --> 00:06:26,520 also we have to. 60 00:06:28,580 --> 00:06:37,100 We have to specify the data, so as you saw, we have some parameters defined on I saw Param. 61 00:06:38,270 --> 00:06:47,480 Um, or I want to three p.m. max and calls, and if you have other characteristics, we could put it 62 00:06:47,480 --> 00:06:56,930 here and also J it is defined over one to four and the demand is specified here in the perimeter distance 63 00:06:57,650 --> 00:07:03,240 and the distance between each pair of, uh, nodes are given here. 64 00:07:03,290 --> 00:07:05,790 OK, so you have to specify that in your. 65 00:07:05,900 --> 00:07:06,520 That's fine. 66 00:07:07,220 --> 00:07:11,030 And if you solve it, let me run the tabs one by one. 67 00:07:11,300 --> 00:07:12,410 This one is wrong. 68 00:07:13,010 --> 00:07:14,050 This one is wrong. 69 00:07:14,750 --> 00:07:17,870 And also this one is wrong. 70 00:07:18,120 --> 00:07:20,840 You can see the objective function is calculated here. 71 00:07:20,840 --> 00:07:24,980 And if you want to visualize the decision variables, you can do it. 72 00:07:25,670 --> 00:07:27,800 So I run this tab. 73 00:07:29,700 --> 00:07:37,390 So these are the results, let's, uh, read them, uh, it is telling us that, um. 74 00:07:39,340 --> 00:07:47,050 And the amount of, um, transportation, uh, between, uh, production one and demand one is zero, 75 00:07:47,440 --> 00:07:52,350 production one on demand to zero, one on the one, three is three hundred and so on. 76 00:07:52,840 --> 00:07:55,580 You could visually show that as well. 77 00:07:55,780 --> 00:07:58,810 So these are the results that are visually shown. 78 00:07:59,230 --> 00:08:05,410 And you can see the biggest transportation is between, um, point one and demand three. 79 00:08:05,770 --> 00:08:08,950 And the next one is between two and demand one. 80 00:08:08,980 --> 00:08:12,740 So if you have a look at that here, it's here. 81 00:08:12,760 --> 00:08:22,510 So you see the next big quantity to be transported is from point two to demand number one. 82 00:08:24,610 --> 00:08:25,630 Thank you very much.