Optimization-Solver Solution (Office 2007) Solver is a powerful

advertisement
Optimization-Solver Solution
(Office 2007)
Solver is a powerful analysis tool, bundled with Excel and used for optimization and simulation of
business and engineering models.
Optimizing values in an Excel spreadsheet to meet a given objective can be an arduous process.
Fortunately, Microsoft offers Solver, a numerical optimization add-in to assist in this task. While it can’t
solve every problem, It can be a very useful “what-if” tool.
Data tab => Analysis => Solver
If it isn`t visible: you need to load it first:
1. Click the File tab, and then click Options.
2. Click Add-Ins, and then in the Manage box, select Excel Add-ins.
3. Click Go.
4. In the Add-Ins available box, select the Solver Add-in check box, and then click OK.
Tip If Solver Add-in is not listed in the Add-Ins available box, click Browse to locate
the add-in.
If you get prompted that the Solver add-in is not currently installed on your computer, click
Yes to install it.
5. After you load the Solver add-in, the Solver command is available
in the Analysis group on the Data tab.
-1-
1st Exercise
We have this function: y=5*x4-3*x3+7*x2-10*x+15
We know the value of this function: y=10000
What is the value of the x variable?
Create a Spreadsheet with name Optimization-1.
A6: x:
B6: 10
( It`s an arbitrary value )
A7: y:
B7: =5*B6^4-3*B6^3+7*B6^2-10*B6+15
(47615)
The target value for y is 10000
What is the x value in this case?
Data tab => Analysis => Solver
Target cell: B7
Equal To: Value of: 10000
By Changing Cells: B6
=>
Solve
Solver found a Solution:
B6: x=6.79696454346293
Create a Solver report
If Solver finds a solution, you can create a Solver report.
Again: Data tab => Analysis => Solver => Solve
Click a report type (Answer) in the Reports box, and then click OK.
The report is created on a new worksheet in your workbook.
-2-
2nd exercise
Optimization-2 Spreadsheet.
Find the minimum value of the next function:
f(x)=(x-2,8)2-12
What are the values of the x variable and the function at the minimum?
We know the shape of this function. So we wait this result:
A1: x
A2: f(x)
B1: 0 ( It`s an arbitrary value )
B2: =(B1-2.8)^2-12
Data tab => Analysis => Solver
Target cell: B2
Equal To: Min
By Changing Cells: B1
=>
Solve
Create an Answer Report!
Solver found a Solution:
B1:
B2:
x= 2.8
f(x) = -12
-3-
x= 2.8
f(x) = -12
3rd exercise
Optimization-3 Spreadsheet.
Find the minimum value of the next function:
f(x)=(x-2,8)2-12
Constraint: 5<=x<=10
What are the values of the x variable and the function at the minimum?
We know the shape of this function, so we wait the minimum at x=5.
A1: x
A2: f(x)
B1: 0 ( It`s an arbitrary value )
B2: =(B1-2.8)^2-12
Data tab => Analysis => Solver
Target cell: B2
Equal To: Min
By Changing Cells: B1
Subject to the constraints:
Add => Cell reference B1
Add => Cell reference B1
=>
>=
<=
Constraint: 5
Constraint: 10
Solve
Create an Answer Report!
Solver found a Solution:
B1:
B2:
x= 5
f(x) = -7.16
-4-
OK
OK
4th exercise
Optimization-4 Spreadsheet.
Find the maximum value of the next function:
f(x)=(x-2,8)2-12
What are the values of the x variable and the function at the minimum?
We know that the maximum of this function is at x= ∞. (Infinite value)
A1: x
A2: f(x)
B1: 0 ( It`s an arbitrary value )
B2: =(B1-2.8)^2-12
Data tab => Analysis => Solver
Create an Answer Report!
Target cell: B2
Equal To: Max
By Changing Cells: B1
Solver found this solution:
x= -2882303815204210
f(x)= 8.3*1030
This is the greatest real number which the program can handle.
-5-
Given the next optimization problem.
With 2 variables and 5 constraints.
Find the maximum value of the next target function:
Z=4x1+3x2
Constraints:
4x1+2x2 <= 16
3x1+x2 <= 12
-2x1-3x2 >= -20
x1,x2 >= 0
Create Optimization1 Worksheet:
A1:
A2:
A4:
x1:
x2:
z:
B1: 0
These variables will be changed by Solver.
B2: 0
B4: =4*B1+3*B2
Constraints:
B6: =4*B1+2*B2
B7: =3*B1+B2
B8: =-2*B1-3*B2
Data tab => Analysis => Solver
Target cell: B4
Equal To: Max
By Changing Cells: B1:B2
Subject to the Constraints: (Add)
B6 <= 16
B7 <= 12
B8 >= -20
B1:B2 >= 0
OR: B1 >= 0
B2 >= 0
Solve.
Create an Answer Report!
Results:
x1=1,
x2=6,
z=22
All constraints fulfilled.
-6-
Create Optimization2 Worksheet
Given the next optimization problem.
With 4 variables and 7 constraints.
Find the maximum value of the target function:
Taget function: y=2*x1+x2+2*x3-2*x4
4 variables: x1, x2, x3, x4
A1: x1
A2: x2
A3: x3
A4: x4
=> MAX
B1: 0
B2: 0
B3: 0
B4: 0
These variables will be changed by Solver.
A6: Target function
B6: =2*B1+B2+2*B3-2*B4
Find the maximum value of this target function
A8: Constraints:
A9: =B1+2*B2-4*B3-B4
A10: =B1-B2+3*B3+2*B4
A11: =2*B1-3*B2+5*B3-B4
Data tab => Analysis => Solver
Target cell: B6
Equal To: Max
By Changing Cells: B1:B4
Subject to the Constraints: (Add)
A9>=1
A10<=2
A11=3
B1:B4 >=0
OR: B1>=0
B2>=0
Solve.
Create an Answer Report!
Results:
x1=3, x2=1, x3=0, x4=0,
y=7
All constraints fulfilled.
-7-
B3>=0
B4>=0
Create Optimization3 Worksheet
Given the next optimization problem.
With 3 variables and 5 constraints.
Find the minimum value of the target function:
Taget function:: x2+3*x*y+y2-2*x*z-4*y*z+x-3*y
3 variables: x, y, z
A1: x
A2: y
A3: z
=> MIN
B1: 0
B2: 0
B3: 0
These variables will be changed by Solver.
A6: Target function
B6: =B1^2+3*B1*B2+B2^2-2*B1*B3-4*B2*B3+B1-3*B2
Find the minimum value of this target function
A8: Constraints:
A9: =B1+B2+B3
A10: =2*B1-B2
Data tab => Analysis => Solver
Target cell: B6
Equal To: Min
By Changing Cells: B1:B3
Subject to the Constraints: (Add)
A9<=10
A10>=0
B1:B3>=0
OR:
B1>=0
B2>=0
B3>=0
y= 2,561,
z= 6,1585,
function=-67,2256
Solve.
Create an Answer Report!
Results: x= 1,2805,
All constraints fulfilled.
-8-
Create Optimization4 Worksheet
Given the next optimization problem.
With 4 variables and 5 constraints.
Find the maximum value of the target function:
Target function: 2x1+2x2+x3+x4
4 variables: x1, x2, x3, x4
A1: x1
A2: x2
A3: x3
A4: x4
=> MAX
B1: 0
B2: 0
B3: 0
B4: 0
These variables will be changed by Solver.
A6: Target function
B6: =2*B1+2*B2+B3+B4
Find the minimum value of this target function
A8: Constraints:
A9: =2*B1+4*B2+B3
A10: =B1+5*B3+B4
A11: =B2+4*B3+2*B4
A12: =B1+B2+B4
-9-
Data tab => Analysis => Solver
Target cell: B6
Equal To: Max
By Changing Cells: B1:B4
Subject to the Constraints: (Add)
A9<=100
A10<=200
A11=200
A12=150
B1:B4>=0
OR:
B1>=0
B2>=0
Solve.
Create an Answer Report!
Results:
x1 = 50.0000002
x2 = 0
x3 = -4E-07
x4 = 100.0000008
Target function: 200.0000008
All constraints fulfilled.
- 10 -
B3>=0
B4>=0
Download