1 00:00:00,210 --> 00:00:10,800 The problem of circle placement in a circle, so we do have in circles with known radius and and we 2 00:00:10,800 --> 00:00:17,350 want to put them inside a bigger circle with the minimum surface possible without overlapping each other. 3 00:00:17,370 --> 00:00:24,100 So we have to write down some mathematical equations that represents the condition described. 4 00:00:24,990 --> 00:00:30,690 So first of all, for each pair of Iron G, we have to write down the distance between the centres of 5 00:00:30,690 --> 00:00:38,150 them, X minus X squared, plus Y minus YJ Square, bigger than our AI plus Arjay Square. 6 00:00:38,250 --> 00:00:43,440 So our AI analogy here are the radius of the both circles. 7 00:00:43,860 --> 00:00:51,960 And also we want to make sure that each small circle is completely inside the bigger circle. 8 00:00:51,960 --> 00:01:03,990 So EXI minus R, which is the center of the bigger circle, plus Y minus R and square less than R minus 9 00:01:03,990 --> 00:01:04,590 R I. 10 00:01:05,250 --> 00:01:15,720 OK, so in this way we are making sure that all the circles are inside the bigger one without overlapping 11 00:01:15,720 --> 00:01:16,200 each other. 12 00:01:16,210 --> 00:01:21,740 So let's have a look at the python code and see how it works. 13 00:01:22,050 --> 00:01:32,180 First of all, we have to import the required packages, Pyrmont and environ import and everything and 14 00:01:32,400 --> 00:01:37,920 import matplotlib pipelines as BLT and import vampy as ENPI. 15 00:01:38,730 --> 00:01:47,250 Then let me run this and then we have to define the optimization model we name it. 16 00:01:47,270 --> 00:01:57,420 Model is an abstract model and Model AI is a set representing all the same circles and also said J is 17 00:01:57,420 --> 00:01:58,410 the um. 18 00:01:58,650 --> 00:01:59,850 Alias of. 19 00:02:01,180 --> 00:02:11,140 Says I, we have Parmeter hour, which is now here is the parameter known parameter, and also, um, 20 00:02:11,140 --> 00:02:17,050 we do have two, three variables, X and Y and radius. 21 00:02:17,050 --> 00:02:20,290 Radius is the radius of the bigger circle. 22 00:02:20,560 --> 00:02:23,800 OK, so the, um. 23 00:02:25,890 --> 00:02:33,240 Dimensions and the bounds of variables are defined here, just some big numbers to avoid, um, a plus 24 00:02:33,240 --> 00:02:35,300 minus invisible and infinity. 25 00:02:35,760 --> 00:02:41,160 And also we do need some equations representing the distance of each pair of circles. 26 00:02:41,520 --> 00:02:45,540 So I understand J returns this expression. 27 00:02:46,530 --> 00:02:48,660 So I already explained. 28 00:02:48,660 --> 00:02:56,880 And we just do not only say I'm not equal to J, because this way it will calculate I and JNI. 29 00:02:57,270 --> 00:03:04,900 So we are in this way we are avoiding unnecessary conditions else and return, constrain, escape. 30 00:03:05,830 --> 00:03:12,720 Um, so this means that for example, if I NJ are equal to each other, it's not needed to be considered 31 00:03:12,720 --> 00:03:16,020 in this, uh, constrained model that each one is. 32 00:03:16,020 --> 00:03:23,860 If I were I Jay, the rule that should be followed is rule 81 and model 82 is a constraint defined. 33 00:03:23,940 --> 00:03:27,300 Were I, uh, to make sure the circle is inside. 34 00:03:27,300 --> 00:03:38,240 The bigger one rule equal to really two is, uh, model X minus radius square plus model Y minus model 35 00:03:38,250 --> 00:03:42,240 radius square less than equal to the radius minus. 36 00:03:42,240 --> 00:03:45,160 And what thoughts are I square. 37 00:03:45,630 --> 00:03:54,330 And also we need an objective function, um which is the model radius here. 38 00:03:54,600 --> 00:04:04,980 So we can say that um instead of calculating the surface of that circle we can say, OK, uh, minimize 39 00:04:04,980 --> 00:04:10,770 the radius of the bigger circle than these should give you the same kind of result. 40 00:04:10,950 --> 00:04:13,530 And the sense is the minimization. 41 00:04:13,590 --> 00:04:21,050 OK, um, so um, we need to read the input data. 42 00:04:21,720 --> 00:04:26,970 Um so here, uh, let me show you the required data. 43 00:04:28,450 --> 00:04:31,210 Just a second, um. 44 00:04:39,630 --> 00:04:48,510 OK, so this is the required data for this problem, as you can see here, that the parameters are running 45 00:04:48,510 --> 00:04:54,210 from one to six and the radius of each circle is already specified. 46 00:04:54,210 --> 00:04:54,610 OK. 47 00:04:55,320 --> 00:05:00,300 Um, so the model we read these stats file and feed it into the model. 48 00:05:00,600 --> 00:05:02,760 The results are obtained. 49 00:05:02,760 --> 00:05:03,270 Um. 50 00:05:03,750 --> 00:05:04,440 OK. 51 00:05:04,520 --> 00:05:08,550 Let me run this tab and also this one. 52 00:05:08,580 --> 00:05:14,330 The model is solved and we can graphically see what's happening here. 53 00:05:14,550 --> 00:05:20,740 So you can see that, um, minimum radius of the bigger circle is this quantity. 54 00:05:20,820 --> 00:05:31,470 OK, um, you can test it for the, uh, objective function pi our radius is square, so to see it will 55 00:05:31,470 --> 00:05:32,880 give you the same results. 56 00:05:34,200 --> 00:05:39,900 OK, the value objective function is different obviously, but the decision variables will remain the 57 00:05:39,900 --> 00:05:40,230 same. 58 00:05:40,380 --> 00:05:41,220 Thank you very much.