Package umontreal.iro.lecuyer.util

Examples of umontreal.iro.lecuyer.util.Chrono


      }
   }

   public static void main (String[] args) {
      InventoryCRN system = new InventoryCRN (100.0, 2.0, 0.1, 10.0, 1.0, 0.95);
      Chrono timer = new Chrono();

      system.simulateDiff (5000, 200, 80, 198, 80, 200);
      system.statDiff.setConfidenceIntervalStudent();
      System.out.println (system.statDiff.report (0.9, 3));
      double varianceIndep = system.statDiff.variance();
      System.out.println ("Total CPU time: " + timer.format() + "\n");

      timer.init();
      system.simulateDiffCRN (5000, 200, 80, 198, 80, 200);
      System.out.println (system.statDiff.report (0.9, 3));
      double varianceCRN = system.statDiff.variance();
      System.out.println ("Total CPU time: " + timer.format());
      System.out.printf ("Variance ratio:  %8.4g%n", varianceIndep/varianceCRN);
   }
View Full Code Here


         zeta[j] = (double)j / (double)s;
      AsianQMCk process = new AsianQMCk (0.05, 0.5, 100.0, 100.0, s, zeta);
      Tally statValue  = new Tally ("value of Asian option");
      Tally statQMC = new Tally ("QMC averages for Asian option");

      Chrono timer = new Chrono();
      int n = 100000;
      System.out.println ("Ordinary MC:\n");
      process.simulateRuns (n, new MRG32k3a(), statValue);
      statValue.setConfidenceIntervalStudent();
      System.out.println (statValue.report (0.95, 3));
      System.out.println ("Total CPU time: " + timer.format());
      double varMC = statValue.variance();
      double cpuMC = timer.getSeconds() / n;  // CPU seconds per run.
      System.out.println ("------------------------\n");

      timer.init();
      KorobovLattice p = new KorobovLattice (65521, 944, s); // approx. 2^{16} points.
      BakerTransformedPointSet pb = new BakerTransformedPointSet (p);

      n = p.getNumPoints();
      int m = 20;                     // Number of QMC randomizations.
      process.simulateQMC (m, pb, new MRG32k3a(), statQMC);
      System.out.println ("QMC with Korobov point set with " + n +
          " points and random shift + baker:\n");
      statQMC.setConfidenceIntervalStudent();
      System.out.println (statQMC.report (0.95, 3));
      System.out.println ("Total CPU time: " + timer.format() + "\n");
      double varQMC = p.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));
   }
View Full Code Here

      for (int i=0; i<n; i++)
    averageWaits.add (simulateOneRun (numCust, lambda, mu));
   }

   public static void main (String[] args) {
      Chrono timer = new Chrono();
      QueueLindley queue = new QueueLindley();
      queue.simulateRuns (100, 10000, 1.0, 2.0);
      System.out.println (queue.averageWaits.report());
      System.out.println ("Total CPU time: " + timer.format());
   }
View Full Code Here

         zeta[j] = (double)j / (double)s;
      AsianQMC process = new AsianQMC (0.05, 0.5, 100.0, 100.0, s, zeta);
      Tally statValue  = new Tally ("value of Asian option");
      Tally statQMC = new Tally ("QMC averages for Asian option");

      Chrono timer = new Chrono();
      int n = 100000;
      System.out.println ("Ordinary MC:\n");
      process.simulateRuns (n, new MRG32k3a(), statValue);
      statValue.setConfidenceIntervalStudent();
      System.out.println (statValue.report (0.95, 3));
      System.out.println ("Total CPU time: " + timer.format());
      double varMC = statValue.variance();
      double cpuMC = timer.getSeconds() / n;  // CPU seconds per run.
      System.out.println ("------------------------\n");

      timer.init();
      DigitalNet p = new SobolSequence (16, 31, s); // 2^{16} points.
      n = p.getNumPoints();
      int m = 20;                     // Number of QMC randomizations.
      process.simulateQMC (m, p, new MRG32k3a(), statQMC);
      System.out.println ("QMC with Sobol point set with " + n +
          " points and affine matrix scramble:\n");
      statQMC.setConfidenceIntervalStudent();
      System.out.println (statQMC.report (0.95, 3));
      System.out.println ("Total CPU time: " + timer.format() + "\n");
      double varQMC = p.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));
   }
View Full Code Here

TOP

Related Classes of umontreal.iro.lecuyer.util.Chrono

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.