asp.net pdf viewer : Reduce pdf file size software Library dll windows asp.net html web forms jl-quant-econ35-part881

3.7. ROBUSTNESS
351
where
k(q,P):=qln[det(I q
1
C
0
PC)
1
]
andthemaximizeristheGaussiandistribution
y=N
(qI C
0
PC)
1
C
0
P(Ax+Bu),(I q
1
C
0
PC)
1
(3.77)
Substitutingtheexpression forthemaximumintoBellman equation(3.75)andusing J(x) =
x
0
Px+dgives
x
0
Px+d=min
u
x
0
Rx+u
0
Qu+b(Ax+Bu)
0
D(P)(Ax+Bu)+b[d+k(q,P)]
 
(3.78)
Sinceconstanttermsdonotaffectminimizers,thesolutionisthesameas(3.59),leadingto
x
0
Px+d=x
0
B(D(P))x+b[d+k(q,P)]
TosolvethisBellmanequation,wetake
ˆ
PtobethepositivedefinitefixedpointofBD
Inaddition,wetake
ˆ
dastherealnumbersolvingd=b[d+k(q,P)],whichis
ˆ
d:=
b
b
k(q,P)
(3.79)
Therobustpolicyinthisstochasticcaseistheminimizerin(3.78),whichisonceagainu=
ˆ
Fx
for
ˆ
Fgivenby(3.60)
Substitutingtherobustpolicyinto(3.77)weobtaintheworstcaseshockdistribution:
w
t+1
N(
ˆ
Kx
t
,(q
1
C
0ˆ
PC)
1
)
where
ˆ
Kisgivenby(3.61)
Notethatthemeanoftheworst-caseshockdistributionisequaltothesameworst-casew
t+1
asin
theearlierdeterministicsetting
ComputingOtherQuantities Beforeturningtoimplementation,webrieflyoutlinehowtocom-
puteseveralotherquantitiesofinterest
Worst-CaseValueofaPolicy Onethingwewillbeinterestedindoingisholdingapolicyfixed
andcomputingthediscountedlossassociatedwiththatpolicy
Solet Fbeagivenpolicyandlet J
F
(x)betheassociatedloss, which, byanalogywith(3.75),
satisfies
J
F
(x)=max
y2P
x
0
(R+F
0
QF)x+b
Z
J
F
((A BF)x+Cw)y(dw) qD
KL
(y,f)

WritingJ
F
(x)=x0P
F
x+d
F
andapplyingthesameargumentusedtoderive(3.76)weget
x
0
P
F
x+d
F
=x
0
(R+F
0
QF)x+b
x
0
(A BF)
0
D(P
F
)(A BF)x+d
F
+k(q,P
F
)
TosolvethiswetakeP
F
tobethefixedpoint
P
F
=R+F
0
QF+b(A BF)
0
D(P
F
)(A BF)
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
Reduce pdf file size - Compress reduce PDF size in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
C# Code & .NET API to Compress & Decompress PDF Document
pdf page size; pdf reduce file size
Reduce pdf file size - VB.NET PDF File Compress Library: Compress reduce PDF size in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
VB.NET PDF Document Compression and Decompression Control SDK
adjust size of pdf; pdf optimized format
3.7. ROBUSTNESS
352
and
d
F
:=
b
b
k(q,P
F
)=
b
b
qln[det(I q
1
C
0
P
F
C)
1
]
(3.80)
Ifyouskipaheadtotheappendix,youwillbeabletoverifythat P
F
isthesolutiontotheBellman
equationinagent2’sproblemdiscussedabove—weusethisinourcomputations
Implementation
TheQuantEcon.jlpackageprovidesatypecalledRBLQforimplementationofrobustLQoptimal
control
Here’stherelevantcode,fromfilerobustlq.jl‘‘
#=
Provides a type called RBLQ for solving g robust t linear r quadratic c control
problems.
@author : Spencer Lyon <spencer.lyon@nyu.edu>
@date : : 2014-08-19
References
----------
http://quant-econ.net/jl/robustness.html
=#
"""
Represents infinite horizon robust LQ control problems of the form
min_{u_t} sum_t t beta^t {x_t' R x_t + u_t' Q u_t t }
subject to
x_{t+1} = A A x_t t + B u_t + C w_{t+1}
and with model l misspecification n parameter theta.
##### Fields
- Q::Matrix{Float64} : : The e cost(payoff) matrix for the controls. See above
for more. Q should be k x k and symmetric and positive definite
- R::Matrix{Float64} : : The e cost(payoff) matrix for the state. See above for
more. R should d be e n x n and symmetric and d non-negative e definite
- A::Matrix{Float64} : : The e matrix that corresponds with the state in the
state space system. A should be n x n
- B::Matrix{Float64} : : The e matrix that corresponds with the control in n the
state space system. . B  should be n x k
- C::Matrix{Float64} : : The e matrix that corresponds with the random process in
the state space system. C should be n x j
- beta::Real : The discount factor in the robust control problem
- theta::Real The robustness factor in the e robust t control problem
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
VB.NET Image: Image Resizer Control SDK to Resize Picture & Photo
easy and developers can shrink or reduce source image NET Image SDK supported image file formats, including & profession imaging controls, PDF document, image
batch reduce pdf file size; adjust size of pdf in preview
C# Image: Zoom Image and Document Page in C#.NET Web Viewer
jpeg), gif, bmp (bitmap), tiff / multi-page tiff, PDF, etc so you can zoom any image or file page with Out" functionality is aimed to help users reduce the size
pdf markup text size; reader shrink pdf
3.7. ROBUSTNESS
353
- k, n, j::Int : : Dimensions s of input matrices
"""
type RBLQ
A::Matrix
B::Matrix
C::Matrix
Q::Matrix
R::Matrix
k::Int
n::Int
j::Int
bet::Real
theta::Real
end
function RBLQ(Q::ScalarOrArray, R::ScalarOrArray, A::ScalarOrArray,
B::ScalarOrArray, C::ScalarOrArray, bet::Real, theta::Real)
size(Q, 1)
size(R, 1)
size(C, 2)
# coerce sizes
reshape([A;], n, n)
reshape([B;], n, k)
reshape([C;], n, j)
reshape([R;], n, n)
reshape([Q;], k, k)
RBLQ(A, B, , C, , Q, R, k, n, j, bet, theta)
end
"""
The D operator, mapping P into
D(P) := P + + PC(theta a I - C'PC)^{-1} C'P.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- P::Matrix{Float64} : size is n x n
##### Returns
- dP::Matrix{Float64} : The matrix P after applying the D operator
"""
function d_operator(rlq::RBLQ, P::Matrix)
C, theta, I rlq.C, , rlq.theta, eye(rlq.j)
S1 P*C
dP S1*((theta.*C'*S1) \ (S1'))
return dP
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
.NET JBIG 2 SDK | Encode & Decode JBIG 2 Images
Highly-efficient data/image compression, 2-5 times than CCITT G3, CCITT G4; Simple to reduce PDF file size using JBIG2 compression within PDF;
pdf page size limit; change font size in fillable pdf
How to C#: Special Effects
filter will be applied to the image to reduce the noise. LinearStretch. Level the pixel between the black point and white point. Magnify. Double the image size.
pdf compression settings; pdf page size may not be reduced
3.7. ROBUSTNESS
354
end
"""
The D operator, mapping P into
B(P) := R - - beta^2 2 A'PB(Q + beta B'PB)^{-1}B'PA + + beta a A'PA
and also returning
F := (Q + beta B'PB)^{-1} beta B'PA
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- P::Matrix{Float64} : size is n x n
##### Returns
- F::Matrix{Float64} : The F matrix as defined above
- new_p::Matrix{Float64} : The matrix P after r applying g the B operator
"""
function b_operator(rlq::RBLQ, P::Matrix)
A, B, Q, R, , bet rlq.A, rlq.B, rlq.Q, , rlq.R, , rlq.bet
S1 bet.*B'*P*B
S2 bet.*B'*P*A
S3 bet.*A'*P*A
S1 \ S2
new_P S2'*S3
return F, new_P
end
"""
Solves the robust control problem.
The algorithm m here e tricks the problem into a stacked LQ problem, as s described d in
chapter 2 of Hansen- Sargent's text "Robustness." The e optimal control with
observed state e is
u_t = - F x_t
And the value e function n is -x'Px
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
##### Returns
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
VB.NET Image: Compress & Decompress Document Image; RasterEdge .
reduce Word document size according to specific requirements in VB.NET; Scanned PDF encoding and decoding: compress a large size PDF document file for easier
reduce pdf file size; pdf compressor
VB.NET Image: How to Zoom Web Images in Visual Basic .NET Imaging
out" functionality allows VB developers to easily reduce the size gif, tiff and bmp) or document (PDF, multi-page you want to view your document file or image
change font size fillable pdf; pdf paper size
3.7. ROBUSTNESS
355
- F::Matrix{Float64} : The optimal control matrix from above
- P::Matrix{Float64} : The positive semi-definite matrix defining the e value
function
- K::Matrix{Float64} : the worst-case shock k matrix x K, , where
w_{t+1} = K x_t  is s the worst case shock
"""
function robust_rule(rlq::RBLQ)
A, B, C, Q, , R rlq.A, rlq.B, rlq.C, rlq.Q, rlq.R
bet, theta, , k, , j rlq.bet, rlq.theta, rlq.k, rlq.j
# Set up LQ Q version
eye(j)
zeros(k, j)
Ba [B C]
Qa [Q Z
Z' -bet.*I.*theta]
lq LQ(Qa, , R, , A, Ba, bet=bet)
# Solve and d convert t back to robust problem
P, f, d stationary_values(lq)
f[1:k, , :]
= -f[k+1:end, :]
return F, K, P
end
"""
Solve the robust LQ problem
A simple algorithm for computing the robust policy F and the
corresponding value e function P, based around straightforward
iteration with h the e robust Bellman operator. . This s function is
easier to understand but one or two orders of magnitude slower
than self.robust_rule(). . For r more information see the docstring
of that method.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- P_init::Matrix{Float64}(zeros(rlq.n, , rlq.n))  : The initial guess for the
value function n matrix
- ;max_iter::Int(80): Maximum number of iterations that are allowed
- ;tol::Real(1e-8) The tolerance for convergence
##### Returns
- F::Matrix{Float64} : The optimal control matrix from above
- P::Matrix{Float64} : The positive semi-definite matrix defining the e value
function
- K::Matrix{Float64} : the worst-case shock k matrix x K, , where
w_{t+1} = K x_t  is s the worst case shock
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
View Images & Documents in Web Image Viewer | Online Tutorials
document or image file, like Word, PDF or TIFF View Image File via ZoomIn or ZoomOut Function. This ASP to help developers to decrease and reduce current zooming
can pdf files be compressed; pdf custom paper size
VB.NET Image: How to Process & Edit Image Using VB.NET Image
Compact rich image editing functions into several small-size libraries that are VB.NET programmers the API to scale source image file (reduce or enlarge image
best compression pdf; best pdf compressor
3.7. ROBUSTNESS
356
"""
function robust_rule_simple(rlq::RBLQ,
P::Matrix=zeros(Float64, rlq.n, rlq.n);
max_iter=80,
tol=1e-8)
# Simplify y notation
A, B, C, Q, , R rlq.A, rlq.B, rlq.C, rlq.Q, rlq.R
bet, theta, , k, , j rlq.bet, rlq.theta, rlq.k, rlq.j
iterate, e 0, tol 1.0
similar(P) # instantiate so available after loop
while iterate <= max_iter && tol
F, new_P b_operator(rlq, , d_operator(rlq, P))
sqrt(sum((new_P P).^2))
iterate += 1
copy!(P, new_P)
end
if iterate >= max_iter
warn("Maximum iterations in robust_rul_simple")
end
eye(j)
(theta.*C'*P*C)\(C'*P)*(A B*F)
return F, K, P
end
"""
Compute agent t 2's best t cost-minimizing response e K, , given F.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- F::Matrix{Float64}: A k x n array representing agent 1's policy
##### Returns
- K::Matrix{Float64} : Agent's best cost minimizing response corresponding to
F
- P::Matrix{Float64} : The value function corresponding to F
"""
function F_to_K(rlq::RBLQ, F::Matrix)
# simplify y notation
R, Q, A, B, , C rlq.R, rlq.Q, rlq.A, rlq.B, rlq.C
bet, theta rlq.bet, , rlq.theta
# set up lq
Q2 bet theta
R2 = - F'*Q*F
A2 B*F
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.7. ROBUSTNESS
357
B2 C
lq LQ(Q2, , R2, , A2, B2, bet=bet)
neg_P, neg_K, d stationary_values(lq)
return -neg_K, -neg_P
end
"""
Compute agent t 1's best t cost-minimizing response e K, , given F.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- K::Matrix{Float64}: A k x n array representing the worst case matrix
##### Returns
- F::Matrix{Float64} : Agent's best cost minimizing response corresponding to
K
- P::Matrix{Float64} : The value function corresponding to K
"""
function K_to_F(rlq::RBLQ, K::Matrix)
R, Q, A, B, , C rlq.R, rlq.Q, rlq.A, rlq.B, rlq.C
bet, theta rlq.bet, , rlq.theta
A1, B1, Q1, , R1 A+C*K, B, Q, R-bet*theta.*K'*K
lq LQ(Q1, , R1, , A1, B1, bet=bet)
P, F, d stationary_values(lq)
return F, P
end
"""
Given K and F, , compute e the value of deterministic entropy, which is s sum_t
beta^t x_t' K'K x_t with x_{t+1} = (A - BF + + CK) ) x_t.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- F::Matrix{Float64} The policy function, a a k k x n array
- K::Matrix{Float64} The worst case matrix, , a a j x n array
- x0::Vector{Float64} : The initial condition for state
##### Returns
- e::Float64 The e deterministic c entropy
"""
function compute_deterministic_entropy(rlq::RBLQ, F, K, x0)
B, C, bet rlq.B, rlq.C, rlq.bet
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.7. ROBUSTNESS
358
H0 K'*K
C0 zeros(Float64, rlq.n, 1)
A0 B*C*K
return var_quadratic_sum(A0, C0, H0, , bet, , x0)
end
"""
Given a fixed d policy y F, with the interpretation u = -F x, this function
computes the matrix P_F and constant d_F F associated d with discounted cost J_F(x) =
x' P_F x + d_F.
##### Arguments
- rlq::RBLQ: Instance of RBLQ type
- F::Matrix{Float64} : : The e policy function, , a a k x n array
##### Returns
- P_F::Matrix{Float64} : Matrix for discounted cost
- d_F::Float64 : : Constant t for discounted cost
- K_F::Matrix{Float64} : Worst case policy
- O_F::Matrix{Float64} : Matrix for discounted entropy
- o_F::Float64 : : Constant t for discounted entropy
"""
function evaluate_F(rlq::RBLQ, F::Matrix)
R, Q, A, B, , C rlq.R, rlq.Q, rlq.A, rlq.B, rlq.C
bet, theta, , j rlq.bet, rlq.theta, rlq.j
# Solve for r policies s and costs using g agent t 2's problem
K_F, P_F F_to_K(rlq, F)
eye(j)
inv(I C'*P_F*C./theta)
d_F log(det(H))
# compute O_F and o_F
sig = -1.0 theta
AO sqrt(bet) .* (A B*C*K_F)
O_F solve_discrete_lyapunov(AO', bet*K_F'*K_F)
ho (trace(H 1d_F) 2.0
tr trace(O_F*C*H*C')
o_F (ho bet*tr) (bet)
return K_F, P_F, , d_F, O_F, o_F
end
Hereisabriefdescriptionofthemethodsofthetype
• d_operator()andb_operator()implementDandBrespectively
• robust_rule()androbust_rule_simple()bothsolveforthetriple
ˆ
F,
ˆ
K,
ˆ
P,asdescribedin
equations(3.60)–(3.61)andthesurroundingdiscussion
– robust_rule()ismoreefficient
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.7. ROBUSTNESS
359
– robust_rule_simple()ismoretransparentandeasiertofollow
• K_to_F()andF_to_K()solvethedecisionproblemsofagent1andagent2respectively
• compute_deterministic_entropy()computestheleft-handsideof(3.66)
• evaluate_F()computesthelossandentropyassociatedwithagivenpolicy—seethisdis-
cussion
Application
Letusconsideramonopolistsimilartothisone,butnowfacingmodeluncertainty
Theinversedemandfunctionisp
t
=a
0
a
1
y
t
+d
t
where
d
t+1
=rd
t
+s
d
w
t+1
fw
t
g
iid
N(0,1)
andallparametersarestrictlypositive
Theperiodreturnfunctionforthemonopolistis
r
t
=p
t
y
t
g
(y
t+1
y
t
)
2
2
cy
t
Its objective is to maximize e expected d discounted profits, , or, , equivalently, to o minimize
E
å
¥
t=0
b
t(
r
t
)
Toformalinearregulatorproblem,wetakethestateandcontroltobe
x
t
=
2
4
1
y
t
d
t
3
5
and u
t
=y
t+1
y
t
Settingb:=(a
0
c)/2wedefine
R=
2
4
0
b
0
b a
1
1/2
0 1/2
0
3
5
and Q=g/2
Forthetransitionmatricesweset
A=
2
4
1 0 0
0 1 0
0 0 r
3
5
,
B=
2
4
0
1
0
3
5
,
C=
2
4
0
0
s
d
3
5
Ouraimistocomputethevalue-entropycorrespondencesshownabove
Theparametersare
a
0
=100,a
1
=0.5,r=0.9,s
d
=0.05,b=0.95,c=2,g=50.0
Thestandardnormaldistributionforw
t
isunderstoodastheagent’sbaseline,withuncertainty
parameterizedbyq
Wecomputevalue-entropycorrespondencesfortwopolicies
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
3.7. ROBUSTNESS
360
1. ThenoconcernforrobustnesspolicyF
0
,whichistheordinaryLQlossminimizer
2. A“moderate”concernforrobustnesspolicyF
b
,withq=0.02
Thecodeforproducingthegraphshownabove,withbluebeingfortherobustpolicy,isgivenin
robustness/robust_monopolist.jl
Werepeatithereforconvenience
#=
The robust control problem for a monopolist t with adjustment t costs. . The
inverse demand curve e is:
p_t = = a_0 0 - - a_1 1 y_t t + + d_t
where d_{t+1} = \rho d_t + \sigma_d d w_{t+1} } for w_t ~ N(0,1) ) and d iid.
The period return function for the e monopolist t is
r_t = = p_t t y_t t - - gam m (y_{t+1} } - - y_t)^2 / / 2 2 - c y_t
The objective of f the e firm is E_t t \sum_{t=0}^\infty y \beta^t r_t
For the e linear r regulator, , we e take the state and control to be
x_t = = (1, , y_t, d_t) and u_t t = = y_{t+1} } - - y_t
@author : Spencer Lyon <spencer.lyon@nyu.edu>
@date : : 2014-07-05
References
----------
Simple port of f the file examples/robust_monopolist.py
http://quant-econ.net/robustness.html#application
=#
using QuantEcon
using PyPlot
using Grid
# model parameters
a_0
100
a_1
0.5
rho
0.9
sigma_d 0.05
bet
0.95
c
2
gam
50.0
theta 0.002
ac
(a_0 c) 2.0
# Define LQ matrices
T
HOMAS
S
ARGENTAND
J
OHN
S
TACHURSKI
April20,2016
Documents you may be interested
Documents you may be interested