Вы находитесь на странице: 1из 59

Optimization

Problem formulation: consider the


following

Is this formulation correct?


Cont.
• To minimize Z, the manufacturer has to
purchase zero amount of X1 and X2.
• Mathematically it is correct, however,
thermodynamically (practically) not.
• Certain amount of X1 reacts with certain
amount of X2 to produce product.
• What is wrong with problem formulation?
Cont.
• Minimum amount of X1 and X2 to produce
product
• Need information on chemistry of reaction in
problem formulation
• Thus, correct problem formulation play very
important role in optimization
Degrees of freedom

Is it possible to use optimization when fewer variables than equations?

Answer is : LS
Objective function, constraints and
feasible region

Unconstraint
problem

Linear constraints and


linear objective function
General optimization problem

Decision variable
Equality constraint
In-equality constraint
Types of Optimization Problems
Steps in solving optimization problem
• Understanding the system
• Degree of freedom analysis
• Apply proper optimization algorithm
Answer this
• Indicate degree of freedom and type of
problem (LP, NLP, IP, MINLP)
Linear Programming
• LP (linear programming) is an optimization
approach that deals with meeting objective
• The term of programming does NOT mean
“computer programming” but rather connotes
:scheduling” or “setting an agenda”
• Example application:
– Maximizing profit
– Minimizing cost
Example in Mechanical App
• A manufacturing from produces five types of automobile parts.
Each is first fabricated and finished. The required worker hours
and profit for each part are
Part
A B C D
Fabrication time (hr/100 units 2.5 1.5 2.75 2
Finishing time (hr/100 units) 3.5 3 3 2
Profit ($/100 units) 375 275 475 325

• The capacities of fabrication and finishing shops over the next


month are 640 and 960 hours, respectively. Determine how
many of each part should be in order to maximize profit
12
Solution
• An LP formulation for this problem can be set
up as
• Decision variables: xi = quantity of part I

Minimize P = 375 x A + 275 x B + 475 xC + 325 x D


• subject to
• 2.5 x A + 1.5 x B + 2.75 xC + 2 x D ≤ 640

3.5 x A + 3 x B + 3 xC + 2 x D ≤ 960

13
Prototype Example
• The Wyndor glass co. produces high quality glass
products including windows glass doors.
• It has 3 plants
– Plant 1, Aluminum frames and hardware
– Plant 2, Wood frames
– Plant 3, Glass and assembles the products
• Because of declining earning, top management has
decided to revamp the company product line
• Only two new products
– Product 1: 8-foot glass door with aluminum framing
– Product 2: 4 x 6 foot double-hung wood-framed window

14
Which one is the most profitable?
• OR team is invited to solve the problem
• Defining the problem
– Product 1 required some of the production
capacity in Plants 1 and 3 but none in Plant 2
– Product 2 needs only Plants 2 and 3
– Both products would be competing the same
productions capacity in Plant 3 but it is unclear
which mix of the two product would be most
profitable?

15
Gather the relevant data
• OR team identified the data that needed
– Number of hours of production time available per
week in each plant for these new product
– Number of hours of production time used in each
plant for each batch produced of each new
product
– Profit per batch produced of each new product.

16
Data for Wyndor Glass Co.

Production Time per


Production
Batch, Hours
Time
Plant Product available per
1 2 Week

1 1 0 4
2 0 2 12
3 3 2 18
Profit per
$3000 $5000
batch 17
Formulation as LP Problem
• Decision variables
– x1 = number of batches of product 1 produced per
week
– x2 = number of batches of product 2 produced per
week
• Objective function
– Z = total profit per week (in thousands of dollars
from producing these two products
– Z = 3x1 + 5x2

18
Formulation as LP Problem
• Constrains
• x1 ≤ 4
• 2x2 ≤ 12
• 3x1 + 2x2 ≤ 18

• x1 ≥ 0, x2 ≥ 0

19
Graphical Solution

• Since only two dimensions problem, a graphical solution


can be applied
• x1 ≤ 4
7
x2
6

0
0 1 2 3 4 x15 6 7

20
Graphical Solution
10
3x1 + 2x2 ≤ 18 x1 ≤ 4
• Constraint 9

• x1 ≤ 4 8

• 2x2 ≤ 12 7

6 2x2 ≤ 12
• 3x1 + 2x2 ≤ 18 5

• x1 ≥ 0, x2 ≥ 0 4

3 Feasible

2 region

0
0 1 2 3 4 5 6 7

21
Graphical Solution
10
3x1 + 2x2 ≤ 18 x1 ≤ 4
9

8
Z=36=3x1+ 2x2
7
(2,6)
6 2x2 ≤ 12
5

Z=20=3x1+ 2x2 4

3 Feasible
Z=10=3x1+ 2x2 2 region

0
0 1 2 3 4 5 6 7

22
The Simplex Method
The geometric method of solving linear programming problems
presented before. The graphical method is useful only for
problems involving two decision variables and relatively few
problem constraints.

What happens when we need more decision variables and more problem constraints?

We use an algebraic method called the simplex method, which


was developed by George B. DANTZIG (1914-2005) in 1947 while
on assignment with the U.S. Department of the air force.
Standard Maximization Problems in
Standard Form
A linear programming problem is said to be a standard maximization problem in
standard form if its mathematical model is of the following form:
Maximize the objective function

Z max = P = c1 x1 + c2 x2 + ... + cn xn

Subject to problem constraints of the form

a1 x1 + a2 x2 + ... + an xn ≤ b ,b ≥ 0

With non-negative constraints


x1 , x2 ,..., xn ≥ 0
Slack Variables
“A mathematical representation of surplus
resources.” In real life problems, it’s unlikely
that all resources will be used completely, so
there usually are unused resources.
Slack variables represent the unused resources
between the left-hand side and right-hand
side of each inequality.
Basic and Nonbasic Variables
Basic variables are selected arbitrarily with the restriction that
there be as many basic variables as there are equations. The
remaining variables are non-basic variables.
x1 + 2 x2 + s1 =
32
3 x1 + 4 x2 + s2 =
84

This system has two equations, we can select any two of the four
variables as basic variables. The remaining two variables are
then non-basic variables. A solution found by setting the two
non-basic variables equal to 0 and solving for the two basic
variables is a basic solution. If a basic solution has no negative
values, it is a basic feasible solution.
To solve a linear programming problem in standard form, use the following steps.

1- Convert each inequality in the set of constraints to an equation by adding slack


variables.
2- Create the initial simplex tableau.
3- Select the pivot column. ( The column with the “most negative value” element
in the last row.)
4- Select the pivot row. (The row with the smallest non-negative result when the
last element in the row is divided by the corresponding in the pivot column.)
5-Use elementary row operations calculate new values for the pivot row so that
the pivot is 1 (Divide every number in the row by the pivot number.)
6- Use elementary row operations to make all numbers in the pivot column equal
to 0 except for the pivot number. If all entries in the bottom row are zero or
positive, this the final tableau. If not, go back to step 3.
7- If you obtain a final tableau, then the linear programming problem has a
maximum solution, which is given by the entry in the lower-right corner of
the tableau.
Pivot
Pivot Column: The column of the tableau
representing the variable to be entered into
the solution mix.
Pivot Row: The row of the tableau representing
the variable to be replaced in the solution mix.
Pivot Number: The element in both the pivot
column and the pivot row.
Simplex Tableau
Most real-world problems are too complex to
solve graphically. They have too many corners
to evaluate, and the algebraic solutions are
lengthy. A simplex tableau is a way to
systematically evaluate variable mixes in order
to find the best one.
Initial Simplex Tableau
All variables Solution

Basic variables coefficients

0
EXAMPLE
The Cannon Hill furniture Company produces tables
and chairs. Each table takes four hours of labor
from the carpentry department and two hours of
labor from the finishing department. Each chair
requires three hours of carpentry and one hour
of finishing. During the current week, 240 hours
of carpentry time are available and 100 hours of
finishing time. Each table produced gives a profit
of $70 and each chair a profit of $50. How many
chairs and tables should be made?
STEP 1
All information about example
Resource Table s ( x1 ) Chairs ( x2 ) Constraints
Carpentry (hr) 4 3 240
Finishing (hr) 2 1 100
Unit Profit $70 $50

Objective Function =
P 70 x1 + 50 x2

Carpentry Constraint 4 x1 + 3 x2 ≤ 240

Finishing Constraint 2 x1 + 1x2 ≤ 100

Non-negativity conditions x1 , x2 ≥ 0
The first step of the simplex method requires that each inequality
be converted into an equation. ”less than or equal to”
inequalities are converted to equations by including slack
variables.
Suppose s1 carpentry hours and s2 finishing hours remain unused
in a week. The constraints become;

4 x1 + 3 x2 + s1 =
240 4 x1 + 3 x2 + s1 + 0 s2 =
240
or
2 x1 + x2 + s2 =
100 2 x1 + x2 + 0 s1 + s2 =
100

As unused hours result in no profit, the slack variables can be


included in the objective function with zero coefficients:
P = 70 x1 + 50 x2 + 0 s1 + 0 s2
P − 70 x1 − 50 x2 − 0 s1 − 0 s2 =
0
The problem can now be considered as solving a system of 3 linear
equations involving the 5 variables x1 , x2 , s1 , s2 , P in such a way
that P has the maximum value;

4 x1 + 3 x2 + s1 + 0 s2 =
240
2 x1 + x2 + 0 s1 + s2 =
100
P − 70 x1 − 50 x2 − 0 s1 − 0 s2 =
0

Now, the system of linear equations can be written in matrix form


or as a 3x6 augmented matrix. The initial tableau is;
STEP 2
Right
Basic
x1 x2 S1 S2 P Hand
Variables
Side
S1 4 3 1 0 0 240
S2 2 1 0 1 0 100
P -70 -50 0 0 1 0

The tableau represents the initial solution;

=x1 0,=
x2 0,=s1 240,=
s2 100,=P 0

The slack variables S1 and S2 form the initial solution mix. The initial solution
assumes that all avaliable hours are unused. i.e. The slack variables take the largest
possible values.
Variables in the solution mix are called basic variables. Each basic
variables has a column consisting of all 0’s except for a single 1.
all variables not in the solution mix take the value 0.

The simplex process, a basic variable in the solution mix is


replaced by another variable previously not in the solution
mix. The value of the replaced variable is set to 0.
STEP 3
Select the pivot column (determine which variable to enter into the
solution mix). Choose the column with the “most negative”
element in the objective function row.

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 4 3 1 0 0 240
S2 2 1 0 1 0 100
P -70 -50 0 0 1 0

Pivot column
x1 should enter into the solution mix because each unit of x1 (a table)
contributes a profit of $70 compared with only $50 for each unit of x2 (a
chair)
Step 4
No, There aren’t any positive elements in the
pivot column above the dashed line.

We can go on step 5
STEP 5
Select the pivot row (determine which variable to replace in the solution mix).
Divide the last element in each row by the corresponding element in the
pivot column. The pivot row is the row with the smallest non-negative
result.
Enter

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 4 3 1 0 0 240 240 / 4 = 60
Exit S2 2 1 0 1 0 100 100 / 2 = 50
P -70 -50 0 0 1 0
Pivot row
Pivot column

Pivot number
Should be replaced by x1 in the solution mix. 60 tables can be made with 240
unused carpentry hours but only 50 tables can be made with 100 finishing
hours. Therefore we decide to make 50 tables.
Now calculate new values for the pivot row. Divide every number in the row
by the pivot number.

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 4 3 1 0 0 240
R2
x1 1 1/2 0 1/2 0 50 2
P -70 -50 0 0 1 0
Use row operations to make all numbers in the pivot column equal to 0 except for the
pivot number which remains as 1.

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
S1 0 1 1 -2 0 40 −4.R2 + R1
x1 1 1/2 0 1/2 0 50
P 0 -15 0 35 1 3500 70.R2 + R3

If 50 tables are made, then the unused carpentry hours are reduced by 200 hours (4
h/table multiplied by 50 tables); the value changes from 240 hours to 40 hours. Making
50 tables results in the profit being increased by $3500; the value changes from $0 to
$3500.
In this case, =x1 50,= x2 0,= s1 40,= s2 0,= P 3500
Now repeat the steps until there are no negative numbers in the last row.

Select the new pivot column. x2 should enter into the solution mix.
Select the new pivot row. S1 should be replaced by x2 in the solution mix.

Enter

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
Exit S1 0 1 1 -2 0 40 40 /1 = 40
x1 1 1/2 0 1/2 0 50 50 / 0,5 = 100

P 0 -15 0 35 1 3500
New pivot row
New pivot
column
Calculate new values for the pivot row. As the pivot number is already 1, there is
no need to calculate new values for the pivot row.

Use row operations to make all numbers in the pivot column equal to except for
the pivot number.

Right
Basic
x1 x2 S1 S2 P hand
Variables
side
x2 0 1 1 -2 0 40
1
x1 1 0 -1/2 3/2 0 30 − .R1 + R2
2
P 0 0 15 5 1 4100 15.R1 + R3
If 40 chairs are made, then the number of tables are reduced by
20 tables (1/2 table/chair multiplied by 40 chairs); the value
changes from 50 tables to 30 tables. The replacement of 20
tables by 40 chairs results in the profit being increased by
$600; the value changes from $3500 to $4100.

As the last row contains no negative numbers, this solution gives


the maximum value of P.
Result
This simplex tableau represents the optimal
solution to the LP problem and is interpreted
as:
=x1 30,=x2 40,=s1 0,=s2 0

and profit or P=$4100


The optimal solution (maximum profit to be
made) is to company 30 tables and 40 chairs
for a profit of $4100.
BIG M method

In std form
• s1 = 4 (≥0)
• e2 = -20 (violating constraint, can’t be BV)
• Set of BV { z, s1, ?, ?}
• Set of NBV { x1, x2}
• No BV in row 3
• Row 2 and 3 must
have BV
Cont.
• Thus we have to add artificial variables that
make the constraints having BV
• Artificial variable added to row i is ai
Cont.
• Now we have BV {z, s1, a2, a3} = {0, 4, 20, 10}
• NBV is {x1, x2, e2} = {0, 0, 0}
• There is no guarantee that solution of this LP
is same for original LP
• If artificial variables must be zero if original LP
is to be solved for BFS
• For example if a3 = 10 (i.e. x1 and x2 are zero in
last equality constraint, which not feasible)
Cont.
• In minimization problem, if we add term Mai
to objective function for each artificial variable
ai (in maximization problem, - Mai), then
artificial variables can become zero. Here M is
very large positive number

Row 0

In solution, if artificial variable assumes positive values then the problem does not
Have feasible solution under given constraints
Description of BIG M method
Cont.
Solution
Cont.
Cont.
Cont.
• First replace row 2 by (1/3)row2
• The new row 2 is
• Now eliminate x2 from row 0 by adding

• OR
Cont.

Вам также может понравиться