Beispiel #1
0
    public void start()
    {
        T VOld, VNew;

        for (long i = 1; i <= NSim; ++i)
        {     // Calculate a path at each iteration
            if ((i / 5000) * 5000 == i)
            { // Give status after a given numbers of iterations
                Console.WriteLine(i);
            }

            VOld = sde.InitialCondition; res[0] = VOld;

            for (int n = 1; n < res.Length; n++)
            { // Compute the solution at level n+1
                VNew   = fdm.advance(VOld, fdm.x[n - 1], fdm.k, rng.GenerateRn(), rng.GenerateRn());
                res[n] = VNew; VOld = VNew;
            }

            path(ref res);
        }
        finish();
    }
Beispiel #2
0
    public void start()
    { // Main event loop for path generation
        double VOld, VNew;

        for (int i = 1; i <= NSim; ++i)
        {     // Calculate a path at each iteration
          //   if ((i / 5000) * 5000 == i)
            { // Give status after a given numbers of iterations
                mis(i);
            }

            VOld = sde.InitialCondition; res[0] = VOld;

            for (int n = 1; n < res.Length; n++)
            { // Compute the solution at level n+1
                VNew   = fdm.advance(VOld, fdm.x[n - 1], fdm.k, rng.GenerateRn(), rng.GenerateRn());
                res[n] = VNew; VOld = VNew;
            }

            // Send path data to the Pricers
            path(ref res);
        }
        finish(); // Signal to pricers to finish up
    }