linear programming
DESCRIPTION
Linear Programming. David Kauchak cs161 Summer 2009. Administrative. Questions for the last class Final Review session 8/12 3:15-5:05pm in Skilling Auditorium – e-mail questions Sample final available NP complete vs. LP problems Course evaluations. Linear programming. - PowerPoint PPT PresentationTRANSCRIPT
![Page 1: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/1.jpg)
Linear Programming
David Kauchak
cs161
Summer 2009
![Page 2: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/2.jpg)
Administrative
Questions for the last class Final
Review session 8/12 3:15-5:05pm in Skilling Auditorium – e-mail questions
Sample final available NP complete vs. LP problems
Course evaluations
![Page 3: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/3.jpg)
Linear programming
A linear function is a function of n variables defined by
A linear equality is a linear function with an equality constraint
A linear inequality is a linear function with an inequality constraint
nnn xcxcxcxxxf ...),...,,( 221121
bxaxaxaxxxf nnn ...),...,,( 221121
bxaxaxaxxxf nnn ...),...,,( 221121
bxaxaxaxxxf nnn ...),...,,( 221121
![Page 4: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/4.jpg)
Linear programming
A linear programming problem consists of two parts a linear function to maximize or minimize
subject to a set of linear constraints
nnxcxcxc ... maximize 2211
bxaxaxa nn 1212111 ...
bxaxaxa nn 2222121 ...
bxaxaxa nmnmm ...2211
…
![Page 5: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/5.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject toobjective function
constraints
![Page 6: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/6.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
2x
1x
![Page 7: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/7.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
02 x
2x
1x
![Page 8: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/8.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
2x
1x
02 x84 21 xx
84 12 xx
![Page 9: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/9.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
2x
1x
02 x84 21 xx
102 21 xx
102 12 xx
![Page 10: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/10.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
2x
1x
02 x84 21 xx
225 21 xx
102 21 xx
12
512 xx
![Page 11: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/11.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
2x
1x
02 x84 21 xx
225 21 xx
the constraints define the feasible region
102 21 xx
![Page 12: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/12.jpg)
For example
21 maximize xx
0,
225
102
84
21
21
21
21
xx
xx
xx
xx
subject to
01 x
2x
1x
02 x84 21 xx
225 21 xx
What are the values of xi that maximize the function within the feasible region?
102 21 xx
![Page 13: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/13.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
![Page 14: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/14.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
How many variables do we need to model the problem?
![Page 15: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/15.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
x1 = number of boxes per day of basic
x2 = number of boxes per day of deluxe
![Page 16: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/16.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
What are the constraints?
![Page 17: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/17.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
300
200
2
1
x
x
![Page 18: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/18.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
400
300
200
21
2
1
xx
x
x
any others?
![Page 19: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/19.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
0,
400
300
200
21
21
2
1
xx
xx
x
x
What function are we trying to maximize/minimize?
![Page 20: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/20.jpg)
Another example A chocolatier has two products: a basic product and a deluxe.
The company makes x1 boxes of the basic per day at a profit of $1 each and x2 boxes of the deluxe at a profit of $6 each. The daily demand is 200 of the basic and 300 of the deluxe. The workforce can create 400 boxes of chocolate per day. How much of each should they create to maximize profits?
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
![Page 21: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/21.jpg)
Another example
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
2x
1x100 200 300
100
200
300
400
400
![Page 22: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/22.jpg)
Another example
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
2x
1x100 200 300
100
200
300
400
400
01 x
02 x2001 x
3002 x
40021 xx
Where is the feasibility region?
![Page 23: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/23.jpg)
Another example
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
2x
1x100 200 300
100
200
300
400
400
01 x
02 x2001 x
3002 x
40021 xx
Where is the maximum within the feasibility region?
![Page 24: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/24.jpg)
Another example
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
2x
1x100 200 300
100
200
300
400
400
cxx 21 6
c = 2100
c = 1800
c = 1500
c = 1200
c = 900
c = 600
![Page 25: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/25.jpg)
Another example
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject to
2x
1x100 200 300
100
200
300
400
400
cxx 21 6
c = 2100
c = 1800
c = 1500
c = 1200
c = 900
c = 600
to maximize, move as far in this direction as the constraints allow
![Page 26: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/26.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function2x
1x100 200 300
100
200
300
400
400
cxx 21 6
c = 2100
c = 1800
c = 1500
c = 1200
c = 900
c = 600
![Page 27: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/27.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function Except… 2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
![Page 28: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/28.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function Except… 2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
![Page 29: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/29.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function Except… 2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
![Page 30: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/30.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function Except…
...
2
1
1
1
x
x
21 6 maximize xx
subject to linear program is infeasible
![Page 31: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/31.jpg)
Solutions to LPs A solution to an LP is a vertex on the
feasibility polygon the very last feasible point in the direction of
improving objective function Except…
0, 21 xx
21 maximize xx
subject to linear program is unbounded
![Page 32: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/32.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 6 maximize xx
subject towhat changes?
![Page 33: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/33.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
400
300
200
321
21
2
1
xxx
xx
x
x
21 6 maximize xx
subject to
Introduce a new variable x3
![Page 34: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/34.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
Introduce a new constraint
0,,
400
300
200
321
21
2
1
xxx
xx
x
x
21 6 maximize xx
subject to
![Page 35: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/35.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
6003
400
300
200
321
32
21
2
1
xxx
xx
xx
x
x
21 6 maximize xx subject to
Introduce a new constraint
![Page 36: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/36.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
6003
400
300
200
321
32
21
2
1
xxx
xx
xx
x
x
21 6 maximize xx subject to
![Page 37: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/37.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
21 6 maximize xx subject to
modify existing constraints
![Page 38: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/38.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
21 6 maximize xx subject to
Anything else?
![Page 39: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/39.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
modify the objective function
![Page 40: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/40.jpg)
More products The chocolatier decides to introduce a third product line
called premium with a profit of $13. We still can only produce 400 units per day. The deluxe and premium products require the same packaging machinery. Deluxe uses one unit and premium uses 3 units. We have a total of 600 units a day of this packaging material.
What does the feasibility region look like?
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
![Page 41: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/41.jpg)
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
adapted from figure 7.2 of [1]
![Page 42: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/42.jpg)
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
![Page 43: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/43.jpg)
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
![Page 44: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/44.jpg)
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
![Page 45: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/45.jpg)
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
![Page 46: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/46.jpg)
Feasibility region For n variables, the feasibility region is a polyhedron in Rn
(i.e. n-dimensional space) Each constraint defines a Rn-1 plane and the inequality a
half-space on one side of the plane
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
![Page 47: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/47.jpg)
Vector/matrix form
0
x
bAx
xcT maximize
subject to
mnmnmm
nn
nn
bxaxaxa
bxaxaxa
bxaxaxa
...
...
...
...
2211
22222121
11212111
nnxcxcxc ... maximize 2211
subject to
![Page 48: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/48.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0
![Page 49: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/49.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0
![Page 50: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/50.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0 0, 1, 0
![Page 51: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/51.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0 0, 1, 0
![Page 52: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/52.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0 0, 1, 0 1, 1, 1
![Page 53: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/53.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0 0, 1, 0 1, 1, 1
![Page 54: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/54.jpg)
Vector/matrix form
6003
400
300
200
32
321
2
1
xx
xxx
x
x
321 136 maximize xxx subject to
c: [1, 6, 13]
A: [ 1, 0, 0 0, 1, 0 1, 1, 1 0, 1, 3 ]
b: [200, 300, 400, 600]
![Page 55: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/55.jpg)
Standard form
An LP is in standard form if It is a maximization problem the constraints are all ≤
and all variables are non-negative, i.e. have constraints of the form
ii bxa
0ix
![Page 56: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/56.jpg)
Converting an LP into standard form
LP is minimize instead of maximize
0
x
bAx
xcT minimize
subject to
0
x
bAx
xcT- maximize
subject to
![Page 57: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/57.jpg)
Converting an LP into standard form
LP contains constraints of the form:
ii bxa ii b xa
![Page 58: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/58.jpg)
Converting an LP into standard form
LP contains constraints of the form:
ii bxaii
ii
b
b
xa
xa
ii
ii
b
b
xa
xa
![Page 59: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/59.jpg)
Converting an LP into standard form
LP contains variable without a non-negative bound constraint
0ix 0' ix
replace all occurrences of xi with -x’i in the objective and constraints
![Page 60: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/60.jpg)
Converting an LP into standard form
LP contains variable without a non-negative bound constraint
ii bx 0' ix
substitute x’i for xi and change constraints and objective appropriately (i.e. xi – bi), including introducing a new variable in the objective function
![Page 61: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/61.jpg)
Converting an LP into standard form
LP contains variable without a non-negative bound constraint
unbounded is ix0
0
i
i
x
x
replace all occurrences of xi with xi
+ - xi- in the objective and constraints
![Page 62: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/62.jpg)
Solving linear programs
As we noted before, if a solution exists, a vertex of the feasibility space is an optimal solution
Because the objective function is linear, we can use a hill-climbing or greedy approach by starting at one vertex and moving to an adjacent vertex that improves the object function
When we’re on top of the “hill”, i.e. we cannot move to a better neighboring vertex, we’re done
The simplex method does exactly this
![Page 63: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/63.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Start: [0,0]
Objective score:
![Page 64: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/64.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Start: [0,0]
Objective score: 0
![Page 65: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/65.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Adjacent vertices
[0, 300]
[200, 0]
Objective score:
Objective score:
![Page 66: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/66.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Adjacent vertices
[0, 300]
[200, 0]
Objective score: 300
Objective score: 200
either option improves the score
![Page 67: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/67.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Adjacent vertices
[100, 300]
Objective score: 400 improvement
![Page 68: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/68.jpg)
Simplex method
2x
1x100 200 300
100
200
300
400
400
0,
400
300
200
21
21
2
1
xx
xx
x
x
21 maximize xx
subject to
Adjacent vertices
[200, 200]
Objective score: 400
No improvement, so we’re done
![Page 69: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/69.jpg)
Another simplex example
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
Start at [0,0,0]
Adjacent vertices
[0,0,0] - 0
![Page 70: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/70.jpg)
Another simplex example
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
Start at [0,0,0]
Adjacent vertices
[200,0,0] - 200
[0,300,0] - 1800
[0,0,200] - 2600
[0,0,0] - 0
![Page 71: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/71.jpg)
Another simplex example
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
321 136 maximize xxx subject to
[200,0,0]
Adjacent vertices
[200,200,0] - 1400
[200,0,200] - 2800
[200,0,0] - 200
![Page 72: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/72.jpg)
Another simplex example
321 136 maximize xxx subject to
[200,200,0]
Adjacent vertices
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
[200,0,200] - 2800
[100,300,0] - 1900
[200,200,0] - 1400
![Page 73: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/73.jpg)
Another simplex example
321 136 maximize xxx subject to
[200,0,200]
Adjacent vertices
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
[0,0,200] - 2600
[0,300,100] - 3100
[200,0,200] - 2800
![Page 74: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/74.jpg)
Another simplex example
321 136 maximize xxx subject to
[0,300,100]
Adjacent vertices
0,,
6003
400
300
200
321
32
321
2
1
xxx
xx
xxx
x
x
[0,0,200] - 2600
[0,300,100] - 3100
[100,300,0] - 1900[0,300,0] - 1800
All others are lower, optimum found
![Page 75: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/75.jpg)
Simplex algorithm
let v be any vertex in the feasibility region While there is a neighbor v’ of v with better
objective value set v = v’
3 tasks to work out: determine a starting vertex check whether current vertex is optimal determine where to move next
![Page 76: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/76.jpg)
What defines a vertex? A vertex is specified by a set of n inequalities
(i.e. at the intersection of n hyperplanes)
adapted from figure 7.12 of [1]
![Page 77: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/77.jpg)
What defines a vertex? A vertex is specified by a set of n inequalities
(i.e. at the intersection of n hyperplanes)
adapted from figure 7.12 of [1]
![Page 78: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/78.jpg)
What defines a vertex? A vertex is specified by a set of n inequalities
(i.e. at the intersection of n hyperplanes)
adapted from figure 7.12 of [1]
![Page 79: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/79.jpg)
Can we define neighbors with respect to constraints? Two vertices are neighbors if they share n-1
defining constraints
adapted from figure 7.12 of [1]
![Page 80: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/80.jpg)
Determining the starting vertex
We’ll assume that the origin is in the feasible region and start here
0
x
bAx
xcT maximize
subject to
![Page 81: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/81.jpg)
Is the origin the optimal solution?
Assuming the origin is feasible Is the origin a vertex?
0
x
bAx
xcT maximize
subject to
![Page 82: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/82.jpg)
Is the origin the optimal solution?
Assuming the origin is feasible Is the origin a vertex? When is the origin an optimal vertex?
if all ci ≤ 0
0
x
bAx
xcT maximize
subject to
![Page 83: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/83.jpg)
Determining where to move next
If some ci > 0 then the origin is not optimal
We can increase the value of xi and it will increase the objective function
How much can we increase xi? Until we hit another constraint (i.e. a vertex)
0
x
bAx
xcT maximize
subject to
![Page 84: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/84.jpg)
For example
0
0
3
92
42
2
1
21
21
21
x
x
xx
xx
xx
21 52 maximize xx subject to
Is [0, 0] a feasible vertex?
Yes.
We have x ≥ 0 and all bi are positive
![Page 85: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/85.jpg)
For example
0
0
3
92
42
2
1
21
21
21
x
x
xx
xx
xx
21 52 maximize xx subject to
Is it optimal?
no, both ci are positive
![Page 86: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/86.jpg)
For example
0
0
3
92
42
2
1
21
21
21
x
x
xx
xx
xx
21 52 maximize xx subject to
How far can we increase x2?
x2 = 3
This gives us a new vertex at [0, 3]
![Page 87: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/87.jpg)
Simplex algorithm continued
We’ve shown how to check for optimality and move to a new vertex when we are at the origin
After we’ve moved to a new vertex, now what?
Idea: we can transform the problem so that the new point is at the origin
The details are beyond the scope of this class, but see pg. 215 of [1] for more details
![Page 88: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/88.jpg)
Simplex algorithm
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a better
solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
![Page 89: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/89.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
Given an LP, we have n variables, m inequality constraints and n constraints of the form x ≥ 0
![Page 90: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/90.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
What is the per iteration cost?
![Page 91: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/91.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
O(nm)
m constraints with up to n variables to determine how far we can move ci
ninii xaxaxa ...2211Solve:
For each constraint:
for all x fixed but xi
![Page 92: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/92.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
O(nm)
![Page 93: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/93.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
How many iterations?
![Page 94: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/94.jpg)
Running time
let v be any vertex in the feasibility region transform the LP so that v is the origin while a ci exists such that ci > 0 (i.e. a
better solution/vertex exists) pick some such ci and increase xi until a
constraint is tight (i.e. increasing xi further would move out of the feasibility space
set v = v’ transform the LP so that v is the origin
O(vertices)
How many vertices?
Each vertex is defined by n constraints and we have m + n constraints:
n
mn
exponential!
![Page 95: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/95.jpg)
Running time of simplex
Worst case is exponential There are theoretical examples that can be
created where the running time is exponential In practice, the algorithm is much faster
![Page 96: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/96.jpg)
Other LP solvers
Many other LP algorithms exist ellipsoid algorithm interior point methods (many of these)
Both of the above algorithms are O(polynomial time)
State of the art run-times are a toss up between interior point methods and simplex solvers
![Page 97: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/97.jpg)
Another example Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
![Page 98: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/98.jpg)
What is the profit for a month? Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
profit = revenue - costrevenue = carpets_sold * price
cost = employees * 2000 + overtime * 180 + hirings * 320 + firings * 400 + storage * 8
![Page 99: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/99.jpg)
Defining variables Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
profit = revenue - costrevenue = carpets_sold * price
cost = employees * 2000 + overtime * 180 + hirings * 320 + firings * 400 + storage * 8
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
ci = carpets sold in month i
![Page 100: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/100.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
ci = carpets sold in month iConstraints on carpets sold?
ii dc
iii sxc
![Page 101: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/101.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
How many carpets are made a month?
iii owx 20
ci = carpets sold in month i
![Page 102: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/102.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
How many workers do we have each month?
iiii fhww 1
ci = carpets sold in month i
![Page 103: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/103.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
How many carpets are stored?
iiii cxss 1
ci = carpets sold in month i
![Page 104: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/104.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
ii wo 6
ci = carpets sold in month i
![Page 105: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/105.jpg)
Constraints Carpet company: From our analysts, we’re given carpet demand
estimates for the next calendar year: d1,d2, …,dn. The company has 30 employees, each of which makes 20 carpets per month and gets paid $2000/mo.
The demand fluctuates from month to month. We can handle this demand in three ways: Overtime: Overtime costs 80% more than regular pay. Workers
can put in at most 30% overtime Hiring and firing, at a cost of $320 and $400 respectively per
worker Store extra carpets at a cost of $8 per carpet per month. We
must end the year without any stored carpets.
wi = number of employees during month i
xi = carpets made in month i
oi = number of carpets made with overtime
hi = number of hirings at beginning of month i
fi = number of firings at beginning of month i
si = number of carpets stored in month i
ci = carpets sold in month i Any other constraints?
0,,,,,, iiiiiii sfhowxc
![Page 106: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/106.jpg)
Maximizing profitprofit = revenue - cost
revenue = carpets_sold * price
cost = employees * 2000 + overtime * 180 + hirings * 320 + firings * 400 + storage * 8
Revenue?
ii pricecrevenue
![Page 107: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/107.jpg)
Maximizing profitprofit = revenue - cost
revenue = carpets_sold * price
cost = employees * 2000 + overtime * 180 + hirings * 320 + firings * 400 + storage * 8
Cost?
i
iw2000 i
io180 i
ih320 i
if400 i
if8
![Page 108: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/108.jpg)
Objective functionprofit = revenue - cost
revenue = carpets_sold * price
cost = employees * 2000 + overtime * 180 + hirings * 320 + firings * 400 + storage * 8
i i i i
iiiii
iii ffhowpricec )84003201802000( maximize
![Page 109: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/109.jpg)
The solution Given our problem formulation, we can plug it into a
solver (or write our own) and we’ll get a solution back if one exists
Are we done? Our solution may have non-integer values. How do
we sell .3 of a carpet? If the variable values are large, we can round and we won’t
be too far away from optimal If the variable values are small, then we need to be more
careful about our rounding decisions Integer (linear) programming is the linear
programming problem with integer solutions Like the 0-1 knapsack problem vs. the fractional knapsack
problem, the fractional problem is easier Integer programming is NP-complete
![Page 110: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/110.jpg)
Uses
operational problems network flow planning microeconomics
![Page 111: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/111.jpg)
Beyond LPs
ii bf )(x
)( maximize 0 xf
subject to
Convex optimization fi(c1x + c2y) = c1fi(x) + c2fi(y)
![Page 112: Linear Programming](https://reader036.vdocument.in/reader036/viewer/2022062517/5681328d550346895d9924f4/html5/thumbnails/112.jpg)
References
[1] Algorithms (2008). Sanjoy Dasgupta, Christos Papadimitiou and Umesh Vazirani.