ExampleProgramming problems are concerned with the efficient use or allocation of limited resources to meet desired
Transportation problem
Activity analysis problem
Diet problem
Mathematical background
Linear inequalities
Solution of linear equations
Linear programming problem
Find extreme points
Find minimum cost feasible solution
Simplex procedure
Reference
A subclass of programming problems called Linear Programming problems. In LP the description of the problem can be stated linearly. AX = b with the cost function cX.
Each LP problem has:
1) no solution in terms of non-neg values of the variables
2) A non-neg soln. that yields an infinite value to cost.
3) A non-neg soln. that yields a finite value to cost.
assume sum a i = sum b j . Find x ij that min cost.
m < n
given m = 2, n = 3
cij = 1 2 4
3 2 1
x11 x12 x13
5
x21 x22 x23
10
8 5 2
---> store 1,2,3
|
v warehouse 1,2
for example: the amount shipped from w1, w2 are:
x11 + x12 + x13
= 5
x21 + x22 + x23
= 10
the total amount of shipped to three stores
x11 + x21 = 8
x12 + x22 = 5
x13 + x23 = 2
m = no. of resources
n = no. of products
a ij = unit of resource i required to produce j
b i = max. units of resource i available
c j = profit per unit of product j
x j = the amount produced of product j (level of activity)
x j >= 0
the cost function c j . x j, constraints
AX <= b
m = no. of nutrient
n = no. of foods.
a ij = no. of mg of nutrient i in one unit of food j
b i = min. of mg of nutrient i required
c j = cost per unit of food j
x j = no. of unit of food j to be purchased (x i
> 0)
AX >= b
with min. cX
C subset of En is convex if every pairs U1
U2
in C:
U = a1U1 + a2U2
is in C
Example all space E n , a circle, a cube
THM 1: any point on the line joins between two points in En is convex combination of two points
example: U,V are points, W = (1-a)V + aU 0 <= a <= 1
Def: Extreme point (xp) is U that is not a convex combination of other point in C.
Def: Convex hull C(S) , S is set of points, is a set of
every convex combination of points from S. C(S) is the
smallest convex set that contains S.
example: S are 8 points of a cube, C(S) is the whole cube.
If S is finite, C(S) is called convex polyhedron (point is the xp)
Def: Simplex is n-D convex polyhedron that has exactly n+1 vertices. A simplex in 0-D is a point, 2-D is a triangle.
P1, P2, P0 is column vectors
x1P1 + x2P2
>=
P0, P is a point in 5-D
Find x1 x2 that satisfies 1..5
The solution is convex region in n-D.
Transform inequality to equality by adding "slack variables" n - m
variables. (n varibles, m equations)
example: x1 - 2x2 + 3x3 >= 6
to x1 - 2x2 + 3x3 - x4 = 6
Some system may not have solution:
x1 + x2 <= 1
2x1 + 2x2 >= 3.
Gauss and Jordan elimination method: multiply by A" ("inverse)
A" A X = A" b
X = A" b
A must be non-singular (det /= 0 )
any variable can be chosen first to be eliminated.
example
x1 + x2 -x3 = 2 (1)
-2x1 + x2 +x3 = 3 (2)
x1 + x2 +x3 = 6 (3)
step 1
to eliminate x1 from (1) do 2(1) + (2)
to eliminate x1 from (3) do -1(1) + (3)
x1 + x2 -x3 = 2
3x2 -x3 = 7
2x3 = 4
step 2
to eliminate x2 from (1) do -1(2)/3 + (1)
x1 -2/3 x3 = -1/3
x2 -1/3 x3 = 7/3
2 x3 = 4
step 3
the pivot element now is 2 (in (3)) do (3)/2 . 2/3 + (1)
and (3)/2 . 1/3 - (1).
x1
= 1
x2
= 3
x3
= 2
this is equivalent to transforming
1 1 -1
A = -2 1 1
1 1 1
to an identity matrix
1 0 0
I = 0 1 0
0 0 1
both finding a solution and inversing A can be done at the same time using a matrix form
(A|I|b)
(A" A|A" I|A" b) = (I|A"|X) X is the solution
where A" is inverse of A
example: do previous example
1 1 -1 | 1 0 0 | 2
-2 1 1 | 0 1 0 | 3
1 1 1 | 0 0 1 | 6
step 1
1 1 -1 | 1 0 0 | 2
0 3 -1 | 2 1 0 | 7
0 0 2 |-1 0 1 | 4
step 2
1 0 -2/3 | 1/3 -1/3 0 | -1/3
0 1 -1/3 | 2/3 1/3 0 |
7/3
0 0 2 | -1
0 1 | 4
step 3
1 0 0 | 0 -1/3 1/3 | 1
0 1 0 | 1/2 1/3 1/6 | 3
0 0 1 | -1/2 0 1/2 | 2
A" is
0 -1/3 1/3
1/2 1/3 1/6
-1/2 0 1/2
The linear combination of P1, P2 and P3 is
1P1 + 3P2 + 2P3 = P0
P1 = (0 1/2 -1/2)' P2
= (-1/3 1/3 0)' P3 = (1/3 1/6 1/2)' P0
= (2 3 6)'
where ' is tranpose
A system of linear equation AX = b is said to be "homogeneous"
if b = 0. Such a system has the trivial
solution X = 0.
x1P1 + x2P2 + .. xnPn = P0
THM 2: set of all feasible soln. to LP is a convex set.
Proof show every convex combination of 2 feas. soln. is feasible solution.
let X1, X2 be the feasible soln.
AX1 = b, AX2 = b, X1
>= 0 , X2 >= 0.
let 0 <= a <= 1 and X = aX1 + (1-a)X2
AX = A[aX1 + (1-a)X2]
= aAX1 + (1-a)AX2
= ab + b - ab
= b
therefore X is a fea.soln. QED
Let K be convex set of soln. of LP
K is a region in En.
1) K = void no soln.
2) K is region unbounded min. may be infinite
3) K is convex polyhedron min. finite
there are many soln. find one the min cX. K is convex hull of xp of K. Look at xp to find min.feasible soln.
THM 3 if P1, P2...Pm
m <= n vector is linearly independent
x1P1 + x2P2
+
... xnPn = P0 xi
>= 0
then a point X (x1,...xm, 0..0) is xp of the convex set of fea.soln. with n-m element is 0.
Collorary every xp of K has m linearly independent vector from P1, P2...Pn.
How many xp to look at ?
combination( n,m ) = n!/(m! (n-m)!)
Select one xp, look to its neighbour that has lower cost, typically looks about m to 2m points. Can detect no finite min. soln. or no feasible.soln.
start: X = (x1,x2,...xm,0,..0)
x1P1 + x2P2
+ ...xmPm = P0 xi
>= 0 (1)
assume next xp exists
P1..Pm linearly independent use as basis
to express all other vectors in n
sum i = 1 to m ( x ij P i ) =
P j j = 1...n
let one vector not in the basis P m+1 has x i,m+1
> 0
x 1,m+1 P1 + x 2,m+1
P2 + ... x m,m+1 Pm = P m+1
(2)
(1) - Z(2)
(x1 - Zx1,m+1)P1
+ (x2 -Zx 2,m+1)P2 + ... (xm
- Zx m,m+1)Pm + ZP m+1 = P0
(3)
x' = (xi - Zx i,m+1, ... ) be
fea.soln. x' >= 0
xi - Zx i,m+1 >= 0,
x i,m+1 >= 0
xi/ x i,m+1 >=
Z
0 < Z <= min i xi/ x
i,m+1
with this condition (3) will be a feasible soln. We want
to inspect only xp which has only m independent,
must force some variable to be zero. Assume it is the first one:
Z0 = x1/x 1,m+1
the soln. will be new feasible soln.
x2'P2 + x3'P3
+ ... xm'Pm + x m+1'P m+1 =
P0
xi' = xi - Z0 x
i,m+1
i = 2..n
x m+1' = Z0
Possibility
x i,m+1 > 0 can move to a new xp
x i,m+1 <= 0 no finite min. soln.
initial xp x1 = 0, x3 = 0, x4 = 7, x5 = 12, x6 = 10, in vector notation:
7P4 + 12P3 + 10P6 = P0 (1)
the basis vectors P4, P3, P6 are unit vectors. We want to introduce P1 to obtain another xp. P1 in terms of this basis is:
3P4 + 2P3 -4P6 = P1 (2)
that is, x41 = 3, x51 = 2, x61 = -4
do (1) - Z(2)
(7 - 3Z)P4 + (12 - 2Z)P5 - (10 - 4Z)P6 + ZP1 = P0 (3)
both x41 = 3, and x51 = 2 are positive, Z0 is determined
Z = Z0 = min xi/xi1 = 7/3
substitute Z into (3), eliminate P4,
22/3 P5 + 58/3 P6 + 7/3 P1 = P0 (4)
this is a new xp.
If instead of P1 we try P2
-P4 -4P5 -3P6 = P2 (5)
and develop P0 in terms of P4 P5 P6 P2:
(7 + Z)P4 + (12 + 4Z)P5 + (10 + 3Z)P6 + ZP2 = P0 (6)
from (6) any Z > 0 yields a fea.soln. Here all xi2 < 0, we do not obtain a new xp.
Given X0 (starting point) (x10, x20...xm0)
and P1...Pm
x10P1 + x20P2
+ ... xm0Pm = P0 (1)
x10c1 + x20c2
+
... xm0cm = w0 xi0
>=
0 (2)
other points
x1jP1 + x2jP2
+ ... xmjPj = Pj j = 1..n
(3)
x1jc1 + x2jc2
+ ... xmjcj = wj
(4)
THM 4 if w j - c j > 0 there is feasible soln. which w < w 0 (can select a new basis which reduce the cost)
THM 5 at X (x10, x20...xm0) if w j - c j <= 0 for all j then X is a min feasible soln.
(1) - Z(3) and (2) - Z(4)
(x10 - Zx1j)P1 +
(x20 - Zx2j)P2 + ... (xm0 -
Zxmj)Pm + ZPj = P0
(5)
(x10 - Zx1j)c1 +
(x20 - Zx2j)c2 + ... (xm0 -
Zxmj)cm + Zcj = w0 -
Z(wj-cj) (6)
mul Zcj on both side of (6)
If every coeff of P1...Pm, Pj >= 0
will have feasible soln. at cost w0 - Z(w j -c
j )
and Z > 0 if w j- c j > 0 then w < w0
BX0 = P0
X0 = B" P0
X0 = (x10,...xm0) >= 0
Xj = B" Pj
Xj = (x1j,...xmj) >= 0
start: (P0|P1..Pm|
Pm+1..Pn)
(P0|B|Pm+1..Pn)
mul B"
(X0|Im|Xm+1...Xn)
find c j and w j - c j
which j that w j - c j > 0 if not found,
stop at min feasible soln.
assume select k
Z0 = min i xi0/xik
xik > 0
if xik <= 0 the soln. has unbounded min.
select to eliminate Pl and add Pk
new basis is (P1...Pl-1,
Pl+1, Pm, Pk)
subject to
x1 + 3x2 - x3 + 2x5
= 7
- 2x2 + 4x3 + x4
= 12
- 4x2 + 3x3
+ 8x5 + x6 = 10
xi >= 0
start: select P1 P4 P6 as the basis, the corresponding soln is X0 = (x1 x4 x6) = (7,12,10), w0 = 0
choose max j (w j - c j ) = w3 - c3 = 3 > 0 select P3
Z0 is min. of xi0/xi3 for xi3 > 0 that is:
min (12/4, 10/3) = 12/4 = Z0 hence P4 is eliminated, we obtain a new solution
X0' = (x1 x3 x6) = (10,3,1)
and the cost is -9
step 2 choose max j (w j ' - c j ) = w 2
' - c2 = 1/2 > 0
and Z0 = 10/(5/2) , P2 is introduced into the
basis and P1 is eliminated. A third soln. is obtained
X0'' = (x2 x3 x6) = (4,5,11)
the cost is -11,
Since max(wj'' - cj) = 0 this soln is a min. feasible soln.
last update 20 September 2002
P. Chongstitvatana
END