This example, we are going to solve the following optimization problem.
So we want to find out what is the biggest cylinder inside this sphere.
So in order to solve that, we need to find out what does it mean by the biggest cylinder?
We mean the volume of that cylinder.
So in order to calculate that volume, we can easily draw a figure like this.
So this Hajj is actually half of the total height of that cylinder.
OK, and the volume of that half is equal to Hajj multiplied by the area of this circle.
So the area of the circle is pi r a square and multiply by each will give you the volume of this side
of the black cylinder and you multiply by two, gives you the whole volume of this cylinder.
So the objective function will be equal to off is equal to two pi, our square multiplied by H and the
decision variables are a, R and H.
So there are some constraints in this example.
So if you look at this graph, you can easily see that the are small R squared plus Hajari Square is
equal to our capital, the square.
So our capital is the radius of the.
Big sphere on our small is the radius of the base of that cylinder.
So we do have that constraint and also we know that the small R is between zero and R.
Capital, so you see here, and H is as well, the same age is between zero and big R, so in order
to solve that, we need to use the promo package.
So here you see from Pottermore environment, we import everything and also we may be using the nonpaying
and these are the comments she's not going to be used.
So we define a concrete model.
It can also define as a as an abstract model.
No worries about it.
So R is the parameter, initialize it with number one and also edge and are are both variables and the
arranging between zero and model that are.
So instead of defining a new constraint, I just put the boundary of the variable inside the variable
definition and we can initialize it with some numbers between Zero and R and I use the R here.
So and also we don't need a constraint.
For example, see a model that sees the constant that the describing the problem for me expression is
equal to model R-squared plus model square is equal to model.
That's our capital, the square.
So as you already noticed, plomo distinguishes between the R capital and small R.
Yeah.
And also the objective function is the following expression here.
I write it down so it will be two pi r a square multiplied by etch.
And the sense of the optimization is since the Aurora model is a non linear programming, I can use
the IP of solver and the result is given here.
So let's run each type separately.
I run the first stop and then the second tab and you see the number of the number increases after running
that and then I use this tab.
So after passing these top.
The optimization is solved and everything is restored here in my model, and we can print the output,
so the value is zero point eighty two, which is equal to zero point fifty eight, and the objective
function is two point forty two.
And I have used two points for rounding purpose.
And also, if you want if you don't want to use the round function, you can easily print the whole
number here.
OK, so you can easily update any numbers that you see in this example and adapt it to your own values.
Thank you very much.