The problem of circle placement in a circle, so we do have in circles with known radius and and we
want to put them inside a bigger circle with the minimum surface possible without overlapping each other.
So we have to write down some mathematical equations that represents the condition described.
So first of all, for each pair of Iron G, we have to write down the distance between the centres of
them, X minus X squared, plus Y minus YJ Square, bigger than our AI plus Arjay Square.
So our AI analogy here are the radius of the both circles.
And also we want to make sure that each small circle is completely inside the bigger circle.
So EXI minus R, which is the center of the bigger circle, plus Y minus R and square less than R minus
R I.
OK, so in this way we are making sure that all the circles are inside the bigger one without overlapping
each other.
So let's have a look at the python code and see how it works.
First of all, we have to import the required packages, Pyrmont and environ import and everything and
import matplotlib pipelines as BLT and import vampy as ENPI.
Then let me run this and then we have to define the optimization model we name it.
Model is an abstract model and Model AI is a set representing all the same circles and also said J is
the um.
Alias of.
Says I, we have Parmeter hour, which is now here is the parameter known parameter, and also, um,
we do have two, three variables, X and Y and radius.
Radius is the radius of the bigger circle.
OK, so the, um.
Dimensions and the bounds of variables are defined here, just some big numbers to avoid, um, a plus
minus invisible and infinity.
And also we do need some equations representing the distance of each pair of circles.
So I understand J returns this expression.
So I already explained.
And we just do not only say I'm not equal to J, because this way it will calculate I and JNI.
So we are in this way we are avoiding unnecessary conditions else and return, constrain, escape.
Um, so this means that for example, if I NJ are equal to each other, it's not needed to be considered
in this, uh, constrained model that each one is.
If I were I Jay, the rule that should be followed is rule 81 and model 82 is a constraint defined.
Were I, uh, to make sure the circle is inside.
The bigger one rule equal to really two is, uh, model X minus radius square plus model Y minus model
radius square less than equal to the radius minus.
And what thoughts are I square.
And also we need an objective function, um which is the model radius here.
So we can say that um instead of calculating the surface of that circle we can say, OK, uh, minimize
the radius of the bigger circle than these should give you the same kind of result.
And the sense is the minimization.
OK, um, so um, we need to read the input data.
Um so here, uh, let me show you the required data.
Just a second, um.
OK, so this is the required data for this problem, as you can see here, that the parameters are running
from one to six and the radius of each circle is already specified.
OK.
Um, so the model we read these stats file and feed it into the model.
The results are obtained.
Um.
OK.
Let me run this tab and also this one.
The model is solved and we can graphically see what's happening here.
So you can see that, um, minimum radius of the bigger circle is this quantity.
OK, um, you can test it for the, uh, objective function pi our radius is square, so to see it will
give you the same results.
OK, the value objective function is different obviously, but the decision variables will remain the
same.
Thank you very much.