- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

A big challenge is PDE for let's say 5-factor model (mostly PDE multiarray<5> won't fit into memory!!!(??)) so what about mixed/hybrid MC PDE method? Take some state variables for the PDE and simulate the others with MC.There are a couple of papers out there for 2-factors.

- FinancialAlex
**Posts:**81**Joined:**

QuoteOriginally posted by: frenchXThe quickest algos for optilization are the one based on differential evolution. Computer science lab which wants to win the IEEE optimization contest only use variant of this algo.I am not sure if I would call differential evolution as the quickest algorithm for optimization. In my opinion it is the best algorithm (in terms of robustness) of global optimization type based on all benchmark results that I have seen.My preference is usually to use a hybrid optimizer (first a certain number of iteration of global optimizer, to get me to the "right" neighborhood, and then switch to efficient local optimization to obtain the solution).One should also make sure that employs a global optimizer which is efficient for constrained optimization. The original differential evolution was done for unconstrained or bounded optimization, and there are very recent articles which show enhancements of the algorithm to deal with linear and nonlinear constraintsA very nice presentation of such a differential evolution algorithm in the context of computational finance is given in A Practical Guide to Implied and Local Volatility and Smiling at evolution

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

For the FDM projects, the objective is to document the design of the framework and give people code to customise for new schemes:1. 1-factor models using C++ and GOF pattern; code is running for 7 FD schemes; still some features to add(2. Same as point except all in C#, 20% ready). Once 1. is working it is relatively easy to port to C#. I already have ADE in C#3. Two-factor PDE (multi-asset and SABR as tests; Heston if there is interest). ADE is running for multi-asset, but ADI and Soviet Spliting TBD as well. The design is similar to the OO design in step 1. except it use Boost libraries.Timeline: the next 6-9 weeks in a packet that people can use.Feedback on features welcome. There's a lot of stuff I have not been able to iron out/get round to.

Last edited by Cuchulainn on October 24th, 2011, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

What about puttiing this stuff into TODO?I think the results would be useful for paralleisation efforts.

Last edited by Cuchulainn on October 27th, 2011, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

Quotethe todo list, is that a list of performance optimization idea's?Is the idea is that you have to value or analyse a whole portfolio of deals, and you try to find a factorization of the the numerical task into a shared overlapping bit, and a non share bit. For European options you can just merge the boundary conditions, but for American's you cant due to contract specific free boundary solutions.* The TODO could be a list of interesting features in general. The bespoke thread was useful. E.g. its solution emerges from a parallel design pattern, some kind of master/worker (Mattson 2005, POSA 1 1996). Using fine-grained threads for indivdual options is not worth the effort as already mentioned. Coarse-grained paralellism will be better here.TODO has to do with 'features' and requirements.Alternative solutions as in thread were also useful, e.g. using FPE to price the option chain, using ADE. These also on TODO list.* Regarding the specific case:For early exercise, it is possible to transform moving boundary problem into a fixed bdy problem by Landau transformation. Then apply the above method, it should be possible, all things being equal.

Last edited by Cuchulainn on October 28th, 2011, 10:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

Taken from the "Matrix ... interface" threadQuoteSome generic application of your code I expect we will need in different area's are:* non-central N-point finite difference, e.g. at the edge of a grid.* non uniform grids, e.g. a 3 point rule for the second derivative of f(xi)where x3-x2 != x2-x1, e.g. Cuch mentioned a FDM transform s/(s+a)* arbitrary order of derivatives. dU/ds, dU^2/d^2s ... e.g. for delta, gamma* multivariate (2D), e.g. is we have a non uniform, tilted grids: and we want delta, gammaOne major scenario:The background is that we start off with a PDE (in S) in an infinite or semi-infinite domain in nd, transform it to a bounded box, apply Fichera to find the boundary conditiions. Now approximate the transformed PDE(in y) using FDM.But we want the solution in S space. So we neeed some tools:1. Mapping mesh-valued function in y back to those in S + error boiunds2. This will need discrete functions of functions, divided differences, functional composition, interpolation etc.A hybrid OOP/GP/functional programming model is needed I suppose to automate the process of domain transformation (instead of computing PDE coefficients each time by hand). We have many f(g(S)) functions.Imo this is a clear candidate for a reusable library.What about MultiArray library as basis data structure.

Last edited by Cuchulainn on November 9th, 2011, 11:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

QuoteOriginally posted by: outrunQuoteOriginally posted by: CuchulainnImo this is a clear candidate for a reusable library.Indeed! I see two separate (orthogonal) concepts / libraries* generic numerical derivatives* mesh / grid coordinates mappings / transforms. This will be some mapping between S,t "space" and mesh/grids space i,j (and in doing that also allow for shadow points, 0 or 1 based addressing)The last one has two sub elements: grid, and coordinate transform. For FDM you'll probably have cube-shaped grids, for trees (binomial, trinonimal) you'll have different (triangular) shapes. Both can have the same coordinate transforms. So we have 3 sub libraries:1. numerical derivatives ala dfdx(x1,x2,x3,f1,f2,f3)2. grids, meshes, trees. Basically integer coordinate regions in N dimensions e.g. things like 0<=i<N 3. coordinate tranforms x,y,z <-> f(i,j,k) what do you think?Bang on. All we need now is someone to do it BTW 1,2 and 3 are closely related to Alan/Financial Alex post-processing error analysis requirements, as they will use 1, 2 and 3.

Last edited by Cuchulainn on November 9th, 2011, 11:00 pm, edited 1 time in total.

- Cuchulainn
**Posts:**59713**Joined:****Location:**Amsterdam-
**Contact:**

Here is the class implementing the domain and BC and PDE, V1. It works but maybe it can be made more generic. We can plug in any specific pde using classes, function objects, members, lambda and function pointers.

Last edited by Cuchulainn on November 9th, 2011, 11:00 pm, edited 1 time in total.

Hey Cuch & outrun, looks real nice, a tiny question w.r.t. RealType implementation -- is it better to use a template-parameter as in template <class RealType> or should it be a typedef (like in QL) or perhaps a combination of both?The upside of the template-parameter way seems to be the ability to work with different choices of RealType at the same time (just instantiating entities as needed).The downside seems to be additional complexity for the coder and the end-user (more things to specify) -- although we could possibly alleviate this using default arguments for template parameters, perhaps (all within QFCL namespace or deeper) something along the lines of:typedef double DefaultRealType;template <class RealType = DefaultRealType> ?Finally, is "Real" a good name that we want to have -- Alan mentioned complex coefficients and multi-precision features of Mathematica, in general we only have different kinds of floating-point-numbers and integers available out of the box. Perhaps we should try to abstract away from this and use something like "Scalar", "Numeric", "Number", possibly combined with "Type", along the lines of:typedef double DefaultFloatingPointNumberType;typedef DefaultFloatingPointNumberType DefaultNumberType;template <class NumberType = DefaultNumberType> ?

Last edited by Polter on November 10th, 2011, 11:00 pm, edited 1 time in total.

GZIP: On