Linear Programming: Maximizing Profits in the Brewery Problem, Assignments of Computer Science

An introduction to linear programming and its application to the brewery problem. Linear programming is a powerful tool for optimal allocation of scarce resources among competing activities. The brewery problem involves maximizing profits by producing a certain quantity of ale and beer with limited resources of corn, hops, and malt. The significance of linear programming, provides the objective function and feasible region for the brewery problem, and describes the simplex algorithm for finding the optimal solution.

Typology: Assignments

Pre 2010

Uploaded on 09/02/2009

koofers-user-spi
koofers-user-spi 🇺🇸

10 documents

1 / 8

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Princeton University • COS 226 • Algorithms and Data Structures • Spring 2004 • Kevin Wayne • http://www.Princeton.EDU/~cos226
Linear Programming
Reference:
The Allocation of Resources by Linear Programming,
Scientific American, by Bob Bland.
Linear programming
Simplex method
LP duality
2
Linear Programming
What is it?
nQuintessential tool for optimal allocation of scarce resources,
among a number of competing activities. (e.g., see ORF 307)
nPowerful and general problem-solving method.
shortest path, max flow, min cost flow, generalized flow,
multicommodity flow, MST, matching, 2-person zero sum games
Why significant?
nFast commercial solvers: CPLEX, OSL.
nPowerful modeling languages: AMPL, GAMS.
nRanked among most important scientific advances of 20th century.
nAlso a general tool for attacking NP-hard optimization problems.
nDominates world of industry.
ex: Delta claims saving $100 million per year using LP
3
Applications
Agriculture. Diet problem.
Computer science. Compiler register allocation, data mining.
Electrical engineering. VLSI design, optimal clocking.
Energy. Blending petroleum products.
Economics. Equilibrium theory, two-person zero-sum games.
Environment. Water quality management.
Finance. Portfolio optimization.
Logistics. Supply-chain management, Berlin airlift.
Management. Hotel yield management.
Marketing. Direct mail advertising.
Manufacturing. Production line balancing, cutting stock.
Medicine. Radioactive seed placement in cancer treatment.
Operations research. Airline crew assignment, vehicle routing.
Physics. Ground states of 3-D Ising spin glasses.
Plasma physics. Optimal stellarator design.
Telecommunication. Network design, Internet routing.
Sports. Scheduling ACC basketball, handicapping horse races.
4
Brewery Problem: A Toy LP Example
Small brewery produces ale and beer.
nProduction limited by scarce resources: corn, hops, barley malt.
nRecipes for ale and beer require different proportions of resources.
How can brewer maximize profits?
nDevote all resources to ale: 34 barrels of ale Þ$442.
nDevote all resources to beer: 32 barrels of beer Þ$736.
n7.5 barrels of ale, 29.5 barrels of beer Þ$776.
n12 barrels of ale, 28 barrels of beer Þ$800.
Beverage Corn
(pounds)
Malt
(pounds)
Hops
(ounces)
Beer 15 204
Ale 5354
Profit
($)
23
13
Quantity 480 1190160
pf3
pf4
pf5
pf8

Partial preview of the text

Download Linear Programming: Maximizing Profits in the Brewery Problem and more Assignments Computer Science in PDF only on Docsity!

Princeton University

-^ COS 226 -^ Algorithms and Data Structures -^ Spring 2004 -^ Kevin Wayne -^ http://www.Princeton.EDU/~cos

Linear Programming

Reference:

Linear programmingSimplex methodLP duality The Allocation of Resources by Linear Programming, Scientific American, by Bob Bland.

Linear Programming

What is it?^ ^ Quintessential tool for optimal allocation of scarce resources,among a number of competing activities. (e.g., see ORF 307)^ ^ Powerful and general problem-solving method.

-^ shortest path, max flow, min cost flow, generalized flow,multicommodity flow, MST, matching, 2-person zero sum games

Why significant?^ ^ Fast commercial solvers:

CPLEX, OSL.

^ Powerful modeling languages: AMPL, GAMS. ^ Ranked among most important scientific advances of 20

th^ century.

^ Also a general tool for attacking NP-hard optimization problems. ^ Dominates world of industry.–

ex:^

Delta claims saving $100 million per year using LP

3

Applications

Agriculture.

Diet problem. Computer science. Compiler register allocation, data mining.Electrical engineering.

VLSI design, optimal clocking.

Energy.

Blending petroleum products. Economics. Equilibrium theory, two-person zero-sum games.Environment.

Water quality management. Finance.

Portfolio optimization. Logistics. Supply-chain management, Berlin airlift.Management. Hotel yield management.Marketing.

Direct mail advertising. Manufacturing. Production line balancing, cutting stock.Medicine. Radioactive seed placement in cancer treatment.Operations research.

Airline crew assignment, vehicle routing.

Physics. Ground states of 3-D Ising spin glasses.Plasma physics. Optimal stellarator design.Telecommunication. Network design, Internet routing.Sports.

Scheduling ACC basketball, handicapping horse races.

Brewery Problem: A Toy LP Example

Small brewery produces ale and beer.^ ^ Production limited by scarce resources:

corn, hops, barley malt.

^ Recipes for ale and beer require different proportions of resources.How can brewer maximize profits? ^ Devote all resources to ale:

34 barrels of ale

^

^ Devote all resources to beer:

32 barrels of beer

^

^ 7.5 barrels of ale, 29.5 barrels of beer

^

^ 12 barrels of ale, 28 barrels of beer

^

Beverage

Corn(pounds)

Malt(pounds)

Hops(ounces)

Beer

Ale^

Profit($)^1323

Quantity

5

Brewery Problem

(^5) t. s.

max

B

A

B

A

B

A

B

A

B

Ale^ A

Beer

ProfitCornHopsMalt

Brewery Problem: Feasible Region Ale

Beer

Corn 5A + 15B

^480

Hops 4A + 4B

^160

Malt 35A + 20B

^1190

7

Brewery Problem: Objective Function

Ale

Beer

13A + 23B = $160013A + 23B = $80013A + 23B = $

Profit

Ale

Beer

Extreme points Brewery Problem: Geometry

Brewery problem observation.

Regardless of objective function

coefficients, an optimal solution occurs at an extreme point.

13

Simplex Algorithm

Simplex algorithm. (George Dantzig, 1947)^ ^ Developed shortly after WWII in response to logistical problems.^ ^ Used for 1948 Berlin airlift.Generic algorithm.^ ^ Start at some extreme point.^ ^ Pivot from one extreme point to a neighboring one.^ ^ Repeat until optimal.How to implement? Linear algebra.

never decrease objective function

Simplex Algorithm: Basis

Basis.

Subset of m of the n variables.

Basic feasible solution (BFS). Set n - m nonbasic variables to 0, solvefor remaining m variables.^ ^ Solve m equations in m unknowns.^ ^ If unique and feasible solution

^

BFS.

^ BFS corresponds to extreme point! ^ Simplex only considers BFS.

Ale

Beer

Basis{A, B, S

}M^ (12, 28)

{A, B, S

}C^ (26, 14)

{B, SH

, S^ }M^ (0, 32)

{S, SH

, S^ }MC^ (0, 0)

{A, SH

, S}C^ (34, 0)

0 , , , ,

1190

20 35

160

4 4

480

15 (^5) t. s.

23 13 max

  



 





  

M H C

M H C

S S S B A

S

B A

S B A

S B A

B A

Infeasible{A, B, S

}H (19.41, 25.53)

16

to subject max

43

853

(^415)

83

(^115)

(^13)

2315

163

^

M H C

M

C

H C C C

S

S

S

B

A

S

S

A

S

S

A

S

B

A

Z

S

Z A

Basis = {B, S

, SH M

A = S

= 0C

Z = 736B = 32S= 32H^ S= 550M^

Simplex Algorithm:

Pivot 1^0

, , , ,

to subject max

^

M H C

M H C

S

S

S

B

A

S

B

A

S

B

A

S

B

A

Z

B

Z A

Substitute: B = 1/15 (480 – 5A – S

)C

Basis = {S

, SCH

, S} M^

A = B = 0Z = 0S= 480C^ S= 160H^ S= 1190M^

Simplex Algorithm:

Pivot 1

Why pivot on column 2?^ ^ Each unit increase in B increases objective value by $23.^ ^ Pivoting on column 1 also OK.Why pivot on row 2?^ ^ Preserves feasibility by ensuring RHS

^ 0.

^ Minimum ratio rule:

min { 480/15, 160/4, 1190/20 }.

to subject max

M H C

M H C

S

S

S

B

A

S

B

A

S

B

A

S

B

A

Z

B

Z^ A

Basis = {S

, SCH

, S} M^

A = B = 0Z = 0S= 480C^ S= 160H^ S= 1190M^

18

Simplex Algorithm:

Pivot 2

to subject max

43

853

(^415)

83

(^115)

(^13)

2315

163

^

M H C

M

C

H C C C

S

S

S

B

A

S

S

A

S

S

A

S

B

A

Z

S

Z A

to subject max

858 256

38 (^110)

18 (^110)

M H C

M H C

H C

H C

H C

S

S

S

B

A

S

S

S

S

S

A

S

S

B

Z

S

S

Z

Substitute: A = 3/8 (32 + 4/15 S

  • SC^

)H^

Basis = {B, S

, SH M

A = S

= 0C

Z = 736B = 32S= 32H^ S= 550M^ Basis = {A, B, S

}M

S= SC^

= 0H

Z = 800B = 28A = 12S= 110M^

Simplex Algorithm: Optimality

When to stop pivoting?^ ^ If all coefficients in top row are non-positive.Why is resulting solution optimal?^ ^ Any feasible solution satisfies system of equations in tableaux.

-^ in particular: Z = 800 – S

  • 2 SC^

H

^ Thus, optimal objective value Z*

^ 800 since S

, S^ CH

^ 0.

^ Current BFS has value 800

^

optimal.

Basis = {A, B, S

}M

S= SC^

= 0H

Z = 800B = 28A = 12S= 110M^

to subject max

858 256

38 (^110)

18 (^110)

M H C

M H C

H C

H C

H C

S

S

S

B

A

S

S

S

S

S

A

S

S

B

Z

S

S

Z

20

Simplex Algorithm: Issues

Remarkable property. In practice, simplex algorithm typicallyterminates in at most 2(m+n) pivots.^ ^ No polynomial pivot rule known.^ ^ Most pivot rules known to be exponential in worst-case.Issues.

Which neighboring extreme point?

Degeneracy.

New basis, same extreme point.

^ "Stalling" is common in practice.Cycling. Get stuck by cycling through different bases that allcorrespond to same extreme point. ^ Doesn't occur in the wild. ^ Bland's least index rule

^

finite # of pivots.

LP Duality: Economic Interpretation

Brewer's problem: find optimal mix of beer and ale to maximize profits.Entrepreneur's problem:

Buy individual resources from brewer at

minimum cost.^ ^ C, H, M = unit price for corn, hops, malt.^ ^ Brewer won't agree to sell resources if 5C + 4H + 35M <

0 ,

1190 20 35

160 4 4

480 15 (^5) t. s.

23 13 max (P)

  

 

  

B A

B A

B A

B A

B A

0 , ,

23 20 4 15

13 35 4 5 t.s.

1190 160 480 min (D)

   

  

 

M H C

M H C

M H C

M H C

A* = 12B* = 28OPT = 800 C* = 1H* = 2M* = 0OPT = 800

27

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.^ ^ Military logistics.^ ^ Operations research.^ ^ Control theory.^ ^ Filter design.^ ^ Structural optimization.

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.1979. Ellipsoid algorithm. (Khachian)^ ^ Geometric divide-and-conquer.^ ^ Solvable in polynomial time: O(n

4 L) bit operations.

-^ n = # variables–^ L = # bits in input  Theoretical tour de force, not remotely practical.

29

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.1979. Ellipsoid algorithm. (Khachian)1984. Projective scaling algorithm. (Karmarkar)^ ^ O(n

3.5^ L).

^ Efficient implementations possible.

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.1979. Ellipsoid algorithm. (Khachian)1984. Projective scaling algorithm. (Karmarkar)1990. Interior point methods.^ ^ O(n

3 L) and practical.

^ Extends to even more general problems.

31

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.1979. Ellipsoid algorithm. (Khachian)1984. Projective scaling algorithm. (Karmarkar)1990. Interior point methods.^ ^ Interior point faster when polyhedron smooth like disco ball.^ ^ Simplex faster when polyhedron spiky like quartz crystal.

History

1939. Production, planning. (Kantorovich)1947. Simplex algorithm. (Dantzig)1950. Applications in many fields.1979. Ellipsoid algorithm. (Khachian)1984. Projective scaling algorithm. (Karmarkar)1990. Interior point methods.Current research.^ ^ Approximation algorithms.^ ^ Software for large scale optimization.^ ^ Interior point variants.

33

Ultimate problem-solving model?^ ^ Shortest path.^ ^ Maximum flow.^ ^ Min cost flow.^ ^ Generalized multicommodity flow.^ ^ Linear programming.^ ^ Semidefinite programming.^ ^...^ ^ TSP (or any NP-complete problem)Does P = NP?

No universal problem-solving model exists unless P = NP.

tractable intractable (conjectured)

Ultimate Problem Solving Model

Perspective

LP is near the deep waters of NP-completeness.^ ^ Solvable in polynomial time.^ ^ Known for less than 25 years.Integer linear programming.^ ^ LP with integrality requirement.^ ^ NP-hard.

An unsuspecting MBA student transitions from tractableLP to intractable ILP in a single mouse click.