Unit 2 Module 1 Notes - Linear Programming
Unit 2 Module 1 Notes - Linear Programming
Introduction
Linear Programming: a mathematical method used to find the ‘best’ solution to problems which can be
expressed in terms of linear equations or inequalities. Solutions are usually found by drawing graphs of
inequalities and looking for optimum values that satisfy the required conditions. This method is widely
used in business and industrial contexts and the problems often relate to obtaining maximum profits for
given costs and production levels.
Variables: items whose quantities are controlled. Variables can take various values within a problem.
For graphical solutions we can only have two variables (one on each axis).
Constraints: equations or inequalities, involving one or more of the variables, which limit or control the
values the variable(s) can take. In linear programming most (if not all) of the constraints are inequalities.
Feasible region: the set of points on the graph which satisfy all the constraints. The feasible region is
usually left unshaded in linear programming graphs.
Exercise
1. A school librarian is ordering new books. He has a total budget of $1000. He must order at least
three books on discrete mathematics and at least three books in pure mathematics. Discrete
books cost $120 each and pure books cost $150.
2. A gardener grows carrots and lettuce on a plot 2 m wide. A 10 cm strip is needed for a row of
carrots and a 50 cm strip is needed for a row of lettuce. He uses a seed dispenser that has to be
filled twice in order to sow a row of carrot seeds and once for a row of lettuce and he only has
time to fill the dispenser at most 22 times.
1
Optimisation
Objective: the purpose of the linear programming problem – e.g. costs, profits.
Objective function: an expression, involving the variables, which is to be maximised or minimised. This
is sometimes called the profit function.
Optimum solution or optimal solution: the combination of the variables that gives the ‘best’ solution to
the problem.
Every point in the feasible region is a solution to the problem. In linear programming there are two
methods used to find the optimal solution - i.e. the solution which minimises costs or maximises profits.
Any set of constraints will always generate a convex shape, the feasible region. A set of parallel lines
with gradient equal to the objective function and with the first one passing through the point of least
profit, will pass through the other vertices, in order, round each side, giving increased profit, until the
maximum profit is reached.
Exercise
2
Integer Solutions
When integer solutions are required the integer points within the feasible region must be considered to
find the one with the best profit or cost. In this case we consider the integer points closest to the
boundary of the feasible region.
Exercise
Multiple Solutions
There are two cases when multiple solutions occur.
The profit line is parallel to one of the constraints. All points on that line (in the feasible region)
have an equal profit and are, therefore, optimum solutions.
If an integer solution is required and the maximum profit occurs at a point with non-integer
values, more than one point in the feasible region have the same ‘maximum’ profit and are
therefore all optimum solutions.
Exercise
Minimisation Problems
Problems which are about minimising costs are solved using the same procedure as problems about
maximising profits. However, there are differences.
The feasible region is infinite.
The origin is NOT feasible, therefore, a vertex on one of the axes is usually taken as a starting
point for a tour of vertices.
The cost line starts towards the top right of the graph and moves towards the origin to find the
lowest cost.
Exercise
1. Minimise 𝑥 + 2𝑦 subject to 4𝑥 + 5𝑦 ≥ 40, 8𝑥 + 3𝑦 ≥ 48
2. Minimise 𝑥 + 𝑦 subject to 3𝑥 + 5𝑦 ≥ 30, 3𝑥 + 2𝑦 ≥ 24
(a) when 𝑥 and 𝑦 can take any values
(b) when 𝑥 and 𝑦 must be integers.
3
3. A diamond company has two mines. The first costs $15 000 a day to operate and will produce in
one day 1 kg of jewel grade diamonds, 2 kg of medium grade and 5 kg of industrial grade. The
second mine costs $22 000 a day, and produces in one day 4 kg of jewel grade diamonds, 1 kg of
medium grade and 6 kg of industrial grade. The company must produce at least 8 kg of jewel
grade, 8 kg of medium grade and 30 kg of industrial grade diamonds each month. How many
days should it operate each mine to meet this quota as cheaply as possible is
(a) It can use a mine for only part of a day
(b) It must use each mine for a whole number of days.
3 or More Variables
In real-world situations many linear programming problems will have more than two variables.
Problems involving 3 variables can be solved graphically using 3-dimensional axes. The feasible region
becomes a convex polyhedron, with each constraint becoming the equation of a plane – the face of the
polyhedron.
For problems in (three or) more than three variables the constraints are modelled by equations and are
solved using
matrices
simultaneous equations.
[Problems involving three or more variables will NOT be tested.]
Exercise
A recycling company makes three grades of recycled paper. Let 𝑎 be the number of boxes of grade 1
paper, 𝑏 be the number of boxes of grade 2 paper and 𝑐 be the number of boxes of grade 3 paper that
the company can make during the day. The table below shows how much recycled newspaper and how
much non-recycled newspaper it takes to make one box of each grade of paper.
Recycled newspaper Non-recycled newspaper
One box of grade 1 paper 10 kg 90 kg
One box of grade 2 paper 25 kg 60 kg
One box of grade 3 paper 80 kg 0 kg
The company has 785 kg of recycled newspaper and 540 kg of non-recycled newspaper.
(a) Write down two inequalities that must be satisfied by the variables, other than that they must
be non-negative.
(b) What other restriction applies to 𝑎, 𝑏 and 𝑐.
Each box of grade 1 paper sold gives a profit of $70, each box of grade 2 paper sold gives a profit of $120
and each box of grade 3 paper sold gives a profit of $180. The company wants to maximise the daily
profit from the sale of the paper.
(c) Write down the objective function for this problem assuming that the company can sell all the
boxes of paper that they make. (OCR)
Bibliography
Discrete & Decision Ian Bloomfield and John Stevens
4
UNIT 2: MATHEMATICAL APPLICATIONS
Graph Theory
Introduction
The graphs discussed in Graph Theory are not like the graphs used in Algebra or Statistics. They are
collections of dots, called vertices (or nodes), that may or may not be connected to each other by lines,
called edges (or arcs).
Graph – a simple way to model connectedness. We use the graph to show the connectedness of the
original real-world situation.
or by multiple edges.
B D E B
C H D
F
F
H G
G E
The two graphs above show the same connectivity. Therefore they may be used to represent the same
data.
5
Different graphs which have the same connectedness are isomorphic. Isomorphic graphs must have the
same number of vertices and the vertices must be connected together in the same manner.
An adjacency matrix is also used to represent the information. The elements represent the number of
direct routes between the vertices. [Note: A vertex which has a loop has 2 routes to itself – one in each
direction].
A B C D E F G H
A - 0 1 0 0 0 0 0
B 0 - 1 0 0 0 0 0
C 1 1 - 1 0 0 0 1
D 0 0 1 - 1 0 0 1
E 0 0 0 1 - 0 1 0
F 0 0 0 0 0 - 1 0
G 0 0 0 0 1 1 - 1
H 0 0 1 1 0 0 1 -
A trail (or route) is a sequence of edges such that the end vertex of one edge is the start vertex of the
next.
A closed trail is one where the initial and final vertices are the same.
A path is a trail with the restriction that no vertex is passed more than once.
A cycle is a closed trail where only the initial and final vertices are the same. Although one vertex is
allowed to be used twice – at the beginning and the end – no edge is allowed to be used twice.
6
Exercise
1. From the eight graphs below, pick out the four pairs which are isomorphic to each other.
7
Types of Graphs
A simple graph is a graph without loops or multiple edges.
The table below shows ALL the simple graphs with 1, 2 or 3 edges.
3 8
The degree or order or valency of a vertex is the number of edges at the vertex. Each of the vertices of
the graph above is of order 2. If the number of edges is even, the vertex has even order; if odd, the
vertex has odd order.
A Loop (i.e an edge that starts and finishes at the same vertex) is counted twice .
A complete graph: a simple graph in which each of the vertices is connected by precisely one
edge to every other vertex.
K1 K2 K3
K4
8
Proof: Each vertex is connected to the other n – 1 vertices
A connected graph: If it is possible to find a route from any vertex to another vertex the graph is
said to be connected.
A bipartite (two part) graph has two sets of vertices. The edges only connect the vertices from
one set to the other set (and do not connect vertices within sets).
K3,2
Every vertex in one set does not have to be connected to all the vertices in the other set.
If every vertex in one set is connected to every vertex in the other set, the graph is called a complete
bipartite graph. If there are m vertices in the first set and n vertices in the second set, the complete
bipartite graph is denoted by Km,n.
Bipartite graphs can be used to represent matching, allocation and transportation problems.
A Eulerian graph is a connected graph which has a closed trail with every edge traversed once
only.
A connected graph is Eulerian if and only if every vertex has even order.
If the start vertex and the finish vertex are not the same, the graph is called semi-Eulerian. That is the
trail is not closed. A connected graph is semi-Eulerian if and only if two of its vertices are of odd order
and all the other vertices are of even order.
9
Exercise
10
A planar graph is a graph with no crossing edges.
K4 K4 in planar form.
Exercise
A network is a graph carrying information such as lengths, costs or times as weights on the
edges. Networks are used to model real-world problems. A network may also be modeled by an
adjacency matrix. The elements of the matrix are the weights on the edges. The matrix is called
a weight (or distance) matrix.
11
Exercise
Exercise
12
Critical Path Analysis
Introduction
Real-world problems can often be analysed using mathematical models. Problems involving multiple
activities may be modeled by networks. Critical Path Analysis (CPA) or Critical Path Method (CPM) is
then used to determine the ‘best’ course of action in order to complete the task most efficiently.
Procedure
STEP 1: Make a table which list the following
1. all the activities
2. the time (duration) that each activity will take to complete
3. the dependencies between the activities
4. logical end points such as milestones or deliverable it
STEP 2: Draw a network (using activity on vertex) to model the schedule of events.
The (vertices) events are represented by squares which are divided into four sections as shown
in the diagram below.
1 2
3 4
Section 1 contains the event name (the activity coming in to the event).
Section 2 contains the duration of the event (i.e. the duration of the activity coming in
to the event).
Section 3 contains the earliest start time.
Section 4 contains the latest start time.
13
STEP 3: Analyse the problem.
Each activity has an earliest start time and a latest start time associated with it. These are the
earliest and latest times an activity can commence without affecting the completion date of the
project
We perform a forward pass through the network to determine the earliest start times. Then
we perform a backward pass through the network to determine the latest start times.
These times are written in the appropriate sections of the event squares.
1. Complete section 4 of the FINISH event with the same time as that in its section 3. That is,
for the FINISH event
earliest start time = latest start time = completion time for the project
2. For each previous event:
a. consider each activity leaving from it (i.e. going towards the start), subtract the
duration of the activity from the latest finish time(s) of the event(s) coming in to it;
b. label the event’s latest start time with the smallest of these.
3. The latest start time of the START event is 0.
Critical activities are the activities for which the earliest start time and the latest start times are
the same. A change in the duration of a critical activity results in a corresponding change in the
completion time for the project. These activities make up the critical path.
A critical path is a path from the START event to the FINISH event consists of critical activities
only. It is the longest path contained in a network. A network may have more than one critical
path but in each case the completion time is the same.
14
Float
Float (or slack) is a measure of the facility to alter the timings (start or duration) of an activity without
affecting the overall completion time of the project. There are three types of float.
1. Total float for an activity is a measure of the facility for an activity to change if it is the only one
being changed. It is the difference between the latest and earliest start times of the activity.
2. Independent float for an activity is a measure of the facility for this activity to change without
affecting the float times of other activities.
Note: latest finish time of an activity is the sum of its latest start time and its duration
3. Interfering float for an activity is the part of the float which is not independent, but interferes
with the float of the other activities.
Crashing a network
If the duration of one (or more) event is changed sufficiently to change the overall project time or the
activities forming the critical path or both, it is said to be crashing the network.
15
EXAMPLE:
The table below shows the activities involved in completing a project, together with their durations and
immediate predecessors.
(a) Draw an activity network for the project given in the table above
(b) Find the critical path and the duration of the project.
(c) If the duration of each activity is increased by a day, by how much will the project
completion be delayed?
(d) Calculate the float times for activity C, activity E and activity F.
SOLUTION:
(a)
A 3 C 2 G 7
0 4 5 7 7 9
E 5 FINISH
START 11 11 16 16
0 0
B 5 D 6 F 2
0 0 5 5 11 14
(b) Activities B, D and E are critical activities. Therefore the critical path is B D E.
The completion time is 16. Therefore the project duration is 16 days.
(c) It will be delayed by 3 days (since 1 day added to each critical event will increase the
project duration by an additional day.
For activity E
Total float = 11 – 11 = 0
Independent float = 16 – max ((7+2), (5+6) – 5 = 16 – 11 – 5 = 0
16
Interfering float = 0 – 0 = 0
For activity F
Total float = 14 – 11 = 3
Independent float = 16 – 11 – 2 = 3
Interfering float = 3 – 3 = 0
Bibliography
Discrete Mathematics 1 Stan Dolan
17