The second example that I want to work through. We have a fenced enclosure that consists of a rectangle of length L and width 2R and a semicircle of radius R as shown in the figure. The enclosure is to be built to have an area of 1,600 square feet. So that's a constraint. We have an area that's going to be 1,600 square feet. The cost of the fence is $40 per foot for the curved portion and $30 per foot for the straight sides. The area of the fence in area can be given by this formula. We have just a rectangle plus half of a circle combines to be the total area. The goal, we wish to minimize the total cost of the fence by choosing R and L with the constraint that the total area is 1,600 square feet. Similar to the previous example, we want to minimize some things. We're going to minimize the total cost. We can independently choose radius and the length, and we've got to make sure that this has an area of 1,600 square feet. In order to calculate the cost, that's what we're trying to minimize. We're trying to minimize the cost. We need to know the total length of the flat fence, which is equal to 2R plus 2L in this diagram. The total length of the curve fence is just half of the circumference of a circle, and that's just Pi R. So we're going to be using these equations in our calculations as well. I've got this in the second tab of this starter file, solver with constraints. We're going to guess the radius and the length. We have the cost of the flat fence is $30 per foot, $40 per foot for the cost of curve fence. We need to put in these formulas then to calculate the length of flat fence, length of the curve fence, and then we're going to calculate the total area and the total cost. Then, we can use our solver tool to converge upon the solution that satisfies all of our constraints and minimizes the cost. We're going to start with a guess. You has to be sure on the order of magnitude. This total area is going to be 1,600 square feet. So I'm just going to say maybe a radius of 40 and a length of 50. So these can be just anything that makes sense. I'm going to go ahead and name these two. Let's go up to the formulas tab, create from selection, click okay, so now we have radius and length. I'm also going to name this cell B6, I'm just going to call this Flat_Cost. I'm going to name cell B7 Curved_Cost, so we've got those named. Let's go ahead and implement these two formulas over here for the length of the flat fence. That's going to be equal to 2 times our radius plus 2 times our length, and I can go ahead and press okay. Right now, based upon my guess for radius and length, that's the total length of flat fencing material. Curve is just going to equal Pi times our radius, and so that's a 125.6 right now. Let's put in the formula here for the total area, that's equal to 2 times the radius times the length plus 1.5 times Pi times radius squared, and we're getting total area is 6,500 square feet. We need that to be a lot lower. This needs to be 600 square feet. We also need to calculate the cost. Before we do that, let's just name this cell B9. I'll just call this L_flat, length of the flat, cell B10 L_curved, and now we're all set to do our total cost. The total cost is just going to be the length of the flat fence times the cost of the flat fence material plus the length of the curve fence times the cost of the curve fence. So it's quite easy. I'm just going to put this into cell B13 equals. Now, there is a nice tool you guys may have learned in Part 1 of the course. You can press F3 and it just brings up all your names. So I'll just put in here, it's the cost that was called Flat_Cost, you can double click on that, times F3, it was L_flat plus F3 Curved_Cost times F3 L_curved. I can press enter. So right now, given these dimensions our cost is $10,000. We need to do some fine tuning, that we need to use the solver tool because we have two objectives. The total area we want to be equal to 1,600, we're way over that right now, and our total cost has to be minimized. So let's go ahead and fill out the solver tool. Why don't you guys try to fill out the set objective cell and which cells we're going to change and what are our constraints? Our set objective is going to be, we're trying to minimize the total cost. So I can click on minimize. By changing we're changing both radius and length. Subject to the constraint, we're going to add a constraint that cell B12 has to be equal to 1,600. Go ahead and click okay, and go ahead and click solve and it chance through. It says that it found a solution and that solution is a total cost of about 5,160. You see that the area is about 1,600. So these right here, let me decrease decimal little. Those are the dimensions of the fenced-in area that's going to lead to the least cost. Hopefully, you enjoyed this screencast on using the solver with constraints.