1 00:00:01,600 --> 00:00:09,250 This example is called the facility allocation, and I suppose we are about to allocate some facilities 2 00:00:09,250 --> 00:00:16,510 in a network and each node should have that specific facility or at least one of its neighbors or connected 3 00:00:16,510 --> 00:00:19,890 nodes has that facility. 4 00:00:20,260 --> 00:00:25,910 So we want to find out the minimum required number of nodes to allocate these facilities. 5 00:00:26,170 --> 00:00:38,710 So here you can see a given graph with, um, if I'm right and there are 19, uh, number of nodes and 6 00:00:38,710 --> 00:00:43,870 we want to find out what is the minimum required facilities and which one of them are the best one to 7 00:00:43,870 --> 00:00:45,120 allocate that facilities. 8 00:00:45,460 --> 00:00:49,400 So, um, I define a binary variable called EXI. 9 00:00:50,320 --> 00:00:52,780 And we want to minimize the summation of that. 10 00:00:53,140 --> 00:01:02,770 And for each I x plus assumption of X should be bigger than one, but some of X is done in a specific 11 00:01:02,770 --> 00:01:02,990 way. 12 00:01:03,010 --> 00:01:05,530 The only doges that are connected to AI. 13 00:01:05,800 --> 00:01:09,760 So we are doing the summation over the neighbor notes. 14 00:01:10,060 --> 00:01:13,180 OK, so um, let's have a look at the code. 15 00:01:13,190 --> 00:01:21,970 So here I import the required packages like networks matplotlib and these two are required for plotting 16 00:01:21,970 --> 00:01:22,540 this graph. 17 00:01:23,380 --> 00:01:34,030 So the one random graph is plotted here and then the other packages are, um, important here. 18 00:01:34,150 --> 00:01:37,960 So since we have already imported that one is not needed again. 19 00:01:38,500 --> 00:01:46,150 And also I run this one as well and then I will create the abstract model and is the number of node 20 00:01:46,150 --> 00:01:52,270 which is in the genome of Node I and J are set representing the nodes. 21 00:01:52,270 --> 00:02:00,880 L is the connection Matrix X and Y are by the decision variables and Y is actually the objective function 22 00:02:00,880 --> 00:02:01,270 as well. 23 00:02:01,540 --> 00:02:08,080 X is a binary variable and this constraint is created, as you can see. 24 00:02:08,520 --> 00:02:08,860 Hmm. 25 00:02:09,790 --> 00:02:10,720 Look at this one. 26 00:02:10,900 --> 00:02:17,170 If l i j it has value equal to one then the summation is going to happen. 27 00:02:18,280 --> 00:02:22,120 Um so um you can see that. 28 00:02:22,120 --> 00:02:30,460 And the model also the final one y is bigger than summation of X, I could say equal to that, but that 29 00:02:30,460 --> 00:02:31,850 will give the same results. 30 00:02:32,170 --> 00:02:37,750 So in these type I am feeding the data into the model. 31 00:02:39,010 --> 00:02:47,560 OK, so I run this uh here I do have the edges in the graph, so I create the lines and the lines will 32 00:02:47,560 --> 00:02:50,920 be fed in that dictionary which is going to construct the data for me. 33 00:02:51,490 --> 00:02:52,430 OK. 34 00:02:52,480 --> 00:02:58,720 And it's always Golfweek because it's a linear kind of programming and then we can print that. 35 00:02:58,850 --> 00:03:09,400 It means that the nodes, uh, there are seven nodes required for this specific graph on the the chosen 36 00:03:09,400 --> 00:03:11,560 nodes are like this here. 37 00:03:11,560 --> 00:03:16,210 You can get some information regarding how the model is is feasible or not. 38 00:03:17,140 --> 00:03:20,260 And finally, the final solution is given here. 39 00:03:20,590 --> 00:03:26,830 So you can see that at the selected nodes are a specified, uh, yellow color. 40 00:03:26,980 --> 00:03:34,330 For example, if you look at the node to the neighbor, node has a facility, Node seven, the same 41 00:03:34,330 --> 00:03:36,760 node 14, the same node 12 the same. 42 00:03:37,120 --> 00:03:39,350 So 16 the same and so on and so on. 43 00:03:39,420 --> 00:03:41,710 OK, and that's it for this example. 44 00:03:41,740 --> 00:03:42,610 Thank you very much.