Sie sind auf Seite 1von 38

# Linear Programming

Hassan Rana

HSR 1
HSR 2
Linear Programming (LP)

3
HSR 3
Linear Programming (LP) • A Linear Programming model seeks to
maximize or minimize a linear function,
subject to a set of linear constraints
• Components of linear model:
• A set of decision variables
• An objective function
• A set of constraints

HSR 4
Linear Programming (LP) • The maximization or minimization of some
quantity is the objective in all linear
programming problems
• All LP problems have constraints that limit the
degree to which the objective can be pursued
• A feasible solution satisfies all the problem's
constraints
• An optimal solution is a feasible solution that
results in the largest possible objective
function value when maximizing (or smallest
when minimizing).

HSR 5
Linear Programming (LP) • If both the objective function and the
constraints are linear, the problem is referred
to as a linear programming problem
• Linear functions are functions in which each
variable appears in a separate term raised to
the first power and is multiplied by a constant
(which could be 0)
• Linear constraints are linear functions that are
restricted to be "less than or equal to", "equal
to", or "greater than or equal to" a constant

HSR 6
Linear Programming (LP) • LP's are important - because:
• Many practical problems can be formulated
as LP's
• There exists an algorithm (called the
simplex algorithm) which enables us to
solve LP's numerically relatively easily

HSR 7
Linear Programming (LP) • Major application areas to which LP can be
applied are:
• Work scheduling
• Production planning & Production process
• Capital budgeting
• Financial planning
• Blending (e.g. Oil refinery management)
• Farm planning
• Distribution
• Multi-period decision problems
• Inventory model
• Financial models
• Work scheduling
HSR 8
Model Formulation

9
HSR 9
Model Formulation • Model Formulation or Problem Formulation or
simply Modeling is the process of translating a
verbal statement of a problem into a
mathematical statement

HSR 10
Model Formulation Guidelines
• Understand the problem thoroughly.
• Describe the objective.
• Describe each constraint.
• Define the decision variables.
• Write the objective in terms of the decision
variables.
• Write the constraints in terms of the decision
variables.

HSR 11
Example

12
HSR 12
Example Giapetto's wooden soldiers and trains. Each
soldier sells for \$27, uses \$10 of raw materials
and takes \$14 of labor & overhead costs. Each
train sells for \$21, uses \$9 of raw materials, and
takes \$10 of overhead costs. Each soldier
needs 2 hours finishing and 1 hour carpentry;
each train needs 1 hour finishing and 1 hour
carpentry. Raw materials are unlimited, but only
100 hours of finishing and 80 hours of
carpentry are available each week. Demand for
trains is unlimited; but at most 40 soldiers can
be sold each week. How many of each toy
should be made each week to maximize profits?

HSR 13
Example • Decision variables completely describe the
decisions to be made (in this case, by Giapetto).
Giapetto must decide how many soldiers and
trains should be manufactured each week. With
this in mind, we define:
• x1 = the number of soldiers produced per week
• x2 = the number of trains produced per week
• Objective function is the function of the decision
variables that the decision maker wants to
maximize (revenue or profit) or minimize (costs).
Giapetto can concentrate on maximizing the total
weekly profit (z).
• Here profit equals to (weekly revenues) – (raw
material purchase cost) – (other variable costs).
Hence Giapetto’s objective function is:
• Maximize z = 3x1 + 2x2
HSR 14
Example • Constraints show the restrictions on the values of
the decision variables. Without constraints
Giapetto could make a large profit by choosing
decision variables to be very large. Here there are
three constraints:
• Finishing time per week
• Carpentry time per week
• Weekly demand for soldiers
• Sign restrictions are added if the decision
variables can only assume non-negative values
(Giapetto can not manufacture negative number of
soldiers or trains!)

HSR 15
Example • All these characteristics explored above give the
following Linear Programming (LP) model
• max z = 3x1 + 2x2 (The Objective function)
• s.t. 2x1 + x2 < 100 (Finishing constraint)
• x1 + x2 < 80 (Carpentry constraint)
• x1 < 40 (Constraint on demand for soldiers)
• x1 , x2 > 0 (Sign restrictions)
• A value of (x1 , x2) is in the feasible region if it
satisfies all the constraints and sign restrictions

HSR 16
Example • Graphically and computationally we see the
solution is (x1 , x2) = (20, 60) at which z = 180
(Optimal solution)
• Report
• The maximum profit is \$180 by making 20
soldiers and 60 trains each week. Profit is
limited by the carpentry and finishing labor
available. Profit could be increased by buying
more labor

HSR 17
Example The Regal China Company produces two products
daily plates and mugs. The company has limited
amounts of two resources used in the production
of these products clay and labor. Given these
limited resources, the company desires to know
how many plates to produce each day, in order to
Maximize profit. The two products have the
following resource requirements for production and
profit per item produced (i.e., the model
parameters).

## There are 40 hours of labour and 120 pounds of

HSR
clay available each day for production. 18
Example • Decision Variables
• x1 = the number of plates produced
• x2 = the number of mugs produced
• Objective Function
• Max z = 4x1 + 5x2
• Constraints
• x1 + 2 x2 < 40
• 4x1 + 3x2 < 120
• x1 , x 2 > 0

HSR 19
Example • The graphical solution is z = 140 when
(x1, x2) = (10, 20)
• Report
• The maximum cost of reaching the target
production is \$140, with 10 plates and 20
mugs. If labour and material is available,
more production can be carried out

HSR 20
Example Dorian makes luxury cars and jeeps for high-
income men and women. It wishes to advertise
with 1 minute spots in comedy shows and
football games. Each comedy spot costs \$50K
and is seen by 7M high-income women and 2M
high-income men. Each football spot costs
\$100K and is seen by 2M high-income women
and 12M high-income men. How can Dorian
reach 28M high-income women and 24M high-
income men at the least cost?

HSR 21
Example • Decision Variables
• x1 = the number of comedy spots
• x2 = the number of football spots
• Objective Function
• min z = 50x1 + 100x2
• Constraints
• 7 x1 + 2 x2 > 28
• 2 x1 + 12x2 > 24
• x1 , x 2 > 0

HSR 22
Example • The graphical solution is z = 320 when
(x1, x2) = (3.6, 1.4); rounding up to
(x1, x2) = (4, 2) gives the best integer solution
• Report
• The minimum cost of reaching the target
audience is \$400K, with 4 comedy spots
and 2 football slots. The model is dubious
as it does not allow for saturation after
repeated viewings.

HSR 23
Example Fauji Foundation produces a cereal SUNFLOWER,
which they advertise as meeting the minimum daily
requirements for vitamins A and D. The mixing
department of the company uses three main ingredients
in making the cereal-wheat, oats, and rice, all three of
which contain amounts of vitamin A and D. Given that
each box of cereal must contain minimum amounts of
vitamin A and D, the company has instructed the mixing
department determine how many ounces of each
ingredient should go into each box of cereal in order to
minimize total cost.
The cost of one ounce of wheat is Rs. 0.4, the cost of an
ounce of oats is Rs. 0.6, and the cost of one ounce of
rice is Rs. 0.2.

HSR 24
Example • Decision Variables
• x1 = ounces of wheat
• x2 = ounces of oats
• x3 = ounces of rice
• Objective Function
• min z = 0.40x1 + 0.60x2 + 0.20x3
• Constraints
• 10x1 + 20x2 + 8x3 > 100
• 7x1 + 14x2 + 12x3 > 70
• x1 , x 2 , x3 > 0

HSR 25
Example • Ms. Fidan’s diet requires that all the food she eats
come from one of the four “basic food groups“. At
present, the following four foods are available for
consumption: brownies, chocolate ice cream, cola,
and pineapple cheesecake. Each brownie costs 0.5\$,
each scoop of chocolate ice cream costs 0.2\$, each
bottle of cola costs 0.3\$, and each pineapple
cheesecake costs 0.8\$. Each day, she must ingest at
least 500 calories, 6 oz of chocolate, 10 oz of sugar,
and 8 oz of fat. The nutritional content per unit of each
food is shown in Table. Formulate an LP model that
can be used to satisfy her daily nutritional
requirements at minimum cost.

HSR 26
Example • Decision Variables
• x1 = number of brownies eaten daily
• x2 = the number of scoops of chocolate ice cream
eaten daily
• x3 = bottles of cola drunk daily
• x4 = pieces of pineapple cheesecake eaten daily
• Objective Function (the total cost of the diet in cents):
• min w = 50x1 + 20x2 + 30x3 + 80x4

HSR 27
Example • Constraints
• 400x1 + 200x2 + 150x3 + 500x4 > 500
• 3x1 + 2x2 > 6
• 2x1 + 2x2 + 4x3 + 4x4 > 10
• 2x1 + 4x2 + x3 + 5x4 > 8
• x1 , x 2 , x3 , x4 > 0
• Report
• The minimum cost diet incurs a daily cost of 90
cents by eating 3 scoops of chocolate and
drinking 1 bottle of cola (w = 90, x2 = 3, x3 = 1)

HSR 28
Example • A PO requires different numbers of employees on
different days of the week. Union rules state each
employee must work 5 consecutive days and then
receive two days off. Find the minimum number of
employees needed.

HSR 29
Example • Decision Variables
• xi = number of employees starting on day i
• Objective Function (the total cost of the diet in cents):
• min z = x1 + x2 + x3 + x4 + x5 + x6 + x7
• Constraints

• xt > 0 (t = 1 to 7)
HSR 30
Example • Solution
• xi = (4/3, 10/3, 2, 22/3, 0, 10/3, 5)  z = 22.3
• xi = (2, 4, 2, 8, 0, 4, 5)  z = 25 (rounded up)
• Report

HSR 31
Example • Sailco must determine how many sailboats to
produce in the next 4 quarters. The demand is
known to be 40, 60, 75, and 25 boats. Sailco
must meet its demands. At the beginning of
the 1st quarter Sailco starts with 10 boats in
inventory. Sailco can produce up to 40 boats
with regular time labor at \$400 per boat, or
additional boats at \$450 with overtime labor.
Boats made in a quarter can be used to meet
that quarter's demand or held in inventory for
the next quarter at an extra cost of \$20.00 per
boat.

HSR 32
Example • Decision Variables for t = 1,2,3,4
• xt = number of employees starting on day i
• yt = number of employees starting on day I
• For convenience, introduce variables:
• it = # of boats in inventory at the end quarter t
• dt = demand in quarter t
• Given
• d1 = 40, d2 = 60, d3 = 75, d4 = 25, i0 = 10
• xt ≤ 40
• By logic it = it-1 + xt + yt + dt
• Demand is met if it ≥ 0
• Sign restrictions xt , yt ≥ 0

HSR 33
Example • Objective Function (the total cost of the diet in
cents):
• z = 400 (x1 + x2 + x3 + x4) + 450 (y1 + y2 + y3 + y4)
+ 20 (i1 + i2 + i3 + i4)
• Constraints

• xt > 0 (t = 1 to 7)

HSR 34
Example • Solution
• (x1, x2, x3, x4) = (40, 40, 40, 25)
• (y1, y2, y3, y4) = (0, 10, 35, 0)
• Report
• Min cost of \$78450.00 is achieved by the
schedule:

HSR 35
Example • CSL services computers. Its demand (hours) for
the time of skilled technicians in the next 5
months is
•t Jan Feb Mar Apr May
• dt 6000 7000 8000 9500 11000
• It starts with 50 skilled technicians at the
beginning of January. Each technician can work
160 hrs/month. To train a new technician they
must be supervised for 50 hrs by an experienced
technician for a period of one month time. Each
experienced technician is paid \$2K/mth and a
trainee is paid \$1K/mth. Each month 5% of the
skilled technicians leave. CSL needs to meet
demand and minimize costs

HSR 36
Questions

HSR 37
HSR 38