Solving Linear Programs 1.0 Basic Form: C) X (H X F
Solving Linear Programs 1.0 Basic Form: C) X (H X F
Solving Linear Programs 1.0 Basic Form: C) X (H X F
1
min f ( x)
s.t. g ( x)b (4)
2
min f ( x)
s.t. g ( x)b
(5)
x0
3. No lower bounds on g(x): It is possible that a
problem has constraints like cl<g(x)<ch. In this
case, the right hand side g(x)<ch is already in the
correct form, but the left hand side cl<g(x) is not.
In this case, we can multiply both sides by -1,
resulting in
g(x)<-cl (6)
The negative right-hand-side is addressed in the
next bullet-point.
4. Negative right-hand-sides: We also require that all
elements of b be nonnegative. This may seem to
contradict the step we took in eq. (3) and (6)
above. However, we will see at the end of these
notes that it is possible to convert inequalities like
these, with a negative right-hand-side, to the
desirable form.
3
“We will call such intersection points corner
points. Therefore we see that our solution will
always be at a corner point. This provides us
with a basis for solution to LPs: Search the
corner points!”
This is an effective approach, and if you take it, you
will always find the right answer. However, you may
also be doing a great deal of work. In our second
example (Section 3.0) of our previous notes
(IntroLP), we considered following LP:
max f ( x, y) 5x 8 y
Subject to
40 x 30 y 480 (person 1)
24 x 32 y 480 (person 2)
20 x 24 y 480 (person 3)
x 0, y 0
and the constraints are visualized in Fig. 1.
4
Fig. 1: Constraints for example problem
5
This number of corner points is a combinatorial
problem, characterized by 5 distinct things
(constraints) taken 2 at a time, i.e.,
5 5! 5 * 4 * 3 * 2 *1
2 2!(5 2)! (2 *1)(3 * 2 *1) 10
We can easily distinguish feasible and infeasible
corner points from Fig. 1. However, it will not be so
easy for larger problems, especially when there are
many decision variables and we cannot easily
visualize the constraints in 2-D as we are doing here.
One could perhaps devise a means to check them all,
but it would be highly computational. For example,
consider having just 40 constraints, there would be
780 corner points to check. Some problems have
millions of constraints.
6
5
4 2
2 6
2
100
90
3
2 7 80
2
70
60
50
8
2 40
2
30
9
20
1 10
2 5 10
7
Our strategy is as follows:
1. Pick a corner point at random.
2. Move to an adjacent corner point that is better.
a. If there are two that are better, move to the one
that is best.
b. If there are no better adjacent corner points,
the current corner point is the solution to the
problem.
Let’s apply this strategy to the problem of Fig. 2,
assuming we are maximizing the function. We also
assume that we initially choose corner point 1.
8
At corner point 5, there are two options: corner point
4, with f4=95, or corner point 6, with f6=97. Both of
these are worse than corner point 5. So we are done,
and corner point 5 is the solution with f5=100 as the
maximum value of the problem.
9
With the above optimality condition in place, we may
outline the algorithm that we are going to study for
solving linear programs. It is called the Simplex
Method, and at a high level, is like this [1]:
1. Initialization: Start at a corner point solution.
2. Iterative step: Move to a better adjacent corner
point feasible solution.
3. Optimality test: Determine if the current feasible
corner point is optimal using our optimality test (if
none of its adjacent feasible corner points are
better, then the current feasible corner point is
optimal).
a. If the current feasible corner point is
optimal, the solution has been found, and the
method terminates.
b. If the current feasible corner point is not
optimal, then go to 2.
10
It is hard to conceptualize now, but at that time, there
was no notion of an objective function. Neither was
there any understanding that physical constraints on
resources could be represented by linear inequalities.
Dantzig recognized both of these; in addition, he
developed the simplex method we are about to study.
11
5.0 Setting up the simplex Method
12
Therefore, the first inequality, x1<4, may be replaced
with
x1 x3 4, x3 0 (7)
We may similarly introduce slack variables into the
other constraints, so that our original LP is converted
to the following equivalent LP.
max F 3 x1 5 x2
s.t.
x1 x3 4
2 x2 x4 12
3 x1 2 x2 x5 18
(8)
x1 0, x2 0, x3 0, x4 0, x5 0
We need a few definitions:
Equality form: In contrast to the original inequality
13
Basic solution: An augmented corner-point solution.
For example, consider the corner point infeasible
solution (4,6) in the example. Augmenting it with the
slack variable values x3=0, x4=0, and x5=-6 yields the
corresponding basic solution (4,6,0,0,-6). This basic
solution is infeasible, as indicated by the presence of
the negative slack variable x5. This point is illustrated
by the ‘O’ in Fig. 3.
Basic feasible solution: A feasible augmented
corner-point solution. For example, consider the
corner point feasible solution (0,6) in the example.
Augmenting it with the slack variables x3=4, x4=0,
and x5=6 yields the corresponding basic feasible
solution (0,6,4,0,6). This basic solution is feasible.
This point is illustrated by the ‘X’ in Fig. 3.
14
Fig. 3: Illustration
15
h( x ) c
h( x ) c
h( x ) c (3)
This results in a negative right-hand-side;
assuming elements of c are all positive, then the
second equation above would have all negative
right-hand sides.
max F 3 x1 5 x2
s.t.
x1 x3 4
2 x2 x4 12
3 x1 2 x2 x5 18
x1 0, x2 0, x3 0, x4 0, x5 0
16
Let’s extract the one equation with the negative
right-hand-side:
3x1 2 x2 x5 18 (9)
Now we multiply by -1 to get
3x1 2 x2 x5 18 (10)
Although this creates the positive right-hand-side
that we need, we will see later on that our
initialization procedure to find a feasible solution
will fail here, because it will result in x5=-18 and
therefore violates variable nonnegativity. As a
result, we must add another slack variable here,
resulting in
3x1 2 x2 x5 x6 18 (10)
Now we have that the right-hand-side is positive
and our initialization procedure will result in
x6=18, satisfying decision variable nonnegativity
and nonnegativity on the element in b.
17