00:00:02
welcome to another video today's uh
00:00:05
video is the first one in talking about
00:00:07
Duality um so first topic we're going to
00:00:10
talk about with Duality is uh what
00:00:12
you're the text the Hillier textbook
00:00:14
calls the fundamental Insight of the
00:00:16
Simplex method so uh let's think about a
00:00:21
linear program in Matrix form so uh
00:00:25
looking at this Matrix uh sort of see th
00:00:28
that those are the coeffic ients of the
00:00:31
objective vector and so we'll call Z our
00:00:35
objective value these are going to be
00:00:37
the uh
00:00:39
objective
00:00:42
coefficients and we can Co collect them
00:00:45
together
00:00:46
into uh a vector that we're multiplying
00:00:49
by our X Vector
00:00:52
X is our
00:00:56
variables and so a * X that's our con
00:01:00
that a is the constraint
00:01:08
Matrix and then the
00:01:10
B is the right hand side essentially the
00:01:13
limits of each of the
00:01:15
constraints uh and so typical
00:01:18
maximization problem in standard form uh
00:01:22
we with less than or equal to
00:01:24
constraints and then each of our
00:01:26
variables is constrained to be non-
00:01:28
negative
00:01:30
okay once we introduce slack variables
00:01:34
uh this is the starting Tableau for um
00:01:38
this problem so uh kind of labeling the
00:01:40
columns this First Column will be for Z
00:01:44
this is actually a chunk of columns
00:01:46
several columns and those are all the
00:01:48
columns corresponding to our original
00:01:51
variables these columns here and there's
00:01:54
going to be several of them uh those are
00:01:57
all the columns that correspond to our
00:01:59
slack VAR variables and then this here
00:02:02
is our right hand
00:02:04
side okay and then we could I guess
00:02:06
think of uh labeling the rows this top
00:02:09
row that I've got put here that's the
00:02:13
the zeroth row the row zero uh
00:02:15
corresponding to the objective and then
00:02:19
um all the rest of the rows and and this
00:02:21
is a whole Matrix here so there's
00:02:23
usually um M constraints and so this is
00:02:26
this part here actually represents all
00:02:28
the other rows um and those correspond
00:02:31
to our our um basis and we'll sort of
00:02:34
abbreviate all the variables that are in
00:02:37
our basis as x with a subscript of B for
00:02:40
for our basic
00:02:42
variables okay so this is our initial
00:02:45
tblo and then uh what normally happens
00:02:49
in the Simplex method is that uh we
00:02:51
choose an entering uh basic variable and
00:02:53
an exiting basic variable and then we do
00:02:56
row operations to change from this
00:02:57
Tableau to another Tableau and when we
00:03:00
move to another Tableau uh we always
00:03:02
make it so that our basic variables uh
00:03:05
have the standard basis vectors showing
00:03:08
up in those
00:03:09
columns okay well the elementary row
00:03:12
operations that we use to move from this
00:03:15
uh Tableau to the next Tableau uh we can
00:03:19
think of that as actually multiplying on
00:03:22
the left by a matrix okay and so when we
00:03:27
choose our basis um remember we always
00:03:31
have Z in our basis and then all the
00:03:33
columns that correspond to um our basis
00:03:37
we'll call those XB representing all the
00:03:40
variables in our
00:03:41
basis if you were to take those columns
00:03:44
out of this uh Tableau up here and
00:03:48
collect them all together into a matrix
00:03:51
and this will be this will have um m +
00:03:54
one columns and m+ one rows um because
00:03:57
there's M basic variables one for each
00:03:59
constraint um as well as the Z kind of
00:04:02
is the bonus basic variable um that's
00:04:05
always
00:04:08
there okay so uh we take The Columns of
00:04:12
the basis collect them here uh We've
00:04:14
called B basis Matrix um these are the
00:04:17
columns uh of a and potentially of I um
00:04:22
that show up in the basis uh negative CB
00:04:26
so um remember when we get our
00:04:30
objective we've got Z equals c transpose
00:04:34
X um but we want to get all of our
00:04:37
variables on to the right uh to the left
00:04:39
side and so we switch this to be Z minus
00:04:42
cpose x equals z um and that's why we
00:04:46
got a zero right here um at the
00:04:48
beginning so um we get the negative
00:04:52
coefficients showing up in the top row
00:04:54
and then any of the basic variables
00:04:56
they're either original variables and
00:04:58
then they'd have sort of a negative
00:05:00
whatever their original coefficient was
00:05:02
or if they were slack variables they
00:05:04
started off with zero as their uh
00:05:07
coefficient in the objective row and so
00:05:10
this CB is the negative coefficients of
00:05:13
the cost Vector that's the objective
00:05:15
Vector um corresponding to the basis
00:05:18
okay and if it's a slack variable in the
00:05:21
basis it's got zero for the initial cost
00:05:24
or for the for the cost Vector
00:05:26
value okay so what we need to do is uh
00:05:30
when we do our row operations we change
00:05:33
all of these columns to the standard
00:05:36
basis vectors okay so one Z z0 and0 One
00:05:40
z z z and so forth okay where there's
00:05:44
only one one in each column and um yeah
00:05:49
and and whichever row that one uh ends
00:05:51
up in is the row that corresponds to
00:05:54
that um basic variable okay so what we
00:05:58
need to do is essentially turn this into
00:06:01
the identity okay and uh if we want to
00:06:03
turn a matrix into an the identity
00:06:06
Matrix we need to multiply by the
00:06:08
inverse of that Matrix so uh there are
00:06:11
some nice formulas for how to do an
00:06:14
inverse of a block Matrix so this is
00:06:17
sort of a matrix of matrices so this B
00:06:19
is a full Matrix here um there's some
00:06:22
nice formulas out there um I'm not going
00:06:24
to drive them but I'll I'll essentially
00:06:25
show you what the the inverse Matrix is
00:06:28
in this case
00:06:30
and so if we think about here's the
00:06:33
Matrix we're going to use and we want to
00:06:35
multiply by uh one this is actually a
00:06:39
zero Vector here's a negative CB
00:06:43
transpose and
00:06:46
B and we want to choose a matrix here so
00:06:49
that we end up with a one here a
00:06:53
zero Vector transposed essentially a
00:06:56
zero row there a zero Vector here here
00:06:59
and an identity M uh Matrix
00:07:03
there that's our that's our goal okay um
00:07:08
and so let's let's choose something
00:07:09
that's going to get us there um we're
00:07:12
going to need a one here a zero here um
00:07:18
to get rid of B we're going to need a b
00:07:21
inverse here and then the tricky part
00:07:24
here is that we multiply by CB transpose
00:07:27
B inverse
00:07:30
okay let's verify that this when we
00:07:33
multiply these together gives us this so
00:07:36
when multiplying block
00:07:37
matrices it's almost as long as the
00:07:41
blocks are sort of consistent with each
00:07:42
other it's just like multiplying
00:07:44
matrices so I'll multiply first row by
00:07:47
First Column and so 1 * 1 and this times
00:07:51
the zero Vector that will give us 1 + 0
00:07:58
uh and that's not a vector that's number
00:08:00
okay and so that gives us the one that
00:08:03
we want that's good uh let's do this uh
00:08:07
row times this column to get this entry
00:08:09
over here and so we get 1 * negative CB
00:08:12
transpose is going to be CB transpose
00:08:16
and then we'll get uh
00:08:19
plus this times B and so
00:08:22
CB transpose B inverse
00:08:28
B okay
00:08:30
uh then let's do this row times this
00:08:32
column so 0 * 1 plus b inverse * 0 and
00:08:36
that's going to give us a zero
00:08:39
Vector zero Vector plus another zero
00:08:41
vector and then finally we'll do this
00:08:44
row times this column and so 0 time
00:08:48
negative CB transposed is going to give
00:08:50
us a zero technically it's going to give
00:08:52
us a zero Matrix uh but then we'll get
00:08:55
plus uh B inverse time B so uh sort of a
00:09:00
zero Matrix plus b inverse time
00:09:05
B okay so 1 + 0 is 1 that's what we want
00:09:10
there we get a zero Vector here that's
00:09:12
good up here B inverse time B is the
00:09:15
identity Matrix so that essentially
00:09:17
disappears and it leaves us with
00:09:18
negative CB transpose plus CB transpose
00:09:22
and those will then cancel each other
00:09:24
out and give us zero finally down here
00:09:27
we got 0 + B inverse * B is the identity
00:09:30
and so 0 plus the identity is just the
00:09:32
identity Matrix so this is going to
00:09:37
be or uh this is our inverse of this uh
00:09:41
since they multiply together to give us
00:09:43
the identity Matrix okay so now what we
00:09:47
want to do is our row operations are
00:09:50
equivalent to multiplying on the left by
00:09:52
this
00:09:54
Matrix so uh let's go ahead and and do
00:09:58
that and let's take our initial Tableau
00:10:00
oopsie our initial Tableau and multiply
00:10:03
on the left by this
00:10:04
Matrix so we'll have the Matrix one CB
00:10:09
transpose B inverse to and zero and B
00:10:13
inverse and we want to multiply by our
00:10:18
Tableau so
00:10:21
onega C transpose zero transpose and
00:10:27
zero and then zero
00:10:31
Vector um a
00:10:33
matrix identity Matrix and a rightand
00:10:37
side
00:10:40
Vector okay let's go ahead and do that
00:10:42
multiplication uh we'll do the top top
00:10:44
row
00:10:48
first uh using the top row of here and
00:10:50
then multiplying down each of the
00:10:52
separate columns there and
00:10:55
so this times this will give us 1 * 1
00:10:58
plus this time Z that * Z will cancel
00:11:01
that out and so we'll get just
00:11:04
one now let's do this times this and
00:11:08
we'll get 1 * negative C
00:11:10
transpose is negative C transpose
00:11:14
plus CB transpose B inverse
00:11:20
a and then we'll do this times this 1 *
00:11:24
0 plus this * the identity Matrix
00:11:27
remember that the identity Matrix is
00:11:29
like multiplying by one it doesn't
00:11:31
change anything and so that times that
00:11:34
will give us just CB transpose B inverse
00:11:39
and then this times this will give us 1
00:11:43
* 0 + CB transpose B
00:11:47
inverse
00:11:49
B okay that's our top row our objective
00:11:52
row now let's go ahead and do the bottom
00:11:54
row so we're multiplying by 0 and B
00:11:56
inverse 0 * 1 is 0 B inverse time 0 is 0
00:12:01
and so we get zero there and that
00:12:03
corresponds with what we expect we
00:12:05
expect the First Column that corresponds
00:12:07
to our um
00:12:10
Z to always be one followed by
00:12:14
zeros now we'll take this times this and
00:12:18
uh this zero will essentially zero out
00:12:20
everything in the top row and we'll be
00:12:22
left with just B inverse a and then this
00:12:26
times this will give us just B inverse
00:12:29
and this times this will give us B
00:12:33
inverse
00:12:35
B okay let's label those columns uh so
00:12:39
this is going to be all of our original
00:12:41
variables X these are all our slack
00:12:44
variables and this is our right hand
00:12:48
side okay let's uh call out and label
00:12:52
what these are um kind of maybe I'll go
00:12:56
ahead and kind of draw separators in
00:13:02
here and think about what each of these
00:13:06
are okay so first
00:13:09
off
00:13:12
um kind of thinking through this is what
00:13:15
we'll notice is we get B inverse right
00:13:18
here and so if you're doing your row
00:13:23
operations uh the B inverse Matrix is
00:13:27
the Matrix directly under your SL slack
00:13:29
variables and so uh I'll say this is
00:13:32
going to be
00:13:33
useful later on and that we can always
00:13:36
find our B inverse Matrix after doing
00:13:38
our row operations and know what is that
00:13:41
b inverse Matrix
00:13:44
okay here is the right hand side uh and
00:13:48
it's the right hand side and it's uh the
00:13:51
right hand side after transformation and
00:13:53
if and if you think about what we do
00:13:55
that right hand side tells us what our
00:13:57
current solution is for our basic
00:13:59
variables and so we're going to call
00:14:01
this XB it is the value of our basic
00:14:06
variables at our current solution right
00:14:09
and then remember all of our non-basic
00:14:11
variables are set to zero so this is
00:14:13
essentially our current solution it's
00:14:15
going to be a vector that's not quite
00:14:17
long enough because it it will only have
00:14:19
the basic variables in there but all the
00:14:21
other uh variables are than zero
00:14:26
okay let's uh introduce this quantity
00:14:30
here so underneath the slack
00:14:34
variables uh this quantity here we'll
00:14:37
call this y
00:14:38
transpose and these are what we call the
00:14:42
Dual variables we're going to talk about
00:14:45
duality in just a bit um these are the
00:14:49
Dual variables um they have a little bit
00:14:52
of a um interpretation as Shadow prices
00:14:55
that we'll talk about in just a bit um
00:14:58
and and yeah so we can kind of
00:15:01
abbreviate uh essentially the quantity
00:15:04
CB transpose B inverse as uh we'll call
00:15:08
that y y transpose it's going to be the
00:15:12
values in the objective row beneath the
00:15:15
slack variables and we'll talk a little
00:15:17
bit more about what those mean in a
00:15:19
little
00:15:21
bit okay uh let's uh look at this value
00:15:26
here
00:15:29
this is the
00:15:32
current objective
00:15:40
value okay and so if we take the costs
00:15:44
or the yeah the objective values
00:15:46
corresponding to the basic variables we
00:15:49
multiply it by B inverse and then by B
00:15:52
um our right hand side we get our
00:15:55
objective Uh current objective value um
00:16:02
but we just introduced the fact that
00:16:04
we're calling this quantity here our y
00:16:07
transpose and so we can think of this as
00:16:09
also y transpose B so if we take these
00:16:13
dual variables and multiply them by our
00:16:16
original right hand side um that gets us
00:16:19
our current objective
00:16:22
value okay uh and then maybe the last
00:16:25
thing uh I'll point out here
00:16:32
is the objective row value as underneath
00:16:36
our original variables um so this is
00:16:39
going to be let me actually um relabel
00:16:42
this as being y transposed because we
00:16:43
see another copy of that CB transpose B
00:16:47
inverse and so this is going to be uh y
00:16:52
transpose a minus C
00:16:56
transpose okay uh these are called uh
00:17:00
reduced
00:17:05
cost uh of the original variable um sort
00:17:08
of thinking of uh they had their
00:17:11
original cost is this negative C
00:17:13
transpose and then uh it's reduced by
00:17:16
whatever y transpose a is and we'll talk
00:17:19
a little bit about what that means in a
00:17:21
little bit later on too okay um this
00:17:26
it's optimal or current basis is optimal
00:17:31
if y transpose a minus cpose the
00:17:35
quantities uh underneath the original
00:17:38
variables
00:17:40
there let me slide this up a little bit
00:17:43
it's optimal if all of those reduced
00:17:46
costs are greater than or equal to zero
00:17:48
for an OP for a maximization problem as
00:17:52
well as we also need the values
00:17:54
underneath s to to be uh greater than or
00:17:58
equal to Z Z so we also need that y
00:18:00
transpose is greater than or equal to
00:18:01
zero okay so our
00:18:04
our Tableau or our basis is
00:18:08
optimal exactly
00:18:10
if uh this condition holds and this
00:18:14
condition holds and if you look at that
00:18:16
that almost looks like
00:18:18
constraints uh for like a non-
00:18:22
negativity constraint on my dual
00:18:24
variables as well as another uh
00:18:27
constraint involving my a Matrix on um
00:18:30
on my dual variables as well so um
00:18:33
interesting and that's going to be
00:18:35
essentially the heart of duality in just
00:18:37
a
00:18:43
second that's it for this video in the
00:18:46
next video we'll talk about Shadow
00:18:48
prices