Sie sind auf Seite 1von 3

Using Excel to Solve Linear Programming Problems

Note: The Pizza Problem will be must to illustrate the use of Excel.

Step 1:
Formulate the linear programming problem.
Define the decision variables
o Example:
Reg = the number of regular pizzas to make
Del = the number of deluxe pizzas to make
Write the objective function
o Example:
Max .5Reg + .75Del
Write each constraint so that all of the decision variables included in the constraint are
written on the left side of the expression and so that the right side is a non-negative
constant. Remember that you can multiple an inequality by -1BUT when you do, the
direction of the inequality change. Name each constraint so that you can remember the
context.
o Example:
Dough Reg + Del 150
Topping 4Reg + 8Del 800
RegOrder Reg 50
DelOrder Del 25
Reg, Del 0

Step 2:
Open Excel and make sure that you have Solver accessible
In Excel 2007, click on the Microsoft Button at the upper left of the screen. Then
select Excel Options at the lower right of the drop-down menu. Click Add-Ins from
the list on the left; then at the bottom of the menu next to Manage: select Excel Add-ins
and click GO. On the next dialogue box, click next to Solver Add-in, and finally,
click on OK. Solver will appear on the right side of the Data Tab. [Note: This process
only needs to be done one time.]
In versions of Excel prior to 2007, click on the Tools Menu, select Add-ins, click next to
Solver Add-in and OK. Solver should appear on the Tools Menu. [Note: This process
only needs to be done one time, and you may need the original disks to add-in this part of
Excel.]

Step 3:
Enter information from the formulation into Excel.
Use one column for the names of the constraints, one column for each decision variable,
one column for the right-hand-side values, and one column to create the formulas for
Excel (explained in Step 4). Use one row for the objective function, one row for each
constraint (other than non-negativity), and one row for the solution.
All you need to enter are the coefficients for each of the decision variables, the right-
hand-sides and an initial guess for the solution (just enter 0s to get startedthis is
where the values of the decision variables will be displayed once the problem is solved).
Leave the cell under RHS across from the objective function blank.
o Example:



Step 4:
Enter formulas for Excel to use in calculations.
You will need to enter a formula for the value of the objective function and a formula for
each constraint.
Each formula will be set up using the sumproduct function. This function uses two
ranges of cells, multiplies the values in the corresponding positions, and then adds the
values. For example: = sumproduct(B3:C3,B8:C8) will provide the same result as the
formula
=B3*B8 + C3*C8. [In this case: .5 times the number of regular pizzas made + .75 times
the number of deluxe pizzas made.]
Hint: You can save some time by using absolute references for the cells that will contain
the decision variables. Example: =sumproduct(B3:C3,$B$8:$C$8) This way you can
enter the formula in the first cell and then copy that formula down the column.
o Example:


Step 5:
Have Excel solve the problem
In Excel 2007, go to the Data Tab and select Solver. In earlier versions of Excel, go to
the Tools menu and select Solver.
To complete the dialogue box-
o Select the formula cell in the objective function row as the Target Cellthis is
where the value of the objective function will appear
o In the Equal to row, tell Excel if the problem is a maximization or minimization
o Select the cells in the solution row under the columns for the decision variables to
tell Excel where the values for the decision variable will be
o Enter each constraint by clicking on the Add button; then select the formula for
that row, the type of constraint ( =), and the RHS for the constraint.
o Example: Once complete, the dialogue box will look as follows:


Select the Options button and select Assume Linear Model and Assume Non-
Negativity. Leave all other boxes at the default values.
o Example: Once complete, the dialogue box will look as follows:


Then click OK to return to the previous dialogue box. Once there, click Solve. The
solution will appear along with a new dialogue box giving you the option to keep the
solution and generate some extra reports. Select Keep Solver Solution and the Answer
and Sensitivity reports.
o Example: Once complete, the dialogue box will look as follows:

Click OK and use the tabs at the bottom of the screen to navigate between parts of the
output.

Das könnte Ihnen auch gefallen