Download Simplex Algorithm

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Equations of motion wikipedia , lookup

Schrödinger equation wikipedia , lookup

Euler equations (fluid dynamics) wikipedia , lookup

Dirac equation wikipedia , lookup

Van der Waals equation wikipedia , lookup

Exact solutions in general relativity wikipedia , lookup

Differential equation wikipedia , lookup

Derivation of the Navier–Stokes equations wikipedia , lookup

Equation of state wikipedia , lookup

Partial differential equation wikipedia , lookup

Heat equation wikipedia , lookup

Schwarzschild geodesics wikipedia , lookup

Transcript
Simplex Algorithm
Solving linear programming
problems algebraically
Initial Example: Maximise P = 10x + 12y
subject to the constraints:
x + y ≤ 40
(i)
x + 2y ≤ 75
(ii)
x ≥ 0, y ≥ 0.
Step 1: Introduce slack variables to convert the
non-trivial inequalities into equalities:
Equation (i): x + y + s = 40
s≥0
Equation (ii): x + 2y + t = 75
t≥0
s, t are slack variables.
Step 2: Rewrite the objective function so
that the RHS is a number:
P = 10x + 12y → P – 10x – 12y = 0.
Step 3: Write the objective function and the
non-trivial constraints in tableau format:
Tableau Format
P-10x-12y=0
x+y+s=40
x+2y+t=75
objective
constraints
Last
column
Pivotal column
P
1
0
0
x
-10
1
1
y
-12
1
2
s
0
1
0
t
0
0
1
l
0
40
75
Equation
(1)
(2)
(3)
The aim is to solve the equations by combining rows
together. The solution is reached when all entries in the
first row (except possibly the value in the The
lastshaded
column)
cells should
are non-negative.
be nonnegative
We begin by identifying the most negative entry in the
objective function row, here -12 in the y column.
We highlight the pivotal column.
We then divide every entry in the l column by the corresponding
value in the highlighted column.
Pick the least positive of these. This is the pivotal row.
Pivotal
column
P
1
0
0
x
-10
1
1
y
-12
1
2
s
0
1
0
t
0
0
1
pivot
l
0
40
75
Equation
Ratio
(1)
0/-12=0
(2)
40/1=40
(3)
75/2=37.5
P
1
0
0
x
-10
1
1
y
-12
1
2
s
0
1
0
t
0
0
1
l
0
40
75
Equation
Ratio
(1)
0/-12=0
(2)
40/1=40
(3)
75/2=37.5
Divide the pivotal row by the pivot value.
P
1
0
0
x
-4
½
½
y
0
0
1
s
0
0
0
t
6
-½
½
Equation
Ratio
l
450 (4)=(1)+12×(6) 450/-4=-112.5
2.5 (5) = (2) – (6) 2.5/0.5 = 5
37.5/0.5 = 75
(6) = (3)/2
37.5
The aim is to now get 0 entries elsewhere in the pivotal column.
We now repeat the process, first selecting the new pivotal column,
i.e. the one with the most negative value in the objective function
row.
P
1
0
0
x
-4
½
½
y
0
0
1
s
0
0
0
Equation
l
450 (4)=(1)+12×(6)
2.5 (5) = (2) – (6)
(6) = (3)/2
37.5
t
6
-½
½
Ratio
450/-4=-112.5
2.5/0.5 = 5
37.5/0.5 = 75
Having identified the pivotal row and the pivot value, we now
divide every entry in the pivotal row by the pivot value.
P
1
0
0
x
0
1
0
y
0
0
1
s
0
0
0
t
2
-1
1
l
470
5
35
Equation
(7)=(4)+4(8)
(8) = (5) ÷ ½
(9) = (6) – ½(8)
The process is now finished as every entry on the objective
function row is non-negative.
P
1
0
0
x
0
1
0
y
0
0
1
s
0
0
0
t
2
-1
1
l
470
5
35
Equation
(7)
(8)
(9)
The values of x, y and P can be read from
the table:
x = 5, y = 35, P = 470.
optimal solution.
This is the
Interpretation
Examination Question
A clocksmith makes 3 types of luxury watches. The mechanism for
each watch is assembled by hand by a skilled watchmaker and
then the complete watch is formed, weatherproofed and
packaged for sale by a fitter.
The table below shows the times (in mins) for each stage of the
process. It also gives the profits to be made on each watch.
Watch type Watchmaker
A
54
B
72
C
36
Fitter
60
36
48
Profit (£)
12
24
20
The watchmaker works for a maximum of 30 hours per week; the fitter
for 25 hours per week.
Let x, y, z represent the number of type A, B, C watches to be made
(respectively).
Setting up the problem
Watch type Watchmaker
A
54
B
72
C
36
Profit function: P =
Constraint 1:
Constraint 2:
Fitter
60
36
48
Profit (£)
12
24
20