So this problem refers to circle placement in a rectangle, so, um, as you can see in this example,
we do have some information regarding the, uh, a number of circles.
Let's assume that we do have any circles.
And what we know about the problem is that, um, the radius of each circle is known as you can see,
we can represent him by our eye.
But the question is, how can we place them on a plain surface, on a rectangle shape surface without
overlapping each other?
And the surface of that, a specific rectangle is a minimal value.
So in order to formulate that, we have to create some constraints on an object to function.
The object of function is multiplication of L multiplied by W, which is lines and width of that rectangle.
And for each pair of circles, we do need some constraints.
For example, the distance between the center of these two circles should be bigger than our eye.
Plus R.G. Square in order to avoid overlapping and also for X for each X and Y, which are representing
the center of each circle, we should have the following two, um, constraints.
OK, so these are actually each constraint is too constrained actually.
So our eye is between our um X is bigger than our eye and is lower than W minus our eye and Y is bigger
than our eye, less than L minus our Y because we don't want the circle to get out of this rectangle.
OK, so in order to show you what's going on, first of all, we have to know the input data for this
problem.
It means that for every eye and a J for every eye, we have to know the radius of each circle.
So in this way, we can, um.
Work on it.
OK, so, uh, let me show you the, um, so as you can see here, we do have six circles and, um,
for solving the problem, we have to find the optimal locations of them.
So, um.
Here you can see the Python code required for solving that problem and as usual, we have to import
the required packages.
For example, Palomo matplotlib non-pay.
We don't need a random package.
So I removed a and also and we have to create an abstract model so we can then easily change the number
of circles that if you want.
So Model I and is a set model that J is another set which is an alias with the previous set or is a
parameter um which is defined overset AI and also um we do need some constraints.
OK, and some decision variables.
The decision variables are dissenters, um coordinations X and Y which are um bounded with um or AI
and uh a big number because as you saw in the formulation and each X is between for example L minus
our AI, but we don't know the value of L.
So for simplicity, I have chosen a big number here.
The same philosophy holds for Y and also for W and L, so W and L are positive numbers between zero
and hundred.
For example, I have initialize all of them and also um.
For every eye, not equal to J, we have some constraints, for example, here you can see that X and
model that X, I want it minus Model X, J Square plus model Y.
That's why I minus model Y, j square should be bigger than an expression like this.
Are I plus Arjay Square.
But you might ask me why didn't you say I am not equal to J use.
And you said I greater than J.
This is because if we calculate the distance between two circles and let's say one and two, then we
don't need to calculate the distance between two and one.
We just need to calculate it once.
Then for the rest of them we should just keep the constraint and model that equation.
One is following that specific rule.
OK, so rule two is telling us X should be less than W minus R.
Um, this is another constraint and the other constraint is for wise.
So that's why I is less than equal to a model L minus R I um.
And the objective function is the multiplication of model Dunstable units multiplied by model dot l
and the objective function should be defined here.
Models on object um is equal to objective rule is objective rule here in the sense is the minimization
the solver chosen for solving this problem should be capable of solving non-linear programming.
Then um the instance will be created using the DAT file associated with this example and then we will
ask Palomo to solve it for us.
OK, so let me run each time one by one.
OK, and this one, number three.
And the final one.
OK, so as you can see here, the optimal locations of a circle is a specified and plotted.
So let me give you a very quick introduction how I have plotted this graph.
So first of all, we have created a fake is equal to plots.
Um, that figure perfect size.
So you specify the size of your figure here.
And um, teta is a linear space between zero and two pi, which is divided into a hundred points.
And also um I have used the scatter command for putting those dots.
So for each value of X and Y as we have a for loop here, we put a dots here on the surface and the
X center values are also, um, calculated.
At the center of each plot is here, scatter is planned, plotting the circle and the X, C and by C,
which is representing center values, are created here.
And then, um, you can see the graph here.
So the solution is graphically shown on these plots.
I can also specify the labels for x axis and y axis.
Thank you very much.