Spacetime Constraints

Spacetime Constraints
Witkin & Kass
Siggraph 1988
Overview
• Unlike common Newtonian dynamic
simulation, the due driving force is
unknown
• Specify the high-level spacetime constraint
and let the optimization solve for the
position and force unknowns by minimizing
the “energy consumption”
2
3
Lamp on
floor
4
Problem Statement
(single particle)
Governing Equation (Motion Equation):
mx  f  mg  0
Boundary Conditions:
f(t)
g
x(0)  a, x(T )  b
Object Function (Energy Consumption):
T
R   | f (t ) |2 dt
0
5
Discretize continuous function
Discretize unknown function x(t) and f(t)
as:
x1, x2, …xi, … xn-1, xn
1
i
n
f1, f2, …fi, … fn-1, fn
Our goal is to solve these discretized
2n values… x1xn satisfies goals
while optimizing f1fn
Next step is to discretize our motion
equation and object equation.
6
Difference
Formula
h
h
xi - 0.5
xi - 1
xi 
xi + 0.5
xi
xi + 1
xi  xi 1 xi 1  xi xi 1  xi 1


h
h
2h
Backward
xi 0.5  xi 0.5
xi 
h
Forward
Central
xi 1  xi xi  xi 1

xi 1  2 xi  xi 1
h
h


h
h2
Central
7
Discretized Function
Motion equation:
x
x3, f3
x2, f2
x4, f4
mx  f  mg  0 
m
( xi 1  2 xi  xi 1 )  f i  mg  0, i  2, 3
h2
Boundary Conditions:
x1, f1
t
Object Function:
T
R   | f (t ) |2 dt
0
4
 R   | f i |2
i 1
x(0)  a  x1  a
x(T )  b  x4  b
When does R have minimum value?
R
0
f i
R
R
R
R
0
0
0
0
f1
f 2
f 3
f 4
8
Generalize Our Notation
Unknown vector:
S = (S1, S2, …Sn)
x
x2, f2
x3, f3
x4, f4
Constraint Functions:
Ci(S) = 0
x1, f1
Minimize Object Function R(S):
t
S = (x1, x2, x3, x4, f1, f2, f3, f4)
m
( xi 1  2 xi  xi 1 )  f i  mg  0, i  2, 3
2
h
x1  a x4  b
Ci
J ij 
S j
R
0
S
2R
H ij 
S i S j
R
R
R
R
0
0
0
0
x1
x2
x3
x4
R
R
R
R
0
0
0
0
f1
f 2
f 3
f 4
9
Sequential Quadratic Programming (SQP)
Step One
Pick a guess S0, evaluate
R
S
Most likely
R
0
S
Taylor series expansion of function f(x) at point a is:
f ( x)  f (a)  f ' (a)( x  a) 
Similarly, we have:
Set equal to 0
1 ''
f (a)( x  a) 2  O(( x  a) 2 )
2!
R R

S S
S  S0
2R
 2
S
( S  S 0 )  O(( S  S 0 ) 2 )
S  S0
R

 H ij ( S0 )( S  S0 ) 
S S  S0
S  S0  S
or
Omit
S  S0  S  S1'
S is the change to S0 that makes
derivative equal to 0
10
SQP Step Two
Now we got S1’, evaluate our constraints Ci(S1’), if equal to 0, we are done
but most likely it will not evaluate to 0 in the first several steps.
So, let’s say Ci(S1’) ≠ 0, let’s apply Taylor series expansion on
the constraint function Ci(S) at point S1’ :
C ( S )  C ( S1' ) 
Set equal to 0
C
S
( S  S1' )  O(( S  S1' ) 2 )
S  S1'
Omit
 C ( S1' )  J ij ( S1' )( S  S1' ) 
S  S1'  S 
or
S1  S 0  S  S 
S  S1'  S   S 0  S  S 
so
S 0  S1
S is the change to S0 that makes
derivative equal to 0
Then we will continue with step one and step two until we got a solution
Sn which minimizes our object function and also satisfies our constraints.
S0  S1’  S1  S2’  S2  …  Sn
11
Graphical Explanation of SQP
C(S)
R
S
S2’
S0
S1
’
S2
S1
S
12
13
Homework
Spacetime Particle (2D version)
Discretize unknown function x(t) and f(t)
as:
x1, x2, …xi, … xn-1, xn
f1, f2, …fi, … fn-1, fn
Our goal is to solve these discretized
2n values… x1xn satisfies goals
while optimizing f1fn
1
i
n
Discretize, (xi,fi) as variables, minimize sum of fi.fi
Formulate as constrained optimization.
15