8.4. UPDATING CONTROL FORCES 81
After grouping terms together, we find that, in the backward simulation, we will have to
solve a system of the form Ax D b in order to compute the adjoint velocities
O
v
n
. e system is
as follows:
M h
@f
@v
T
h
2
@f
@x
T
!
O
v
n
D
M
O
v
nC1
C
@
@v
n
T
C h
O
x
nC1
C h
@
@x
n
T
!
:
(8.10)
e right-hand side contains all known quantities. is means that it can just be computed
at every time step. One remarkable thing about this adjoint computation is that the left-hand side
of this system is exactly the same one as used in the forward simulation at the corresponding time
step. If you’re not sure about this, go ahead and look back to the chapter on implicit integration.
We can just save this matrix at every time step in the forward simulation and then use it again
for the backward simulation.
Not that much extra work. Just a little bit of extra storage. Well, by now you should know
that these matrices are big and having to save one for every time step will require a significant
amount of computer memory. is too will have a significant impact on performance. is trade-
off between less computation requirements but more storage needs is typical for adjoint methods.
Before starting a backward simulation, we will have to initialize the final adjoint states.
Initialization is done using
Oq
N
D
@
@q
N
T
:
(8.11)
ese states
@
@x
N
and
@
@v
N
equal x
N
x
N
and v
N
v
N
multiplied by their respective
goal function weights.
After solving this system, the adjoint velocities
O
v
n
are known and we can compute the
adjoint positions
O
x
n
using Equation (8.9). Again, we use the same Jacobian matrix
@f
@x
that we
saved in the corresponding step in the forward simulation.
8.4 UPDATING CONTROL FORCES
After solving the system to obtain the adjoint velocities, the adjoint positions can easily be com-
puted using Equation (8.9). Given these adjoint states, the gradient vector is computed using
the Formula (8.4).