**Microsoft Office Excel 2003**Tutorial 10 – Using Solver For Complex Problems New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Formulate a problem**• Goal Seek and Solver are Excel tools that can help us solve complex, multi-variable problems. • A typical multi-variable problem is optimizing the mix of several different products to be manufactured, stocked, and/or sold by a factory or business. • Such problems deal with issues such as inventory, demand, display, space, and profit. • In order to solve such a problem in Excel, it is first necessary to create an Excel workbook showing all of the interrelated facts. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Income Analysis portion of sample worksheet**This figure shows an income analysis worksheet for a barbecue grill manufacturer. This worksheet will be referenced in other slides in this presentation to illustrate solving complex problems with Excel. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Grill Parts Inventory portion of sample worksheet**This figure shows a grill parts inventory worksheet that will also be referenced in other slides in this presentation. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**An example problem**• The problem addressed in this example is to optimize the profit that a grill manufacturing plant can make, by balancing the number of each kind of grill against inventory and revenue. • Note the following factors in the spreadsheets seen in the previous two slides: • The cost, both in parts and labor, to produce each kind of grill • The selling price of each grill • The total income • The current inventory of all parts • A chart of how many of each part are needed by each grill type • Most mix-optimizing problems will require this type of information. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**A helpful formula tip**• The formula in cell I6 of the Inventory portion of the worksheet (to calculate the count of the part named “Burner (Main)”) can be written in the form =$B$6*H21 +$C$6*I21 +$D$6*J21 +$E$6*K21. • In this way, it can be copied to the rest of the cells in the column. • This is better than writing a new formula for each count because it: • Allows you to use the same formula for each part and reduces the risk of data entry error • Allows the possibility of someday changing the number of parts used for a specific model without having to rewrite the formulas New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Mix-optimizing problem considerations**• In every mix-optimizing problem, the constraints or requirements must be defined. • In the problem under discussion, the solution must meet the following requirements: • There must be enough of each kind of grill to fill the current orders • No further parts can be ordered or manufactured, so no more grills can be manufactured once a part type is exhausted • The company wants a mix that will maximize profits New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Perform what-if analyses**• Once you have a worksheet set up that defines the problem, you can begin to do a what-if analysis. • A good way to begin is to enter some reasonable numbers, and see what happens. • This will also be a check to see if the worksheet is set up properly. • In our grill problem, the current orders would be a good starting place. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**An income analysis for an order**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Now what-if? The order continued**Now the question is: How many more grills of each kind can be manufactured? What if we add 150 to the count of each model and order that many? This figure shows what happens with a guess—a what-if of 150 more of each model. The net income looks very good. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Recognizing a problem**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Try to solve a problem using trial and error**• Returning to the last what-if analysis, entering a count of 150 more than the current orders for each type of grill, you will remember that we used 15 too many of the parts called “Rack (Top)”. • You could check to see what models use this part, and reduce the count of one of them by 15. • For example, let's reduce the count of Extended grills from 225 to 210 • This will make the parts inventory OK, and will reduce the net income by $1,500 or so • This looks like a good solution, but our problem is to find the optimal solution, the optimal mix of grills that will yield the most net income. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Explore other order possibilities**• If you increase the number of Extended grills by 15 and decrease the number of Deluxe grills by 15, the solution is better, but is it the best? • Let's try increasing the number of Standard grills in the order (since they don't use top racks). • We could keep on trying different entries for the count of different models of grill, trying to come up with the best solution, but continuing to use this manual trial-and-error method is tedious, and could take a long time. • Fortunately, Excel has a tool that can help in trial-and-error problem solving. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Use Goal Seek to automate the trial-and-error process**• To automate the trial-and-error process, Excel has a tool called Goal Seek. • When you use Goal Seek, you specify the result you want, and Goal Seek changes the value in an input cell to arrive at that result. • For example, we have been changing the number of each grill ordered (the inputs), and checking the net income (the result) • With Goal Seek, we specify the net income we want, and tell Goal Seek to change one of the inputs until it arrives at that goal. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Use Goal Seek**• In the worksheet for the optimal-mix problem about grills, we want to see what inputs would give us a net income of 42,000. • To invoke Goal Seek, from the Tools menu, click Goal Seek. • This will bring up the Goal Seek dialog box. • In that dialog box, you specify: • The cell to be set to some value • The value you want to be in that cell • The cell to change to accomplish the goal New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The Goal Seek dialog box**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Understand the Goal Seek dialog box**• Goal Seek only allows you to enter one input cell to change. • If you read the text of the entire Goal Seek dialog box as a sentence, it says, Set cell B21 to value 42000 by changing cell B6. • Keeping that sentence in mind will help you know what Goal Seek is going to try to do. • When you click OK, Goal Seek does its work. • When it finds a solution, Goal Seek reports success in a Goal Seek Status box. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Look for Goal Seek problems**• There are a couple of problems with this solution seen in the previous slide. • First of all, you cannot order 331.2887 Standard grills. • Second, when you check the status of the inventory, you see that there is a negative quantity in the Remaining column for the part called Igniter Button, which means you have exceeded the inventory for that part. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Fixing Goal Seek problems**• The first problem is caused by the fact that Goal Seek does not differentiate between integer and real numbers. • Once Goal Seek gives you an estimate, you can manually change the number to the appropriate integer. • To fix the second problem, you can run Goal Seek again, this time specifying that cell J13 (the remaining igniter buttons) should be set to 0, by changing cell B4. • When you run Goal Seek with these values, the value displayed in B6 is 302. • If you click on cell B6, you will see that the real value is 302.000000000002. You should fix this by manually entering 302 in cell B6. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The final Goal Seek solution**• After making the changes shown in the previous slide, check the inventory status, to see if there are any negative numbers. • The number of igniter buttons remaining is zero; this product mix uses them all. • Now, check the net income. It has fallen from $42,000 to just a little over $40,500, but we do have a workable solution that satisfies the first two constraints: • All current orders can be filled • The supply of parts has not been exceeded New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Did Goal Seek provide the final answer?**• Goal Seek helped find a solution that worked, but remember that our problem is to find the best solution—the one that yields the maximum net income. • We could do several trials using Goal Seek, and see which one of them is better, but we won't know that we have found the best one. • The only way to be absolutely sure that you have found the best solution using the trial-and-error method is to create all the solutions and then pick the best one. • In the current problem, there are thousands of different combinations, certainly more than we want to run. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Use Solver to find the best solution**• Excel has an add-in program called Solver. • Check the Tools menu to see if Solver is installed and activated on your machine. • If it is, the word Solver will appear on the tools menu. • You can activate it by clicking Add-Ins on the Tools menu. • This will bring up a list of the add-in programs available to activate • Find Solver on the list, check its box, and then click OK. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Install Solver**• If it is not installed, a dialog box that will guide you in the installation of Solver. • You will need your Microsoft Office 2003 CD to complete the installation. • Once Solver is installed, you will not need to install it again. • It will be available on the Tools menu to use any time you need to solve an optimal-mix type of problem. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Look for Solver on the Tools menu**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Information required by Solver**• Solver needs four types of values that you will enter into the Solver Parameter dialog box: • It needs the address of the target cell. • It needs to know what you want to do with the target cell. You can ask Solver to set the target cell's value to the: • greatest possible value • the least possible value • to a certain value that you enter 3. Solver needs to know which cells it can change to arrive at the desired result. 4. Solver needs to know what constraints have to be applied to the solution. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The Solver Parameters dialog box**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Add Solver constraints**• The next step is to enter the requirements, or constraints. • The first requirement is that the number of each part cannot exceed the available supply of each part. • Since the counts of available parts are in column H, and the count of the parts used in the order are in corresponding places in column I, the constraint is that the value in cell I6 must be less than or equal to the value in cell H6, the value in cell I7 must be less than or equal to the value in cell H7, and so on. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Access the Add Constraint dialog box**• You can write this constraint in the Add Constraint dialog box. • Click Add in the Constraints section of the Solver Parameters dialog box. • This brings up the Add Constraint dialog box, which has three boxes to enter values in. • The first box asks for references to the cells in question, in our case I6:I17 • The second box lets you choose from several comparison options; we will choose “=“ • The third box asks you for the address of the constraining cells, in our case H6:H17 • Add additional constraints as needed for the problem being solved. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**View the constraints**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The Add Constraint dialog box**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The Solver Results box**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Create an answer report**• Once you have examined the optimal solution created by Solver, you will want to create a report that captures the important facts about the solution. • Create an answer report from the Solver Results window: • Set the changing cells (B6:E6) to zero • Bring up Solver and notice that the parameters, changing cells, and constraints are still just like you set them • Click the Solve button and wait for the Solver Results window to appear • Check the Keep Solver Solution check box, and click on Answer in the Reports box • Solver creates the answer report and stores it in a separate worksheet called “Answer Report”. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**A Solver Answer Report**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Solver Answer Report sections**• Section one of the Solver Answer reports shown in the previous slide is the title section, containing identifying information. • Section two is the Target Cell section. It shows the optimization goal (in this case, “Max”), the cell's address, the cell's name, the cell's value at the beginning of the Solver run, and the cell's value at the end of the run. • The third section is the Adjustable Cells section, containing the same information (address, name, start value, ending value) about all of the changing cells. • The fourth section is the Constraints section. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Configure Solver to best work with your data**• Solver is designed to use an iterative process: • It starts with an initial solution, and then does the problem over and over, using different values in the changing variables • When a change to a variable results in a better solution, Solver makes another change to the same variable in the same direction • When a change results in a worse solution, Solver does not make any more changes to that variable in that direction • Solver continues to make changes and re-run the problem, until it arrives at a solution that is not significantly better than the previous one. • At that point, Solver reports success. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Solver options you can set**• Max Time - Solver will stop when it has been looking for a solution for this much time. If it has not yet found a solution, it will give you the option of stopping without an optimal solution or continuing for another time set. • Iterations - Solver will stop when it has done the problem this many times, even though it may not have arrived at a solution. Again, it will give you the option to stop or continue. • Precision - Solver continues to work until the constraints are satisfied within this precision For example, if the value in this box is 0.000001, and the constraint says J3 must equal 14, Solver will stop when the value in cell J3 is within 0.000001 of 14, that is, between 13.999999 and 14.000001. • Tolerance - similar to Precision, but for integer constraints. Solver stops when the answer is within this percent of the constraint value. • Convergence - Solver uses this to determine when a solution is significantly better than the previous one. If the change in the two solutions is less than or equal to this value, Solver will stop and declare that it has found a solution. • Assume Linear Model - if you know your problem can be solved with linear functions, you can speed up Solver by checking this box. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**The Solver Options dialog box**New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10**Linear vs. non-linear functions**• A linear function is a function that can be written as the sum of a series of variables, where each variable is multiplied by some constant. • A non-linear function involves using some mathematical operation other than summation. • Solver sometimes has problems arriving at a solution to non-linear problems, simply because in a non-linear problem, there may be many avenues that Solver could travel to find solutions, and it is not always possible to determine which of these directions is the best. • The rest of the choice boxes in the Solver Options dialog box have to do with helping Solver solve non-linear problems. • Generally, these options are for the advanced user. New Perspectives on Microsoft Office Excel 2003, Second Edition- Tutorial 10