MASSACHUSETTS INSTITUTE OF TECHNOLOGY

advertisement
MASSACHUSETTS INSTITUTE OF TECHNOLOGY
Department of Civil and Environmental Engineering
1.731 Water Resource Systems
Lecture 11, Differential Constraints and Response Matrices, Oct. 5, 2006
Standard formulation of optimization problem relies on algebraic constraints. In many
environmental applications constraints arise most naturally as differential equations. How
should these differential constraints be handled?
Example – Allocation of waste heat discharges along a stream
Problem is to select heat discharges WA and WB at 2 locations xA and xB along stream in order to
maximize total heat discharged WA + WB, subject to upper limit (Tmax) on water temperature T.
T(x)
Tmax
Stream temperature
profile
T
Q
0
x
x
WA
WB Heat sources
L
x
Incorporate model based on stream energy balance (relates heat discharges and stream
temperature):
dE
dT
= 0 = ργQ
+ k e Aργ (T − T0 ) + W Aδ ( x − x A ) + W B δ ( x − x B ) ; T (0) = T0
dt
dx
E = Energy per unit length [Joules/m]
3
ρ = Density of water [kg/m ]
γ = Specific heat of water [Joules/(kg ° C)]
3
Q = Stream flow [m /day]
T = Water temperature [° C]
T0 = Air temperature [° C]
2
A = Stream cross-section [m ]
ke = Exchange rate [1/day]
1
WA , WB Source heat flux [Joules/ day]
δ(x - xA), δ(x - xB) = Dirac delta function at xA or xB [1/m], defined by:
xU
∫x L
f ( x)δ ( x − x' )dx = f ( x' ) x L < x' ≤ xU
=0
otherwise
Assume steady state (dE/dt = 0) and simplify to:
dT
= −α (T − T0 ) + W Aδ ( x − x A ) + W B δ ( x − x B ) ; T (0) = T0
dx
α=
ke A
Q
β=
1
ργQ
Suppose solution to this equation at any x is T(x, WA, WB). Then optimization problem is:
Maximize W A + W B
W A,W B
such that :
T ( x, W A , W B ) ≤ Tmax
; ∀x
Note that the temperature constraint as given here is evaluated at every x (infinite number of
algebraic constraints).
There are three ways to write the constraint T ( x, W A , W B ) ≤ Tmax in a practical (finite) form:
1. Analytical solution - T ( x,W A ,WB ) is written as an explicit function of WA and WB.
2. Imbedding - T ( x,W A ,WB ) is defined implicitly, by a set of discretized model
equations.
3. Response matrix - T ( x,W A ,WB ) is approximated by a Taylor series expressed in
terms of model sensitivity derivatives.
Analytical solution
Solution to stream equation with upstream boundary condition imposed:
x
∫
T ( x, W A , W B ) = T0 + β W A e
−α ( x − ξ )
x
δ (ξ − x A ) dξ + β W B ∫ e −α ( x − ξ )δ (ξ − x B ) dξ
0
0
Apply definition of δ function to get:
T ( x, W A , W B ) = T0
x ≤ xA
T ( x, W A , W B ) = T0 + β W A e −α ( x − x A )
xA < x ≤ xB
T ( x, W A , W B ) = T0 + β W A e −α ( x − x A ) + β W B e −α ( x − x B )
x > xB
B
2
B
Note that temperature is highest at the discharge points xA and xB. Therefore, we can apply
temperature constraint only at xA and xB rather than at all points x:
Maximize W A + W B
W A,W B
such that :
T0 + βW A − Tmax ≤ 0
at x A
T0 + βW A e −α ( x B − x A ) + βWB − Tmax ≤ 0 at x B
This is in standard form, with algebraic rather than differential constraints. This approach is best
when analytical solution is available, but that is not usually the case.
Imbedding
When an analytical solution is not available an approximate numerical solution can be obtained
by discretizing the differential equation over a computational grid of equally spaced points x1, x2,
…, xN..
In this example use either of two approximations for the spatial derivative at each computational
grid point:
T ( xi +1 ) − T ( xi ) Ti +1 − Ti
∂T
≈
=
Forward difference (explicit)
∂x x
Δx
Δx
i
T ( xi ) − T ( xi −1 ) Ti − Ti −1
∂T
≈
=
Backward difference (implicit)
∂x x
Δx
Δx
i
The Dirac delta function is approximated by 1/Δx.
The explicit discretization yields a set of N coupled equations as follows:
Ti = T0
xi = x0
Ti +1 = Ti − αΔx(Ti − T0 )
x0 < xi ≤ xA
Ti +1 = Ti − αΔx(Ti − T0 ) + βW A
Ti +1 = Ti − αΔx(Ti − T0 ) + β WB
xA < xi ≤ xB
B
xi > xB
B
These first-order difference equations have the same general form as the reservoir storage
equation in Problem Set 3.
The system of equations obtained from the implicit discretization is most conveniently
expressed in matrix form:
Aki Ti = bk (W A ,WB ) i, k = 1,K, N
where Aii = 1
Ai,i-1 = αΔx-1
Ai,k =0
for i =1,…, N
for i =2,…, N
otherwise
3
bi = T0
for i =1
bi = αΔxT0
for i >1 and xi ≠ xA or xB
bi = βWΑ + αΔxT0
for xi = xA
bi = βWΒ + αΔxT0
for xi = xB
B
B
Both the explicit and implicit discretizations are in a form that can be inserted directly into
optimization software such as GAMS (note that the implicit matrix equation does need not be
solved and the decision variables only appear on the right-hand side – the implicit constraints
relating each Ti to WA and WB are sufficient).
B
The disadavantage of imbedding is the large number of decision variables and constraints it
produces (one for each grid point for each scalar differential equation). This is particularly
inefficient in the example problem since we really only care about the temperature solutions at
the two points xA and xB . Solutions at all the other upstream points need to be computed in order
to obtain these two temperatures.
B
Response Matrix
Response matrix methods represent differential constraints with efficient linear approximations.
Assume we have a numerical model available to evaluate temperatures T ( x A , W A ) and
T ( x B ,W A , WB ) at the discrete locations xA and xB, for any set of decision variables WA and WB.
B
B
TA=T(xA ,WA)
WA, WB
Numerical Model
(“Black Box”)
TB=T(xB ,WA ,WB)
Other inputs:
α,β,T0
Expand these temperatures in a Taylor series around nominal decision values (e.g. WA = WB = 0):
B
RAA
T ( x A ,W A ) = T ( x A ,0) +
∂T ( x A ,W A )
WA + K
∂W A
W A =0
T ( x B ,W A ,W B ) = T ( x B ,0,0) +
∂T ( x B ,W A ,0)
∂T ( x B ,0,W B )
WA +
WB + K
∂W A
∂W B
W A =0
WB = 0
RBA
RBB
Associate the sensitivity derivatives with the elements of a response matrix R and rearrange equations:
⎡T0 ⎤ ⎡ R AA
⎢T ⎥ + ⎢ R
⎣ 0 ⎦ ⎣ BA
0 ⎤ ⎡W A ⎤ ⎡T A ⎤
=
R BB ⎥⎦ ⎢⎣WB ⎥⎦ ⎢⎣TB ⎥⎦
4
Resulting constraints for the optimization problem are:
0 ⎤ ⎡W A ⎤ ⎡Tmax ⎤
⎡T0 ⎤ ⎡ R AA
⎢T ⎥ + ⎢ R
⎥
⎥⎢ ⎥ ≤ ⎢
⎣ 0 ⎦ ⎣ BA R BB ⎦ ⎣W B ⎦ ⎣Tmax ⎦
In this example the response matrix approximation is exact because the differential constraints
are linear in the decision variables. Consequently, the response matrix elements can be identified
directly from the analytical solutions above.
More generally, we derive the sensitivity derivatives numerically, from multiple model
evaluations. For example:
T ( x B , ε ,0) − T ( x B ,0,0)
R BA ≈
ε
This approach does not require knowledge of the model equations (i.e. the model can be a “black
box”).
The response matrix approach can also be used to approximate nonlinear differential
constraints, so long as the Taylor series expansion is sufficiently accurate.
5
Download