C++ Frameworks for the Monte Carlo Method

C++ Frameworks for the Monte Carlo Method

Postby Cuchulainn » Sat Feb 10, 2007 5:07 pm

In this blog I would like to give a bird?s-eye overview of some collaborative work with Dr. J?rg Kienitz of the German Postbank AG.



The main goal is to design, develop and deploy a customizable software system that can be adapted to suit different types of derivatives products and that meets certain performance criteria. In particular, we wish to calculate the price of a number of equity and interest rate products using the Monte Carlo (MC) method. The important thing to remember about the MC method is that it is robust, converges to an accurate solution in most cases and it can be applied to a range of problems that other methods are not able to solve. For this reason alone we are attempting to develop flexible frameworks using modern system and design patterns.



The language of choice is C++ and we have chosen it for a number of reasons, some of which are based on the simple fact that we know the language well, we like it and it is interoperable with many software libraries. It is also an industry standard. Finally, it supports the object-oriented, generic and modular programming techniques and we use all three metaphors to help us create software that is as flexible and malleable as possible.



Some of the major challenges (nice ones!) in this project are:



-Such a framework has not been attempted before to the best of our knowledge in the sense than we cannot see any results in published literature



-The project demands a number of skills such as finance, stochastic and MC theory, numerical analysis, design techniques, C++ and project management skills (the last in the sense that the project must be delivered 31 June 2007)



-The number of robust finite difference schemes that are able to approximate the solution of the Stochastic Differential Equations (SDE) that describe the behaviour of the underlying assets seems to be restricted to the Euler and Milstein methods and for this reason we are developing and applying other schemes that are applicable to a range of SDE. Much research needs to be done in this area



-J?rg and myself are located in different countries (Germany, Netherlands) which makes communication more difficult than if we were sitting in the same office. For this reason, we needed to develop a vocabulary which would allow us to impart ideas at a higher level than just ?raw? C++ code



-When the application is in the ?get it working? phase we wish to port it to MPI and OpenMP environments



In later blogs both JK and myself will discuss a number of related issues in more detail. For the moment, I would like to conclude the blog with a number of do?s and don?ts that we learned during this project (we are still learning):



Do?s

-Partition the problem into loosely coupled subsystems/component with well-defined interfaces

-Spend 30% of your time on design, 35% on programming. The rationale is that once you know what must be done then it is easy to do

-Adopt a multi-disciplinary and multi-paradigm approach

-Spiral, risk-driven, incremental project management model

-Make sure you learn C++ well to get optimal results



Don?ts

-Start the project by creating deep C++ class hierarchies; using inheritance is an optimization step in a sense. The hierarchy will come once you get the basic classes up and running; at all costs, avoid spaghetti code

-Try to make everything into an object. Not everything needs to be a class. And such a step may be semantically wrong. Nice class for the wrong problem

-Do not generalize until we have some specialisation (this means that were work with concrete examples at each stage of the project, it keeps us on the rails)



My next blog will be a video presentation ?Daniel in the C++ Lion?s Den: Do?s and Don?ts when learning C++?. I dedicate it to my co-blogger Dr. Egor Kraev.



Daniel Duffy
User avatar
Cuchulainn
 
Posts: 668
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands

Re: C++ Frameworks for the Monte Carlo Method

Postby Cuchulainn » Thu Jul 03, 2014 9:16 pm

Here is 2013 chapter on a design for 1 factor Monte Carlo.
Attachments
MC Application.pdf
(736.97 KiB) Downloaded 909 times
User avatar
Cuchulainn
 
Posts: 668
Joined: Mon Dec 18, 2006 2:48 pm
Location: Amsterdam, the Netherlands


Return to Monte Carlo

Who is online

Users browsing this forum: No registered users and 1 guest

cron