Lecture-01 - Linear Programming Excellent 26-July-2017
Lecture-01 - Linear Programming Excellent 26-July-2017
Linear Programming:
Introduction, Formulation and
Graphical Solution
Dr Maaz Akhtar
Professor
Mechanical Engineering Department
1
Outline
• Definition of Linear Programming
• Formulation of Linear Programming
– Surviving in an island
– Extending a problem formulation
• Linear Programming Terminology
• Graphical Solution to Linear Programming
• Properties of Linear Programming
2
What is Mathematical Programming?
• Mathematical programming is selecting the best
option(s) from a set of alternatives mathematically
– Minimizing/maximizing a function where your
alternatives are defined by functions
• Many industries use mathematical programming
– Supply chain, logistics, and transportation
– Health industry, energy industry, finance, airlines
– Manufacturing industry, agriculture industry
– Education, Military
• Operations Research raised with WWII
3
What is Linear Programming?
• Linear Programming problem (LP) is a
mathematical programming problem where all of
your functions are linear
– A function is linear when
• The variables have power of 1 and the variables are not
multiplied with each other 𝑓 (𝑥 )
– linear
– not linear
– linear
– not linear
– It is assumed that our variables are continuous (for now) 𝑥
4
How to formulate?
• What do we need to formulate a linear
programming problem?
– Have a problem!!
– Know your problem
• Gather the relevant data
• Know what each number means
– Best way to learn is to do some examples….
5
Example 1: Surviving in an island
• Linear programming will save you!
– Suppose that you will be left in a deserted
island
– You want to live as many days as you can
to increase chance of rescue
– Fortunately (!), you can take a bag with you
to the island
– What would you put into the bag?
6
Example 1: Surviving in an island
• The bag can carry at most 50 lbs
• There are limited set of items you can carry
– Bread: You can survive for 2 days with 1 lb of bread
– Steak: You can survive for 5 days with 1 lb of steak
(Memphis style grilled!)
– Chicken: You can survive for 3 days with 1 lb of
chicken (southern style deep fried!)
– Chocolate: You can survive for 6 days with 1 lb of
chocolate
• How much of each item to take with you?
7
Example 1: Formulation Steps
• STEP 0: Know the problem and gather your data
– Your problem is to increase your chance of rescue by
maximizing the number of days you survive
– You can have 1 bag which can carry 50 lbs at most
– You can only put bread, steak, chicken and chocolate
into you bag
– Each item enables you survive for a specific number of
days for each pound you take
Bread: 2 days/lb Steak: 5 days/lb
Chicken: 3days/lb Chocolate: 6days/lb
8
Example 1: Formulation Steps
• STEP 1: Identify your decision variables
– Decision variables are the things you control
– The amount of each item you will take with you
Warning: Always be careful with the metrics (try to use the same metrics)
9
Example 1: Formulation Steps
• STEP 2: Define your objective function and
objective
– Your objective function is the measure of performance
as a result of your decisions
– Your objective is what you want to do with your
objective function
Objective
12
Example 1: LP Formulation
• Combine your objective, objective function, and
constraints
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒
𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒
𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜
,
14
Example 1: Extending the LP
• Furthermore, suppose you have a budgetary limit
• 1 lb of bread costs you $3
• 1 lb of steak costs you $6
• 1 lb of chicken costs you $7
• 1 lb of chocolate costs you $15
• 1 lb of cheese costs you $8
– You can spend at most $150
– Write the new restriction: Limit on how
much you can
spend
𝑀𝑎𝑥𝑖𝑚𝑖𝑧𝑒
𝑠𝑢𝑏𝑗𝑒𝑐𝑡 𝑡𝑜
,
17
LP Terminology
• Decision Variables: things we control
• Objective function: measure of performance
• Nonnegativity constraints
• Functional constraints: restrictions we have
• Parameters: constants we use in the objective function
and constraint definitions
• Solution: any choice of values for the decision variables
– Feasible solution is one that satisfies the constraints
– Optimal solution is the best feasible solution
18
Graphically Solving Simple LPs
• So far we have discussed how to formulate LPs
• How about solving them?
• Simple LPs can be solved graphically
– Simple LP: 2 decision variables!
1. Graph the constraints to see which points satisfy all
constraints (i.e., graph the feasible points)
2. Graph iso-lines of the objective function (objective
function lines)
3. Use iso-lines to find the optimal solution(s)
19
Example 2: Product Mix Problem
• Maximize your profit
– Decide how many to produce product types 1,2
– To be produced, each product requires different
amount of 2 resources per unit
– Each resource is limited
20
Example 2: LP formulation
• You can formulate the following LP model
• type 1 produced (units)
• (units)
Total profit
Resource A limit
Resource B limit
Non-negativity
21
Example 2: Graphical Solution
• First, draw your
decision variables
as the axes of
your graph
22
Example 2: Graphical Solution
• Start with the easy
constraints
– Non-negativity
constraints!
– Assume equality of
the constraint
( or )
– Then, find the
region defined by
the constraint
23
Example 2: Graphical Solution
• Resource A limit
constraint
– Draw
– Find the region
where
– Hint: take a point in each of
one of the regions and see if
this point satisfies the
constraint. The region
including the point satisfying
your constraint is the region
defined by your constraint
(you can take the origin as
your point)
24
Example 2: Graphical Solution
• Resource B limit
constraint
– Draw 2
– Find the region
where 2
25
Example 2: Graphical Solution
• Define the feasible
region
– It is the region
defined by the
intersection of all
of your constraints
– It includes all of
the feasible
solutions to your
LP
26
Example 2: Graphical Solution
Improvement
Direction
27
Example 2: Graphical Solution
• Optimum solution
will be one of the
corner solutions!!
1. Graph the
constraints
2. Define your feasible
region
3. Evaluate the corner
points (or draw iso-
lines until you leave
feasible region)
4. Choose the best
corner point 28
Graphical Solution to Case 1
• Recall the Wyndor Glass Co. Product Mix
problem
– D: number of doors, W: number of windows
29
Graphical Solution to Case 1
• STEP 1&2: Graph the constraints and find feasible region
Production rate for windows
W
10
3 D + 2 W = 18
8
D=4
6 2 W =12
Feasible
region
2
30
0 2 4 6 8 D
Production rate for doors
Graphical Solution to Case 1
• STEP 3: Draw iso-lines to find the optimal solution
Production rate W
for windows
8
Feasible
4
region
P = 1500 = 300D + 500W
0 2 4 6 8 D
10 31
Production rate for doors
Summary of the Graphical Method
• Draw the constraint boundary line for each constraint. Use the origin (or any
point not on the line) to determine which side of the line is permitted by the
constraint.
• Find the feasible region by determining where all constraints are satisfied
simultaneously.
• Determine the slope of one objective function line (iso-line). All other objective
function lines will have the same slope.
• Move a straight edge with this slope through the feasible region in the
direction of improving values of the objective function. Stop at the last instant
that the straight edge still passes through a point in the feasible region. This
line given by the straight edge is the optimal objective function line.
• A feasible point on the optimal objective function line is an optimal solution.
32
Properties of LPs
• An LP problem can have
– Infeasibility
• No feasible solutions!
– Unique optimal solution
• Only one feasible solution is optimum
– Multiple optimal solutions (alternative optima)
• More than one feasible solutions that are optimum
– Unboundedness
• There is always a better feasible solution
33
Infeasibility
• Consider the following LP problem
34
Infeasibility
• The feasible
region is empty
• That is, no
solution satisfies
the constraints
(i.e., there is no
feasible
solution)
– So, no optimal
solution exists
35
Unique Optimal Solution
• Consider the following LP problem (Example 2)
36
Unique Optimal Solution
• The feasible region
is not empty
• All of the points in
the feasible region
are feasible solutions
• But we have a single
optimal solution
37
Alternative Optima
• Consider the following LP problem
38
Alternative Optima
• The feasible region
is not empty
– There are many
feasible solutions
– Also, there are
many optimal
solutions
• but still there are
corner points that
are also optimum!
39
Problem-1