3import java.io.IOException;
4import umontreal.ssj.rng.*;
5import umontreal.ssj.hups.*;
6import umontreal.ssj.stat.Tally;
7import umontreal.ssj.util.Chrono;
10public class AsianGBMRQMC
extends AsianGBM {
12 public AsianGBMRQMC(
double r,
double sigma,
double strike,
double s0,
int s,
double[] zeta) {
13 super(r, sigma, strike, s0, s, zeta);
20 Tally statValue =
new Tally(
"stat on value of Asian option");
23 for (
int j = 0; j < m; j++) {
26 simulateRuns(n, stream, statValue);
31 public static void main(String[] args)
throws IOException {
33 double[] zeta =
new double[d + 1];
34 for (
int j = 0; j <= d; j++)
35 zeta[j] = (
double) j / (double) d;
36 AsianGBMRQMC process =
new AsianGBMRQMC(0.05, 0.5, 100.0, 100.0, d, zeta);
37 Tally statMC =
new Tally(
"value of Asian option");
38 Tally statRQMC =
new Tally(
"RQMC averages for Asian option under GBM");
43 System.out.println(
"Ordinary MC:\n");
44 process.simulateRuns(n,
new LFSR113(), statMC);
46 System.out.println(statMC.
report(0.95, 3));
47 System.out.println(
"Total CPU time: " + timer.
format());
48 System.out.println(
"------------------------\n");
60 process.simulateRunsRQMC(m, prqmc, statRQMC);
61 System.out.println(
"RQMC with Sobol point set with " + n +
" points and affine matrix scramble:\n");
63 System.out.println(statRQMC.
report(0.95, 3));
64 System.out.println(
"Total CPU time: " + timer.
format());
65 System.out.println(
"------------------------\n");
69 System.out.printf(
"Variance ratio: %9.4g%n", varMC / varRQMC);
70 System.out.printf(
"Efficiency ratio: %9.4g%n", (varMC * cpuMC) / (varRQMC * cpuRQMC));
This class provides the basic structures for storing and manipulating linear digital nets in base ,...
This class implements a umontreal.ssj.hups.PointSetRandomization that performs a left matrix scrambli...
int getNumPoints()
Returns the number of points.
This class is used for randomized quasi-Monte Carlo (RQMC) simulations.
void randomize()
Randomizes the point set.
int getNumPoints()
Returns the number of points in the associated point set.
PointSetIterator iterator()
Returns a new point set iterator for the point set associated to this object.
This class implements digital nets and digital sequences in base 2 formed by the first points of a S...
Extends RandomStreamBase using a composite linear feedback shift register (LFSR) (or Tausworthe) RNG ...
double average()
Returns the average value of the observations since the last initialization.
void setConfidenceIntervalStudent()
Indicates that a confidence interval on the true mean, based on the normality assumption,...
double variance()
Returns the sample variance of the observations since the last initialization.
void add(double x)
Gives a new observation x to the statistical collector.
String report()
Returns a formatted string that contains a report on this probe.
String format()
Converts the CPU time used by the program since its last call to init for this AbstractChrono to a St...
void init()
Initializes this AbstractChrono to zero.
double getSeconds()
Returns the CPU time in seconds used by the program since the last call to init for this AbstractChro...
The Chrono class extends the umontreal.ssj.util.AbstractChrono class and computes the CPU time for th...
This is the interface for iterators that permit one to go through the points of a PointSet and the su...
This interface is for a randomization that can be used to randomize a umontreal.ssj....
void resetStartStream()
Reinitializes the stream to its initial state : and are set to .