SlideShare une entreprise Scribd logo
1  sur  75
Télécharger pour lire hors ligne
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Accelerated computing through
Quasi-Monte Carlo (QMC) constructions
Polynomial lattice builder, C++ software
Mohamed Hanini,
CEO & Chief Scientist at Koïos Intelligence
Research & development
Montreal, January 28th 2020,
mohamed.hanini@koiosintelligence.ca
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 1 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Summary
1 Motivation
2 Theoretical approach
3 C++ practicing examples
4 Asian Option Pricing
5 Asian Option Valuation powered by Polylatbuilder
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 2 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Why you should care?
For many applications, using QMC structured points is a very
efficient way to cut infrastructure and development costs.
Applications
1 Accelerate your training algorithms (Initializing
parameters),
2 Bayesian Deep Learning (reducing the variance of the
gradient estimator),
3 Parallel computing (optimize your GPU),
4 Evaluate complex financial applications,
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Why you should care?
For many applications, using QMC structured points is a very
efficient way to cut infrastructure and development costs.
Applications
1 Accelerate your training algorithms (Initializing
parameters),
2 Bayesian Deep Learning (reducing the variance of the
gradient estimator),
3 Parallel computing (optimize your GPU),
4 Evaluate complex financial applications,
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Why you should care?
For many applications, using QMC structured points is a very
efficient way to cut infrastructure and development costs.
Applications
1 Accelerate your training algorithms (Initializing
parameters),
2 Bayesian Deep Learning (reducing the variance of the
gradient estimator),
3 Parallel computing (optimize your GPU),
4 Evaluate complex financial applications,
We need an efficient software!
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Multidimensional Integration Methods
Methods
1 Monte Carlo (MC),
2 Quasi-Monte Carlo (QMC) and Randomized QMC
(RQMC).
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Multidimensional Integration Methods
Methods
1 Monte Carlo (MC),
2 Quasi-Monte Carlo (QMC) and Randomized QMC
(RQMC).
Practical approach QMC-RQMC
1 Start a search for a given construction method to find a
generator vector. How to find this vector?
2 Build a Low Discrepancy sequence (grid points)
Different representations:
Worst case error, square error (QMC),
Variance (RQMC),
Others?
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Multidimensional Integration Methods
Methods
1 Monte Carlo (MC),
2 Quasi-Monte Carlo (QMC) and Randomized QMC
(RQMC).
Practical approach QMC-RQMC
1 Start a search for a given construction method to find a
generator vector. How to find this vector?
2 Build a Low Discrepancy sequence (grid points)
Different representations:
Worst case error, square error (QMC),
Variance (RQMC),
Others?
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Monte Carlo (MC)
Multidimensional Integration Methods
Monte Carlo (MC), Quasi-Monte Carlo (QMC) et Randomized
QMC (RQMC)
Let X be a system (output) with real values
X = f(u1, u2, . . . , ud).
µ = E[X] = E[f(u1, u2, . . . , ud)] =
∫
[0,1)d
f(u) du
Inversion technique Example: X ∼ exp(λ)
F(X) = 1 − exp(−λX) = U ∼ U[0, 1)
⇒ X = − log(U)/λ.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 5 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Monte Carlo (MC)
Multidimensional Integration Methods
Monte Carlo (MC), Quasi-Monte Carlo (QMC) and
Randomized QMC (RQMC)
µ = E[X] = E[f(U)] =
∫
[0,1)d
f(u) du
standard MC: generate n random values i.i.d of U(0, 1)d, let
U0, . . . , Un−1;
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Monte Carlo (MC)
Multidimensional Integration Methods
Monte Carlo (MC), Quasi-Monte Carlo (QMC) and
Randomized QMC (RQMC)
µ = E[X] = E[f(U)] =
∫
[0,1)d
f(u) du
standard MC: generate n random values i.i.d of U(0, 1)d, let
U0, . . . , Un−1; estimate µ with ˆµn,MC = 1
n
∑n−1
i=0 f(Ui),
En = ˆµn,MC − µ converges with Op(n−1/2).
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Monte Carlo (MC)
Multidimensional Integration Methods
Monte Carlo (MC), Quasi-Monte Carlo (QMC) and
Randomized QMC (RQMC)
µ = E[X] = E[f(U)] =
∫
[0,1)d
f(u) du
standard MC: generate n random values i.i.d of U(0, 1)d, let
U0, . . . , Un−1; estimate µ with ˆµn,MC = 1
n
∑n−1
i=0 f(Ui),
En = ˆµn,MC − µ converges with Op(n−1/2).
Var[ˆµn,MC] = E[(ˆµn,MC − µ)2)] = σ2/n = O(n−1) converges
slowly as a function of n, where σ2 =
∫
[0,1)d f(u) du − µ2.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Monte Carlo (MC)
Multidimensional Integration Methods
Monte Carlo (MC), Quasi-Monte Carlo (QMC) and
Randomized QMC (RQMC)
µ = E[X] = E[f(U)] =
∫
[0,1)d
f(u) du
standard MC: generate n random values i.i.d of U(0, 1)d, let
U0, . . . , Un−1; estimate µ with ˆµn,MC = 1
n
∑n−1
i=0 f(Ui),
En = ˆµn,MC − µ converges with Op(n−1/2).
Var[ˆµn,MC] = E[(ˆµn,MC − µ)2)] = σ2/n = O(n−1) converges
slowly as a function of n, where σ2 =
∫
[0,1)d f(u) du − µ2.
central limit theorem
√
n(ˆµn,MC − µ)/σ ⇒ N(0, 1) when n → ∞.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Quasi-Monte Carlo (QMC)
Multidimensional Integration Methods
µ = E[f(U)] =
∫
[0,1)d
f(u) du
QMC estimator
ˆµn,QMC =
1
n
n−1∑
i=0
f(ui).
We replace independent points MC by u0, . . . , un−1 a set of n
structured points () which covers the hypercube (0, 1)d more
uniformly than MC points.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Quasi-Monte Carlo (QMC)
Multidimensional Integration Methods
µ = E[f(U)] =
∫
[0,1)d
f(u) du
QMC estimator
ˆµn,QMC =
1
n
n−1∑
i=0
f(ui).
We replace independent points MC by u0, . . . , un−1 a set of n
structured points () which covers the hypercube (0, 1)d more
uniformly than MC points.
Integration methods: Polynomial lattice rules and digital nets.
Construction methods: example Korobov, CBC etc...
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Quasi-Monte Carlo (QMC)
Multidimensional Integration Methods
µ = E[f(U)] =
∫
[0,1)d
f(u) du
QMC estimator
ˆµn,QMC =
1
n
n−1∑
i=0
f(ui).
We replace independent points MC by u0, . . . , un−1 a set of n
structured points () which covers the hypercube (0, 1)d more
uniformly than MC points.
Integration methods: Polynomial lattice rules and digital nets.
Construction methods: example Korobov, CBC etc...
Worst case error dans O(n−α+ϵ) where α ≥ 1
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Randomized Quasi-Monte Carlo (RQMC)
Multidimensional Integration Methods
RQMC estimator
ˆµn,RQMC,l =
1
n
n−1∑
i=0
f(ui).
To create variance, we need to randomize the n structurted
points u0, . . . , un−1 : by shifting them individually. Each point
Ui ∼ U[0, 1)d.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Randomized Quasi-Monte Carlo (RQMC)
Multidimensional Integration Methods
RQMC estimator
ˆµn,RQMC,l =
1
n
n−1∑
i=0
f(ui).
To create variance, we need to randomize the n structurted
points u0, . . . , un−1 : by shifting them individually. Each point
Ui ∼ U[0, 1)d. With m i.i.d estimators, we can construct an
unbiased estimator ˆµn,RQMC = 1
m
∑m
l=1 ˆµn,RQMC,l.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Randomized Quasi-Monte Carlo (RQMC)
Multidimensional Integration Methods
RQMC estimator
ˆµn,RQMC,l =
1
n
n−1∑
i=0
f(ui).
To create variance, we need to randomize the n structurted
points u0, . . . , un−1 : by shifting them individually. Each point
Ui ∼ U[0, 1)d. With m i.i.d estimators, we can construct an
unbiased estimator ˆµn,RQMC = 1
m
∑m
l=1 ˆµn,RQMC,l.
Var[ˆµn,RQMC] = Var[f(ui)]
n + 2
n2
∑
i<j Cov[f(ui), f(uj)].
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Primal lattice
Ld =



v =
d∑
j=1
hjvj such that each hj ∈ Z



,
Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant
points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d.
.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Primal lattice
Ld =



v =
d∑
j=1
hjvj such that each hj ∈ Z



,
Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant
points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d.
A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1.
nv1 = a = (a1, a2, . . . , ad) ∈ Zd
n.
.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Primal lattice
Ld =



v =
d∑
j=1
hjvj such that each hj ∈ Z



,
Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant
points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d.
A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1.
nv1 = a = (a1, a2, . . . , ad) ∈ Zd
n.
Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1
mod n) = O(n), because 0 ≤ a ≤ n − 1.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Primal lattice
Ld =



v =
d∑
j=1
hjvj such that each hj ∈ Z



,
Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant
points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d.
A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1.
nv1 = a = (a1, a2, . . . , ad) ∈ Zd
n.
Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1
mod n) = O(n), because 0 ≤ a ≤ n − 1.
Dual lattice
L⊥
d =
{
h ∈ Rd
: hT
v ∈ Z for each v ∈ Ld
}
⊆ Zd
.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Primal lattice
Ld =



v =
d∑
j=1
hjvj such that each hj ∈ Z



,
Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant
points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d.
A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1.
nv1 = a = (a1, a2, . . . , ad) ∈ Zd
n.
Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1
mod n) = O(n), because 0 ≤ a ≤ n − 1.
Dual lattice
L⊥
d =
{
h ∈ Rd
: hT
v ∈ Z for each v ∈ Ld
}
⊆ Zd
.
A dual representation
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
How to choose the generator vector?
Naive approach
1 Consider all the possibilities of finding a generator vector,
2 minimize the worst case error or the variance
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
How to choose the generator vector?
Naive approach
1 Consider all the possibilities of finding a generator vector,
2 minimize the worst case error or the variance
Practical approach
1 Refine the search space g(z)
2 minimize an error function (cost function)
With a construction method
Component by component(CBC),
Fast component by component (Fast-CBC),
Korobov
Others?
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
How to choose the generator vector?
Naive approach
1 Consider all the possibilities of finding a generator vector,
2 minimize the worst case error or the variance
Practical approach
1 Refine the search space g(z)
2 minimize an error function (cost function)
With a construction method
Component by component(CBC),
Fast component by component (Fast-CBC),
Korobov
Others?
We clearly need a software (Polylatbuilder)!
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example of a rank 1 lattice rule
Rank1 lattice
Pn =
{
ui =
ia
n
mod 1 : 0 ≤ i ≤ n − 1
}
,
Rank1 lattice rule = 1
n
∑n−1
i=0 f(ui),
Number of points: n,
Generator vector: a ∈ Zd.
0 1
0
1
a/n
u1
u2
original
a = (1, 3)
0 1
0
1
u1
u2
shifted
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example of a rank 1 lattice rule
Rank1 lattice
Pn =
{
ui =
ia
n
mod 1 : 0 ≤ i ≤ n − 1
}
,
Rank1 lattice rule = 1
n
∑n−1
i=0 f(ui),
Number of points: n,
Generator vector: a ∈ Zd.
Randomized lattice rule
Pn,∆ = {Ui = (ui + U) mod 1 : 0 ≤ i ≤ n − 1} ,
Random point : U ∼ U[0, 1)d.
0 1
0
1
a/n
u1
u2
original
a = (1, 3)
0 1
0
1
U
u1
u2
shifted
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example of a rank 1 lattice rule
Rank1 lattice
Pn =
{
ui =
ia
n
mod 1 : 0 ≤ i ≤ n − 1
}
,
Rank1 lattice rule = 1
n
∑n−1
i=0 f(ui),
Number of points: n,
Generator vector: a ∈ Zd.
Randomized lattice rule
Pn,∆ = {Ui = (ui + U) mod 1 : 0 ≤ i ≤ n − 1} ,
Random point : U ∼ U[0, 1)d.
0 1
0
1
a/n
u1
u2
original
a = (1, 3)
0 1
0
1
U
u1
u2
shifted
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration lattice
Projection of the lattice points
⇒ We ideally want n distinct values for each one-dimensional
projection Pn({j}) of Pn so the components of a are found in :
Un = {a ∈ Z : 1 ≤ a ≤ n − 1 et pgcd(a, n) = 1}.
For n prime:
There are n − 1 choices for each component of a,
there are (n − 1)d possibilities to generate the vector a.
For each subset ν ⊆ {1, 2, . . . , d}, the projection of Ld(ν) under
Ld is also a lattice, having a set points Pn(ν).
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 12 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration polynomial lattice
Primal lattice
Ld =



v(z) =
d∑
j=1
hjvj as each hj ∈ Zb[z]



,
where v1(z), v2(z), . . . , vd(z) ∈ Ld
b (a set of Laurent series) where
vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree
m. Pn = φ(Ld) ∩ [0, 1)d.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration polynomial lattice
Primal lattice
Ld =



v(z) =
d∑
j=1
hjvj as each hj ∈ Zb[z]



,
where v1(z), v2(z), . . . , vd(z) ∈ Ld
b (a set of Laurent series) where
vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree
m. Pn = φ(Ld) ∩ [0, 1)d.
Dual lattice
L∗⊥
d =



h ∈ Nd
0 :
d∑
j=1
hj(z)vj(z) ∈ Zb[z] for each v(z) ∈ Ld



,
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Integration polynomial lattice
Primal lattice
Ld =



v(z) =
d∑
j=1
hjvj as each hj ∈ Zb[z]



,
where v1(z), v2(z), . . . , vd(z) ∈ Ld
b (a set of Laurent series) where
vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree
m. Pn = φ(Ld) ∩ [0, 1)d.
Dual lattice
L∗⊥
d =



h ∈ Nd
0 :
d∑
j=1
hj(z)vj(z) ∈ Zb[z] for each v(z) ∈ Ld



,
Dual representation
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Construction of points
Structure of the points for a rank 1 polynomial lattice rule
ui,j = φ
(
qi(z)gj(z) mod P(z)
P(z)
)
such asφ : Lb → R.
=⇒ φ
( ∞∑
l=w
xlz−l
)
=
∞∑
l=w
(xl)b−l
,
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Construction of points
Structure of the points for a rank 1 polynomial lattice rule
ui,j = φ
(
qi(z)gj(z) mod P(z)
P(z)
)
such asφ : Lb → R.
=⇒ φ
( ∞∑
l=w
xlz−l
)
=
∞∑
l=w
(xl)b−l
,
Practical approach
1 Truncate Laurent’s series to L ui,j =
∑L
l=w xlb−l,
2 Find the xl ∈ {0, 1} for a base b = 2.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Construction of points
Structure of the points for a rank 1 polynomial lattice rule
ui,j = φ
(
qi(z)gj(z) mod P(z)
P(z)
)
such asφ : Lb → R.
=⇒ φ
( ∞∑
l=w
xlz−l
)
=
∞∑
l=w
(xl)b−l
,
Practical approach
1 Truncate Laurent’s series to L ui,j =
∑L
l=w xlb−l,
2 Find the xl ∈ {0, 1} for a base b = 2.
ui = (u1,i, u2,i, . . . , uj,i, . . . , ui,d) the i-th point
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example: rank 1 polynomial lattice rules
Rank 1 polynomial lattice rules
Pn =
{
ui =
qi(z)g(z) mod P(z)
P(z)
: q(z) ∈ Zb[z]
}
rank 1 polynomial lattice rules = 1
n
∑n−1
i=0 f(ui)
prime polynomial : P(z) with degree m.
generator vector : g(z) ∈ Zb[z]d
Example (particular case): Korobov rules
g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z))
Ṟandomized Rank 1 polynomial lattice rules
Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1}
random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example: rank 1 polynomial lattice rules
Rank 1 polynomial lattice rules
Pn =
{
ui =
qi(z)g(z) mod P(z)
P(z)
: q(z) ∈ Zb[z]
}
rank 1 polynomial lattice rules = 1
n
∑n−1
i=0 f(ui)
prime polynomial : P(z) with degree m.
generator vector : g(z) ∈ Zb[z]d
Example (particular case): Korobov rules
g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z))
Ṟandomized Rank 1 polynomial lattice rules
Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1}
random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example: rank 1 polynomial lattice rules
Rank 1 polynomial lattice rules
Pn =
{
ui =
qi(z)g(z) mod P(z)
P(z)
: q(z) ∈ Zb[z]
}
rank 1 polynomial lattice rules = 1
n
∑n−1
i=0 f(ui)
prime polynomial : P(z) with degree m.
generator vector : g(z) ∈ Zb[z]d
Example (particular case): Korobov rules
g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z))
Ṟandomized Rank 1 polynomial lattice rules
Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1}
random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example: Rank 1 polynomial lattice rules
Quadratic error QMC
Could converge more fast the MC depending on:
the regularity of the function to be integrated
the uniformity of points in the polynomial lattice (choice of
parameter g(z))
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 16 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Example: Rank 1 polynomial lattice rules
Quadratic error QMC
Could converge more fast the MC depending on:
the regularity of the function to be integrated
the uniformity of points in the polynomial lattice (choice of
parameter g(z))
Polynomial lattice of
n = 64 points
P(z) = z6 + z + 1 in
2D
0 1
0
1
Good lattice
g(z) = (1, z5
+
z3
+ z2
+ z + 1)
0 1
0
1
Very bad lattice
g(z) = (1, 1)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 16 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Réseaux digitaux
Définition
Let a prime number b ≥ 2, called base, a digital net in base b
formed by n = bm points in d dimensions is defined by selecting
d generating matrices C1, C2, . . . , Cd, where each Cj is an
∞ × m. The matrix whose elements belong to the finite field
Fb = 0, 1, 2, . . . , b − 1. ⇒ The matrix Cj determines the
coordinate j of all the points.
We define ui pour i = 0, 1, 2, . . . bm − 1,
we write the binary representation of i in base b,
the vector of the binary coefficient is multiplied by Cj
mod b to obtain the binary coefficients of ui,j.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 17 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Réseaux digitaux
Définition
Let a prime number b ≥ 2, called base, a digital net in base b
formed by n = bm points in d dimensions is defined by selecting
d generating matrices C1, C2, . . . , Cd, where each Cj is an
∞ × m. The matrix whose elements belong to the finite field
Fb = 0, 1, 2, . . . , b − 1. ⇒ The matrix Cj determines the
coordinate j of all the points.
⇒ Similar to the component gj(z) of the vector g(z)
We define ui pour i = 0, 1, 2, . . . bm − 1,
we write the binary representation of i in base b,
the vector of the binary coefficient is multiplied by Cj
mod b to obtain the binary coefficients of ui,j.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 17 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Digital Nets
Construction of points
Let
i =
k−1∑
l=0
ai,lbl
,
and let



ui,j,1
ui,j,2
...


 = Cj





ai,0
ai,1
...
ai,k−1





mod b.
ui,j =
∞∑
l=1
ui,j,lb−l
et ui =
(
ui,1, ui,2, . . . , ui,d
)
.
⇒ The resulting set of points is a basic digital net in base b. In
practice we truncate the expansion ui,j to L. For b = 2, the Cj
are the L × m binary matrcies.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 18 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Walsh transform
f(u) =
∑
h∈Nd
0
ˆf(h) walb,h(u),
where
ˆf(h) =
∫
[0,1)d f(u)walb,h(u)du et walb,h(u) = exp (2πih · u)/b.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 19 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Walsh transform
f(u) =
∑
h∈Nd
0
ˆf(h) walb,h(u),
where
ˆf(h) =
∫
[0,1)d f(u)walb,h(u)du et walb,h(u) = exp (2πih · u)/b.
Integration error (Sloan’s property)
En =
1
n
n−1∑
i=0
f(ui) −
∫
[0,1)d
f(u) du =
∑
0̸=h∈L∗⊥
d
ˆf(h).
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 19 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Expression of variance
For a randomized lattice, the variance can be expressed:
Var[ˆµn,RQMC] =
∑
0̸=h∈L∗⊥
d
|ˆf(h)|2
.
From a variance reduction perspective, an optimal network
for f minimize Df(Pn)2 = Var[ˆµn,RQMC].
Not widely used as criterion solution ?
⇒ Worst case error
e(HK; Pn) = sup
f∈HK,||f||K≤1
|Qn(f) − I(f)|.
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 20 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Practical criteria
Consider the following class of functions:
Eν,d(c) = {f : [0, 1]d
→ R : |ˆf(h)| ≤ c b−νµ1(h)
pour tout h ∈ Nd
0},
où ν > 1 et c > 0. We thus obtain:
|Qn(f) − I(f)| ≤
∑
0̸=h∈L∗⊥
d
c b−νµ1(h)
, ν > 1,
The quantity
Tν =
∑
0̸=h∈L∗⊥
d
c b−νµ1(h)
, ν > 1,
Depends only on the function class Eν,d(1).
To implement!
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 21 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
  
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 22 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
What do we need?
To find good digital and polynomial lattice
Figures of merit and weights adapted to a problem,
for a number of points n, for a polynomial and a dimension
d,
several construction methods,
Options: like normalization etc.
Our research work
Establish merit figures for digital networks and       
polynomial,
compare (application) the performance of our software
integration methods compared to other integration
methods,
define new criteria for non-functional classes,       
considered (explored) ⇒ unbounded functions!?
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 22 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
What already exists
Dirk Nuyens’ Code Matlab
a construction method (Fast CBC)       
Limited choice of parameters (ex: only ten primitive
polynomials)       
only one type of weight (product weight)       
No QMC / RQMC points generated and tested! no
application!!
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 23 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
What already exists
Dirk Nuyens’ Code Matlab
a construction method (Fast CBC)       
Limited choice of parameters (ex: only ten primitive
polynomials)       
only one type of weight (product weight)       
No QMC / RQMC points generated and tested! no
application!!
Generator vector tables
J. Dick
D. Nuyens
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 23 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Structure of Polylatbuilder
Points of the
polynomial and
digital nets
Figures of merit Weight type
Construction
methods
Error in a
Walsh space
t-value
Spectral test
other heuris-
tic??
Product weight
Order depend-
ing weights
General weight
Product and
order depen-
dent weights
(POD)
CBC
Fast CBC
Random Ko-
robov
Korobov
Exhaustive
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 24 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Quality measures (Discrepancies)
Implemented figure of merit
E(f, g(z))1/q
) = e(g(z); n; ||.||p,α,γ)
The worst function:
χ(g(z); n; ||.||p,α,γ) =
∑
0̸=v⊂1:t
γv
q/2
∏
j∈v
ω(uj)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 25 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Quality measures (Discrepancies)
Implemented figure of merit
E(f, g(z))1/q
) = e(g(z); n; ||.||p,α,γ)
The worst function:
χ(g(z); n; ||.||p,α,γ) =
∑
0̸=v⊂1:t
γv
q/2
∏
j∈v
ω(uj)
The kernel
ω(uj) =
∞∑
h=1
wal2,h(uj)
2qα⌊log2hj⌋
= 12(
1
6
− 2⌊log)2uj⌋−1
)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 25 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Construction methods
CBC Constructions
Knowing n, we construct a generator vector
g(z) = (g1(z), g2(z), . . . , gd(z)).
We set g1(z) = 1,
g1(z) remains fixed, we choose g2(z) from the subset of the
components of generator vectors   to minimize the desired
error criterion in 2 dimensions,
With g1(z), g2(z) remain fixed, we choose g3(z) from the
subset of the components of generator vectors   to
minimize the desired error criterion in 3 dimensions,
ed(gd(z); Pn; ||.||p,α,γ)q
= ed−1(g(z)d−1; n; ||.||p,α,γ)q
+ Θd(g(z)d)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 26 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Setup intger to bit
#include "PolyType.h"
namespace PolyLatBuilder {
// choose the type of lattice
std::ostream& operator<<(std::ostream&
os, PolyLatType polylatType)
{ return os << (polylatType ==
PolyLatType::EMBEDDED ? "embedded" :
"ordinary"); }
}
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 27 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
C++code
boost::dynamic_bitset<>
PolyLatBuilder::FastCBC::getbin(int
integer){
unsigned long long dec;
dec = integer;
std::string str;
for(unsigned long long d = dec; d>0;
d/=2)
str.insert(str.begin(),
boost::lexical_cast<char>(d&1));
boost::dynamic_bitset<>
binaryNumber(str);
std::cout << "The number " << dec << "
in binary is: " << binaryNumber<<'n';
return binaryNumber;
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 28 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Setup Bit vector to polynomial
std::string PolyLatBuilder::FastCBC::
pretty(const GF2X& p) {
std::ostringstream os;
if ( deg(p)<0 ) os << "0" ;
for (int i = deg(p); i >= 0; i--) {
if (rep(coeff(p, i))) {
if (i < deg(p)) os << " + ";
if (i >= 2)
os << "x^" << i;
else if (i == 1)
os << "x";
else
os << "1";
}
}
return os.str();
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 29 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Perform the mapping function Vm(g(z)q(z)modP(z)
GF2X ww(INIT_SIZE,1);
ww.SetLength(1);
std::vector <double> w(rr.length());
std::vector <double> w1(rr.length());
for ( long j= 0; j <rr.length(); j++) {
w[j]=0;
double b = 1.0;
for( int k=0; k< m; k++){
ww[k] = rr[j][m-k-1];
for ( int l =0; l <k; l++){
ww[k] = ww[k] - ww[l] *
P2[m+(l-k)];
}
b *= 0.5;
if (IsOne(ww[k]))
w[j] += b;
}
std::cout << w[j] << std::endl;
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 30 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Perform the vector of real values by applying the
Kernel
fftw<double>::real_vector usob(n-1);
for (long i = 0 ; i < w.size(); i++){
usob[i] = 1.0/6 - pow(2,
floor(log2(w[i]))-1);
}
float usob_0=1.0/6;
fftw<double>::complex_vector fft_psi =
fftw<double>::fft(usob);
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 31 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Results – g(z) with Fast CBC
Values of g(z)
P(z) = z10 + z3 + 1 P(z) = z7 + z + 1
t gt(z) Square Error gt(z) Square Error
1 1 1.58 10−8 1 1.01 10−6
2 z9 + z8 + z5 3.6 10−8 z6 + z5 + z3 + z 2.22 10−6
3 z9 + z8 + z6 + z2 + z + 1 6.36 10−8 z6 + z5 + z4 + z2 3.74 10−6
4 z8 + z6 + z5 + z4 + z3 + z2 + z 1.03 10−7 z5 + z4 + z + 1 5.70 10−6
5 z8 + z6 + z1 1.57 10−7 z5 + z3 8.18 10−6
6 z9 + z7 + z4 + z2 + z 2.36 10−7 z5 + z4 + z3 1.16 10−5
7 z8 + z7 + z6 + z3 + z2 3.34 10−7 z6 + z3 + z + 1 1.56 10−5
8 z9 + z8 + z6 + z5 + z4 + z3 + 1 4.55 10−7 z6 + z5 + z3 + z2 + 1 2.03 10−5
9 z9 + z8 + z6 + z4 + z3 + z2 6.25 10−7 z6 + z5 + z4 + z3 + z + 1 2.7 10−5
10 z8 + z6 + z5 + z4 + z2 + 1 8.64 10−7 z5 + z4 + z3 + z 3.43 10−5
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 32 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
QMC square error
Built in C++
Encouraging results
Good uniformity of the polynomial lattice rules (good
parameter g(z))
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 33 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
QMC square error
Built in C++
Encouraging results
Good uniformity of the polynomial lattice rules (good
parameter g(z))
Polynomial lattice
rules points
n = 1023, P(z) =
z10 + z3 + 1 en 2D
0 1
0
1
good lattice
g(z)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 33 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Financial application: asian option
Stochastic differential equation(SDE)
dSt = µSt dt + σSt dWt
The SDE solution St = S0 exp(r−σ2/2)t+σBt
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 34 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Financial application: asian option
Stochastic differential equation(SDE)
dSt = µSt dt + σSt dWt
The SDE solution St = S0 exp(r−σ2/2)t+σBt
Option pricing
The payoff of the option X = e−rt max(0, 1
d
∑s
j=1 Stj − K),
and the price
c = E[X |Ft]
v(s0, T) = E[e−rt
f(S1 . . . St) |Ft]
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 34 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Asian purchase option - Numerical results
v(s0, T) = e−rt
∫
(0,1)d
max(0,
1
d
d∑
i=1
S0 exp [(r − σ2
)ti
+σ
√
ti − ti−1
i∑
j=1
Φ−1
(uj)] − K)du1 . . . dud
Variance reduction techniques for MC
control variate CV1 = e−rt max(0, Y − K) where
Y =
∏t
j=1(Stj )1/d
control variate CV2 = e−rt max(0, Y − K) where
Y =
∑t
j=1(Stj )1/d
Antithetic variable (AV)
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 35 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Call Asian option– Numerical results (n=1023)
Risk free rate r = 0.08, volatility σ = 0.2, and the strike price K
MC points with variance reduction techniques
Approach PD LGD EAD
No CV 20.83 49.87
CV1 20.90 1.00 10−2
Data CV2 20.90 9.25 10−4
CV1 +CV2 20.90 8.45 10−4
CV1+CV2+AV 20.91 3.23 10−4
No CV 11.23 4.68
1
CV1 11.28 8.79 10−3
Key Features CV2 11.29 4.61 10−1
CV1 +CV2 11.28 8.52 10−3
CV1+CV2+AV 11.30 3.36 10−3
No CV 3.54 22. 58
1
CV1 3.55 5.66 10−3
100 CV2 3.57 4.27
CV1 +CV2 3.55 5.5710−3
CV1+CV2+AV 3.56 1.4010−3
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 36 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Call Asian option– Numerical results
Comparison with LatticeBuilder software
Table: Value of the Asian option with a low exercise based on the
following configuration:(j)/10, for j = 1, 2, . . . , d = 10, number of
n = 210
points, and an exercise price K = 100
MC RQMC RQMC
Polylatbuilder LatticeBuilder
Option value 3.37 3.33 3.354
Standard deviation 4.52 0.015 0.025
Variance Ratio 95.17 33.06
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 37 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Java Asian Option Valuation (using QMC points)
import umontreal.iro.lecuyer.rng.*;
import umontreal.iro.lecuyer.hups.*;
import umontreal.iro.lecuyer.stat.Tally;
import umontreal.iro.lecuyer.util.Chrono;
public class AsianQMCSSJ extends AsianSSJ {
public AsianQMCSSJ (double r, double
sigma, double strike, double s0, int
s, double[] zeta) {
super (r, sigma, strike, s0, s, zeta);
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 38 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Java code
public void simulateQMC (int m, PointSet p,
RandomStream noise, Tally statQMC) {
Tally statValue = new Tally ("stat on
value of Asian option");
PointSetIterator stream = p.iterator ();
for (int j=0; j<m; j++) {
simulateRuns (p.getNumPoints(), stream,
statValue);
statQMC.add (statValue.average());
p.addRandomShift (0, 1, noise);
stream.resetStartStream();
}
}
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 39 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Java code
public static void main (String[] args) {
try {
int s = 9;
double[] zeta = new double[s+1];
for (int j=0; j<=s; j++)
zeta[j] = 12.0*j/365;
AsianQMCSSJ process = new AsianQMCSSJ
(0.08, 0.2, 100.0, 100.0, s, zeta);
Tally statValue = new Tally ("value of
Asian option");
Tally statQMC = new Tally ("QMC averages
for Asian option");
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 40 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Java code
timer.init();
// QMC Polynomial points
PointSet ps2 = new
PointSetFromFile("/Users/QuasiMonteAsian/src/options/pointsl
int m;
m =10;
// Number of QMC randomizations
process.simulateQMC ( m, ps2, new
MRG32k3a(), statQMC);
System.out.println ("QMC point set with
" + n +
" points and affine matrix
scramble:n");
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 41 / 42
Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p
Java code
System.out.printf ("Vlaue of Asian with
QMC: %9.4g%n", valueQMC);
double varQMC = ps2.getNumPoints() *
statQMC.variance();
double cpuQMC = timer.getSeconds() / (m *
n);
System.out.printf ("Variance ratio:
%9.4g%n", varMC/varQMC);
System.out.printf ("Efficiency ratio:
%9.4g%n",
(varMC * cpuMC) / (varQMC * cpuQMC));
System.out.printf ("Efficiency ratio 22:
%9.4g%n",
(cpuMC) / (cpuQMC));
System.out.println ("Test CPU time: "+
cpuMC);
System.out.println ("Test CPUQMC time: "+
Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 42 / 42

Contenu connexe

Similaire à Accelerated Computing Through Quasi-Monte Carlo Methods

Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...AIRCC Publishing Corporation
 
Sampling-Based Planning Algorithms for Multi-Objective Missions
Sampling-Based Planning Algorithms for Multi-Objective MissionsSampling-Based Planning Algorithms for Multi-Objective Missions
Sampling-Based Planning Algorithms for Multi-Objective MissionsMd Mahbubur Rahman
 
Support Vector Machines for Classification
Support Vector Machines for ClassificationSupport Vector Machines for Classification
Support Vector Machines for ClassificationPrakash Pimpale
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations researchsmumbahelp
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)Mumtaz Ali
 
Quantum Business in Japanese Market
Quantum Business in Japanese MarketQuantum Business in Japanese Market
Quantum Business in Japanese MarketYuichiro MInato
 
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVES
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVESSURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVES
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVESZac Darcy
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1Amrinder Arora
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSijfcstjournal
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSijfcstjournal
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communicationsDeepshika Reddy
 
Basic of computational economics with MATLAB program
Basic of computational economics with MATLAB programBasic of computational economics with MATLAB program
Basic of computational economics with MATLAB programTOSHI STATS Co.,Ltd.
 
Constraint-Based Fault-Localization
Constraint-Based Fault-LocalizationConstraint-Based Fault-Localization
Constraint-Based Fault-LocalizationMohammed Bekkouche
 
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...Review of Methodology and Rationale of Monte Carlo Simulation - Application t...
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...vramnath
 
Faster Interleaved Modular Multiplier Based on Sign Detection
Faster Interleaved Modular Multiplier Based on Sign DetectionFaster Interleaved Modular Multiplier Based on Sign Detection
Faster Interleaved Modular Multiplier Based on Sign DetectionVLSICS Design
 
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...SAJJAD KHUDHUR ABBAS
 

Similaire à Accelerated Computing Through Quasi-Monte Carlo Methods (20)

Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...Applying Transformation Characteristics to Solve the Multi Objective Linear F...
Applying Transformation Characteristics to Solve the Multi Objective Linear F...
 
Trabajo grupal II parcial
Trabajo grupal II parcialTrabajo grupal II parcial
Trabajo grupal II parcial
 
Mb0048 operations research
Mb0048 operations researchMb0048 operations research
Mb0048 operations research
 
QMC: Transition Workshop - Monte Carlo and (Randomized) Quasi-Monte Carlo Sim...
QMC: Transition Workshop - Monte Carlo and (Randomized) Quasi-Monte Carlo Sim...QMC: Transition Workshop - Monte Carlo and (Randomized) Quasi-Monte Carlo Sim...
QMC: Transition Workshop - Monte Carlo and (Randomized) Quasi-Monte Carlo Sim...
 
Sampling-Based Planning Algorithms for Multi-Objective Missions
Sampling-Based Planning Algorithms for Multi-Objective MissionsSampling-Based Planning Algorithms for Multi-Objective Missions
Sampling-Based Planning Algorithms for Multi-Objective Missions
 
Support Vector Machines for Classification
Support Vector Machines for ClassificationSupport Vector Machines for Classification
Support Vector Machines for Classification
 
Mb0048 operations research
Mb0048  operations researchMb0048  operations research
Mb0048 operations research
 
dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)dynamic programming complete by Mumtaz Ali (03154103173)
dynamic programming complete by Mumtaz Ali (03154103173)
 
Quantum Business in Japanese Market
Quantum Business in Japanese MarketQuantum Business in Japanese Market
Quantum Business in Japanese Market
 
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVES
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVESSURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVES
SURVEY ON POLYGONAL APPROXIMATION TECHNIQUES FOR DIGITAL PLANAR CURVES
 
Dynamic Programming - Part 1
Dynamic Programming - Part 1Dynamic Programming - Part 1
Dynamic Programming - Part 1
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
 
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMSA HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
A HYBRID COA/ε-CONSTRAINT METHOD FOR SOLVING MULTI-OBJECTIVE PROBLEMS
 
D05511625
D05511625D05511625
D05511625
 
Convex optmization in communications
Convex optmization in communicationsConvex optmization in communications
Convex optmization in communications
 
Basic of computational economics with MATLAB program
Basic of computational economics with MATLAB programBasic of computational economics with MATLAB program
Basic of computational economics with MATLAB program
 
Constraint-Based Fault-Localization
Constraint-Based Fault-LocalizationConstraint-Based Fault-Localization
Constraint-Based Fault-Localization
 
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...Review of Methodology and Rationale of Monte Carlo Simulation - Application t...
Review of Methodology and Rationale of Monte Carlo Simulation - Application t...
 
Faster Interleaved Modular Multiplier Based on Sign Detection
Faster Interleaved Modular Multiplier Based on Sign DetectionFaster Interleaved Modular Multiplier Based on Sign Detection
Faster Interleaved Modular Multiplier Based on Sign Detection
 
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...Episode 50 :  Simulation Problem Solution Approaches Convergence Techniques S...
Episode 50 : Simulation Problem Solution Approaches Convergence Techniques S...
 

Dernier

Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commercemanigoyal112
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...Akihiro Suda
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsAhmed Mohamed
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...OnePlan Solutions
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...confluent
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprisepreethippts
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Developmentvyaparkranti
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesPhilip Schwarz
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZABSYZ Inc
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Velvetech LLC
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identityteam-WIBU
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceBrainSell Technologies
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Mater
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfMarharyta Nedzelska
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfDrew Moseley
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Matt Ray
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxAndreas Kunz
 

Dernier (20)

Cyber security and its impact on E commerce
Cyber security and its impact on E commerceCyber security and its impact on E commerce
Cyber security and its impact on E commerce
 
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
20240415 [Container Plumbing Days] Usernetes Gen2 - Kubernetes in Rootless Do...
 
Unveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML DiagramsUnveiling Design Patterns: A Visual Guide with UML Diagrams
Unveiling Design Patterns: A Visual Guide with UML Diagrams
 
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
Tech Tuesday - Mastering Time Management Unlock the Power of OnePlan's Timesh...
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
Catch the Wave: SAP Event-Driven and Data Streaming for the Intelligence Ente...
 
Odoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 EnterpriseOdoo 14 - eLearning Module In Odoo 14 Enterprise
Odoo 14 - eLearning Module In Odoo 14 Enterprise
 
VK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web DevelopmentVK Business Profile - provides IT solutions and Web Development
VK Business Profile - provides IT solutions and Web Development
 
Folding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a seriesFolding Cheat Sheet #4 - fourth in a series
Folding Cheat Sheet #4 - fourth in a series
 
Salesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZSalesforce Implementation Services PPT By ABSYZ
Salesforce Implementation Services PPT By ABSYZ
 
Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...Software Project Health Check: Best Practices and Techniques for Your Product...
Software Project Health Check: Best Practices and Techniques for Your Product...
 
Post Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on IdentityPost Quantum Cryptography – The Impact on Identity
Post Quantum Cryptography – The Impact on Identity
 
CRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. SalesforceCRM Contender Series: HubSpot vs. Salesforce
CRM Contender Series: HubSpot vs. Salesforce
 
Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)Ahmed Motair CV April 2024 (Senior SW Developer)
Ahmed Motair CV April 2024 (Senior SW Developer)
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
A healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdfA healthy diet for your Java application Devoxx France.pdf
A healthy diet for your Java application Devoxx France.pdf
 
Comparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdfComparing Linux OS Image Update Models - EOSS 2024.pdf
Comparing Linux OS Image Update Models - EOSS 2024.pdf
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
Open Source Summit NA 2024: Open Source Cloud Costs - OpenCost's Impact on En...
 
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptxUI5ers live - Custom Controls wrapping 3rd-party libs.pptx
UI5ers live - Custom Controls wrapping 3rd-party libs.pptx
 

Accelerated Computing Through Quasi-Monte Carlo Methods

  • 1. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Accelerated computing through Quasi-Monte Carlo (QMC) constructions Polynomial lattice builder, C++ software Mohamed Hanini, CEO & Chief Scientist at Koïos Intelligence Research & development Montreal, January 28th 2020, mohamed.hanini@koiosintelligence.ca Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 1 / 42
  • 2. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Summary 1 Motivation 2 Theoretical approach 3 C++ practicing examples 4 Asian Option Pricing 5 Asian Option Valuation powered by Polylatbuilder Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 2 / 42
  • 3. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Why you should care? For many applications, using QMC structured points is a very efficient way to cut infrastructure and development costs. Applications 1 Accelerate your training algorithms (Initializing parameters), 2 Bayesian Deep Learning (reducing the variance of the gradient estimator), 3 Parallel computing (optimize your GPU), 4 Evaluate complex financial applications, Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
  • 4. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Why you should care? For many applications, using QMC structured points is a very efficient way to cut infrastructure and development costs. Applications 1 Accelerate your training algorithms (Initializing parameters), 2 Bayesian Deep Learning (reducing the variance of the gradient estimator), 3 Parallel computing (optimize your GPU), 4 Evaluate complex financial applications, Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
  • 5. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Why you should care? For many applications, using QMC structured points is a very efficient way to cut infrastructure and development costs. Applications 1 Accelerate your training algorithms (Initializing parameters), 2 Bayesian Deep Learning (reducing the variance of the gradient estimator), 3 Parallel computing (optimize your GPU), 4 Evaluate complex financial applications, We need an efficient software! Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 3 / 42
  • 6. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Multidimensional Integration Methods Methods 1 Monte Carlo (MC), 2 Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC). Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
  • 7. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Multidimensional Integration Methods Methods 1 Monte Carlo (MC), 2 Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC). Practical approach QMC-RQMC 1 Start a search for a given construction method to find a generator vector. How to find this vector? 2 Build a Low Discrepancy sequence (grid points) Different representations: Worst case error, square error (QMC), Variance (RQMC), Others? Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
  • 8. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Multidimensional Integration Methods Methods 1 Monte Carlo (MC), 2 Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC). Practical approach QMC-RQMC 1 Start a search for a given construction method to find a generator vector. How to find this vector? 2 Build a Low Discrepancy sequence (grid points) Different representations: Worst case error, square error (QMC), Variance (RQMC), Others? Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 4 / 42
  • 9. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Monte Carlo (MC) Multidimensional Integration Methods Monte Carlo (MC), Quasi-Monte Carlo (QMC) et Randomized QMC (RQMC) Let X be a system (output) with real values X = f(u1, u2, . . . , ud). µ = E[X] = E[f(u1, u2, . . . , ud)] = ∫ [0,1)d f(u) du Inversion technique Example: X ∼ exp(λ) F(X) = 1 − exp(−λX) = U ∼ U[0, 1) ⇒ X = − log(U)/λ. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 5 / 42
  • 10. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Monte Carlo (MC) Multidimensional Integration Methods Monte Carlo (MC), Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC) µ = E[X] = E[f(U)] = ∫ [0,1)d f(u) du standard MC: generate n random values i.i.d of U(0, 1)d, let U0, . . . , Un−1; Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
  • 11. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Monte Carlo (MC) Multidimensional Integration Methods Monte Carlo (MC), Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC) µ = E[X] = E[f(U)] = ∫ [0,1)d f(u) du standard MC: generate n random values i.i.d of U(0, 1)d, let U0, . . . , Un−1; estimate µ with ˆµn,MC = 1 n ∑n−1 i=0 f(Ui), En = ˆµn,MC − µ converges with Op(n−1/2). Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
  • 12. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Monte Carlo (MC) Multidimensional Integration Methods Monte Carlo (MC), Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC) µ = E[X] = E[f(U)] = ∫ [0,1)d f(u) du standard MC: generate n random values i.i.d of U(0, 1)d, let U0, . . . , Un−1; estimate µ with ˆµn,MC = 1 n ∑n−1 i=0 f(Ui), En = ˆµn,MC − µ converges with Op(n−1/2). Var[ˆµn,MC] = E[(ˆµn,MC − µ)2)] = σ2/n = O(n−1) converges slowly as a function of n, where σ2 = ∫ [0,1)d f(u) du − µ2. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
  • 13. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Monte Carlo (MC) Multidimensional Integration Methods Monte Carlo (MC), Quasi-Monte Carlo (QMC) and Randomized QMC (RQMC) µ = E[X] = E[f(U)] = ∫ [0,1)d f(u) du standard MC: generate n random values i.i.d of U(0, 1)d, let U0, . . . , Un−1; estimate µ with ˆµn,MC = 1 n ∑n−1 i=0 f(Ui), En = ˆµn,MC − µ converges with Op(n−1/2). Var[ˆµn,MC] = E[(ˆµn,MC − µ)2)] = σ2/n = O(n−1) converges slowly as a function of n, where σ2 = ∫ [0,1)d f(u) du − µ2. central limit theorem √ n(ˆµn,MC − µ)/σ ⇒ N(0, 1) when n → ∞. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 6 / 42
  • 14. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Quasi-Monte Carlo (QMC) Multidimensional Integration Methods µ = E[f(U)] = ∫ [0,1)d f(u) du QMC estimator ˆµn,QMC = 1 n n−1∑ i=0 f(ui). We replace independent points MC by u0, . . . , un−1 a set of n structured points () which covers the hypercube (0, 1)d more uniformly than MC points. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
  • 15. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Quasi-Monte Carlo (QMC) Multidimensional Integration Methods µ = E[f(U)] = ∫ [0,1)d f(u) du QMC estimator ˆµn,QMC = 1 n n−1∑ i=0 f(ui). We replace independent points MC by u0, . . . , un−1 a set of n structured points () which covers the hypercube (0, 1)d more uniformly than MC points. Integration methods: Polynomial lattice rules and digital nets. Construction methods: example Korobov, CBC etc... Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
  • 16. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Quasi-Monte Carlo (QMC) Multidimensional Integration Methods µ = E[f(U)] = ∫ [0,1)d f(u) du QMC estimator ˆµn,QMC = 1 n n−1∑ i=0 f(ui). We replace independent points MC by u0, . . . , un−1 a set of n structured points () which covers the hypercube (0, 1)d more uniformly than MC points. Integration methods: Polynomial lattice rules and digital nets. Construction methods: example Korobov, CBC etc... Worst case error dans O(n−α+ϵ) where α ≥ 1 Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 7 / 42
  • 17. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Randomized Quasi-Monte Carlo (RQMC) Multidimensional Integration Methods RQMC estimator ˆµn,RQMC,l = 1 n n−1∑ i=0 f(ui). To create variance, we need to randomize the n structurted points u0, . . . , un−1 : by shifting them individually. Each point Ui ∼ U[0, 1)d. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
  • 18. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Randomized Quasi-Monte Carlo (RQMC) Multidimensional Integration Methods RQMC estimator ˆµn,RQMC,l = 1 n n−1∑ i=0 f(ui). To create variance, we need to randomize the n structurted points u0, . . . , un−1 : by shifting them individually. Each point Ui ∼ U[0, 1)d. With m i.i.d estimators, we can construct an unbiased estimator ˆµn,RQMC = 1 m ∑m l=1 ˆµn,RQMC,l. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
  • 19. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Randomized Quasi-Monte Carlo (RQMC) Multidimensional Integration Methods RQMC estimator ˆµn,RQMC,l = 1 n n−1∑ i=0 f(ui). To create variance, we need to randomize the n structurted points u0, . . . , un−1 : by shifting them individually. Each point Ui ∼ U[0, 1)d. With m i.i.d estimators, we can construct an unbiased estimator ˆµn,RQMC = 1 m ∑m l=1 ˆµn,RQMC,l. Var[ˆµn,RQMC] = Var[f(ui)] n + 2 n2 ∑ i<j Cov[f(ui), f(uj)]. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 8 / 42
  • 20. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Primal lattice Ld =    v = d∑ j=1 hjvj such that each hj ∈ Z    , Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d. . Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
  • 21. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Primal lattice Ld =    v = d∑ j=1 hjvj such that each hj ∈ Z    , Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d. A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1. nv1 = a = (a1, a2, . . . , ad) ∈ Zd n. . Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
  • 22. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Primal lattice Ld =    v = d∑ j=1 hjvj such that each hj ∈ Z    , Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d. A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1. nv1 = a = (a1, a2, . . . , ad) ∈ Zd n. Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1 mod n) = O(n), because 0 ≤ a ≤ n − 1. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
  • 23. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Primal lattice Ld =    v = d∑ j=1 hjvj such that each hj ∈ Z    , Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d. A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1. nv1 = a = (a1, a2, . . . , ad) ∈ Zd n. Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1 mod n) = O(n), because 0 ≤ a ≤ n − 1. Dual lattice L⊥ d = { h ∈ Rd : hT v ∈ Z for each v ∈ Ld } ⊆ Zd . Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
  • 24. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Primal lattice Ld =    v = d∑ j=1 hjvj such that each hj ∈ Z    , Where v1(z), v2(z), . . . , vd(z) ∈ Rd are linearly independant points over R and Ld contains Zd, Pn = Ld ∩ [0, 1)d. A rank 1 lattice: ui = iv1 mod 1 for i = 0, 1, . . . , n − 1. nv1 = a = (a1, a2, . . . , ad) ∈ Zd n. Example: Korobov construction a = (1, a, a2 mod n, . . . , ad−1 mod n) = O(n), because 0 ≤ a ≤ n − 1. Dual lattice L⊥ d = { h ∈ Rd : hT v ∈ Z for each v ∈ Ld } ⊆ Zd . A dual representation Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 9 / 42
  • 25. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p How to choose the generator vector? Naive approach 1 Consider all the possibilities of finding a generator vector, 2 minimize the worst case error or the variance Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
  • 26. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p How to choose the generator vector? Naive approach 1 Consider all the possibilities of finding a generator vector, 2 minimize the worst case error or the variance Practical approach 1 Refine the search space g(z) 2 minimize an error function (cost function) With a construction method Component by component(CBC), Fast component by component (Fast-CBC), Korobov Others? Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
  • 27. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p How to choose the generator vector? Naive approach 1 Consider all the possibilities of finding a generator vector, 2 minimize the worst case error or the variance Practical approach 1 Refine the search space g(z) 2 minimize an error function (cost function) With a construction method Component by component(CBC), Fast component by component (Fast-CBC), Korobov Others? We clearly need a software (Polylatbuilder)! Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 10 / 42
  • 28. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example of a rank 1 lattice rule Rank1 lattice Pn = { ui = ia n mod 1 : 0 ≤ i ≤ n − 1 } , Rank1 lattice rule = 1 n ∑n−1 i=0 f(ui), Number of points: n, Generator vector: a ∈ Zd. 0 1 0 1 a/n u1 u2 original a = (1, 3) 0 1 0 1 u1 u2 shifted Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
  • 29. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example of a rank 1 lattice rule Rank1 lattice Pn = { ui = ia n mod 1 : 0 ≤ i ≤ n − 1 } , Rank1 lattice rule = 1 n ∑n−1 i=0 f(ui), Number of points: n, Generator vector: a ∈ Zd. Randomized lattice rule Pn,∆ = {Ui = (ui + U) mod 1 : 0 ≤ i ≤ n − 1} , Random point : U ∼ U[0, 1)d. 0 1 0 1 a/n u1 u2 original a = (1, 3) 0 1 0 1 U u1 u2 shifted Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
  • 30. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example of a rank 1 lattice rule Rank1 lattice Pn = { ui = ia n mod 1 : 0 ≤ i ≤ n − 1 } , Rank1 lattice rule = 1 n ∑n−1 i=0 f(ui), Number of points: n, Generator vector: a ∈ Zd. Randomized lattice rule Pn,∆ = {Ui = (ui + U) mod 1 : 0 ≤ i ≤ n − 1} , Random point : U ∼ U[0, 1)d. 0 1 0 1 a/n u1 u2 original a = (1, 3) 0 1 0 1 U u1 u2 shifted Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 11 / 42
  • 31. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration lattice Projection of the lattice points ⇒ We ideally want n distinct values for each one-dimensional projection Pn({j}) of Pn so the components of a are found in : Un = {a ∈ Z : 1 ≤ a ≤ n − 1 et pgcd(a, n) = 1}. For n prime: There are n − 1 choices for each component of a, there are (n − 1)d possibilities to generate the vector a. For each subset ν ⊆ {1, 2, . . . , d}, the projection of Ld(ν) under Ld is also a lattice, having a set points Pn(ν). Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 12 / 42
  • 32. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration polynomial lattice Primal lattice Ld =    v(z) = d∑ j=1 hjvj as each hj ∈ Zb[z]    , where v1(z), v2(z), . . . , vd(z) ∈ Ld b (a set of Laurent series) where vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree m. Pn = φ(Ld) ∩ [0, 1)d. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
  • 33. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration polynomial lattice Primal lattice Ld =    v(z) = d∑ j=1 hjvj as each hj ∈ Zb[z]    , where v1(z), v2(z), . . . , vd(z) ∈ Ld b (a set of Laurent series) where vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree m. Pn = φ(Ld) ∩ [0, 1)d. Dual lattice L∗⊥ d =    h ∈ Nd 0 : d∑ j=1 hj(z)vj(z) ∈ Zb[z] for each v(z) ∈ Ld    , Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
  • 34. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Integration polynomial lattice Primal lattice Ld =    v(z) = d∑ j=1 hjvj as each hj ∈ Zb[z]    , where v1(z), v2(z), . . . , vd(z) ∈ Ld b (a set of Laurent series) where vj(z) = gj(z)/P(z), which P(z) ∈ Zb[z] a polynomial with degree m. Pn = φ(Ld) ∩ [0, 1)d. Dual lattice L∗⊥ d =    h ∈ Nd 0 : d∑ j=1 hj(z)vj(z) ∈ Zb[z] for each v(z) ∈ Ld    , Dual representation Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 13 / 42
  • 35. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Construction of points Structure of the points for a rank 1 polynomial lattice rule ui,j = φ ( qi(z)gj(z) mod P(z) P(z) ) such asφ : Lb → R. =⇒ φ ( ∞∑ l=w xlz−l ) = ∞∑ l=w (xl)b−l , Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
  • 36. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Construction of points Structure of the points for a rank 1 polynomial lattice rule ui,j = φ ( qi(z)gj(z) mod P(z) P(z) ) such asφ : Lb → R. =⇒ φ ( ∞∑ l=w xlz−l ) = ∞∑ l=w (xl)b−l , Practical approach 1 Truncate Laurent’s series to L ui,j = ∑L l=w xlb−l, 2 Find the xl ∈ {0, 1} for a base b = 2. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
  • 37. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Construction of points Structure of the points for a rank 1 polynomial lattice rule ui,j = φ ( qi(z)gj(z) mod P(z) P(z) ) such asφ : Lb → R. =⇒ φ ( ∞∑ l=w xlz−l ) = ∞∑ l=w (xl)b−l , Practical approach 1 Truncate Laurent’s series to L ui,j = ∑L l=w xlb−l, 2 Find the xl ∈ {0, 1} for a base b = 2. ui = (u1,i, u2,i, . . . , uj,i, . . . , ui,d) the i-th point Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 14 / 42
  • 38. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example: rank 1 polynomial lattice rules Rank 1 polynomial lattice rules Pn = { ui = qi(z)g(z) mod P(z) P(z) : q(z) ∈ Zb[z] } rank 1 polynomial lattice rules = 1 n ∑n−1 i=0 f(ui) prime polynomial : P(z) with degree m. generator vector : g(z) ∈ Zb[z]d Example (particular case): Korobov rules g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z)) Ṟandomized Rank 1 polynomial lattice rules Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1} random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
  • 39. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example: rank 1 polynomial lattice rules Rank 1 polynomial lattice rules Pn = { ui = qi(z)g(z) mod P(z) P(z) : q(z) ∈ Zb[z] } rank 1 polynomial lattice rules = 1 n ∑n−1 i=0 f(ui) prime polynomial : P(z) with degree m. generator vector : g(z) ∈ Zb[z]d Example (particular case): Korobov rules g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z)) Ṟandomized Rank 1 polynomial lattice rules Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1} random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
  • 40. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example: rank 1 polynomial lattice rules Rank 1 polynomial lattice rules Pn = { ui = qi(z)g(z) mod P(z) P(z) : q(z) ∈ Zb[z] } rank 1 polynomial lattice rules = 1 n ∑n−1 i=0 f(ui) prime polynomial : P(z) with degree m. generator vector : g(z) ∈ Zb[z]d Example (particular case): Korobov rules g(z) = (1, g(z), g(z)2 mod P(z), . . . g(z)d−1 mod P(z)) Ṟandomized Rank 1 polynomial lattice rules Pn,∆ = {ui = ui + ∆ : 0 ≤ i ≤ n − 1} random point: ∆ ∼ U[0, 1)d, ˆui,j = (ui,j + ∆i,j) mod b Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 15 / 42
  • 41. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example: Rank 1 polynomial lattice rules Quadratic error QMC Could converge more fast the MC depending on: the regularity of the function to be integrated the uniformity of points in the polynomial lattice (choice of parameter g(z)) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 16 / 42
  • 42. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Example: Rank 1 polynomial lattice rules Quadratic error QMC Could converge more fast the MC depending on: the regularity of the function to be integrated the uniformity of points in the polynomial lattice (choice of parameter g(z)) Polynomial lattice of n = 64 points P(z) = z6 + z + 1 in 2D 0 1 0 1 Good lattice g(z) = (1, z5 + z3 + z2 + z + 1) 0 1 0 1 Very bad lattice g(z) = (1, 1) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 16 / 42
  • 43. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Réseaux digitaux Définition Let a prime number b ≥ 2, called base, a digital net in base b formed by n = bm points in d dimensions is defined by selecting d generating matrices C1, C2, . . . , Cd, where each Cj is an ∞ × m. The matrix whose elements belong to the finite field Fb = 0, 1, 2, . . . , b − 1. ⇒ The matrix Cj determines the coordinate j of all the points. We define ui pour i = 0, 1, 2, . . . bm − 1, we write the binary representation of i in base b, the vector of the binary coefficient is multiplied by Cj mod b to obtain the binary coefficients of ui,j. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 17 / 42
  • 44. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Réseaux digitaux Définition Let a prime number b ≥ 2, called base, a digital net in base b formed by n = bm points in d dimensions is defined by selecting d generating matrices C1, C2, . . . , Cd, where each Cj is an ∞ × m. The matrix whose elements belong to the finite field Fb = 0, 1, 2, . . . , b − 1. ⇒ The matrix Cj determines the coordinate j of all the points. ⇒ Similar to the component gj(z) of the vector g(z) We define ui pour i = 0, 1, 2, . . . bm − 1, we write the binary representation of i in base b, the vector of the binary coefficient is multiplied by Cj mod b to obtain the binary coefficients of ui,j. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 17 / 42
  • 45. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Digital Nets Construction of points Let i = k−1∑ l=0 ai,lbl , and let    ui,j,1 ui,j,2 ...    = Cj      ai,0 ai,1 ... ai,k−1      mod b. ui,j = ∞∑ l=1 ui,j,lb−l et ui = ( ui,1, ui,2, . . . , ui,d ) . ⇒ The resulting set of points is a basic digital net in base b. In practice we truncate the expansion ui,j to L. For b = 2, the Cj are the L × m binary matrcies. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 18 / 42
  • 46. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Walsh transform f(u) = ∑ h∈Nd 0 ˆf(h) walb,h(u), where ˆf(h) = ∫ [0,1)d f(u)walb,h(u)du et walb,h(u) = exp (2πih · u)/b. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 19 / 42
  • 47. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Walsh transform f(u) = ∑ h∈Nd 0 ˆf(h) walb,h(u), where ˆf(h) = ∫ [0,1)d f(u)walb,h(u)du et walb,h(u) = exp (2πih · u)/b. Integration error (Sloan’s property) En = 1 n n−1∑ i=0 f(ui) − ∫ [0,1)d f(u) du = ∑ 0̸=h∈L∗⊥ d ˆf(h). Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 19 / 42
  • 48. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Expression of variance For a randomized lattice, the variance can be expressed: Var[ˆµn,RQMC] = ∑ 0̸=h∈L∗⊥ d |ˆf(h)|2 . From a variance reduction perspective, an optimal network for f minimize Df(Pn)2 = Var[ˆµn,RQMC]. Not widely used as criterion solution ? ⇒ Worst case error e(HK; Pn) = sup f∈HK,||f||K≤1 |Qn(f) − I(f)|. Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 20 / 42
  • 49. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Practical criteria Consider the following class of functions: Eν,d(c) = {f : [0, 1]d → R : |ˆf(h)| ≤ c b−νµ1(h) pour tout h ∈ Nd 0}, où ν > 1 et c > 0. We thus obtain: |Qn(f) − I(f)| ≤ ∑ 0̸=h∈L∗⊥ d c b−νµ1(h) , ν > 1, The quantity Tν = ∑ 0̸=h∈L∗⊥ d c b−νµ1(h) , ν > 1, Depends only on the function class Eν,d(1). To implement! Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 21 / 42
  • 50. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p    Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 22 / 42
  • 51. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p What do we need? To find good digital and polynomial lattice Figures of merit and weights adapted to a problem, for a number of points n, for a polynomial and a dimension d, several construction methods, Options: like normalization etc. Our research work Establish merit figures for digital networks and        polynomial, compare (application) the performance of our software integration methods compared to other integration methods, define new criteria for non-functional classes,        considered (explored) ⇒ unbounded functions!? Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 22 / 42
  • 52. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p What already exists Dirk Nuyens’ Code Matlab a construction method (Fast CBC)        Limited choice of parameters (ex: only ten primitive polynomials)        only one type of weight (product weight)        No QMC / RQMC points generated and tested! no application!! Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 23 / 42
  • 53. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p What already exists Dirk Nuyens’ Code Matlab a construction method (Fast CBC)        Limited choice of parameters (ex: only ten primitive polynomials)        only one type of weight (product weight)        No QMC / RQMC points generated and tested! no application!! Generator vector tables J. Dick D. Nuyens Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 23 / 42
  • 54. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Structure of Polylatbuilder Points of the polynomial and digital nets Figures of merit Weight type Construction methods Error in a Walsh space t-value Spectral test other heuris- tic?? Product weight Order depend- ing weights General weight Product and order depen- dent weights (POD) CBC Fast CBC Random Ko- robov Korobov Exhaustive Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 24 / 42
  • 55. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Quality measures (Discrepancies) Implemented figure of merit E(f, g(z))1/q ) = e(g(z); n; ||.||p,α,γ) The worst function: χ(g(z); n; ||.||p,α,γ) = ∑ 0̸=v⊂1:t γv q/2 ∏ j∈v ω(uj) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 25 / 42
  • 56. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Quality measures (Discrepancies) Implemented figure of merit E(f, g(z))1/q ) = e(g(z); n; ||.||p,α,γ) The worst function: χ(g(z); n; ||.||p,α,γ) = ∑ 0̸=v⊂1:t γv q/2 ∏ j∈v ω(uj) The kernel ω(uj) = ∞∑ h=1 wal2,h(uj) 2qα⌊log2hj⌋ = 12( 1 6 − 2⌊log)2uj⌋−1 ) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 25 / 42
  • 57. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Construction methods CBC Constructions Knowing n, we construct a generator vector g(z) = (g1(z), g2(z), . . . , gd(z)). We set g1(z) = 1, g1(z) remains fixed, we choose g2(z) from the subset of the components of generator vectors   to minimize the desired error criterion in 2 dimensions, With g1(z), g2(z) remain fixed, we choose g3(z) from the subset of the components of generator vectors   to minimize the desired error criterion in 3 dimensions, ed(gd(z); Pn; ||.||p,α,γ)q = ed−1(g(z)d−1; n; ||.||p,α,γ)q + Θd(g(z)d) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 26 / 42
  • 58. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Setup intger to bit #include "PolyType.h" namespace PolyLatBuilder { // choose the type of lattice std::ostream& operator<<(std::ostream& os, PolyLatType polylatType) { return os << (polylatType == PolyLatType::EMBEDDED ? "embedded" : "ordinary"); } } } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 27 / 42
  • 59. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p C++code boost::dynamic_bitset<> PolyLatBuilder::FastCBC::getbin(int integer){ unsigned long long dec; dec = integer; std::string str; for(unsigned long long d = dec; d>0; d/=2) str.insert(str.begin(), boost::lexical_cast<char>(d&1)); boost::dynamic_bitset<> binaryNumber(str); std::cout << "The number " << dec << " in binary is: " << binaryNumber<<'n'; return binaryNumber; } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 28 / 42
  • 60. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Setup Bit vector to polynomial std::string PolyLatBuilder::FastCBC:: pretty(const GF2X& p) { std::ostringstream os; if ( deg(p)<0 ) os << "0" ; for (int i = deg(p); i >= 0; i--) { if (rep(coeff(p, i))) { if (i < deg(p)) os << " + "; if (i >= 2) os << "x^" << i; else if (i == 1) os << "x"; else os << "1"; } } return os.str(); } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 29 / 42
  • 61. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Perform the mapping function Vm(g(z)q(z)modP(z) GF2X ww(INIT_SIZE,1); ww.SetLength(1); std::vector <double> w(rr.length()); std::vector <double> w1(rr.length()); for ( long j= 0; j <rr.length(); j++) { w[j]=0; double b = 1.0; for( int k=0; k< m; k++){ ww[k] = rr[j][m-k-1]; for ( int l =0; l <k; l++){ ww[k] = ww[k] - ww[l] * P2[m+(l-k)]; } b *= 0.5; if (IsOne(ww[k])) w[j] += b; } std::cout << w[j] << std::endl; Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 30 / 42
  • 62. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Perform the vector of real values by applying the Kernel fftw<double>::real_vector usob(n-1); for (long i = 0 ; i < w.size(); i++){ usob[i] = 1.0/6 - pow(2, floor(log2(w[i]))-1); } float usob_0=1.0/6; fftw<double>::complex_vector fft_psi = fftw<double>::fft(usob); } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 31 / 42
  • 63. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Results – g(z) with Fast CBC Values of g(z) P(z) = z10 + z3 + 1 P(z) = z7 + z + 1 t gt(z) Square Error gt(z) Square Error 1 1 1.58 10−8 1 1.01 10−6 2 z9 + z8 + z5 3.6 10−8 z6 + z5 + z3 + z 2.22 10−6 3 z9 + z8 + z6 + z2 + z + 1 6.36 10−8 z6 + z5 + z4 + z2 3.74 10−6 4 z8 + z6 + z5 + z4 + z3 + z2 + z 1.03 10−7 z5 + z4 + z + 1 5.70 10−6 5 z8 + z6 + z1 1.57 10−7 z5 + z3 8.18 10−6 6 z9 + z7 + z4 + z2 + z 2.36 10−7 z5 + z4 + z3 1.16 10−5 7 z8 + z7 + z6 + z3 + z2 3.34 10−7 z6 + z3 + z + 1 1.56 10−5 8 z9 + z8 + z6 + z5 + z4 + z3 + 1 4.55 10−7 z6 + z5 + z3 + z2 + 1 2.03 10−5 9 z9 + z8 + z6 + z4 + z3 + z2 6.25 10−7 z6 + z5 + z4 + z3 + z + 1 2.7 10−5 10 z8 + z6 + z5 + z4 + z2 + 1 8.64 10−7 z5 + z4 + z3 + z 3.43 10−5 Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 32 / 42
  • 64. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p QMC square error Built in C++ Encouraging results Good uniformity of the polynomial lattice rules (good parameter g(z)) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 33 / 42
  • 65. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p QMC square error Built in C++ Encouraging results Good uniformity of the polynomial lattice rules (good parameter g(z)) Polynomial lattice rules points n = 1023, P(z) = z10 + z3 + 1 en 2D 0 1 0 1 good lattice g(z) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 33 / 42
  • 66. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Financial application: asian option Stochastic differential equation(SDE) dSt = µSt dt + σSt dWt The SDE solution St = S0 exp(r−σ2/2)t+σBt Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 34 / 42
  • 67. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Financial application: asian option Stochastic differential equation(SDE) dSt = µSt dt + σSt dWt The SDE solution St = S0 exp(r−σ2/2)t+σBt Option pricing The payoff of the option X = e−rt max(0, 1 d ∑s j=1 Stj − K), and the price c = E[X |Ft] v(s0, T) = E[e−rt f(S1 . . . St) |Ft] Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 34 / 42
  • 68. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Asian purchase option - Numerical results v(s0, T) = e−rt ∫ (0,1)d max(0, 1 d d∑ i=1 S0 exp [(r − σ2 )ti +σ √ ti − ti−1 i∑ j=1 Φ−1 (uj)] − K)du1 . . . dud Variance reduction techniques for MC control variate CV1 = e−rt max(0, Y − K) where Y = ∏t j=1(Stj )1/d control variate CV2 = e−rt max(0, Y − K) where Y = ∑t j=1(Stj )1/d Antithetic variable (AV) Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 35 / 42
  • 69. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Call Asian option– Numerical results (n=1023) Risk free rate r = 0.08, volatility σ = 0.2, and the strike price K MC points with variance reduction techniques Approach PD LGD EAD No CV 20.83 49.87 CV1 20.90 1.00 10−2 Data CV2 20.90 9.25 10−4 CV1 +CV2 20.90 8.45 10−4 CV1+CV2+AV 20.91 3.23 10−4 No CV 11.23 4.68 1 CV1 11.28 8.79 10−3 Key Features CV2 11.29 4.61 10−1 CV1 +CV2 11.28 8.52 10−3 CV1+CV2+AV 11.30 3.36 10−3 No CV 3.54 22. 58 1 CV1 3.55 5.66 10−3 100 CV2 3.57 4.27 CV1 +CV2 3.55 5.5710−3 CV1+CV2+AV 3.56 1.4010−3 Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 36 / 42
  • 70. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Call Asian option– Numerical results Comparison with LatticeBuilder software Table: Value of the Asian option with a low exercise based on the following configuration:(j)/10, for j = 1, 2, . . . , d = 10, number of n = 210 points, and an exercise price K = 100 MC RQMC RQMC Polylatbuilder LatticeBuilder Option value 3.37 3.33 3.354 Standard deviation 4.52 0.015 0.025 Variance Ratio 95.17 33.06 Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 37 / 42
  • 71. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Java Asian Option Valuation (using QMC points) import umontreal.iro.lecuyer.rng.*; import umontreal.iro.lecuyer.hups.*; import umontreal.iro.lecuyer.stat.Tally; import umontreal.iro.lecuyer.util.Chrono; public class AsianQMCSSJ extends AsianSSJ { public AsianQMCSSJ (double r, double sigma, double strike, double s0, int s, double[] zeta) { super (r, sigma, strike, s0, s, zeta); } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 38 / 42
  • 72. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Java code public void simulateQMC (int m, PointSet p, RandomStream noise, Tally statQMC) { Tally statValue = new Tally ("stat on value of Asian option"); PointSetIterator stream = p.iterator (); for (int j=0; j<m; j++) { simulateRuns (p.getNumPoints(), stream, statValue); statQMC.add (statValue.average()); p.addRandomShift (0, 1, noise); stream.resetStartStream(); } } Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 39 / 42
  • 73. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Java code public static void main (String[] args) { try { int s = 9; double[] zeta = new double[s+1]; for (int j=0; j<=s; j++) zeta[j] = 12.0*j/365; AsianQMCSSJ process = new AsianQMCSSJ (0.08, 0.2, 100.0, 100.0, s, zeta); Tally statValue = new Tally ("value of Asian option"); Tally statQMC = new Tally ("QMC averages for Asian option"); Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 40 / 42
  • 74. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Java code timer.init(); // QMC Polynomial points PointSet ps2 = new PointSetFromFile("/Users/QuasiMonteAsian/src/options/pointsl int m; m =10; // Number of QMC randomizations process.simulateQMC ( m, ps2, new MRG32k3a(), statQMC); System.out.println ("QMC point set with " + n + " points and affine matrix scramble:n"); Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 41 / 42
  • 75. Motivation Theoretical approach C++ practicing examples Asian Option Pricing Asian Option Valuation p Java code System.out.printf ("Vlaue of Asian with QMC: %9.4g%n", valueQMC); double varQMC = ps2.getNumPoints() * statQMC.variance(); double cpuQMC = timer.getSeconds() / (m * n); System.out.printf ("Variance ratio: %9.4g%n", varMC/varQMC); System.out.printf ("Efficiency ratio: %9.4g%n", (varMC * cpuMC) / (varQMC * cpuQMC)); System.out.printf ("Efficiency ratio 22: %9.4g%n", (cpuMC) / (cpuQMC)); System.out.println ("Test CPU time: "+ cpuMC); System.out.println ("Test CPUQMC time: "+ Mohamed Hanini, CEO & Chief Scientist at Koïos IntelligenceACCELERATED COMPUTING 42 / 42