32.1 Introduction and Objectives
In this chapter we continue with the analysis of the Monte Carlo method already discussed in Chapter 31, in which we designed a software framework for one-factor plain options. We discovered a number of new features that we would like to address here:
- R1: More general SDEs, for example support for corrected drift functions and the derivative of the diffusion term.
- R2: Support for a range of finite difference schemes, for example the predictor–corrector and Milstein methods.
- R3: More support for random number generation based on the C++ <random> and Boost Random libraries.
- R4: Improving speedup by using multithreading and multitasking code (for example, C++ Concurrency and PPL).
- R5: Creating a mediator class that prices several option types in a seamless manner (using events that are supported by Agents Library and the Boost signals2 library).
- R6: Developing flexible modules (for example, builders and factories) to configure the software framework while keeping the code maintainable.
We address these requirements by creating C++ code to realise them.
32.2 Parallel Processing and Monte Carlo Simulation
In this section we discuss feature R4. In general, the Monte Carlo method has a reputation for being slow, especially when we simulate many paths (Glasserman, 2004). (Incidentally, it is a good idea to run your Monte Carlo application in release mode.) We can start thinking about how to improve the speedup ...