Sie sind auf Seite 1von 33

# KNC 3413 – Process Integration and Optimization

Linear Programming

## Lecturer : Nur Amalina Shairah Abdul Samat

Room : Wing B, No. 3
Email : asnamalina@unimas.my
Lecture Content
At the end of this lecture, student will be able to :
1) Understand the concept of linear programming.
2) Formulate and solve linear optimization problems, using software and graphical methods.
Introduction to Linear Programming (LP)
 Linear Programming (LP) is one of the most widely used and effective optimization techniques.
 The word programming does not refer to computer programming, but simply refer to optimization.
 When stated mathematically, each of these problems potentially involves many variables, equations
and inequalities.
 A Linear Programming model seeks to maximize or minimize a linear function, subject to a set of linear
constraints - used to obtain optimal solutions to problems that involve restrictions or limitations.
 A solution must not only satisfy all of the constraints, but also must achieve an extremum (maximum or
minimum) of the objective function.
 LP problems with many thousands of variables and constraints can be solved with the aid of modern
software.
 LP consists of a sequence of steps that will lead to an optimal solution to problems, in cases where an
optimum exists
Introduction to Linear Programming (LP)
 Importance of Linear Programming
o Many real world problems lend themselves to linear programming modeling
o Many real world problems can be approximated by linear models
o There are well-known successful applications in manufacturing, marketing, finance (investment),
o There are efficient solution techniques that solve linear programming models
o The output generated from linear programming packages provides useful “what if” analysis
 The linear model consists of the following components:
o A set of decision variables.
o A linear objective function.
o A set of linear constraints.
Introduction to Linear Programming (LP)
 Assumptions in LP
o Linearity : the impact of decision variables is linear in constraints and objective function
o Divisibility : non-integer values of decision variables are acceptable
o Certainty : values of parameters are known and constant
o Non-negativity : negative values of decision variables are unacceptable
Sensitivity Analysis
 Range of optimality : the range of values for which the solution quantities of the decision variables
remains the same

 Range of feasibility : the range of values for the fight-hand side of a constraint over which the shadow
price remains the same

 Shadow prices : negative values indicating how much a one-unit decrease in the original amount of a
constraint would decrease the final value of the objective function
Standard form for Linear Programs
An LP problem can always be written in the following form

## Maximize or Minimize : 𝑓 = σ𝑛𝑗=1 𝑐𝑗 𝑥𝑗

Subject to : σ𝑛𝑗=1 𝑎𝑖𝑗 𝑥𝑗 = 𝑏𝑖 , 𝑖 = 1,2, … 𝑚
𝑙𝑗 ≤ 𝑥𝑗 ≤ 𝑢𝑗 , 𝑗 = 1, … 𝑛
 𝑛 : number of variables
 𝑐𝑗 : 𝑛 objective function coefficients
 𝑎𝑖𝑗 and 𝑏𝑖 : parameters in the 𝑚 linear equality constraints
 𝑙𝑗 and 𝑢𝑗 : lower and upper bounds with 𝑙𝑗 ≤ 𝑢𝑗 . Both may be positive or negative
Standard form for Linear Programs
In matrix form :

Maximize or Minimize : 𝑓 = 𝒄𝒙
Subject to : 𝑨𝒙 = 𝒃 (equality constraint)
and 𝒍≤𝒙≤𝒖
 𝑨 : 𝑚 𝑥 𝑛 matrix whose (𝑖,𝑗) element is the constraint coefficient 𝑎𝑖𝑗
 𝒄, 𝒃, 𝒍, 𝒖 : vectors with components 𝑐𝑗 , 𝑏𝑗 , 𝑙𝑗 , 𝑢𝑗 respectively
Graphical Linear Programming
Graphical method can be used for finding optimal solutions to two-variable problems
1. Set up objective function and constraints in mathematical format
2. Plot the constraints
3. Identify the feasible solution space
4. Plot the objective function
5. Determine the optimum solution
Geometry of Linear Programs
Consider the problem
Maximize : 𝑓 𝑥1 , 𝑥2 = 𝑥1 + 3𝑥2
Subject to : −𝑥1 + 𝑥2 ≤ 1
𝑥1 + 𝑥2 ≤ 2
𝑥1 ≥ 0
𝑥2 ≥ 0

##  The feasible region lies within the unshaded area of

Figure 1.
 The feasible region is defined by the intersections
between constraints, satisfying the linear inequalities.
Figure 1 : Geometry of linear program
 The numbered points - extreme points, corner points,
or vertices of this set.
 The maximum of 𝑓 𝑥1 , 𝑥2 occurs at the vertex of the constraint set (point 4), such that 𝑓 𝑥1 , 𝑥2 =
𝑥1 + 3𝑥2 = 5.
Geometry of Linear Programs
 At this point, the optimal values of 𝒙 are 𝑥1 = 0.5 and
𝑥2 = 1.5.
 If the problem seeks to minimize 𝑓 𝑥1 , 𝑥2 , then the
minimum points occurs at the origin (point 2), which
is again a vertex.
 If constraint 𝑥1 + 𝑥2 ≤ 2 is removed, the feasible
region would appear as in Figure 2; the set would be
unbounded.
 Then maximum 𝑓 𝑥1 , 𝑥2 is also unbounded because Figure 2 : Unbounded
𝑓 𝑥1 , 𝑥2 can be made as large as desired, subjected
to the constraints.
 Hence, in summary, LP problem can have no solution,
an unbounded solution, a single optimal solution, or
an infinite number of optimal solutions.
Formulating Linear Programs
Example 1 : The Galaxy Industries Production Problem

 Galaxy manufactures two toy doll models; Space Ray and Zapper
 Resources are limited to 1000 pounds of special plastic and 40 hours of production time per week
 Marketing requirement
◦ Total production cannot exceed 700 dozens.
◦ Number of dozens of Space Rays cannot exceed number of dozens of Zappers by more than 350

 Technological input
◦ Space Rays requires 2 pounds of plastic and 3 minutes of labor per dozen.
◦ Zappers requires 1 pound of plastic and 4 minutes of labor per dozen.

##  The current production plan calls for

◦ Producing as much as possible of the more profitable product, Space Ray (\$8 profit per dozen).
◦ Use resources left over to produce Zappers (\$5 profit per dozen), while remaining within the marketing
guidelines.
Formulating Linear Programs
Solution Graphical Analysis
Using a graphical presentation we can represent all the
Maximize Weekly Profit = 8𝑥1 + 5𝑥2 constraints, the objective function, and the three types of
Subject to 2𝑥1 + 𝑥2 ≤ 1000 feasible points.
3𝑥1 + 4𝑥2 ≤ 2400
𝑥1 + 𝑥2 ≤ 700
𝑥1 − 𝑥2 ≤ 350
𝑥1 ≥ 0, 𝑥2 ≥ 0
Formulating Linear Programs
Formulating Linear Programs
The search of an optimal solution :

## The optimal values of Space Ray, 𝑥1

and Zapper, 𝑥2 are determined as 320
and 360 respectively, such that the
maximum profit is \$4360.

## If a linear programming problem has an

optimal solution, an extreme point is
optimal
Formulating Linear Programs
Example 2 : Maximizing Profit

## Maximize Profit = 60𝑥1 + 50𝑥2

Subject to Assembly : 4𝑥1 + 10𝑥2 ≤ 100 hours
Inspection : 2𝑥1 + 𝑥2 ≤ 22 hours
Storage : 3𝑥1 + 3𝑥2 ≤ 39 ft 3
𝑥1 ≥ 0, 𝑥2 ≥ 0
Formulating Linear Programs
Solution
Formulating Linear Programs

25

20
Product X2

15

10

Product X1

## The optimal values of 𝑥1 and 𝑥2 are determined as 9 and 4 respectively,

such that the maximum profit is \$740.
Formulating Linear Programs
Example 3 : A Diet Problem

Formulate a linear diet problem to decide the optimal quantities of different food items to be consumed
daily in order to meet the daily requirement (DR) of several nutrients at minimum cost.

##  Wheat contains 5 carbs/unit while Rye contains 7 carbs/unit

 Wheat and Rye contain 4 and 2 proteins/unit respectively
 2 vitamins is available in per unit of wheat whilst rye has half of the amount
 The cost of wheat and rye is \$0.6 and \$0.35 per unit respectively
 The minimum DR for carbs, proteins and vitamins are 20, 15 and 3 respectively
*Data above is a toy example
Formulating Linear Programs
Solution

DECISION VARIABLES ?
OBJECTIVE FUNCTION ?
CONSTRAINTS (EQUALITY OR INEQUALITY) ?
Formulating Linear Programs
DECISION VARIABLES ?
**Produce graph and shade the feasible region
 Units of wheats consumed every day, 𝑋𝑊
 Units of rye consumed every day, 𝑋𝑅 Minimize Cost, C = 0.6𝑋𝑊 + 0.35𝑋𝑅

##  Minimize Cost = 0.6𝑋𝑊 + 0.35𝑋𝑅 4𝑋𝑊 + 2𝑋𝑅 ≥ 15

2𝑋𝑊 + 𝑋𝑅 ≥ 3
CONSTRAINTS (EQUALITY OR INEQUALITY) ?
𝑋𝑊 ≥ 0
 5𝑋𝑊 + 7𝑋𝑅 ≥ 20
𝑋𝑅 ≥ 0
 4𝑋𝑊 + 2𝑋𝑅 ≥ 15
 2𝑋𝑊 + 𝑋𝑅 ≥ 3 The optimal values of 𝑋𝑊 and 𝑋𝑅 are
determined as 3.612 and 0.278 respectively,
 𝑋𝑊 ≥ 0
such that the minimum cost is \$2.26.
 𝑋𝑅 ≥ 0
Formulating Linear Programs
Example 4 : Cancer treatment with radiation therapy

## One possible way to treat cancer is by radiation therapy.

 An external beam treatment machine called a linear accelerator is used to pass radiation through the
patient’s body.

##  Damages both cancerous and healthy cells.

 Typically multiple beams of different strengths are used from different sides and different angles.

With the information given in the table, decide what beam strengths to use to achieve sufficient tumor
damage but limit damage to healthy regions.
Formulating Linear Programs
Formulating Linear Programs
Solution

##  Strength for beam 1, 𝑥1 Minimize Total Average Dose = 0.4𝑥1 + 0.5𝑥2

 Strength for beam 2, 𝑥2 Subject to 0.3𝑥1 + 0.1𝑥2 ≤ 2.7
OBJECTIVE FUNCTION ? 0.5𝑥1 + 0.5𝑥2 = 6

##  Minimize Total Average Dose = 0.4𝑥1 + 0.5𝑥2 0.6𝑥1 + 0.4𝑥2 ≥ 6

𝑥1 ≥ 0
CONSTRAINTS (EQUALITY OR INEQUALITY) ?
𝑥2 ≥ 0
 0.3𝑥1 + 0.1𝑥2 ≤ 2.7
 0.5𝑥1 + 0.5𝑥2 = 6 The optimal values of 𝑥1 and 𝑥2 are determined as 7.5
and 4.5 respectively, such that the minimum total
 0.6𝑥1 + 0.4𝑥2 ≥ 6 average dosage is 5.25.
 𝑥1 ≥ 0
 𝑥2 ≥ 0
Formulating Linear Programs
Example 5 : Production Problem

##  A company makes three types of laptops; type 1, type 2, and type 3.

 Three types of machines are used to make these laptops, but the machines have limited machine time
available for production.
 The available time for Machine 1, Machine 2 and Machine 3 are 500, 350 and 150 respectively.
 Making one laptop requires the following machine times.

##  The production costs of making one laptop are as follows.

Formulating Linear Programs
 The company does not want to make more than 20 type 3 laptops.
 The price (\$) that the company needs to set to sell 𝑥 laptops of type 1 is 350 + 100𝑥 1/3 .
 The price (\$) that the company needs to set to sell 𝑦 laptops of type 2 is 150 + 400𝑦1/4 .
 The price (\$) that the company needs to set to sell 𝑧 laptops of type 3 is 200 + 50𝑧1/2 .
 Given this information, how many laptops of each type should the company make if they want to maximize
their profit? (“number of laptops” has to be an integer).
Formulating Linear Programs
Solution

DECISION VARIABLES ?
 Number of Type 1 laptops, 𝑥
 Number of Type 2 laptops, 𝑦
 Number of Type 3 laptops, 𝑧

OBJECTIVE FUNCTION ?
 Maximize Profit = 350 + 100𝑥 1/3 − 250 𝑥 + 150 + 400𝑦1/4 − 100 𝑦 + 200 + 50𝑧1/2 − 150 𝑧

## CONSTRAINTS (EQUALITY OR INEQUALITY) ?

 9𝑥 + 3𝑦 + 5𝑧 ≤ 500
 5𝑥 + 4𝑦 ≤ 350
 3𝑥 + 2𝑧 ≤ 150
 𝑥 ≥ 0, 𝑦 ≥ 0, 0 ≤ 𝑧 ≤ 20
Formulating Linear Programs
**Produce graph and shade the feasible region

Maxmize Profit = 350 + 100𝑥 1/3 − 250 𝑥 + 150 + 400𝑦1/4 − 100 𝑦 + 200 + 50𝑧1/2 − 150 𝑧
Subject to 9𝑥 + 3𝑦 + 5𝑧 ≤ 500
5𝑥 + 4𝑦 ≤ 350
3𝑥 + 2𝑧 ≤ 150
𝑥 ≥ 0, 𝑦 ≥ 0, 0 ≤ 𝑧 ≤ 20

The optimal values of 𝑥, 𝑦 and 𝑧 are determined as 0, 87 and 20 respectively, such that the maximum profit
is \$116,893.
Slack Variables
 It is easier to work with equality constraints than inequality constraints to solve optimization problem
most easily.
 Note that there can be inequality constraints in any optimization problem.
 Hence, if there exists inequality constraints in the original system, those can easily be transformed by
the use of slack variables.
 If the inequality constraint is given as such,
𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 ≤ 𝑏𝑖
𝑗=1

## define slack variable 𝑥𝑛+𝑖 ≥ 0 such that

𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 + 𝑥𝑛+𝑖 = 𝑏𝑖
𝑗=1

## and the inequality becomes an equality.

Slack Variables
 If the inequality constraint is given as such,
𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 ≥ 𝑏𝑖
𝑗=1

## define slack variable 𝑥𝑛+𝑖 ≤ 0 such that

𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 − 𝑥𝑛+𝑖 = 𝑏𝑖
𝑗=1

## and the inequality becomes an equality.

**Note that the slacks must be nonnegative to guarantee that the inequalities are satisfied.
Slack Variables
 If the inequality constraint is given as such,
𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 ≥ 𝑏𝑖
𝑗=1

## define slack variable 𝑥𝑛+𝑖 ≤ 0 such that

𝑛

෍ 𝑎𝑖𝑗 𝑥𝑗 − 𝑥𝑛+𝑖 = 𝑏𝑖
𝑗=1

## and the inequality becomes an equality.

**Note that the slacks must be nonnegative to guarantee that the inequalities are satisfied.
Slack Variables
Example 6 : Standard LP form

##  Transform the following linear program into standard form : Minimize : 𝑓 = 𝑥1 + 𝑥2

Subject to : 2𝑥1 + 3𝑥2 ≤ 6
𝑥1 + 7𝑥2 ≥ 4
𝑥1 + 𝑥2 = 3
𝑥1 ≥ 0
𝑥2 unconstrained in sign
Solution