Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

G54LDO Workshop 1

Basics of Computational Optimization

Purpose: Familiarise with Excel Solver and LP-Solve to model and solve some small
optimization problems. Ask the lecturer or the teaching assistant for help if needed at
any point during the workshop.

Step 1
An optimization problem consists of 4 main components: data, decision variables,
objective function and constraints. The goal is to find an optimal solution among all
feasible solutions. A feasible solution is one that satisfies all the constraints. An infeasible
solution is one that violates at least one constraint. Refer to (read again if needed) the
BANK ABC small optimization problem described in the Lecture 1 notes. The two
equivalent algebraic models are shown below.
BANK ABC1 Algebraic Model BANK ABC2 Algebraic Model

Step 2
Download the Excel file for this workshop and examine the spreadsheet BankABC1 (not
the BankABC2 spreadsheet, that one will be used later). This is the spreadsheet
optimization model for the problem. Note the following in this spreadsheet model:
 The given data is arranged using a layout that seeks to intuitively reflect the
optimization problem.
 The four yellow cells are the decision variables, i.e. the amount loaned for each type
of loan; these are the values that we need to find.
 The green cells are calculations, some are needed to solve the problem and others
are just to clarify the optimization model and solution.
 There are five constraints in the model implemented in the green cells D9, E15, E17,
E19 and E21.
 The purple cell is a special calculation, the objective function, which should be
maximized.
Make sure you understand the BankABC1 spreadsheet model. Enter manually some
values in the yellow cells to experiment finding feasible and infeasible solutions. You can
also manually enter the values for the decision variables in the optimal solution (shown
in the Lecture 1 notes).
Step 3
Now you will used the Excel Solver Add-in to solve this optimization problem. Make sure
the solver is activated by doing the following:
1. Click on the FILE tab and select Options
2. Click on Add-ins and then click on the Go… button next to Manage Excel Add-ins
3. Check the box for Solver Add-in and click OK
The solver add-in should now be active in the DATA tab as shown below.

Step 4
While having the BanckABC1 spreadsheet
active, click on the Solver Add-in; the
following dialog box will be shown. The
objective function (maximization), decision
variables and constraints are shown. Once
you identify all these elements and associate
them to the corresponding cells in the
spreadsheet model, click on Solve and then
click OK on the Solver Results dialog box. The
solver should have obtained an optimal
solution for the optimization problem. Note
that this BANK ABC1 spreadsheet model
reflects the BANK ABC1 Algebraic Model.

Step 5
Excel can be used to implement an algebraic optimization model directly. Complete the
spreadsheet Bank ABC2 to implement the BANK ABC2 Algebraic Model shown in Step 1
by doing this:
1. Enter the correct calculations in the green and purple cells.
2. Set the correct parameters in the Solver Add-in and solve.
1. The optimal solution obtained with both spreadsheet models Bank ABC1 and Bank
ABC2 should be the same.
Step 6
Now implement the same BANK ABC2 Algebraic Model in LP-Solve by doing this:
1. Open LP-Solve and enter the algebraic model as shown in the Lecture 1 notes.
2. Run the solver by selecting Action  Solve from the menu.
3. See the optimal solution found by selecting the Result tab.
4. The optimal solution obtained with LP-Solve should be the same as the one obtained
with the Excel solver as shown below.

Step 7
Modify the Bank ABC1 spreadsheet optimization model and then solve for each problem
modification below. You will need to modify the actual spreadsheet and the parameters in
the Solver Add-in dialog box. Make sure to create a copy of the spreadsheet model for
each problem modification because you will need them all for the online test.
a) Consider the original model but instead of maximizing, achieve an ‘Interest Income’
of exactly 30.
b) Consider the original model and solve for maximization but adding the condition
that home improvement loans should be at most half of the personal overdraft loans
and no less than the second mortgage loans.
c) Consider the original model and solve the problem where the objective is to
minimize the windfall tax paid while achieving an ‘Interest Income’ of at least 50.

Step 8
Read the following description of another small optimization problem. Identify the 4 parts
of the optimization problem: data, decision variables, objective function and constraints.
Then, use the spreadsheet John Strong provided in order to implement and solve the
corresponding optimization model and find the optimal solution. Write also the
corresponding algebraic optimization model and implement it in LP-Solve.
JOHN STRONG needs to decide the daily consumption of corn and soybean that is better
for his diet while minimizing the cost. He should eat at least 750 units of these two
ingredients combined each day. Also, he wants to ensure that his daily consumption
includes at least 30% of protein and at most 5% of fiber. The nutrients composition of
corn and soybean is as shown in the table.

Units of nutrients per


each unit of ingredients
Protein Fiber Cost per Unit
Corn 0.09 0.02 0.30
Soybean 0.60 0.06 0.90

You might also like