Lecture 4

advertisement
4. Linear Programming
(Graphics)
Objectives:
1. Sketching a straight line
2. Half-planes - sketching inequalities
3. Simultaneous inequalities determining a region
Refs: B&Z 5.1.
Graphing Inequalities
We know how to graph equations of the form
y  mx c
slope m
y

An equation like
c
ax by  c
-c/m
x
is also the equation
of a straight line.
y=mx+c

Written in this form, the y-intercept is c/b,
the x-intercept is c/a and the gradient is -a/b.
Example 1:
4x  2y  8
y
y-intercept: 8/-2=-4

x-intercept: 8/4=2
gradient:-4/-2=2
4x-2y=8
2
-4
x
Notice that the straight line has divided the plane
into two half-planes.
In fact any straight line divides the plane into two
half planes.
Now let’s go back to our equation 4x  2y  8
If we replace the equality by an inequality, can we
represent this graphically? y
Let’s do some exploration.
4x-2y=8

Where do the points
(0,0), (-2,1), (-1,-2) lie?
They are all in the same
half plane.
2
-4
x
Now let’s evaluate 4 x  2y at these points.
(0,0)
(-2,1)
(-1,-2)
4(0)-2(0)=0
4(-2)-2(1)=-10
4(-1)-2(-2)=0
Notice that all of these values are ≤ 8.
Indeed all points in the left
half-plane give values ≤ 8.
y
4x-2y=8
Try some more for
yourself.
2
-4
x
Now identify the points (3,0), (4,1), (2,-2) on the graph.
They are all in
the right half-plane.
y
4x-2y=8
2
x
-4
If we evaluate 4 x  2y
at these points

(3,0)
4(3)-2(0)=12
(4,1)
4(4)-2(1)=14
(2,-2)
4(2)-2(-2)=12
we find that all of these values are ≥ 8.
This is no accident!
It turns out if the function has value ≤ c (or ≥) for some
point in the half-plane, then the function has value ≤ c (or ≥)
for all points in the half-plane.
So to sketch the inequality
4x  2y  8
we need only to check one point (not on the line).
The value of the function at this point will tell us which
 we want.
half-plane is the one
Note that if the inequality is strict
(<, > rather than ≤, ≥) we indicate this by a dotted line.
So far this is too easy!
What happens if we have a system of simultaneous
inequalities?
Example 2:
Sketch the region determined by
We must determine the region
which satisfies all four inequalities.
2x  2y  6
5x  2y  10
x  0, y  0
On the diagram we will shade the excluded region.
y
5

3
The first step is to indicate
the lines
x 0
y 0
2
3
x
5x+2y=10
2x+2y=6
2x  2y  6
5x  2y  10
on the graph.
y
5
3
2
3
x
5x+2y=10
2x+2y=6
Now we can determine which half-planes to include.
(a) x ≥ 0 - any point with negative x-co-ordinate is excluded.
(b) y ≥ 0 - any point with negative y-co-ordinate is excluded.
(c) 2x+2y ≤ 6 - try the point (3,3). 2(3)+2(3)=12 ≥ 6,
so the half-plane containing (3,3) is excluded
(d) 5x +2y ≤ 10 - try the point (1,1). 5(1)+2(1)=7 ≤ 10,
so the half-plane containing (1,1) is included.
y
3
3
x
2x+2y=6
Any point within this region will satisfy all
of the inequalities
You may now do
Questions 1 and 2,
Example Sheet 2
From the Orange Book.
Download